tests/gem_suspend: test debugfs/sysfs reads while s/r

Just a very quick hack cobbled together with /bin/sh and exec. We
can't use system since that does stupid things with singals ... Still
we need to whack the child process pretty hard to get rid of it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2013-10-10 14:20:43 +02:00
parent 8a9b275b96
commit ffdece38e2
3 changed files with 59 additions and 1 deletions

View File

@ -1080,7 +1080,8 @@ void igt_stop_helper(struct igt_helper_process *proc)
assert(proc->running); 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 && while (waitpid(proc->pid, &status, 0) == -1 &&
errno == -EINTR) errno == -EINTR)
; ;

View File

@ -243,6 +243,7 @@ void igt_waitchildren(void);
struct igt_helper_process { struct igt_helper_process {
bool running; bool running;
bool use_SIGKILL;
pid_t pid; pid_t pid;
int id; int id;
}; };

View File

@ -95,6 +95,56 @@ test_fence_restore(int fd, bool tiled2untiled)
munmap(ptr_tiled, OBJECT_SIZE); 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 fd;
int main(int argc, char **argv) int main(int argc, char **argv)
@ -110,6 +160,12 @@ int main(int argc, char **argv)
igt_subtest("fence-restore-untiled") igt_subtest("fence-restore-untiled")
test_fence_restore(fd, false); test_fence_restore(fd, false);
igt_subtest("debugfs-reader")
test_debugfs_reader();
igt_subtest("sysfs-reader")
test_sysfs_reader();
igt_fixture igt_fixture
close(fd); close(fd);