diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-26 20:52:14 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-26 20:55:54 +0200 |
commit | 8869e1e6281139f2c12a9a774becd6c1f892274f (patch) | |
tree | e9fede25ed02c1f8e30c006ac53ae9ff4fc85fae | |
parent | cf93ba45b00e302c755e1ea5fb860ee5f5379e24 (diff) |
lib/drmtest: don't complete fixtures with a longjmp
Longjmp creates havoc with stack variables of the current stackframe.
And since fixtures should be used to set up such variables creating
havoc isn't a great idea. With this I can revert a bunch of
bogus patches I've done to paper over this by moving stack variables
to be global.
The same issue is actually a feature for subtest blocks since subtests
should be independant anyway.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | lib/drmtest.c | 5 | ||||
-rw-r--r-- | lib/drmtest.h | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index 37d7da32..6247ef57 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -666,6 +666,11 @@ bool __igt_fixture(void) return true; } +void __igt_fixture_complete(void) +{ + in_fixture = false; +} + void __igt_fixture_end(void) { assert(in_fixture); diff --git a/lib/drmtest.h b/lib/drmtest.h index 1cada0cb..5fecb2b0 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -184,6 +184,7 @@ void igt_exit(void) __attribute__((noreturn)); #define igt_require(expr) do { if (!(expr)) __igt_skip_check(__FILE__, __LINE__, __func__, #expr ); } while (0) bool __igt_fixture(void); +void __igt_fixture_complete(void); void __igt_fixture_end(void) __attribute__((noreturn)); /** * igt_fixture - annote global test fixture code @@ -193,9 +194,12 @@ void __igt_fixture_end(void) __attribute__((noreturn)); * enumeration (e.g. when enumerating on systemes without an intel gpu) such * blocks should be annotated with igt_fixture. */ -#define igt_fixture for (; __igt_fixture() && \ +#define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \ + igt_tokencat(__tmpint,__LINE__) < 1 && \ + __igt_fixture() && \ (setjmp(igt_subtest_jmpbuf) == 0); \ - __igt_fixture_end()) + igt_tokencat(__tmpint,__LINE__) ++, \ + __igt_fixture_complete()) /* check functions which auto-skip tests by calling igt_skip() */ void gem_require_caching(int fd); |