summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@kernel.org>2022-05-24 12:01:41 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-25 15:52:30 +0200
commitef18e59c374472e961a3a145724e7381eb4800aa (patch)
treefaf6594288a655726c37843d4ce5d58e407a5cfa /lib
parentcdbd3e9148ca9ac760dc7f80046e20e60289bc70 (diff)
lib/igt_aux: fix kselftest module unload
Most of the time, i915 module unload happens inside a subtest. So, using igt_fork() is OK. However, on i915_selftest, this is called earlier, at igt_kselftest_begin. This causes an error on IGT: forking is only allowed in subtests or igt_simple_main please refer to lib/igt_core documentation As igt_fork() can only be used inside subtests. So, use igt_fork_helper() instead. Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_aux.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 751c8a29..9431960f 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1465,11 +1465,12 @@ igt_lsof(const char *dpath)
static void pulseaudio_unload_module(proc_t *proc_info)
{
+ struct igt_helper_process pa_proc = {};
char xdg_dir[PATH_MAX];
const char *homedir;
struct passwd *pw;
- igt_fork(child, 1) {
+ igt_fork_helper(&pa_proc) {
pw = getpwuid(proc_info->euid);
homedir = pw->pw_dir;
snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", proc_info->euid);
@@ -1484,11 +1485,12 @@ static void pulseaudio_unload_module(proc_t *proc_info)
system("for i in $(pacmd list-sources|grep module:|cut -d : -f 2); do pactl unload-module $i; done");
}
- igt_waitchildren();
+ igt_wait_helper(&pa_proc);
}
static int pipewire_pulse_pid = 0;
static int pipewire_pw_reserve_pid = 0;
+static struct igt_helper_process pw_reserve_proc = {};
static void pipewire_reserve_wait(void)
{
@@ -1498,7 +1500,7 @@ static void pipewire_reserve_wait(void)
proc_t *proc_info;
PROCTAB *proc;
- igt_fork(child, 1) {
+ igt_fork_helper(&pw_reserve_proc) {
igt_info("Preventing pipewire-pulse to use the audio drivers\n");
proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
@@ -1592,7 +1594,7 @@ void pipewire_pulse_stop_reserve(void)
if (!pipewire_pulse_pid)
return;
- igt_kill_children(SIGTERM);
+ igt_stop_helper(&pw_reserve_proc);
}
/**