tests/kms_flip: Repeat all of the tests whilst being rudely interrupted
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 1 Jul 2013 11:24:55 +0000 (12:24 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 1 Jul 2013 11:52:43 +0000 (12:52 +0100)
Once upon a time, our modesetting code used to fail if it was
interrupted. So lets make sure that never happens whilst flipping.

tests/kms_flip.c

index 8e49f05..3585876 100644 (file)
@@ -925,7 +925,9 @@ static unsigned int wait_for_events(struct test_output *o)
 
        FD_ZERO(&fds);
        FD_SET(drm_fd, &fds);
-       ret = select(drm_fd + 1, &fds, NULL, NULL, &timeout);
+       do {
+               ret = select(drm_fd + 1, &fds, NULL, NULL, &timeout);
+       } while (ret < 0 && errno == EINTR);
 
        if (ret <= 0) {
                fprintf(stderr, "select timed out or error (ret %d)\n",
@@ -1189,6 +1191,17 @@ int main(int argc, char **argv)
                }
        }
 
+       drmtest_fork_signal_helper();
+       for (i = 0; i < sizeof(tests) / sizeof (tests[0]); i++) {
+               char name[160];
+               snprintf(name, sizeof(name), "%s-interruptible", tests[i].name);
+               if (drmtest_run_subtest(name)) {
+                       printf("running testcase: %s\n", name);
+                       run_test(tests[i].duration, tests[i].flags, name);
+               }
+       }
+       drmtest_stop_signal_helper();
+
        close(drm_fd);
 
        return 0;