killall.test 625 B

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