From 7553ad6e10f76aa703359a10e08138e14501d54d Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Mon, 12 Aug 2013 10:43:59 +0200 Subject: tests: use drmtest_skip() in caching ioctl helpers This way we can rip out all the skip handling from the test control flow, and additionally (by using drmtest_retval()) even get correct exit codes. The only tricky part is that when we only want ot skip parts of a test (like for gem_pread and gem_pwrite) we need to split out those parts as subtests. But no addition of control-flow is required, the set/longjmp magic in the helpers all makes it happen. Also we make extensive use of the behaviour of drmtest_skip to skip all subsequent subtests if it is called outside of a subtest. This allows us to re-flatten the control flow a lot. Signed-off-by: Daniel Vetter --- tests/gem_partial_pwrite_pread.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'tests/gem_partial_pwrite_pread.c') diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c index a27e584bf..f6e6e32df 100644 --- a/tests/gem_partial_pwrite_pread.c +++ b/tests/gem_partial_pwrite_pread.c @@ -257,17 +257,8 @@ static void do_tests(int cache_level, const char *suffix) { char name[80]; - if (cache_level != -1) { - switch (gem_set_caching(fd, scratch_bo->handle, cache_level)) { - case 0: break; - case -EINVAL: - case -ENOTTY: - return; - default: - assert(0); - return; - } - } + if (cache_level != -1) + gem_set_caching(fd, scratch_bo->handle, cache_level); snprintf(name, sizeof(name), "reads%s", suffix); drmtest_subtest_block(name) @@ -315,5 +306,5 @@ int main(int argc, char **argv) close(fd); - return 0; + return drmtest_retval(); } -- cgit v1.2.3