"Fossies" - the Fresh Open Source Software Archive

Member "vnstat-2.9/tests/vnstat_tests.h" (3 Jan 2022, 2098 Bytes) of package /linux/misc/vnstat-2.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "vnstat_tests.h": 2.8_vs_2.9.

    1 #ifndef VNSTAT_TESTS_H
    2 #define VNSTAT_TESTS_H
    3 
    4 #include <check.h>
    5 
    6 extern int output_suppressed;
    7 
    8 Suite *test_suite(void);
    9 void verify_fork_status(void);
   10 void setup(void);
   11 void teardown(void);
   12 void suppress_output(void);
   13 void restore_output(void);
   14 int pipe_output(void);
   15 void disable_logprints(void);
   16 int clean_testdbdir(void);
   17 int create_testdir(void);
   18 int create_directory(const char *directory);
   19 int remove_directory(const char *directory);
   20 int create_zerosize_dbfile(const char *iface);
   21 int check_dbfile_exists(const char *iface, const int minsize);
   22 int fake_proc_net_dev(const char *mode, const char *iface, const int rx, const int tx, const int rxp, const int txp);
   23 int fake_sys_class_net(const char *iface, const int rx, const int tx, const int rxp, const int txp, const int speed);
   24 uint64_t get_timestamp(const int year, const int month, const int day, const int hour, const int minute);
   25 
   26 #ifndef TESTDIR
   27 #define TESTDIR "testdir"
   28 #endif
   29 
   30 #define TESTDBDIR          TESTDIR"/database"
   31 #define TESTPROCDIR        TESTDIR"/proc"
   32 #define TESTSYSCLASSNETDIR TESTDIR"/sysclassnet"
   33 
   34 #if !defined(CFGFILE)
   35 #define CFGFILE            "tests/vnstat.conf"
   36 #endif
   37 
   38 #if !defined(__linux__)
   39 #define linuxonly return
   40 #else
   41 #define linuxonly
   42 #endif
   43 
   44 #if !defined(__linux__)
   45 #define linuxonly_exit exit(1)
   46 #else
   47 #define linuxonly_exit
   48 #endif
   49 
   50 /* for compatibility with older check framework versions */
   51 #ifndef ck_assert_int_ge
   52 #define ck_assert_int_ge(X, Y) _ck_assert_int(X, >=, Y)
   53 #endif
   54 
   55 #ifndef ck_assert_int_gt
   56 #define ck_assert_int_gt(X, Y) _ck_assert_int(X, >, Y)
   57 #endif
   58 
   59 #ifndef ck_assert_int_le
   60 #define ck_assert_int_le(X, Y) _ck_assert_int(X, <=, Y)
   61 #endif
   62 
   63 #ifndef ck_assert_int_lt
   64 #define ck_assert_int_lt(X, Y) _ck_assert_int(X, <, Y)
   65 #endif
   66 
   67 #ifndef _ck_assert_ptr
   68 #define _ck_assert_ptr(X, OP, Y) do { \
   69   void* _ck_x = (X); \
   70   void* _ck_y = (Y); \
   71   ck_assert_msg(_ck_x OP _ck_y, "Assertion '"#X#OP#Y"' failed: "#X"==%p, "#Y"==%p", _ck_x, _ck_y); \
   72 } while (0)
   73 #define ck_assert_ptr_eq(X, Y) _ck_assert_ptr(X, ==, Y)
   74 #define ck_assert_ptr_ne(X, Y) _ck_assert_ptr(X, !=, Y)
   75 #endif
   76 
   77 #endif