diff options
author | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2018-02-02 12:35:47 +0100 |
---|---|---|
committer | Maarten Lankhorst <maarten.lankhorst@linux.intel.com> | 2018-02-05 13:41:02 +0100 |
commit | ba7acd3f118452da41149efb1fe503347f04a77a (patch) | |
tree | 21ef8b3543db424df0654074936f21d58a639d86 /tests/kms_vblank.c | |
parent | c219cc5307474cb53612ca759354f9473955e110 (diff) |
tests/kms_vblank: Fix spurious test failure.
igt_system_suspend_autoresume() calls igt_require(), which isn't allowed
to be called from a forked child. Run subtests directly from the test body,
except when a forked test is requested.
Changes since v1:
- Fixed to actually compile..
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104783
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/kms_vblank.c')
-rw-r--r-- | tests/kms_vblank.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c index 5df2da7b..2bee49de 100644 --- a/tests/kms_vblank.c +++ b/tests/kms_vblank.c @@ -113,8 +113,6 @@ static int wait_vblank(int fd, union drm_wait_vblank *vbl) static void run_test(data_t *data, void (*testfunc)(data_t *, int, int)) { - int nchildren = - data->flags & FORKED ? sysconf(_SC_NPROCESSORS_ONLN) : 1; igt_display_t *display = &data->display; igt_output_t *output = data->output; int fd = display->drm_fd; @@ -125,9 +123,9 @@ static void run_test(data_t *data, void (*testfunc)(data_t *, int, int)) if (data->flags & RPM) igt_require(igt_setup_runtime_pm()); - igt_info("Beginning %s on pipe %s, connector %s (%d threads)\n", + igt_info("Beginning %s on pipe %s, connector %s\n", igt_subtest_name(), kmstest_pipe_name(data->pipe), - igt_output_name(output), nchildren); + igt_output_name(output)); if (!(data->flags & NOHANG)) hang = igt_hang_ring(fd, I915_EXEC_DEFAULT); @@ -143,9 +141,16 @@ static void run_test(data_t *data, void (*testfunc)(data_t *, int, int)) igt_assert_eq(wait_vblank(fd, &vbl), 0); } - igt_fork(child, nchildren) - testfunc(data, fd, nchildren); - igt_waitchildren(); + if (data->flags & FORKED) { + int nchildren = sysconf(_SC_NPROCESSORS_ONLN); + + igt_debug("Spawning %d threads\n", nchildren); + + igt_fork(child, nchildren) + testfunc(data, fd, nchildren); + igt_waitchildren(); + } else + testfunc(data, fd, 1); if (data->flags & BUSY) { struct drm_event_vblank buf; |