tests: Add event-test, which tests for a few incoming events
[platform/upstream/weston.git] / tests / test-runner.h
1 #ifndef _TEST_RUNNER_H_
2 #define _TEST_RUNNER_H_
3
4 #ifdef NDEBUG
5 #error "Tests must not be built with NDEBUG defined, they rely on assert()."
6 #endif
7
8 #include "../src/compositor.h"
9
10 struct test {
11         const char *name;
12         void (*run)(struct weston_compositor *compositor);
13 } __attribute__ ((aligned (16)));
14
15 #define TEST(name)                                              \
16         static void name(struct weston_compositor *compositor); \
17                                                                 \
18         const struct test test##name                            \
19                  __attribute__ ((section ("test_section"))) = { \
20                 #name, name                                     \
21         };                                                      \
22                                                                 \
23         static void name(struct weston_compositor *compositor)
24
25 struct test_client {
26         struct weston_compositor *compositor;
27         struct wl_client *client;
28         struct weston_process proc;
29         int fd;
30         int done;
31         int status;
32         int terminate;
33
34         char buf[256];
35         void (*handle)(struct test_client *client);
36         void *data;
37 };
38
39 struct test_client *test_client_launch(struct weston_compositor *compositor);
40 void test_client_send(struct test_client *client, const char *fmt, ...);
41
42 #endif