aboutsummaryrefslogtreecommitdiff
path: root/tests/killall.test
blob: 8302a574bf837526599d92586877bc3377e3169f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

echo "#!$(which sh)
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

tst=toybox.test
./$tst &
testing "short name" "killall $tst && echo killed ; sleep 0.1 ; \
  pgrep -l $tst || echo really" "killed\nreally\n" "" ""

tst=toybox.killall.test.script
./$tst &
testing "long name" "killall $tst && echo killed ; sleep 0.1 ; \
  pgrep -l $tst || echo really" "killed\nreally\n" "" ""

rm -f toybox.killall.test.script toybox.test