Next: , Previous: Plugin directories and files, Up: The ARTE Plugins


6.2 Importing the functions defined in the ARTE Core

The plugins need to import some ARTE Core functions needed to indicate that tests failed, or to print debug messages. This import is done using the following structure, defined in arte.h:

     
     /** Standard plugin actions */
     typedef struct
     {
       /** Make the test fail */
       void (* FAIL) (char *message);
       /** Make the test fail if str1 != str2 */
       void (* FAIL_IF_DIFFERENT) (char *str1,
                                   char *str2,
                                   char *message);
       /** Make the test fail if str1 == str2 */
       void (* FAIL_IF_EQUAL) (char *str1,
                               char *str2,
                               char *message);
       /** Dump debug message */
       void (* DEBUG) (arte_log_type_t type,
                       const char *format,
                       ...);
     } arte_core_functions_t;
     

The imported functions are the following:

FAIL
The ‘FAIL’ function is used by the plugin to indicate that the test being executed should fail. The additional message parameter allows the plugin to include a message/description string of why the test failed.
FAIL_IF_DIFFERENT
The ‘FAIL_IF_DIFFERENT’ function will fail the test if the provided strings are different. The additional message parameter allows the plugin to include a message/description string of why the test failed.
FAIL_IF_EQUAL
The ‘FAIL_IF_EQUAL’ function will fail the test if the provided strings are the same. The additional message parameter allows the plugin to include a message/description string of why the test failed.
DEBUG
The ‘DEBUG’ function allows the plugin to include traces in the ARTE Core log file.

The import process of the functions is done when the library is dynamically loaded by the Arte Core. In order to provide a correct communication between the Plugin and the Core, the Plugin must export in its API the following:

     
     /** Function to retrieve the array of arte_command_t from the module */
     arte_command_t *
     arte_plugin_get_commands (arte_core_functions_t *common);
     

The previous function not only allows to import the Core functions in the plugin, but also exports the plugin dictionary into the ARTE Core (as shown in the next section).