diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-14 13:47:47 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-14 13:47:47 +0200 |
commit | 6234658063b4080778c34228a444e96eb901279f (patch) | |
tree | 90bae911b39c7f00ea625fc0ba9b6ff3856afa99 /lib/drmtest.h | |
parent | 1532af19d9bf962412bb150393aa10d13fae91d6 (diff) |
tests: add igt_subtest_f for snprintf'ing testnames
Useful when stitching together combinatorial testnames.
v2:
- ## rules are just fun. We need 2 indirections to actually get
__LINE__ to properly expand.
- Kill stray ; which botched the logic.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/drmtest.h')
-rw-r--r-- | lib/drmtest.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/drmtest.h b/lib/drmtest.h index d9a11e18..440e27ef 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -100,6 +100,17 @@ void igt_progress(const char *header, uint64_t i, uint64_t total); jmp_buf igt_subtest_jmpbuf; void igt_subtest_init(int argc, char **argv); bool __igt_run_subtest(const char *subtest_name); +#define igt_tokencat2(x, y) x ## y +#define igt_tokencat(x, y) igt_tokencat2(x, y) +#define __igt_subtest_f(tmp, format, args...) \ + for (char tmp [256]; \ + snprintf( tmp , sizeof( tmp ), \ + format, args), \ + __igt_run_subtest( tmp ) && \ + (setjmp(igt_subtest_jmpbuf) == 0); \ + igt_success()) +#define igt_subtest_f(f, a...) \ + __igt_subtest_f(igt_tokencat(__tmpchar, __LINE__), f, a) #define igt_subtest(name) for (; __igt_run_subtest((name)) && \ (setjmp(igt_subtest_jmpbuf) == 0); \ igt_success()) |