test: Disown child pid for cleaner stderr
PATCH v2 1/1 test: Disown child pid for cleaner stderr
From: Eugene Loh <[email protected]>
The shell can report when a job is killed, potentially polluting stderr and thereby mismatching the results file.
When a job is killed at the end of test, appearance of such reports may depend on timing details: does the parent test or the child job terminate first?
Many tests deal with this problem by disowning child jobs.
Disown jobs in a few more possibly problematic tests.
--- test/unittest/usdt/tst.dlclose1.sh | 1 + test/unittest/usdt/tst.enable_pid.sh | 2 ++ test/unittest/usdt/tst.exec-dof-replacement.sh | 1 + test/unittest/usdt/tst.nusdtprobes.sh | 1 + 4 files changed, 5 insertions(+)
test/unittest/usdt/tst.dlclose1.sh +1 -0
@@ -200,6 +200,7 @@ function mywait() { ./main > myfile.txt & pid=$! +disown %+ echo started pid $pid mywait 6 "started" myfile.txt # wait for process to start
test/unittest/usdt/tst.enable_pid.sh +2 -0
@@ -142,8 +142,10 @@ fi ./main >& out.1 & pid1=$! +disown %+ ./main >& out.2 & pid2=$! +disown %+ # # Run DTrace with different pid probes, each case is its own "epoch":
test/unittest/usdt/tst.exec-dof-replacement.sh +1 -0
@@ -81,6 +81,7 @@ fi ./test1 & PROC=$! +disown %+ # Wait for the exec, then list all the target's probes. # We cannot use pure dtrace to do this because it doesn't check
test/unittest/usdt/tst.nusdtprobes.sh +1 -0
@@ -121,6 +121,7 @@ for nusdt in "" "-xnusdtprobes=40" "-xnusdtprobes=39"; do for (( immbr = 0; immbr < $nmmbrs; immbr++ )); do ./main & pids[$immbr]=$! + disown %+ for j in `seq 0 9`; do echo testprov${pids[$immbr]} main main foo$j >> check.txt done
Signature · 1 line
2.43.5
Quoted 9 lines · On Thu, Oct 31, 2024 at 12:49:06AM -0400, [email protected] wrote:
From: Eugene Loh <[email protected]>
The shell can report when a job is killed, potentially polluting stderr and thereby mismatching the results file.
When a job is killed at the end of test, appearance of such reports may depend on timing details: does the parent test or the child job terminate first?
Quoted 5 lines
Many tests deal with this problem by disowning child jobs.
Disown jobs in a few more possibly problematic tests.
Signed-off-by Eugene Loh <[email protected]>
Quoted 61 lines
--- test/unittest/usdt/tst.dlclose1.sh | 1 + test/unittest/usdt/tst.enable_pid.sh | 2 ++ test/unittest/usdt/tst.exec-dof-replacement.sh | 1 + test/unittest/usdt/tst.nusdtprobes.sh | 1 + 4 files changed, 5 insertions(+)test/unittest/usdt/tst.dlclose1.sh +1
-0@@ -200,6 +200,7 @@ function mywait() { ./main > myfile.txt & pid=$! +disown %+ echo started pid $pid mywait 6 "started" myfile.txt # wait for process to starttest/unittest/usdt/tst.enable_pid.sh +2
-0@@ -142,8 +142,10 @@ fi ./main >& out.1 & pid1=$! +disown %+ ./main >& out.2 & pid2=$! +disown %+ # # Run DTrace with different pid probes, each case is its own "epoch":test/unittest/usdt/tst.exec-dof-replacement.sh +1
-0@@ -81,6 +81,7 @@ fi ./test1 & PROC=$! +disown %+ # Wait for the exec, then list all the target's probes. # We cannot use pure dtrace to do this because it doesn't checktest/unittest/usdt/tst.nusdtprobes.sh +1
-0@@ -121,6 +121,7 @@ for nusdt in "" "-xnusdtprobes=40" "-xnusdtprobes=39"; do for (( immbr = 0; immbr < $nmmbrs; immbr++ )); do ./main & pids[$immbr]=$! + disown %+ for j in `seq 0 9`; do echo testprov${pids[$immbr]} main main foo$j >> check.txt doneSignature · 1 line
2.43.5
On 31 Oct 2024, eugene loh verbalised:
Quoted 9 lines
From: Eugene Loh <[email protected]>
The shell can report when a job is killed, potentially polluting stderr and thereby mismatching the results file.
When a job is killed at the end of test, appearance of such reports may depend on timing details: does the parent test or the child job terminate first?
Quoted 5 lines
Many tests deal with this problem by disowning child jobs.
Disown jobs in a few more possibly problematic tests.
Signed-off-by Eugene Loh <[email protected]>
(My only reason for not doing that already was that I mistakenly thought disown didn't do anything in noninteractive shells.)
Signature · 1 line
NULL && (void)