aboutsummaryrefslogtreecommitdiff
path: root/tests/pkill.test
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-04-02 12:20:53 -0700
committerRob Landley <rob@landley.net>2017-04-07 11:40:14 -0500
commit92ca5af53128aba511c4144c173283a3e810af8b (patch)
treee6fd3385e50ad6a8e92af7f7a0dd1e7297fec011 /tests/pkill.test
parentf966da9e6efed946209a68e53970ad3488a55456 (diff)
downloadtoybox-92ca5af53128aba511c4144c173283a3e810af8b.tar.gz
Make pkill tests runnable on a toybox-only system.
Also use a much stricter regex in the regex test to avoid killing innocent bystanders.
Diffstat (limited to 'tests/pkill.test')
-rwxr-xr-xtests/pkill.test8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/pkill.test b/tests/pkill.test
index 3f20d260..c98b6a45 100755
--- a/tests/pkill.test
+++ b/tests/pkill.test
@@ -46,10 +46,10 @@ testing "-f pattern (multiple)" "pkill -f yes && sleep 1 &&
(pgrep yes || echo 'yes')" "yes\n" "" ""
killall yes >/dev/null 2>&1
-yes >/dev/null &
+yes this-is-unlikely-to-appear-otherwise >/dev/null &
sleep 1
-testing "-s 0 -f pattern (regexp)" "pkill -s 0 -f ye* && sleep 1 &&
- (pgrep yes || echo 'yes')" "yes\n" "" ""
+testing "-s 0 -f pattern (regexp)" "pkill -s 0 -f .*-unlikely-.*-otherwise &&
+ sleep 1 && (pgrep yes || echo 'yes')" "yes\n" "" ""
killall yes >/dev/null 2>&1
yes >/dev/null &
@@ -85,7 +85,7 @@ killall yes >/dev/null 2>&1
yes >/dev/null &
proc=$!
-proc_p=`cat /proc/${proc}/stat | awk '{ print $4 }'`
+proc_p=`cat /proc/${proc}/stat | cut -d' ' -f4`
sleep 1
testing "-P parent_prodId pattern" "pkill -P $proc_p yes && sleep 1 &&
(pgrep yes || echo 'yes')" "yes\n" "" ""