pkill tests: Fix pkill usage in the pkill -x test

The target process name(s) mark the beginning of the command's
positional parameters, so the -P filter wasn't getting applied as
intended.  As a result, the second "pkill -x sleep -P $$" would kill all
sleep(1) processes in the system, which can cause problems when running
tests in parallel.

MFC after:	2 weeks
This commit is contained in:
Mark Johnston committed 2025-03-20 02:52:49 +00:00
1 parent cf6a780469
commit 57b09e470d
1 file changed
+4 -4
+4 -4
View File
@@ -9,13 +9,13 @@ sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
pkill -x slee -P $$
pkill -P $$ -x slee
if [ $? -ne 0 ]; then
echo "ok 1 - $name"
else
echo "not ok 1 - $name"
fi
pkill -x sleep -P $$
pkill -P $$ -x sleep
if [ $? -eq 0 ]; then
echo "ok 2 - $name"
else
@@ -28,13 +28,13 @@ sleep=$(pwd)/sleep.txt
ln -sf /bin/sleep $sleep
$sleep 5 &
sleep 0.3
pkill -x -f "$sleep " -P $$
pkill -P $$ -x -f "$sleep "
if [ $? -ne 0 ]; then
echo "ok 3 - $name"
else
echo "not ok 3 - $name"
fi
pkill -x -f "$sleep 5" -P $$
pkill -P $$ -x -f "$sleep 5"
if [ $? -eq 0 ]; then
echo "ok 4 - $name"
else