busybox.tests 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. ln -s `which busybox` unknown
  7. testing "busybox as unknown name" "./unknown 2>&1" \
  8. "unknown: applet not found\n" "" ""
  9. rm unknown
  10. # We need busybox --help to be enabled for the rest of tests
  11. test x"$CONFIG_BUSYBOX" = x"y" \
  12. || { echo "SKIPPED: busybox --help"; exit 0; }
  13. HELPDUMP=`true | busybox 2>&1 | cat`
  14. # We need to test under calling the binary under other names.
  15. optional FEATURE_VERBOSE_USAGE
  16. testing "busybox --help busybox" "true | busybox --help busybox 2>&1 | cat" "$HELPDUMP\n\n" "" ""
  17. SKIP=
  18. ln -s `which busybox` busybox-suffix
  19. for i in busybox ./busybox-suffix
  20. do
  21. # The gratuitous "\n"s are due to a shell idiosyncrasy:
  22. # environment variables seem to strip trailing whitespace.
  23. testing "" "$i" "$HELPDUMP\n\n" "" ""
  24. testing "$i unknown" "$i unknown 2>&1" \
  25. "unknown: applet not found\n" "" ""
  26. testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
  27. optional FEATURE_VERBOSE_USAGE CAT
  28. testing "" "$i cat" "moo" "" "moo"
  29. testing "$i --help cat" "$i --help cat 2>&1 | grep print" \
  30. "Concatenate FILEs and print them to stdout\n" "" ""
  31. SKIP=
  32. testing "$i --help unknown" "$i --help unknown 2>&1" \
  33. "unknown: applet not found\n" "" ""
  34. done
  35. rm busybox-suffix
  36. exit $FAILCOUNT