Changeset 9b20126 in mainline for uspace/lib/pcut/src/internal.h


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/src/internal.h

    r15d0046 r9b20126  
    3737#include <stdlib.h>
    3838
     39
     40/** @def PCUT_DEBUG(msg, ...)
     41 * Debug printing.
     42 *
     43 * By default, this macro does nothing. Define PCUT_DEBUG_BUILD to
     44 * actually print the messages to the console.
     45 *
     46 * @param msg Printf-like formatting message.
     47 * @param ... Extra arguments for printf.
     48 */
     49#ifdef PCUT_DEBUG_BUILD
     50#include <stdio.h>
     51#define PCUT_DEBUG_INTERNAL(msg, ...) \
     52        fprintf(stderr, "[PCUT %s:%d]: " msg "%s", __FILE__, __LINE__, __VA_ARGS__)
     53#define PCUT_DEBUG(...) \
     54        PCUT_DEBUG_INTERNAL( \
     55                PCUT_VARG_GET_FIRST(__VA_ARGS__, this_arg_is_ignored), \
     56                PCUT_VARG_SKIP_FIRST(__VA_ARGS__, "\n") \
     57        )
     58#else
     59#define PCUT_DEBUG(...) (void)0
     60#endif
     61
     62
    3963/** Mark a variable as unused. */
    4064#define PCUT_UNUSED(x) ((void)x)
     
    6387/** Test outcome: test failed unexpectedly. */
    6488#define TEST_OUTCOME_ERROR 3
     89
     90
     91/*
     92 * Use sprintf_s in Windows but only with Microsoft compiler.
     93 * Namely, let MinGW use snprintf.
     94 */
     95#if (defined(__WIN64) || defined(__WIN32) || defined(_WIN32)) && defined(_MSC_VER)
     96#define snprintf sprintf_s
     97#endif
    6598
    6699extern int pcut_run_mode;
     
    92125        /** Initialize the reporting, given all tests. */
    93126        void (*init)(pcut_item_t *);
     127        /** Finalize the reporting. */
     128        void (*done)(void);
    94129        /** Test suite just started. */
    95130        void (*suite_start)(pcut_item_t *);
     
    101136        void (*test_done)(pcut_item_t *, int, const char *, const char *,
    102137                const char *);
    103         /** Finalize the reporting. */
    104         void (*done)(void);
    105138};
    106139
     
    120153/* OS-dependent functions. */
    121154
     155/** Hook to execute before test starts.
     156 *
     157 * Useful for OS-specific preparations prior to launching the actual
     158 * test code (i. e. sandboxing the process more etc.).
     159 *
     160 * This function is not run by the launcher process that only
     161 * starts other tests in separate processes.
     162 *
     163 * @param test The test that is about to be executed.
     164 */
     165void pcut_hook_before_test(pcut_item_t *test);
     166
    122167/** Tell whether two strings start with the same prefix.
    123168 *
Note: See TracChangeset for help on using the changeset viewer.