From 09d9089ead9ceec19888251807db4ccd8017c9ff Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Fri, 23 Aug 2013 22:32:29 +0200 Subject: [PATCH] tests/gem_evict_*: Add interruptible modes Also I've stumbled over igt_fixture again. Somehow gcc loves to wreak havoc with stack variables set up in igt_fixtures ... Duct-tape in the form of moving fd out to global scope applied. Signed-off-by: Daniel Vetter --- tests/Makefile.am | 4 +-- tests/gem_evict_alignment.c | 45 ++++++++++++++++++++++++++-------- tests/gem_evict_everything.c | 47 ++++++++++++++++++++++++++++-------- 3 files changed, 74 insertions(+), 22 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index df7da3e1..9878a25b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -22,6 +22,8 @@ TESTS_progs_M = \ gem_cs_tlb \ gem_ctx_bad_exec \ gem_dummy_reloc_loop \ + gem_evict_alignment \ + gem_evict_everything \ gem_exec_bad_domains \ gem_exec_nop \ gem_fence_thrash \ @@ -63,8 +65,6 @@ TESTS_progs = \ gem_ctx_create \ gem_ctx_exec \ gem_double_irq_loop \ - gem_evict_alignment \ - gem_evict_everything \ gem_exec_big \ gem_exec_blt \ gem_exec_faulting_reloc \ diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c index 08e5906d..a70d3fa2 100644 --- a/tests/gem_evict_alignment.c +++ b/tests/gem_evict_alignment.c @@ -175,22 +175,47 @@ static void major_evictions(int fd, int size, int count) free(bo); } +int fd; + int main(int argc, char **argv) { - int fd, size, count; + int size, count; + + igt_subtest_init(argc, argv); igt_skip_on_simulation(); - fd = drm_open_any(); + igt_fixture + fd = drm_open_any(); - size = 1024 * 1024; - count = 3*gem_aperture_size(fd) / size / 4; - minor_evictions(fd, size, count); + igt_subtest("minor-normal") { + size = 1024 * 1024; + count = 3*gem_aperture_size(fd) / size / 4; + minor_evictions(fd, size, count); + } - size = 3*gem_aperture_size(fd) / 4; - count = 4; - major_evictions(fd, size, count); + igt_subtest("major-normal") { + size = 3*gem_aperture_size(fd) / 4; + count = 4; + major_evictions(fd, size, count); + } - close(fd); - return 0; + igt_fork_signal_helper(); + igt_subtest("minor-interruptible") { + size = 1024 * 1024; + count = 3*gem_aperture_size(fd) / size / 4; + minor_evictions(fd, size, count); + } + + igt_subtest("major-interruptible") { + size = 3*gem_aperture_size(fd) / 4; + count = 4; + major_evictions(fd, size, count); + } + igt_stop_signal_helper(); + + igt_fixture + close(fd); + + igt_exit(); } diff --git a/tests/gem_evict_everything.c b/tests/gem_evict_everything.c index cf55939e..d95a54e9 100644 --- a/tests/gem_evict_everything.c +++ b/tests/gem_evict_everything.c @@ -168,22 +168,49 @@ static void major_evictions(int fd, int size, int count) free(bo); } +int fd; + int main(int argc, char **argv) { - int fd, size, count; + int size, count; + + igt_subtest_init(argc, argv); igt_skip_on_simulation(); - fd = drm_open_any(); + igt_fixture + fd = drm_open_any(); - size = 1024 * 1024; - count = 3*gem_aperture_size(fd) / size / 4; - minor_evictions(fd, size, count); + igt_subtest("minor-normal") { + size = 1024 * 1024; + count = 3*gem_aperture_size(fd) / size / 4; + minor_evictions(fd, size, count); + } - size = 3*gem_aperture_size(fd) / 4; - count = 4; - major_evictions(fd, size, count); + igt_subtest("major-normal") { + size = 3*gem_aperture_size(fd) / 4; + count = 4; + major_evictions(fd, size, count); + } - close(fd); - return 0; + igt_fork_signal_helper(); + igt_subtest("minor-interruptible") { + size = 1024 * 1024; + count = 3*gem_aperture_size(fd) / size / 4; + minor_evictions(fd, size, count); + } + + igt_subtest("major-interruptible") { + size = 3*gem_aperture_size(fd) / 4; + count = 4; + major_evictions(fd, size, count); + } + + igt_stop_signal_helper(); + + igt_fixture { + close(fd); + } + + igt_exit(); }