tests/gem_evict_*: Add interruptible modes
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 23 Aug 2013 20:32:29 +0000 (22:32 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 23 Aug 2013 20:32:29 +0000 (22:32 +0200)
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 <daniel.vetter@ffwll.ch>
tests/Makefile.am
tests/gem_evict_alignment.c
tests/gem_evict_everything.c

index df7da3e..9878a25 100644 (file)
@@ -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 \
index 08e5906..a70d3fa 100644 (file)
@@ -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);
+       }
+
+       igt_subtest("major-normal") {
+               size = 3*gem_aperture_size(fd) / 4;
+               count = 4;
+               major_evictions(fd, size, count);
+       }
+
+       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();
 
-       size = 3*gem_aperture_size(fd) / 4;
-       count = 4;
-       major_evictions(fd, size, count);
+       igt_fixture
+               close(fd);
 
-       close(fd);
-       return 0;
+       igt_exit();
 }
index cf55939..d95a54e 100644 (file)
@@ -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();
+
+       igt_subtest("minor-normal") {
+               size = 1024 * 1024;
+               count = 3*gem_aperture_size(fd) / size / 4;
+               minor_evictions(fd, size, count);
+       }
 
-       size = 1024 * 1024;
-       count = 3*gem_aperture_size(fd) / size / 4;
-       minor_evictions(fd, size, count);
+       igt_subtest("major-normal") {
+               size = 3*gem_aperture_size(fd) / 4;
+               count = 4;
+               major_evictions(fd, size, count);
+       }
 
-       size = 3*gem_aperture_size(fd) / 4;
-       count = 4;
-       major_evictions(fd, size, count);
+       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);
+       }
 
-       close(fd);
-       return 0;
+       igt_exit();
 }