summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-12 09:04:24 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-12 11:10:26 +0200
commit9f6365e4eacc7aa07fc3f9524500d1e217b61bb5 (patch)
tree1592d8b751616a705e2a5e4b9729b8baf4604f66
parent40ea6f4ea89dbf5a326677ea9482cc48743d2543 (diff)
lib/drmtest: Add drmtest_subtest_block macro
Doesn't do more than an if (drmtest_run_test(name)) right now, but as soon as we get a bit of infrastructure to handle test failures and skipping, this will get more interesting. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--lib/drmtest.h1
-rw-r--r--tests/gem_basic.c6
-rw-r--r--tests/gem_cpu_concurrent_blit.c12
-rw-r--r--tests/gem_cs_tlb.c8
-rw-r--r--tests/gem_dummy_reloc_loop.c10
-rw-r--r--tests/gem_exec_bad_domains.c10
-rw-r--r--tests/gem_exec_faulting_reloc.c4
-rw-r--r--tests/gem_exec_nop.c8
-rw-r--r--tests/gem_fence_thrash.c14
-rw-r--r--tests/gem_flink.c10
-rw-r--r--tests/gem_flink_race.c4
-rw-r--r--tests/gem_gtt_concurrent_blit.c12
-rw-r--r--tests/gem_linear_blits.c4
-rw-r--r--tests/gem_mmap_gtt.c14
-rw-r--r--tests/gem_partial_pwrite_pread.c6
-rw-r--r--tests/gem_pread_after_blit.c16
-rw-r--r--tests/gem_prw_concurrent_blit.c12
-rw-r--r--tests/gem_pwrite_pread.c24
-rw-r--r--tests/gem_ringfill.c8
-rw-r--r--tests/gem_set_tiling_vs_blt.c6
-rw-r--r--tests/gem_suspend.c4
-rw-r--r--tests/gem_tiled_blits.c4
-rw-r--r--tests/gem_tiled_partial_pwrite_pread.c6
-rw-r--r--tests/gem_write_read_ring_switch.c9
-rw-r--r--tests/kms_flip.c4
-rw-r--r--tests/kms_render.c2
-rw-r--r--tests/prime_nv_api.c2
-rw-r--r--tests/prime_nv_pcopy.c17
-rw-r--r--tests/prime_nv_test.c2
-rw-r--r--tests/prime_self_import.c2
30 files changed, 123 insertions, 118 deletions
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 773beaa7..ada8e81c 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -95,6 +95,7 @@ void drmtest_progress(const char *header, uint64_t i, uint64_t total);
/* subtest infrastructure */
void drmtest_subtest_init(int argc, char **argv);
bool drmtest_run_subtest(const char *subtest_name);
+#define drmtest_subtest_block(name) if (drmtest_run_subtest((name)))
bool drmtest_only_list_subtests(void);
/* helpers to automatically reduce test runtime in simulation */
diff --git a/tests/gem_basic.c b/tests/gem_basic.c
index 5cc8684e..900194db 100644
--- a/tests/gem_basic.c
+++ b/tests/gem_basic.c
@@ -84,11 +84,11 @@ int main(int argc, char **argv)
fd = drm_open_any();
- if (drmtest_run_subtest("bad-close"))
+ drmtest_subtest_block("bad-close")
test_bad_close(fd);
- if (drmtest_run_subtest("create-close"))
+ drmtest_subtest_block("create-close")
test_create_close(fd);
- if (drmtest_run_subtest("create-fd-close"))
+ drmtest_subtest_block("create-fd-close")
test_create_fd_close(fd);
return 0;
diff --git a/tests/gem_cpu_concurrent_blit.c b/tests/gem_cpu_concurrent_blit.c
index e6cc50bb..7bcfcd84 100644
--- a/tests/gem_cpu_concurrent_blit.c
+++ b/tests/gem_cpu_concurrent_blit.c
@@ -117,7 +117,7 @@ main(int argc, char **argv)
}
/* try to overwrite the source values */
- if (drmtest_run_subtest("overwrite-source")) {
+ drmtest_subtest_block("overwrite-source") {
for (i = 0; i < num_buffers; i++) {
set_bo(src[i], i, width, height);
set_bo(dst[i], i, width, height);
@@ -131,7 +131,7 @@ main(int argc, char **argv)
}
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("early-read")) {
+ drmtest_subtest_block("early-read") {
for (i = num_buffers; i--; )
set_bo(src[i], 0xdeadbeef, width, height);
for (i = 0; i < num_buffers; i++)
@@ -141,7 +141,7 @@ main(int argc, char **argv)
}
/* and finally try to trick the kernel into loosing the pending write */
- if (drmtest_run_subtest("gpu-read-after-write")) {
+ drmtest_subtest_block("gpu-read-after-write") {
for (i = num_buffers; i--; )
set_bo(src[i], 0xabcdabcd, width, height);
for (i = 0; i < num_buffers; i++)
@@ -155,7 +155,7 @@ main(int argc, char **argv)
drmtest_fork_signal_helper();
/* try to overwrite the source values */
- if (drmtest_run_subtest("overwrite-source-interruptible")) {
+ drmtest_subtest_block("overwrite-source-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = 0; i < num_buffers; i++) {
@@ -172,7 +172,7 @@ main(int argc, char **argv)
}
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("early-read-interruptible")) {
+ drmtest_subtest_block("early-read-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = num_buffers; i--; )
@@ -185,7 +185,7 @@ main(int argc, char **argv)
}
/* and finally try to trick the kernel into loosing the pending write */
- if (drmtest_run_subtest("gpu-read-after-write-interruptible")) {
+ drmtest_subtest_block("gpu-read-after-write-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = num_buffers; i--; )
diff --git a/tests/gem_cs_tlb.c b/tests/gem_cs_tlb.c
index 05e78c23..081b6f24 100644
--- a/tests/gem_cs_tlb.c
+++ b/tests/gem_cs_tlb.c
@@ -164,18 +164,18 @@ int main(int argc, char **argv)
sleep(5); /* needs more serious ducttape */
}
- if (drmtest_run_subtest("render"))
+ drmtest_subtest_block("render")
run_on_ring(fd, I915_EXEC_RENDER, "render");
- if (drmtest_run_subtest("bsd"))
+ drmtest_subtest_block("bsd")
if (HAS_BSD_RING(devid))
run_on_ring(fd, I915_EXEC_BSD, "bsd");
- if (drmtest_run_subtest("blt"))
+ drmtest_subtest_block("blt")
if (HAS_BLT_RING(devid))
run_on_ring(fd, I915_EXEC_BLT, "blt");
- if (drmtest_run_subtest("vebox"))
+ drmtest_subtest_block("vebox")
if (gem_has_vebox(fd))
run_on_ring(fd, LOCAL_I915_EXEC_VEBOX, "vebox");
diff --git a/tests/gem_dummy_reloc_loop.c b/tests/gem_dummy_reloc_loop.c
index b889f835..7cffbbea 100644
--- a/tests/gem_dummy_reloc_loop.c
+++ b/tests/gem_dummy_reloc_loop.c
@@ -160,13 +160,13 @@ int main(int argc, char **argv)
exit(-1);
}
- if (drmtest_run_subtest("render")) {
+ drmtest_subtest_block("render") {
printf("running dummy loop on render\n");
dummy_reloc_loop(I915_EXEC_RENDER);
printf("dummy loop run on render completed\n");
}
- if (drmtest_run_subtest("bsd")) {
+ drmtest_subtest_block("bsd") {
if (HAS_BSD_RING(devid)) {
sleep(2);
printf("running dummy loop on bsd\n");
@@ -175,7 +175,7 @@ int main(int argc, char **argv)
}
}
- if (drmtest_run_subtest("blt")) {
+ drmtest_subtest_block("blt") {
if (HAS_BLT_RING(devid)) {
sleep(2);
printf("running dummy loop on blt\n");
@@ -184,7 +184,7 @@ int main(int argc, char **argv)
}
}
- if (drmtest_run_subtest("vebox")) {
+ drmtest_subtest_block("vebox") {
if (gem_has_vebox(fd)) {
sleep(2);
printf("running dummy loop on vebox\n");
@@ -193,7 +193,7 @@ int main(int argc, char **argv)
}
}
- if (drmtest_run_subtest("mixed")) {
+ drmtest_subtest_block("mixed") {
if (num_rings > 1) {
sleep(2);
printf("running dummy loop on random rings\n");
diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c
index d1743493..53c33fd0 100644
--- a/tests/gem_exec_bad_domains.c
+++ b/tests/gem_exec_bad_domains.c
@@ -166,7 +166,7 @@ int main(int argc, char **argv)
tmp = drm_intel_bo_alloc(bufmgr, "tmp", 128 * 128, 4096);
- if (drmtest_run_subtest("cpu-domain")) {
+ drmtest_subtest_block("cpu-domain") {
BEGIN_BATCH(2);
OUT_BATCH(0);
OUT_RELOC(tmp, I915_GEM_DOMAIN_CPU, 0, 0);
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
}
}
- if (drmtest_run_subtest("gtt-domain")) {
+ drmtest_subtest_block("gtt-domain") {
BEGIN_BATCH(2);
OUT_BATCH(0);
OUT_RELOC(tmp, I915_GEM_DOMAIN_GTT, 0, 0);
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
#if 0 /* kernel checks have been eased, doesn't reject conflicting write domains
any more */
- if (drmtest_run_subtest("conflicting-write-domain")) {
+ drmtest_subtest_block("conflicting-write-domain") {
BEGIN_BATCH(4);
OUT_BATCH(0);
OUT_RELOC(tmp, I915_GEM_DOMAIN_RENDER,
@@ -229,10 +229,10 @@ int main(int argc, char **argv)
}
#endif
- if (drmtest_run_subtest("double-write-domain"))
+ drmtest_subtest_block("double-write-domain")
multi_write_domain(fd);
- if (drmtest_run_subtest("invalid-gpu-domain")) {
+ drmtest_subtest_block("invalid-gpu-domain") {
BEGIN_BATCH(2);
OUT_BATCH(0);
OUT_RELOC(tmp, ~(I915_GEM_GPU_DOMAINS | I915_GEM_DOMAIN_GTT | I915_GEM_DOMAIN_CPU),
diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c
index c7f7b6b7..d9c9db33 100644
--- a/tests/gem_exec_faulting_reloc.c
+++ b/tests/gem_exec_faulting_reloc.c
@@ -222,9 +222,9 @@ int main(int argc, char **argv)
{
drmtest_subtest_init(argc, argv);
- if (drmtest_run_subtest("normal"))
+ drmtest_subtest_block("normal")
run(OBJECT_SIZE);
- if (drmtest_run_subtest("no-prefault")) {
+ drmtest_subtest_block("no-prefault") {
drmtest_disable_prefault();
run(OBJECT_SIZE);
drmtest_enable_prefault();
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 35cb23d6..ca1f5809 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -124,18 +124,18 @@ int main(int argc, char **argv)
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
- if (drmtest_run_subtest("render"))
+ drmtest_subtest_block("render")
loop(fd, handle, I915_EXEC_RENDER, "render");
- if (drmtest_run_subtest("bsd"))
+ drmtest_subtest_block("bsd")
if (HAS_BSD_RING(devid))
loop(fd, handle, I915_EXEC_BSD, "bsd");
- if (drmtest_run_subtest("blt"))
+ drmtest_subtest_block("blt")
if (HAS_BLT_RING(devid))
loop(fd, handle, I915_EXEC_BLT, "blt");
- if (drmtest_run_subtest("vebox"))
+ drmtest_subtest_block("vebox")
if (gem_has_vebox(fd))
loop(fd, handle, LOCAL_I915_EXEC_VEBOX, "vebox");
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index a28c1274..a6cd6eea 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -210,33 +210,33 @@ main(int argc, char **argv)
drmtest_subtest_init(argc, argv);
drmtest_skip_on_simulation();
- if (drmtest_run_subtest("bo-write-verify-none"))
+ drmtest_subtest_block("bo-write-verify-none")
assert (run_test(0, bo_write_verify, I915_TILING_NONE, 80) == 0);
- if (drmtest_run_subtest("bo-write-verify-x"))
+ drmtest_subtest_block("bo-write-verify-x")
assert (run_test(0, bo_write_verify, I915_TILING_X, 80) == 0);
- if (drmtest_run_subtest("bo-write-verify-y"))
+ drmtest_subtest_block("bo-write-verify-y")
assert (run_test(0, bo_write_verify, I915_TILING_Y, 80) == 0);
- if (drmtest_run_subtest("bo-write-verify-threaded-none"))
+ drmtest_subtest_block("bo-write-verify-threaded-none")
assert (run_test(5, bo_write_verify, I915_TILING_NONE, 2) == 0);
- if (drmtest_run_subtest("bo-write-verify-threaded-x")) {
+ drmtest_subtest_block("bo-write-verify-threaded-x") {
assert (run_test(2, bo_write_verify, I915_TILING_X, 2) == 0);
assert (run_test(5, bo_write_verify, I915_TILING_X, 2) == 0);
assert (run_test(10, bo_write_verify, I915_TILING_X, 2) == 0);
assert (run_test(20, bo_write_verify, I915_TILING_X, 2) == 0);
}
- if (drmtest_run_subtest("bo-write-verify-threaded-y")) {
+ drmtest_subtest_block("bo-write-verify-threaded-y") {
assert (run_test(2, bo_write_verify, I915_TILING_Y, 2) == 0);
assert (run_test(5, bo_write_verify, I915_TILING_Y, 2) == 0);
assert (run_test(10, bo_write_verify, I915_TILING_Y, 2) == 0);
assert (run_test(20, bo_write_verify, I915_TILING_Y, 2) == 0);
}
- if (drmtest_run_subtest("bo-copy"))
+ drmtest_subtest_block("bo-copy")
assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
return 0;
diff --git a/tests/gem_flink.c b/tests/gem_flink.c
index cc4f0e5f..abdbfca6 100644
--- a/tests/gem_flink.c
+++ b/tests/gem_flink.c
@@ -158,15 +158,15 @@ int main(int argc, char **argv)
fd = drm_open_any();
- if (drmtest_run_subtest("basic"))
+ drmtest_subtest_block("basic")
test_flink(fd);
- if (drmtest_run_subtest("double-flink"))
+ drmtest_subtest_block("double-flink")
test_double_flink(fd);
- if (drmtest_run_subtest("bad-flink"))
+ drmtest_subtest_block("bad-flink")
test_bad_flink(fd);
- if (drmtest_run_subtest("bad-open"))
+ drmtest_subtest_block("bad-open")
test_bad_open(fd);
- if (drmtest_run_subtest("flink-lifetime"))
+ drmtest_subtest_block("flink-lifetime")
test_flink_lifetime(fd);
return 0;
diff --git a/tests/gem_flink_race.c b/tests/gem_flink_race.c
index ce6f3027..4c846e05 100644
--- a/tests/gem_flink_race.c
+++ b/tests/gem_flink_race.c
@@ -197,10 +197,10 @@ int main(int argc, char **argv)
drmtest_subtest_init(argc, argv);
- if (drmtest_run_subtest("flink_name"))
+ drmtest_subtest_block("flink_name")
test_flink_name();
- if (drmtest_run_subtest("flink_close"))
+ drmtest_subtest_block("flink_close")
test_flink_close();
return 0;
diff --git a/tests/gem_gtt_concurrent_blit.c b/tests/gem_gtt_concurrent_blit.c
index b3ac0b49..63fbcc27 100644
--- a/tests/gem_gtt_concurrent_blit.c
+++ b/tests/gem_gtt_concurrent_blit.c
@@ -120,7 +120,7 @@ main(int argc, char **argv)
}
/* try to overwrite the source values */
- if (drmtest_run_subtest("overwrite-source")) {
+ drmtest_subtest_block("overwrite-source") {
for (i = 0; i < num_buffers; i++) {
set_bo(src[i], i, width, height);
set_bo(dst[i], i, width, height);
@@ -134,7 +134,7 @@ main(int argc, char **argv)
}
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("early-read")) {
+ drmtest_subtest_block("early-read") {
for (i = num_buffers; i--; )
set_bo(src[i], 0xdeadbeef, width, height);
for (i = 0; i < num_buffers; i++)
@@ -144,7 +144,7 @@ main(int argc, char **argv)
}
/* and finally try to trick the kernel into loosing the pending write */
- if (drmtest_run_subtest("gpu-read-after-write")) {
+ drmtest_subtest_block("gpu-read-after-write") {
for (i = num_buffers; i--; )
set_bo(src[i], 0xabcdabcd, width, height);
for (i = 0; i < num_buffers; i++)
@@ -158,7 +158,7 @@ main(int argc, char **argv)
drmtest_fork_signal_helper();
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("overwrite-source-interruptible")) {
+ drmtest_subtest_block("overwrite-source-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = 0; i < num_buffers; i++) {
@@ -175,7 +175,7 @@ main(int argc, char **argv)
}
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("early-read-interruptible")) {
+ drmtest_subtest_block("early-read-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = num_buffers; i--; )
@@ -188,7 +188,7 @@ main(int argc, char **argv)
}
/* and finally try to trick the kernel into loosing the pending write */
- if (drmtest_run_subtest("gpu-read-after-write-interruptible")) {
+ drmtest_subtest_block("gpu-read-after-write-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = num_buffers; i--; )
diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c
index 0956fd08..661baa83 100644
--- a/tests/gem_linear_blits.c
+++ b/tests/gem_linear_blits.c
@@ -264,10 +264,10 @@ int main(int argc, char **argv)
printf("Using %d 1MiB buffers\n", count);
}
- if (drmtest_run_subtest("normal"))
+ drmtest_subtest_block("normal")
run_test(fd, count);
- if (drmtest_run_subtest("interruptible")) {
+ drmtest_subtest_block("interruptible") {
drmtest_fork_signal_helper();
run_test(fd, count);
drmtest_stop_signal_helper();
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index 5151ea3d..198dd59a 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -164,19 +164,19 @@ int main(int argc, char **argv)
fd = drm_open_any();
- if (drmtest_run_subtest("copy"))
+ drmtest_subtest_block("copy")
test_copy(fd);
- if (drmtest_run_subtest("read"))
+ drmtest_subtest_block("read")
test_read(fd);
- if (drmtest_run_subtest("write"))
+ drmtest_subtest_block("write")
test_write(fd);
- if (drmtest_run_subtest("write-gtt"))
+ drmtest_subtest_block("write-gtt")
test_write_gtt(fd);
- if (drmtest_run_subtest("read-no-prefault"))
+ drmtest_subtest_block("read-no-prefault")
run_without_prefault(fd, test_read);
- if (drmtest_run_subtest("write-no-prefault"))
+ drmtest_subtest_block("write-no-prefault")
run_without_prefault(fd, test_write);
- if (drmtest_run_subtest("write-gtt-no-prefault"))
+ drmtest_subtest_block("write-gtt-no-prefault")
run_without_prefault(fd, test_write_gtt);
close(fd);
diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c
index 0330216b..a27e584b 100644
--- a/tests/gem_partial_pwrite_pread.c
+++ b/tests/gem_partial_pwrite_pread.c
@@ -270,15 +270,15 @@ static void do_tests(int cache_level, const char *suffix)
}
snprintf(name, sizeof(name), "reads%s", suffix);
- if (drmtest_run_subtest(name))
+ drmtest_subtest_block(name)
test_partial_reads();
snprintf(name, sizeof(name), "writes%s", suffix);
- if (drmtest_run_subtest(name))
+ drmtest_subtest_block(name)
test_partial_writes();
snprintf(name, sizeof(name), "writes-after-reads%s", suffix);
- if (drmtest_run_subtest(name))
+ drmtest_subtest_block(name)
test_partial_read_writes();
}
diff --git a/tests/gem_pread_after_blit.c b/tests/gem_pread_after_blit.c
index 55caa98d..7375000a 100644
--- a/tests/gem_pread_after_blit.c
+++ b/tests/gem_pread_after_blit.c
@@ -190,37 +190,37 @@ main(int argc, char **argv)
dst[0] = drm_intel_bo_alloc(bufmgr, "dst bo", size, 4096);
dst[1] = drm_intel_bo_alloc(bufmgr, "dst bo", size, 4096);
- if (drmtest_run_subtest("normal"))
+ drmtest_subtest_block("normal")
do_test(fd, -1, src, start, dst, 1);
- if (drmtest_run_subtest("interruptible")) {
+ drmtest_subtest_block("interruptible") {
drmtest_fork_signal_helper();
do_test(fd, -1, src, start, dst, 100);
drmtest_stop_signal_helper();
}
- if (drmtest_run_subtest("normal-uncached"))
+ drmtest_subtest_block("normal-uncached")
do_test(fd, 0, src, start, dst, 1);
- if (drmtest_run_subtest("interruptible-uncached")) {
+ drmtest_subtest_block("interruptible-uncached") {
drmtest_fork_signal_helper();
do_test(fd, 0, src, start, dst, 100);
drmtest_stop_signal_helper();
}
- if (drmtest_run_subtest("normal-snoop"))
+ drmtest_subtest_block("normal-snoop")
do_test(fd, 1, src, start, dst, 1);
- if (drmtest_run_subtest("interruptible-snoop")) {
+ drmtest_subtest_block("interruptible-snoop") {
drmtest_fork_signal_helper();
do_test(fd, 1, src, start, dst, 100);
drmtest_stop_signal_helper();
}
- if (drmtest_run_subtest("normal-display"))
+ drmtest_subtest_block("normal-display")
do_test(fd, 2, src, start, dst, 1);
- if (drmtest_run_subtest("interruptible-display")) {
+ drmtest_subtest_block("interruptible-display") {
drmtest_fork_signal_helper();
do_test(fd, 2, src, start, dst, 100);
drmtest_stop_signal_helper();
diff --git a/tests/gem_prw_concurrent_blit.c b/tests/gem_prw_concurrent_blit.c
index 1765f096..2e0d36ff 100644
--- a/tests/gem_prw_concurrent_blit.c
+++ b/tests/gem_prw_concurrent_blit.c
@@ -120,7 +120,7 @@ main(int argc, char **argv)
}
/* try to overwrite the source values */
- if (drmtest_run_subtest("overwrite-source")) {
+ drmtest_subtest_block("overwrite-source") {
for (i = 0; i < num_buffers; i++) {
set_bo(src[i], i, width, height);
set_bo(dst[i], i, width, height);
@@ -134,7 +134,7 @@ main(int argc, char **argv)
}
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("early-read")) {
+ drmtest_subtest_block("early-read") {
for (i = num_buffers; i--; )
set_bo(src[i], 0xdeadbeef, width, height);
for (i = 0; i < num_buffers; i++)
@@ -144,7 +144,7 @@ main(int argc, char **argv)
}
/* and finally try to trick the kernel into loosing the pending write */
- if (drmtest_run_subtest("gpu-read-after-write")) {
+ drmtest_subtest_block("gpu-read-after-write") {
for (i = num_buffers; i--; )
set_bo(src[i], 0xabcdabcd, width, height);
for (i = 0; i < num_buffers; i++)
@@ -158,7 +158,7 @@ main(int argc, char **argv)
drmtest_fork_signal_helper();
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("overwrite-source-interruptible")) {
+ drmtest_subtest_block("overwrite-source-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = 0; i < num_buffers; i++) {
@@ -175,7 +175,7 @@ main(int argc, char **argv)
}
/* try to read the results before the copy completes */
- if (drmtest_run_subtest("early-read-interruptible")) {
+ drmtest_subtest_block("early-read-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = num_buffers; i--; )
@@ -188,7 +188,7 @@ main(int argc, char **argv)
}
/* and finally try to trick the kernel into loosing the pending write */
- if (drmtest_run_subtest("gpu-read-after-write-interruptible")) {
+ drmtest_subtest_block("gpu-read-after-write-interruptible") {
for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd);
for (i = num_buffers; i--; )
diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c
index 65427c3e..d29c5312 100644
--- a/tests/gem_pwrite_pread.c
+++ b/tests/gem_pwrite_pread.c
@@ -400,9 +400,9 @@ int main(int argc, char **argv)
if (gem_set_caching(fd, src, 0) == 0 &&
gem_set_caching(fd, dst, 0) == 0) {
- if (drmtest_run_subtest("uncached-copy-correctness"))
+ drmtest_subtest_block("uncached-copy-correctness")
test_copy(fd, src, dst, tmp, object_size);
- if (drmtest_run_subtest("uncached-copy-performance")) {
+ drmtest_subtest_block("uncached-copy-performance") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
@@ -417,9 +417,9 @@ int main(int argc, char **argv)
}
}
- if (drmtest_run_subtest("uncached-pwrite-blt-gtt_mmap-correctness"))
+ drmtest_subtest_block("uncached-pwrite-blt-gtt_mmap-correctness")
test_as_gtt_mmap(fd, src, dst, object_size);
- if (drmtest_run_subtest("uncached-pwrite-blt-gtt_mmap-performance")) {
+ drmtest_subtest_block("uncached-pwrite-blt-gtt_mmap-performance") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
@@ -437,9 +437,9 @@ int main(int argc, char **argv)
if (gem_set_caching(fd, src, 1) == 0 &&
gem_set_caching(fd, dst, 1) == 0) {
- if (drmtest_run_subtest("snooped-copy-correctness"))
+ drmtest_subtest_block("snooped-copy-correctness")
test_copy(fd, src, dst, tmp, object_size);
- if (drmtest_run_subtest("snooped-copy-performance")) {
+ drmtest_subtest_block("snooped-copy-performance") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
@@ -454,9 +454,9 @@ int main(int argc, char **argv)
}
}
- if (drmtest_run_subtest("snooped-pwrite-blt-cpu_mmap-correctness"))
+ drmtest_subtest_block("snooped-pwrite-blt-cpu_mmap-correctness")
test_as_cpu_mmap(fd, src, dst, object_size);
- if (drmtest_run_subtest("snooped-pwrite-blt-cpu_mmap-performance")) {
+ drmtest_subtest_block("snooped-pwrite-blt-cpu_mmap-performance") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
@@ -474,9 +474,9 @@ int main(int argc, char **argv)
if (gem_set_caching(fd, src, 2) == 0 &&
gem_set_caching(fd, dst, 2) == 0) {
- if (drmtest_run_subtest("display-copy-correctness"))
+ drmtest_subtest_block("display-copy-correctness")
test_copy(fd, src, dst, tmp, object_size);
- if (drmtest_run_subtest("display-copy-performance")) {
+ drmtest_subtest_block("display-copy-performance") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
@@ -491,9 +491,9 @@ int main(int argc, char **argv)
}
}
- if (drmtest_run_subtest("display-pwrite-blt-gtt_mmap-correctness"))
+ drmtest_subtest_block("display-pwrite-blt-gtt_mmap-correctness")
test_as_gtt_mmap(fd, src, dst, object_size);
- if (drmtest_run_subtest("display-pwrite-blt-gtt_mmap-performance")) {
+ drmtest_subtest_block("display-pwrite-blt-gtt_mmap-performance") {
for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end;
diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index db842fe6..1f5faf3f 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
- if (drmtest_run_subtest("blitter"))
+ drmtest_subtest_block("blitter")
fails += check_ring(bufmgr, batch, "blt", blt_copy);
/* Strictly only required on architectures with a separate BLT ring,
@@ -222,8 +222,10 @@ int main(int argc, char **argv)
*/
copy = get_render_copyfunc(batch->devid);
- if (drmtest_run_subtest("render") && copy)
- fails += check_ring(bufmgr, batch, "render", copy);
+ drmtest_subtest_block("render") {
+ if (copy)
+ fails += check_ring(bufmgr, batch, "render", copy);
+ }
intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr);
diff --git a/tests/gem_set_tiling_vs_blt.c b/tests/gem_set_tiling_vs_blt.c
index 398a227e..56a8203a 100644
--- a/tests/gem_set_tiling_vs_blt.c
+++ b/tests/gem_set_tiling_vs_blt.c
@@ -246,7 +246,7 @@ int main(int argc, char **argv)
devid = intel_get_drm_devid(fd);
batch = intel_batchbuffer_alloc(bufmgr, devid);
- if (drmtest_run_subtest("untiled-to-tiled")) {
+ drmtest_subtest_block("untiled-to-tiled") {
printf("testing untiled->tiled transisition:\n");
tiling = I915_TILING_NONE;
tiling_after = I915_TILING_X;
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
assert(tiling_after == I915_TILING_X);
}
- if (drmtest_run_subtest("tiled-to-untiled")) {
+ drmtest_subtest_block("tiled-to-untiled") {
printf("testing tiled->untiled transisition:\n");
tiling = I915_TILING_X;
tiling_after = I915_TILING_NONE;
@@ -264,7 +264,7 @@ int main(int argc, char **argv)
assert(tiling_after == I915_TILING_NONE);
}
- if (drmtest_run_subtest("tiled-to-tiled")) {
+ drmtest_subtest_block("tiled-to-tiled") {
printf("testing tiled->tiled transisition:\n");
tiling = I915_TILING_X;
tiling_after = I915_TILING_X;
diff --git a/tests/gem_suspend.c b/tests/gem_suspend.c
index a31161dc..e252d141 100644
--- a/tests/gem_suspend.c
+++ b/tests/gem_suspend.c
@@ -105,10 +105,10 @@ int main(int argc, char **argv)
fd = drm_open_any();
- if (drmtest_run_subtest("fence-restore-tiled2untiled"))
+ drmtest_subtest_block("fence-restore-tiled2untiled")
test_fence_restore(fd, true);
- if (drmtest_run_subtest("fence-restore-untiled"))
+ drmtest_subtest_block("fence-restore-untiled")
test_fence_restore(fd, false);
close(fd);
diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c
index b879b1cd..ddb5b79c 100644
--- a/tests/gem_tiled_blits.c
+++ b/tests/gem_tiled_blits.c
@@ -220,10 +220,10 @@ int main(int argc, char **argv)
drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 32);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
- if (drmtest_run_subtest("normal"))
+ drmtest_subtest_block("normal")
run_test(count);
- if (drmtest_run_subtest("interruptible")) {
+ drmtest_subtest_block("interruptible") {
drmtest_fork_signal_helper();
run_test(count);
drmtest_stop_signal_helper();
diff --git a/tests/gem_tiled_partial_pwrite_pread.c b/tests/gem_tiled_partial_pwrite_pread.c
index 48fd506f..8e684062 100644
--- a/tests/gem_tiled_partial_pwrite_pread.c
+++ b/tests/gem_tiled_partial_pwrite_pread.c
@@ -303,13 +303,13 @@ int main(int argc, char **argv)
drmtest_init_aperture_trashers(bufmgr);
mappable_gtt_limit = gem_mappable_aperture_size();
- if (drmtest_run_subtest("reads"))
+ drmtest_subtest_block("reads")
test_partial_reads();
- if (drmtest_run_subtest("writes"))
+ drmtest_subtest_block("writes")
test_partial_writes();
- if (drmtest_run_subtest("writes-after-reads"))
+ drmtest_subtest_block("writes-after-reads")
test_partial_read_writes();
drmtest_cleanup_aperture_trashers();
diff --git a/tests/gem_write_read_ring_switch.c b/tests/gem_write_read_ring_switch.c
index 162c0594..211b5300 100644
--- a/tests/gem_write_read_ring_switch.c
+++ b/tests/gem_write_read_ring_switch.c
@@ -206,16 +206,17 @@ int main(int argc, char **argv)
}
for (i = 0; i < ARRAY_SIZE(tests); i++) {
- if (has_ring(tests[i].ring) &&
- drmtest_run_subtest(tests[i].name))
- run_test(tests[i].ring, tests[i].name);
+ drmtest_subtest_block(tests[i].name) {
+ if (has_ring(tests[i].ring))
+ run_test(tests[i].ring, tests[i].name);
+ }
}
drmtest_fork_signal_helper();
for (i = 0; i < ARRAY_SIZE(tests); i++) {
char name[180];
snprintf(name, sizeof(name), "%s-interruptible", tests[i].name);
- if (has_ring(tests[i].ring) && drmtest_run_subtest(name))
+ drmtest_subtest_block(name)
run_test(tests[i].ring, name);
}
drmtest_stop_signal_helper();
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 9e0d2350..1998bd99 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1186,7 +1186,7 @@ int main(int argc, char **argv)
batch = intel_batchbuffer_alloc(bufmgr, devid);
for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) {
- if (drmtest_run_subtest(tests[i].name)) {
+ drmtest_subtest_block(tests[i].name) {
printf("running testcase: %s\n", tests[i].name);
run_test(tests[i].duration, tests[i].flags, tests[i].name);
}
@@ -1203,7 +1203,7 @@ int main(int argc, char **argv)
!(tests[i].flags & TEST_VBLANK_ABSOLUTE))
continue;
- if (drmtest_run_subtest(name)) {
+ drmtest_subtest_block(name) {
printf("running testcase: %s\n", name);
run_test(tests[i].duration, tests[i].flags, name);
}
diff --git a/tests/kms_render.c b/tests/kms_render.c
index e6d3e936..5670d1b2 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -247,7 +247,7 @@ int main(int argc, char **argv)
}
for (i = 0; i < ARRAY_SIZE(tests); i++) {
- if (drmtest_run_subtest(tests[i].name))
+ drmtest_subtest_block(tests[i].name)
run_test(tests[i].name, tests[i].flags);
}
diff --git a/tests/prime_nv_api.c b/tests/prime_nv_api.c
index f470fd70..ad030b03 100644
--- a/tests/prime_nv_api.c
+++ b/tests/prime_nv_api.c
@@ -569,7 +569,7 @@ int main(int argc, char **argv)
intel_batch = intel_batchbuffer_alloc(bufmgr, devid);
#define xtest(name) \
- if (drmtest_run_subtest(#name)) \
+ drmtest_subtest_block(#name) \
if (test_##name()) \
exit(2);
diff --git a/tests/prime_nv_pcopy.c b/tests/prime_nv_pcopy.c
index 88b14e5d..52f5e7b2 100644
--- a/tests/prime_nv_pcopy.c
+++ b/tests/prime_nv_pcopy.c
@@ -1295,14 +1295,15 @@ int main(int argc, char **argv)
devid = intel_get_drm_devid(intel_fd);
batch = intel_batchbuffer_alloc(bufmgr, devid);
-#define xtest(x, args...) do { \
- if (!drmtest_run_subtest( #x )) break; \
- ret = ((x)(args)); \
- ++run; \
- if (ret) { \
- ++failed; \
- fprintf(stderr, "prime_pcopy: failed " #x "\n"); } \
- } while (0)
+#define xtest(x, args...) \
+ drmtest_subtest_block( #x ) { \
+ ret = ((x)(args)); \
+ ++run; \
+ if (ret) { \
+ ++failed; \
+ fprintf(stderr, "prime_pcopy: failed " #x "\n"); \
+ } \
+ }
xtest(test1_macro);
xtest(test1_micro);
diff --git a/tests/prime_nv_test.c b/tests/prime_nv_test.c
index c6410954..c850eebb 100644
--- a/tests/prime_nv_test.c
+++ b/tests/prime_nv_test.c
@@ -504,7 +504,7 @@ int main(int argc, char **argv)
intel_batch = intel_batchbuffer_alloc(bufmgr, devid);
#define xtest(name) \
- if (drmtest_run_subtest(#name)) \
+ drmtest_subtest_block(#name) \
if (test_##name()) \
exit(2);
diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
index ed3ff95f..1bd0bb50 100644
--- a/tests/prime_self_import.c
+++ b/tests/prime_self_import.c
@@ -386,7 +386,7 @@ int main(int argc, char **argv)
drmtest_subtest_init(argc, argv);
for (i = 0; i < ARRAY_SIZE(tests); i++) {
- if (drmtest_run_subtest(tests[i].name))
+ drmtest_subtest_block(tests[i].name)
tests[i].fn();
}