]>
git.ipfire.org Git - thirdparty/kmod.git/blob - testsuite/testsuite.h
1 #ifndef _LIBKMOD_TESTSUITE_
2 #define _LIBKMOD_TESTSUITE_
8 typedef int (*testfunc
)(const struct test
*t
);
16 #define S_TC_ROOTFS "TESTSUITE_ROOTFS"
17 #define S_TC_UNAME_R "TESTSUITE_UNAME_R"
22 const char *description
;
24 const char *config
[_TC_LAST
];
29 const struct test
*test_find(const struct test
*tests
[], const char *name
);
30 int test_init(int argc
, char *const argv
[], const struct test
*tests
[]);
31 int test_spawn_prog(const char *prog
, const char *args
[]);
33 int test_run(const struct test
*t
);
35 #define TS_EXPORT __attribute__ ((visibility("default")))
37 #define _LOG(prefix, fmt, ...) printf("TESTSUITE: " prefix fmt, ## __VA_ARGS__)
38 #define LOG(fmt, ...) _LOG("", fmt, ## __VA_ARGS__)
39 #define WARN(fmt, ...) _LOG("WARN: ", fmt, ## __VA_ARGS__)
40 #define ERR(fmt, ...) _LOG("ERR: ", fmt, ## __VA_ARGS__)
42 /* Test definitions */
43 #define DEFINE_TEST(_name) \
44 struct test s_name = { \