toybox/tests/killall.test
<<
>>
Prefs
   1#!/bin/bash
   2
   3[ -f testing.sh ] && . testing.sh
   4
   5#testing "name" "command" "result" "infile" "stdin"
   6
   7echo -e "#!$(which sh)\nwhile true; do sleep 0.1; done" > toybox.test
   8chmod a+x toybox.test
   9cp toybox.test toybox.killall.test.script
  10
  11tst=toybox.test
  12(./$tst 2>/dev/null &)
  13testing "short name" "killall -w $tst && echo killed ; sleep 0.1; \
  14  pgrep -l $tst || echo really" "killed\nreally\n" "" ""
  15
  16tst=toybox.killall.test.script
  17(./$tst 2>/dev/null &)
  18testing "long name" "killall -w $tst && echo killed ; sleep 0.1; \
  19  pgrep -l $tst || echo really" "killed\nreally\n" "" ""
  20
  21rm -f toybox.killall.test.script toybox.test
  22