Ignore:
Timestamp:
2014-09-19T08:23:01Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c85a57f
Parents:
15d0046
Message:

Update PCUT to newest version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcut/include/pcut/datadef.h

    r15d0046 r9b20126  
    3939/** @cond devel */
    4040
     41#if defined(__GNUC__) || defined(__clang__)
     42#define PCUT_CC_UNUSED_VARIABLE(name, initializer) \
     43        name __attribute__((unused)) = initializer
     44#else
     45#define PCUT_CC_UNUSED_VARIABLE(name, initializer) \
     46        name = initializer
     47#endif
     48
     49
    4150enum {
    4251        PCUT_KIND_SKIP,
     
    5463};
    5564
     65enum {
     66        PCUT_MAIN_EXTRA_PREINIT_HOOK,
     67        PCUT_MAIN_EXTRA_INIT_HOOK,
     68        PCUT_MAIN_EXTRA_REPORT_XML,
     69        PCUT_MAIN_EXTRA_LAST
     70};
     71
    5672/** Generic wrapper for test cases, test suites etc. */
    5773typedef struct pcut_item pcut_item_t;
     
    5975/** Extra information about a test. */
    6076typedef struct pcut_extra pcut_extra_t;
     77
     78/** Extra information for the main() function. */
     79typedef struct pcut_main_extra pcut_main_extra_t;
    6180
    6281/** Test method type. */
     
    7392         */
    7493        int type;
    75         union {
    76                 /** Test-specific time-out in seconds. */
    77                 int timeout;
    78         };
     94        /** Test-specific time-out in seconds. */
     95        int timeout;
     96};
     97
     98/** @copydoc pcut_main_extra_t */
     99struct pcut_main_extra {
     100        /** Discriminator for the union.
     101         *
     102         * Use PCUT_MAIN_EXTRA_* to determine which field of the union is used.
     103         */
     104        int type;
     105        /** Callback once PCUT initializes itself. */
     106        void (*init_hook)(void);
     107        /** Callback even before command-line arguments are processed. */
     108        void (*preinit_hook)(int *, char ***);
    79109};
    80110
     
    89119        int id;
    90120
    91         /** Discriminator for the union.
    92          *
    93          * Use PCUT_KIND_* to determine which field of the union is used.
    94          */
     121        /** Discriminator for this item. */
    95122        int kind;
    96         union {
    97                 struct {
    98                         const char *name;
    99                         pcut_setup_func_t setup;
    100                         pcut_setup_func_t teardown;
    101                 } suite;
    102                 struct {
    103                         const char *name;
    104                         pcut_test_func_t func;
    105                         pcut_extra_t *extras;
    106                 } test;
    107                 /* setup is used for both set-up and tear-down */
    108                 struct {
    109                         pcut_setup_func_t func;
    110                 } setup;
    111                 struct {
    112                         pcut_item_t *last;
    113                 } nested;
    114                 struct {
    115                         int dummy;
    116                 } meta;
    117         };
     123
     124        /** Name of this item. */
     125        const char *name;
     126
     127        /** Test-case function. */
     128        pcut_test_func_t test_func;
     129
     130        /** Set-up function of a suite. */
     131        pcut_setup_func_t setup_func;
     132        /** Tear-down function of a suite. */
     133        pcut_setup_func_t teardown_func;
     134
     135        /** Extra attributes. */
     136        pcut_extra_t *extras;
     137
     138        /** Extra attributes for main() function. */
     139        pcut_main_extra_t *main_extras;
     140
     141        /** Nested lists. */
     142        pcut_item_t *nested;
    118143};
    119 
    120 #ifdef PCUT_DEBUG_BUILD
    121 #define PCUT_DEBUG(msg, ...) \
    122         printf("[PCUT]: Debug: " msg "\n", ##__VA_ARGS__)
    123 #else
    124 
    125 /** Debug printing.
    126  *
    127  * By default, this macro does nothing. Define PCUT_DEBUG_BUILD to
    128  * actually print the messages to the console.
    129  *
    130  * @param msg Printf-like formatting message.
    131  * @param ... Extra arguments for printf.
    132  */
    133 #define PCUT_DEBUG(msg, ...) (void)0
    134 #endif
    135144
    136145/** @endcond */
Note: See TracChangeset for help on using the changeset viewer.