3
0

busybox.tests 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. # Tests for busybox applet itself.
  3. # Copyright 2005 by Rob Landley <rob@landley.net>
  4. # Licensed under GPL v2, see file LICENSE for details.
  5. . testing.sh
  6. HELPDUMP=`busybox`
  7. # We need to test under calling the binary under other names.
  8. testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" ""
  9. ln -s `which busybox` busybox-suffix
  10. for i in busybox ./busybox-suffix
  11. do
  12. # The gratuitous "\n"s are due to a shell idiosyncrasy:
  13. # environment variables seem to strip trailing whitespace.
  14. testing "" "$i" "$HELPDUMP\n\n" "" ""
  15. testing "$i unknown" "$i unknown 2>&1" \
  16. "unknown: applet not found\n" "" ""
  17. testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
  18. optional CAT
  19. testing "" "$i cat" "moo" "" "moo"
  20. testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \
  21. "Concatenates FILE(s) and prints them to stdout.\n" "" ""
  22. optional ""
  23. testing "$i --help unknown" "$i --help unknown 2>&1" \
  24. "unknown: applet not found\n" "" ""
  25. done
  26. rm busybox-suffix
  27. ln -s `which busybox` unknown
  28. testing "busybox as unknown name" "./unknown 2>&1" \
  29. "unknown: applet not found\n" "" ""
  30. rm unknown
  31. exit $FAILCOUNT