diff --git a/lib/drmtest.c b/lib/drmtest.c index 3cec956e..2660af72 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -1080,7 +1080,8 @@ void igt_stop_helper(struct igt_helper_process *proc) assert(proc->running); - assert(kill(proc->pid, SIGQUIT) == 0); + assert(kill(proc->pid, + proc->use_SIGKILL ? SIGKILL : SIGQUIT) == 0); while (waitpid(proc->pid, &status, 0) == -1 && errno == -EINTR) ; diff --git a/lib/drmtest.h b/lib/drmtest.h index dac12fac..ff2827d3 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -243,6 +243,7 @@ void igt_waitchildren(void); struct igt_helper_process { bool running; + bool use_SIGKILL; pid_t pid; int id; }; diff --git a/tests/gem_suspend.c b/tests/gem_suspend.c index eea4cfce..c0f71ae1 100644 --- a/tests/gem_suspend.c +++ b/tests/gem_suspend.c @@ -95,6 +95,56 @@ test_fence_restore(int fd, bool tiled2untiled) munmap(ptr_tiled, OBJECT_SIZE); } +static void +test_debugfs_reader(void) +{ + struct igt_helper_process reader = {}; + reader.use_SIGKILL = true; + + igt_fork_helper(&reader) { + static const char dfs_base[] = "/sys/kernel/debug/dri"; + static char tmp[1024]; + + snprintf(tmp, sizeof(tmp) - 1, + "while true; do find %s/%i/ -type f | xargs cat &> /dev/null; done", + dfs_base, drm_get_card()); + assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1); + } + + sleep(1); + + igt_system_suspend_autoresume(); + + sleep(1); + + igt_stop_helper(&reader); +} + +static void +test_sysfs_reader(void) +{ + struct igt_helper_process reader = {}; + reader.use_SIGKILL = true; + + igt_fork_helper(&reader) { + static const char dfs_base[] = "/sys/class/drm/card"; + static char tmp[1024]; + + snprintf(tmp, sizeof(tmp) - 1, + "while true; do find %s%i*/ -type f | xargs cat &> /dev/null; done", + dfs_base, drm_get_card()); + assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1); + } + + sleep(1); + + igt_system_suspend_autoresume(); + + sleep(1); + + igt_stop_helper(&reader); +} + int fd; int main(int argc, char **argv) @@ -110,6 +160,12 @@ int main(int argc, char **argv) igt_subtest("fence-restore-untiled") test_fence_restore(fd, false); + igt_subtest("debugfs-reader") + test_debugfs_reader(); + + igt_subtest("sysfs-reader") + test_sysfs_reader(); + igt_fixture close(fd);