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>
This commit is contained in:
Daniel Vetter 2013-08-12 09:04:24 +02:00
parent 40ea6f4ea8
commit 9f6365e4ea
30 changed files with 123 additions and 118 deletions

View File

@ -95,6 +95,7 @@ void drmtest_progress(const char *header, uint64_t i, uint64_t total);
/* subtest infrastructure */ /* subtest infrastructure */
void drmtest_subtest_init(int argc, char **argv); void drmtest_subtest_init(int argc, char **argv);
bool drmtest_run_subtest(const char *subtest_name); bool drmtest_run_subtest(const char *subtest_name);
#define drmtest_subtest_block(name) if (drmtest_run_subtest((name)))
bool drmtest_only_list_subtests(void); bool drmtest_only_list_subtests(void);
/* helpers to automatically reduce test runtime in simulation */ /* helpers to automatically reduce test runtime in simulation */

View File

@ -84,11 +84,11 @@ int main(int argc, char **argv)
fd = drm_open_any(); fd = drm_open_any();
if (drmtest_run_subtest("bad-close")) drmtest_subtest_block("bad-close")
test_bad_close(fd); test_bad_close(fd);
if (drmtest_run_subtest("create-close")) drmtest_subtest_block("create-close")
test_create_close(fd); test_create_close(fd);
if (drmtest_run_subtest("create-fd-close")) drmtest_subtest_block("create-fd-close")
test_create_fd_close(fd); test_create_fd_close(fd);
return 0; return 0;

View File

@ -117,7 +117,7 @@ main(int argc, char **argv)
} }
/* try to overwrite the source values */ /* try to overwrite the source values */
if (drmtest_run_subtest("overwrite-source")) { drmtest_subtest_block("overwrite-source") {
for (i = 0; i < num_buffers; i++) { for (i = 0; i < num_buffers; i++) {
set_bo(src[i], i, width, height); set_bo(src[i], i, width, height);
set_bo(dst[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 */ /* 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--; ) for (i = num_buffers; i--; )
set_bo(src[i], 0xdeadbeef, width, height); set_bo(src[i], 0xdeadbeef, width, height);
for (i = 0; i < num_buffers; i++) 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 */ /* 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--; ) for (i = num_buffers; i--; )
set_bo(src[i], 0xabcdabcd, width, height); set_bo(src[i], 0xabcdabcd, width, height);
for (i = 0; i < num_buffers; i++) for (i = 0; i < num_buffers; i++)
@ -155,7 +155,7 @@ main(int argc, char **argv)
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
/* try to overwrite the source values */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = 0; i < num_buffers; i++) { 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 */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = num_buffers; i--; ) 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 */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = num_buffers; i--; ) for (i = num_buffers; i--; )

View File

@ -164,18 +164,18 @@ int main(int argc, char **argv)
sleep(5); /* needs more serious ducttape */ sleep(5); /* needs more serious ducttape */
} }
if (drmtest_run_subtest("render")) drmtest_subtest_block("render")
run_on_ring(fd, I915_EXEC_RENDER, "render"); run_on_ring(fd, I915_EXEC_RENDER, "render");
if (drmtest_run_subtest("bsd")) drmtest_subtest_block("bsd")
if (HAS_BSD_RING(devid)) if (HAS_BSD_RING(devid))
run_on_ring(fd, I915_EXEC_BSD, "bsd"); run_on_ring(fd, I915_EXEC_BSD, "bsd");
if (drmtest_run_subtest("blt")) drmtest_subtest_block("blt")
if (HAS_BLT_RING(devid)) if (HAS_BLT_RING(devid))
run_on_ring(fd, I915_EXEC_BLT, "blt"); run_on_ring(fd, I915_EXEC_BLT, "blt");
if (drmtest_run_subtest("vebox")) drmtest_subtest_block("vebox")
if (gem_has_vebox(fd)) if (gem_has_vebox(fd))
run_on_ring(fd, LOCAL_I915_EXEC_VEBOX, "vebox"); run_on_ring(fd, LOCAL_I915_EXEC_VEBOX, "vebox");

View File

@ -160,13 +160,13 @@ int main(int argc, char **argv)
exit(-1); exit(-1);
} }
if (drmtest_run_subtest("render")) { drmtest_subtest_block("render") {
printf("running dummy loop on render\n"); printf("running dummy loop on render\n");
dummy_reloc_loop(I915_EXEC_RENDER); dummy_reloc_loop(I915_EXEC_RENDER);
printf("dummy loop run on render completed\n"); printf("dummy loop run on render completed\n");
} }
if (drmtest_run_subtest("bsd")) { drmtest_subtest_block("bsd") {
if (HAS_BSD_RING(devid)) { if (HAS_BSD_RING(devid)) {
sleep(2); sleep(2);
printf("running dummy loop on bsd\n"); 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)) { if (HAS_BLT_RING(devid)) {
sleep(2); sleep(2);
printf("running dummy loop on blt\n"); 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)) { if (gem_has_vebox(fd)) {
sleep(2); sleep(2);
printf("running dummy loop on vebox\n"); 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) { if (num_rings > 1) {
sleep(2); sleep(2);
printf("running dummy loop on random rings\n"); printf("running dummy loop on random rings\n");

View File

@ -166,7 +166,7 @@ int main(int argc, char **argv)
tmp = drm_intel_bo_alloc(bufmgr, "tmp", 128 * 128, 4096); tmp = drm_intel_bo_alloc(bufmgr, "tmp", 128 * 128, 4096);
if (drmtest_run_subtest("cpu-domain")) { drmtest_subtest_block("cpu-domain") {
BEGIN_BATCH(2); BEGIN_BATCH(2);
OUT_BATCH(0); OUT_BATCH(0);
OUT_RELOC(tmp, I915_GEM_DOMAIN_CPU, 0, 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); BEGIN_BATCH(2);
OUT_BATCH(0); OUT_BATCH(0);
OUT_RELOC(tmp, I915_GEM_DOMAIN_GTT, 0, 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 #if 0 /* kernel checks have been eased, doesn't reject conflicting write domains
any more */ any more */
if (drmtest_run_subtest("conflicting-write-domain")) { drmtest_subtest_block("conflicting-write-domain") {
BEGIN_BATCH(4); BEGIN_BATCH(4);
OUT_BATCH(0); OUT_BATCH(0);
OUT_RELOC(tmp, I915_GEM_DOMAIN_RENDER, OUT_RELOC(tmp, I915_GEM_DOMAIN_RENDER,
@ -229,10 +229,10 @@ int main(int argc, char **argv)
} }
#endif #endif
if (drmtest_run_subtest("double-write-domain")) drmtest_subtest_block("double-write-domain")
multi_write_domain(fd); multi_write_domain(fd);
if (drmtest_run_subtest("invalid-gpu-domain")) { drmtest_subtest_block("invalid-gpu-domain") {
BEGIN_BATCH(2); BEGIN_BATCH(2);
OUT_BATCH(0); OUT_BATCH(0);
OUT_RELOC(tmp, ~(I915_GEM_GPU_DOMAINS | I915_GEM_DOMAIN_GTT | I915_GEM_DOMAIN_CPU), OUT_RELOC(tmp, ~(I915_GEM_GPU_DOMAINS | I915_GEM_DOMAIN_GTT | I915_GEM_DOMAIN_CPU),

View File

@ -222,9 +222,9 @@ int main(int argc, char **argv)
{ {
drmtest_subtest_init(argc, argv); drmtest_subtest_init(argc, argv);
if (drmtest_run_subtest("normal")) drmtest_subtest_block("normal")
run(OBJECT_SIZE); run(OBJECT_SIZE);
if (drmtest_run_subtest("no-prefault")) { drmtest_subtest_block("no-prefault") {
drmtest_disable_prefault(); drmtest_disable_prefault();
run(OBJECT_SIZE); run(OBJECT_SIZE);
drmtest_enable_prefault(); drmtest_enable_prefault();

View File

@ -124,18 +124,18 @@ int main(int argc, char **argv)
handle = gem_create(fd, 4096); handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch)); gem_write(fd, handle, 0, batch, sizeof(batch));
if (drmtest_run_subtest("render")) drmtest_subtest_block("render")
loop(fd, handle, I915_EXEC_RENDER, "render"); loop(fd, handle, I915_EXEC_RENDER, "render");
if (drmtest_run_subtest("bsd")) drmtest_subtest_block("bsd")
if (HAS_BSD_RING(devid)) if (HAS_BSD_RING(devid))
loop(fd, handle, I915_EXEC_BSD, "bsd"); loop(fd, handle, I915_EXEC_BSD, "bsd");
if (drmtest_run_subtest("blt")) drmtest_subtest_block("blt")
if (HAS_BLT_RING(devid)) if (HAS_BLT_RING(devid))
loop(fd, handle, I915_EXEC_BLT, "blt"); loop(fd, handle, I915_EXEC_BLT, "blt");
if (drmtest_run_subtest("vebox")) drmtest_subtest_block("vebox")
if (gem_has_vebox(fd)) if (gem_has_vebox(fd))
loop(fd, handle, LOCAL_I915_EXEC_VEBOX, "vebox"); loop(fd, handle, LOCAL_I915_EXEC_VEBOX, "vebox");

View File

@ -210,33 +210,33 @@ main(int argc, char **argv)
drmtest_subtest_init(argc, argv); drmtest_subtest_init(argc, argv);
drmtest_skip_on_simulation(); 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); 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); 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); 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); 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(2, bo_write_verify, I915_TILING_X, 2) == 0);
assert (run_test(5, 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(10, bo_write_verify, I915_TILING_X, 2) == 0);
assert (run_test(20, 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(2, bo_write_verify, I915_TILING_Y, 2) == 0);
assert (run_test(5, 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(10, bo_write_verify, I915_TILING_Y, 2) == 0);
assert (run_test(20, 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); assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
return 0; return 0;

View File

@ -158,15 +158,15 @@ int main(int argc, char **argv)
fd = drm_open_any(); fd = drm_open_any();
if (drmtest_run_subtest("basic")) drmtest_subtest_block("basic")
test_flink(fd); test_flink(fd);
if (drmtest_run_subtest("double-flink")) drmtest_subtest_block("double-flink")
test_double_flink(fd); test_double_flink(fd);
if (drmtest_run_subtest("bad-flink")) drmtest_subtest_block("bad-flink")
test_bad_flink(fd); test_bad_flink(fd);
if (drmtest_run_subtest("bad-open")) drmtest_subtest_block("bad-open")
test_bad_open(fd); test_bad_open(fd);
if (drmtest_run_subtest("flink-lifetime")) drmtest_subtest_block("flink-lifetime")
test_flink_lifetime(fd); test_flink_lifetime(fd);
return 0; return 0;

View File

@ -197,10 +197,10 @@ int main(int argc, char **argv)
drmtest_subtest_init(argc, argv); drmtest_subtest_init(argc, argv);
if (drmtest_run_subtest("flink_name")) drmtest_subtest_block("flink_name")
test_flink_name(); test_flink_name();
if (drmtest_run_subtest("flink_close")) drmtest_subtest_block("flink_close")
test_flink_close(); test_flink_close();
return 0; return 0;

View File

@ -120,7 +120,7 @@ main(int argc, char **argv)
} }
/* try to overwrite the source values */ /* try to overwrite the source values */
if (drmtest_run_subtest("overwrite-source")) { drmtest_subtest_block("overwrite-source") {
for (i = 0; i < num_buffers; i++) { for (i = 0; i < num_buffers; i++) {
set_bo(src[i], i, width, height); set_bo(src[i], i, width, height);
set_bo(dst[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 */ /* 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--; ) for (i = num_buffers; i--; )
set_bo(src[i], 0xdeadbeef, width, height); set_bo(src[i], 0xdeadbeef, width, height);
for (i = 0; i < num_buffers; i++) 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 */ /* 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--; ) for (i = num_buffers; i--; )
set_bo(src[i], 0xabcdabcd, width, height); set_bo(src[i], 0xabcdabcd, width, height);
for (i = 0; i < num_buffers; i++) for (i = 0; i < num_buffers; i++)
@ -158,7 +158,7 @@ main(int argc, char **argv)
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
/* try to read the results before the copy completes */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = 0; i < num_buffers; i++) { 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 */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = num_buffers; i--; ) 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 */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = num_buffers; i--; ) for (i = num_buffers; i--; )

View File

@ -264,10 +264,10 @@ int main(int argc, char **argv)
printf("Using %d 1MiB buffers\n", count); printf("Using %d 1MiB buffers\n", count);
} }
if (drmtest_run_subtest("normal")) drmtest_subtest_block("normal")
run_test(fd, count); run_test(fd, count);
if (drmtest_run_subtest("interruptible")) { drmtest_subtest_block("interruptible") {
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
run_test(fd, count); run_test(fd, count);
drmtest_stop_signal_helper(); drmtest_stop_signal_helper();

View File

@ -164,19 +164,19 @@ int main(int argc, char **argv)
fd = drm_open_any(); fd = drm_open_any();
if (drmtest_run_subtest("copy")) drmtest_subtest_block("copy")
test_copy(fd); test_copy(fd);
if (drmtest_run_subtest("read")) drmtest_subtest_block("read")
test_read(fd); test_read(fd);
if (drmtest_run_subtest("write")) drmtest_subtest_block("write")
test_write(fd); test_write(fd);
if (drmtest_run_subtest("write-gtt")) drmtest_subtest_block("write-gtt")
test_write_gtt(fd); test_write_gtt(fd);
if (drmtest_run_subtest("read-no-prefault")) drmtest_subtest_block("read-no-prefault")
run_without_prefault(fd, test_read); 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); 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); run_without_prefault(fd, test_write_gtt);
close(fd); close(fd);

View File

@ -270,15 +270,15 @@ static void do_tests(int cache_level, const char *suffix)
} }
snprintf(name, sizeof(name), "reads%s", suffix); snprintf(name, sizeof(name), "reads%s", suffix);
if (drmtest_run_subtest(name)) drmtest_subtest_block(name)
test_partial_reads(); test_partial_reads();
snprintf(name, sizeof(name), "writes%s", suffix); snprintf(name, sizeof(name), "writes%s", suffix);
if (drmtest_run_subtest(name)) drmtest_subtest_block(name)
test_partial_writes(); test_partial_writes();
snprintf(name, sizeof(name), "writes-after-reads%s", suffix); snprintf(name, sizeof(name), "writes-after-reads%s", suffix);
if (drmtest_run_subtest(name)) drmtest_subtest_block(name)
test_partial_read_writes(); test_partial_read_writes();
} }

View File

@ -190,37 +190,37 @@ main(int argc, char **argv)
dst[0] = drm_intel_bo_alloc(bufmgr, "dst bo", size, 4096); dst[0] = drm_intel_bo_alloc(bufmgr, "dst bo", size, 4096);
dst[1] = 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); do_test(fd, -1, src, start, dst, 1);
if (drmtest_run_subtest("interruptible")) { drmtest_subtest_block("interruptible") {
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
do_test(fd, -1, src, start, dst, 100); do_test(fd, -1, src, start, dst, 100);
drmtest_stop_signal_helper(); drmtest_stop_signal_helper();
} }
if (drmtest_run_subtest("normal-uncached")) drmtest_subtest_block("normal-uncached")
do_test(fd, 0, src, start, dst, 1); do_test(fd, 0, src, start, dst, 1);
if (drmtest_run_subtest("interruptible-uncached")) { drmtest_subtest_block("interruptible-uncached") {
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
do_test(fd, 0, src, start, dst, 100); do_test(fd, 0, src, start, dst, 100);
drmtest_stop_signal_helper(); drmtest_stop_signal_helper();
} }
if (drmtest_run_subtest("normal-snoop")) drmtest_subtest_block("normal-snoop")
do_test(fd, 1, src, start, dst, 1); do_test(fd, 1, src, start, dst, 1);
if (drmtest_run_subtest("interruptible-snoop")) { drmtest_subtest_block("interruptible-snoop") {
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
do_test(fd, 1, src, start, dst, 100); do_test(fd, 1, src, start, dst, 100);
drmtest_stop_signal_helper(); drmtest_stop_signal_helper();
} }
if (drmtest_run_subtest("normal-display")) drmtest_subtest_block("normal-display")
do_test(fd, 2, src, start, dst, 1); do_test(fd, 2, src, start, dst, 1);
if (drmtest_run_subtest("interruptible-display")) { drmtest_subtest_block("interruptible-display") {
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
do_test(fd, 2, src, start, dst, 100); do_test(fd, 2, src, start, dst, 100);
drmtest_stop_signal_helper(); drmtest_stop_signal_helper();

View File

@ -120,7 +120,7 @@ main(int argc, char **argv)
} }
/* try to overwrite the source values */ /* try to overwrite the source values */
if (drmtest_run_subtest("overwrite-source")) { drmtest_subtest_block("overwrite-source") {
for (i = 0; i < num_buffers; i++) { for (i = 0; i < num_buffers; i++) {
set_bo(src[i], i, width, height); set_bo(src[i], i, width, height);
set_bo(dst[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 */ /* 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--; ) for (i = num_buffers; i--; )
set_bo(src[i], 0xdeadbeef, width, height); set_bo(src[i], 0xdeadbeef, width, height);
for (i = 0; i < num_buffers; i++) 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 */ /* 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--; ) for (i = num_buffers; i--; )
set_bo(src[i], 0xabcdabcd, width, height); set_bo(src[i], 0xabcdabcd, width, height);
for (i = 0; i < num_buffers; i++) for (i = 0; i < num_buffers; i++)
@ -158,7 +158,7 @@ main(int argc, char **argv)
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
/* try to read the results before the copy completes */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = 0; i < num_buffers; i++) { 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 */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = num_buffers; i--; ) 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 */ /* 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++) { for (loop = 0; loop < 10; loop++) {
gem_quiescent_gpu(fd); gem_quiescent_gpu(fd);
for (i = num_buffers; i--; ) for (i = num_buffers; i--; )

View File

@ -400,9 +400,9 @@ int main(int argc, char **argv)
if (gem_set_caching(fd, src, 0) == 0 && if (gem_set_caching(fd, src, 0) == 0 &&
gem_set_caching(fd, dst, 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); 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) { for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end; 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); 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) { for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end; struct timeval start, end;
@ -437,9 +437,9 @@ int main(int argc, char **argv)
if (gem_set_caching(fd, src, 1) == 0 && if (gem_set_caching(fd, src, 1) == 0 &&
gem_set_caching(fd, dst, 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); 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) { for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end; 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); 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) { for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end; struct timeval start, end;
@ -474,9 +474,9 @@ int main(int argc, char **argv)
if (gem_set_caching(fd, src, 2) == 0 && if (gem_set_caching(fd, src, 2) == 0 &&
gem_set_caching(fd, dst, 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); 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) { for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end; 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); 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) { for (count = 1; count <= 1<<17; count <<= 1) {
struct timeval start, end; struct timeval start, end;

View File

@ -214,7 +214,7 @@ int main(int argc, char **argv)
drm_intel_bufmgr_gem_enable_reuse(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd)); 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); fails += check_ring(bufmgr, batch, "blt", blt_copy);
/* Strictly only required on architectures with a separate BLT ring, /* 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); copy = get_render_copyfunc(batch->devid);
if (drmtest_run_subtest("render") && copy) drmtest_subtest_block("render") {
fails += check_ring(bufmgr, batch, "render", copy); if (copy)
fails += check_ring(bufmgr, batch, "render", copy);
}
intel_batchbuffer_free(batch); intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr); drm_intel_bufmgr_destroy(bufmgr);

View File

@ -246,7 +246,7 @@ int main(int argc, char **argv)
devid = intel_get_drm_devid(fd); devid = intel_get_drm_devid(fd);
batch = intel_batchbuffer_alloc(bufmgr, devid); 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"); printf("testing untiled->tiled transisition:\n");
tiling = I915_TILING_NONE; tiling = I915_TILING_NONE;
tiling_after = I915_TILING_X; tiling_after = I915_TILING_X;
@ -255,7 +255,7 @@ int main(int argc, char **argv)
assert(tiling_after == I915_TILING_X); 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"); printf("testing tiled->untiled transisition:\n");
tiling = I915_TILING_X; tiling = I915_TILING_X;
tiling_after = I915_TILING_NONE; tiling_after = I915_TILING_NONE;
@ -264,7 +264,7 @@ int main(int argc, char **argv)
assert(tiling_after == I915_TILING_NONE); 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"); printf("testing tiled->tiled transisition:\n");
tiling = I915_TILING_X; tiling = I915_TILING_X;
tiling_after = I915_TILING_X; tiling_after = I915_TILING_X;

View File

@ -105,10 +105,10 @@ int main(int argc, char **argv)
fd = drm_open_any(); fd = drm_open_any();
if (drmtest_run_subtest("fence-restore-tiled2untiled")) drmtest_subtest_block("fence-restore-tiled2untiled")
test_fence_restore(fd, true); test_fence_restore(fd, true);
if (drmtest_run_subtest("fence-restore-untiled")) drmtest_subtest_block("fence-restore-untiled")
test_fence_restore(fd, false); test_fence_restore(fd, false);
close(fd); close(fd);

View File

@ -220,10 +220,10 @@ int main(int argc, char **argv)
drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 32); drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 32);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd)); batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
if (drmtest_run_subtest("normal")) drmtest_subtest_block("normal")
run_test(count); run_test(count);
if (drmtest_run_subtest("interruptible")) { drmtest_subtest_block("interruptible") {
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
run_test(count); run_test(count);
drmtest_stop_signal_helper(); drmtest_stop_signal_helper();

View File

@ -303,13 +303,13 @@ int main(int argc, char **argv)
drmtest_init_aperture_trashers(bufmgr); drmtest_init_aperture_trashers(bufmgr);
mappable_gtt_limit = gem_mappable_aperture_size(); mappable_gtt_limit = gem_mappable_aperture_size();
if (drmtest_run_subtest("reads")) drmtest_subtest_block("reads")
test_partial_reads(); test_partial_reads();
if (drmtest_run_subtest("writes")) drmtest_subtest_block("writes")
test_partial_writes(); test_partial_writes();
if (drmtest_run_subtest("writes-after-reads")) drmtest_subtest_block("writes-after-reads")
test_partial_read_writes(); test_partial_read_writes();
drmtest_cleanup_aperture_trashers(); drmtest_cleanup_aperture_trashers();

View File

@ -206,16 +206,17 @@ int main(int argc, char **argv)
} }
for (i = 0; i < ARRAY_SIZE(tests); i++) { for (i = 0; i < ARRAY_SIZE(tests); i++) {
if (has_ring(tests[i].ring) && drmtest_subtest_block(tests[i].name) {
drmtest_run_subtest(tests[i].name)) if (has_ring(tests[i].ring))
run_test(tests[i].ring, tests[i].name); run_test(tests[i].ring, tests[i].name);
}
} }
drmtest_fork_signal_helper(); drmtest_fork_signal_helper();
for (i = 0; i < ARRAY_SIZE(tests); i++) { for (i = 0; i < ARRAY_SIZE(tests); i++) {
char name[180]; char name[180];
snprintf(name, sizeof(name), "%s-interruptible", tests[i].name); 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); run_test(tests[i].ring, name);
} }
drmtest_stop_signal_helper(); drmtest_stop_signal_helper();

View File

@ -1186,7 +1186,7 @@ int main(int argc, char **argv)
batch = intel_batchbuffer_alloc(bufmgr, devid); batch = intel_batchbuffer_alloc(bufmgr, devid);
for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) { 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); printf("running testcase: %s\n", tests[i].name);
run_test(tests[i].duration, tests[i].flags, 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)) !(tests[i].flags & TEST_VBLANK_ABSOLUTE))
continue; continue;
if (drmtest_run_subtest(name)) { drmtest_subtest_block(name) {
printf("running testcase: %s\n", name); printf("running testcase: %s\n", name);
run_test(tests[i].duration, tests[i].flags, name); run_test(tests[i].duration, tests[i].flags, name);
} }

View File

@ -247,7 +247,7 @@ int main(int argc, char **argv)
} }
for (i = 0; i < ARRAY_SIZE(tests); i++) { 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); run_test(tests[i].name, tests[i].flags);
} }

View File

@ -569,7 +569,7 @@ int main(int argc, char **argv)
intel_batch = intel_batchbuffer_alloc(bufmgr, devid); intel_batch = intel_batchbuffer_alloc(bufmgr, devid);
#define xtest(name) \ #define xtest(name) \
if (drmtest_run_subtest(#name)) \ drmtest_subtest_block(#name) \
if (test_##name()) \ if (test_##name()) \
exit(2); exit(2);

View File

@ -1295,14 +1295,15 @@ int main(int argc, char **argv)
devid = intel_get_drm_devid(intel_fd); devid = intel_get_drm_devid(intel_fd);
batch = intel_batchbuffer_alloc(bufmgr, devid); batch = intel_batchbuffer_alloc(bufmgr, devid);
#define xtest(x, args...) do { \ #define xtest(x, args...) \
if (!drmtest_run_subtest( #x )) break; \ drmtest_subtest_block( #x ) { \
ret = ((x)(args)); \ ret = ((x)(args)); \
++run; \ ++run; \
if (ret) { \ if (ret) { \
++failed; \ ++failed; \
fprintf(stderr, "prime_pcopy: failed " #x "\n"); } \ fprintf(stderr, "prime_pcopy: failed " #x "\n"); \
} while (0) } \
}
xtest(test1_macro); xtest(test1_macro);
xtest(test1_micro); xtest(test1_micro);

View File

@ -504,7 +504,7 @@ int main(int argc, char **argv)
intel_batch = intel_batchbuffer_alloc(bufmgr, devid); intel_batch = intel_batchbuffer_alloc(bufmgr, devid);
#define xtest(name) \ #define xtest(name) \
if (drmtest_run_subtest(#name)) \ drmtest_subtest_block(#name) \
if (test_##name()) \ if (test_##name()) \
exit(2); exit(2);

View File

@ -386,7 +386,7 @@ int main(int argc, char **argv)
drmtest_subtest_init(argc, argv); drmtest_subtest_init(argc, argv);
for (i = 0; i < ARRAY_SIZE(tests); i++) { for (i = 0; i < ARRAY_SIZE(tests); i++) {
if (drmtest_run_subtest(tests[i].name)) drmtest_subtest_block(tests[i].name)
tests[i].fn(); tests[i].fn();
} }