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. test -f "$bindir/.config" && . "$bindir/.config"
  7. ln -s `which busybox` unknown
  8. testing "busybox as unknown name" "./unknown 2>&1" \
  9. "unknown: applet not found\n" "" ""
  10. rm unknown
  11. # We need busybox --help to be enabled for the rest of tests
  12. test x"$CONFIG_BUSYBOX" = x"y" \
  13. || { echo "SKIPPED: busybox --help"; exit 0; }
  14. HELPDUMP=`true | busybox 2>&1 | cat`
  15. optional FEATURE_VERBOSE_USAGE
  16. testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n" "" ""
  17. SKIP=
  18. ln -s `which busybox` busybox-suffix
  19. for i in busybox ./busybox-suffix
  20. do
  21. testing "$i" "$i 2>&1 | cat" "$HELPDUMP\n" "" ""
  22. testing "$i unknown" "$i unknown 2>&1" \
  23. "unknown: applet not found\n" "" ""
  24. testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n" "" ""
  25. optional FEATURE_VERBOSE_USAGE CAT
  26. testing "" "$i cat" "moo" "" "moo"
  27. testing "$i --help cat" "$i --help cat 2>&1 | grep Print" \
  28. "Print FILEs to stdout\n" "" ""
  29. SKIP=
  30. testing "$i --help unknown" "$i --help unknown 2>&1" \
  31. "unknown: applet not found\n" "" ""
  32. done
  33. rm busybox-suffix
  34. exit $FAILCOUNT