public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH v2] test: Disown child pid for cleaner stderr
Date: Thu, 31 Oct 2024 00:49:06 -0400	[thread overview]
Message-ID: <20241031044906.15804-1-eugene.loh@oracle.com> (raw)

From: Eugene Loh <eugene.loh@oracle.com>

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.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
 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(+)

diff --git a/test/unittest/usdt/tst.dlclose1.sh b/test/unittest/usdt/tst.dlclose1.sh
index ee4d95f3b..b65e4de5d 100755
--- a/test/unittest/usdt/tst.dlclose1.sh
+++ b/test/unittest/usdt/tst.dlclose1.sh
@@ -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
diff --git a/test/unittest/usdt/tst.enable_pid.sh b/test/unittest/usdt/tst.enable_pid.sh
index 91923014d..bbb7680c4 100755
--- a/test/unittest/usdt/tst.enable_pid.sh
+++ b/test/unittest/usdt/tst.enable_pid.sh
@@ -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":
diff --git a/test/unittest/usdt/tst.exec-dof-replacement.sh b/test/unittest/usdt/tst.exec-dof-replacement.sh
index 9f30bbfcc..f9cf6bdb2 100755
--- a/test/unittest/usdt/tst.exec-dof-replacement.sh
+++ b/test/unittest/usdt/tst.exec-dof-replacement.sh
@@ -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
diff --git a/test/unittest/usdt/tst.nusdtprobes.sh b/test/unittest/usdt/tst.nusdtprobes.sh
index 50f18a6ca..4b5050ff9 100755
--- a/test/unittest/usdt/tst.nusdtprobes.sh
+++ b/test/unittest/usdt/tst.nusdtprobes.sh
@@ -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
-- 
2.43.5


             reply	other threads:[~2024-10-31  4:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31  4:49 eugene.loh [this message]
2024-10-31  5:22 ` [PATCH v2] test: Disown child pid for cleaner stderr Kris Van Hees
2024-11-01 13:42 ` Nick Alcock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241031044906.15804-1-eugene.loh@oracle.com \
    --to=eugene.loh@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox