1 /* This is a wrapper around X11 tests to make it faster to use for the simple
4 * Use with the X11_TEST macro like this:
6 * X11_TEST(some_test) {
11 * return x11_tests_run(void);
18 typedef int (* x11_test_func_t)(char* display);
20 struct test_function {
21 const char *name; /* function name */
22 const char *file; /* file name */
23 x11_test_func_t func; /* test function */
24 } __attribute__((aligned(16)));
27 * Defines a struct test_function in a custom ELF section that we can then
28 * loop over in x11_tests_run() to extract the tests. This removes the
29 * need of manually adding the tests to a suite or listing them somewhere.
31 #define X11_TEST(_func) \
32 static int _func(char* display); \
33 static const struct test_function _test_##_func \
34 __attribute__((used)) \
35 __attribute__((section("test_functions_section"))) = { \
40 static int _func(char* display)
42 int xvfb_wrapper(int (*f)(char* display));
44 int x11_tests_run(void);