aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-07-01 16:15:55 -0700
committerRob Landley <rob@landley.net>2019-07-06 16:15:35 -0500
commit82a33b3f060e163b14155e8f6833ec30514a609b (patch)
tree8ea5cce41b024233ef8af23dcaf12a1068e9b0be /tests
parent3d8bbdc83d8b4891c1b887942e054974eb6291b7 (diff)
downloadtoybox-82a33b3f060e163b14155e8f6833ec30514a609b.tar.gz
killall: better handling of long names.
Change names_to_pid() so that we can actually match shell scripts with long names (the code to get the shell script's name was correct, but there was an extra test preventing us from actually comparing it to the sought name). In kill.c itself, remove a dead test for -l and switch to the FLAG() macro. Also extend the tests to explicitly cover long and short names.
Diffstat (limited to 'tests')
-rw-r--r--tests/killall.test12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/killall.test b/tests/killall.test
index 40f6cb35..7e171d46 100644
--- a/tests/killall.test
+++ b/tests/killall.test
@@ -5,10 +5,16 @@
#testing "name" "command" "result" "infile" "stdin"
echo "#!$(which sh)
-yes > /dev/null" > toybox.killall.test.script
+while true; do
+ sleep 0.1
+done" > toybox.killall.test.script
chmod a+x toybox.killall.test.script
+cp toybox.killall.test.script toybox.test
+
+./toybox.test &
+testing "short name" "killall toybox.test && echo killed ; pgrep -l toybox.test || echo really" "killed\nreally\n" "" ""
./toybox.killall.test.script &
-testing "script" "killall toybox.killall.test.script && echo killed ; pgrep -l toybox.killall.test.script || echo really" "killed\nreally\n" "" ""
+testing "long name" "killall toybox.killall.test.script && echo killed ; pgrep -l toybox.killall.test.script || echo really" "killed\nreally\n" "" ""
-rm -f toybox.killall.test.script
+rm -f toybox.killall.test.script toybox.test