busybox.tests 1.2 KB

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