diff --git a/test/zdtm.sh b/test/zdtm.sh index cf42d054d..31b2cbdde 100755 --- a/test/zdtm.sh +++ b/test/zdtm.sh @@ -186,11 +186,15 @@ construct_root() { local root=$1 local test_path=$2 + local ps_path=`type -P ps` local libdir=$root/lib local libdir2=$root/lib64 + mkdir $root/bin + cp $ps_path $root/bin + mkdir $libdir $libdir2 - for i in `ldd $test_path | awk '{ print $1 }' | grep -v vdso`; do + for i in `ldd $test_path $ps_path | awk '/^\s/{ print $1 }' | grep -v vdso`; do local lib=`basename $i` [ -f $libdir/$lib ] && continue || [ -f $i ] && cp $i $libdir && cp $i $libdir2 && continue || diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c index 5eb8186a6..ead4522d9 100644 --- a/test/zdtm/lib/ns.c +++ b/test/zdtm/lib/ns.c @@ -210,6 +210,13 @@ int ns_init(int argc, char **argv) ret = 1; waitpid(pid, &ret, 0); + + pid = fork(); + if (pid == 0) { + execl("/bin/ps", "ps", "axf", "-o", "pid,sid,comm", NULL); + } else if (pid > 0) + waitpid(pid, NULL, 0); + /* Daemonize */ write(status_pipe, &ret, sizeof(ret)); close(status_pipe); @@ -219,6 +226,12 @@ int ns_init(int argc, char **argv) /* suspend/resume */ test_waitsig(); + pid = fork(); + if (pid == 0) { + execl("/bin/ps", "ps", "axf", "-o", "pid,sid,comm", NULL); + } else if (pid > 0) + waitpid(pid, NULL, 0); + fd = open(pidfile, O_RDONLY); if (fd == -1) { fprintf(stderr, "open(%s) failed: %m\n", pidfile);