Navigation


Changeset 1088:1d1a20a0779d in freeDiameter for tests/tests.h


Ignore:
Timestamp:
May 5, 2013, 4:25:27 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/tests.h

    r1078 r1088  
    6868/* Define the macro to fail a test with a message */
    6969#define FAILTEST( message... ){                         \
    70         TRACE_ERROR(message);                           \
    71         TRACE_ERROR("FAILED: %s ", __STRIPPED_FILE__);  \
     70        LOG_F(message);                                 \
     71        LOG_F("FAILED: %s ", __STRIPPED_FILE__);        \
     72        free(tbuf);                                     \
    7273        exit(FAIL);                                     \
    7374}
     
    7576/* Define the macro to pass a test */
    7677#define PASSTEST( ){                                    \
    77         TRACE_NOTICE("PASS: %s", __STRIPPED_FILE__);    \
     78        LOG_N("PASS: %s", __STRIPPED_FILE__);           \
    7879        (void)fd_core_shutdown();                       \
    7980        (void)fd_core_wait_shutdown_complete();         \
    8081        (void)fd_thr_term(&signal_thr);                 \
     82        free(tbuf);                                     \
    8183        exit(PASS);                                     \
    8284}
    8385
    84 static int test_verbo = 0;
    8586static struct fd_config conf;
    8687extern struct fd_config * fd_g_config;
    8788
     89/* for dumps */
     90static char * tbuf = NULL; size_t tbuflen = 0;
     91#define FD_DUMP_TEST_PARAMS &tbuf, &tbuflen, NULL
     92
     93
    8894/* Define the standard check routines */
    8995#define CHECK( _val, _assert ){                         \
    90         if (test_verbo > 0) {                           \
    91                 TRACE_NOTICE("CHECK( %s == %s )",       \
     96        LOG_D("CHECK( %s == %s )",                      \
    9297                                #_assert,               \
    9398                                #_val);                 \
    94         }{                                              \
     99        {                                               \
    95100        __typeof__ (_val) __ret = (_assert);            \
    96101        if (__ret != (_val)) {                          \
     
    143148                switch (c) {
    144149                        case 'd':       /* Increase verbosity of debug messages.  */
    145                                 test_verbo++;
     150                                fd_g_debug_lvl--;
    146151                                break;
    147152                               
    148153                        case 'q':       /* Decrease verbosity.  */
    149                                 test_verbo--;
     154                                fd_g_debug_lvl++;
    150155                                break;
    151156                       
     
    178183                }
    179184        }
    180         fd_g_debug_lvl = (test_verbo > 0) ? (test_verbo - 1) : 0;
    181185        if (!no_timeout) {
    182186                alarm(TEST_TIMEOUT);
Note: See TracChangeset for help on using the changeset viewer.