mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
tests: add support for tests expected to fail
Add a new macro FAIL_TEST that can be used to define tests that are supposed to fail. To distinguish the supposed outcome of a test, add a field to 'struct test'. However, simply adding a field to 'struct test' will make all tests past the first one in an executable to be garbage. Apparently, the variables of type 'struct test' have different alignment when put into a special section than otherwise, and the compiler will get the skip from one 'struct test' to the next wrong. Explicitly specify the alingment of 'struct test' to be 16 bytes, which is what it seems to be in the special section on x86_64. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
56426d8a4a
commit
bb74adbc4d
2 changed files with 17 additions and 3 deletions
|
|
@ -8,14 +8,25 @@
|
|||
struct test {
|
||||
const char *name;
|
||||
void (*run)(void);
|
||||
};
|
||||
int must_fail;
|
||||
} __attribute__ ((aligned (16)));
|
||||
|
||||
#define TEST(name) \
|
||||
static void name(void); \
|
||||
\
|
||||
const struct test test##name \
|
||||
const struct test test##name \
|
||||
__attribute__ ((section ("test_section"))) = { \
|
||||
#name, name \
|
||||
#name, name, 0 \
|
||||
}; \
|
||||
\
|
||||
static void name(void)
|
||||
|
||||
#define FAIL_TEST(name) \
|
||||
static void name(void); \
|
||||
\
|
||||
const struct test test##name \
|
||||
__attribute__ ((section ("test_section"))) = { \
|
||||
#name, name, 1 \
|
||||
}; \
|
||||
\
|
||||
static void name(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue