busybox.tests 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # verify the applet order is correct in applets.h, otherwise applets won't
  7. # be called properly.
  8. #sed -n -e '/^USE_^\tAPPLET/{s:.*(::;s:,.*::;s:"::g;p}'
  9. # ../include/applets.h > applet.order1
  10. #LC_ALL=C sort applet.order.current > applet.order.correct
  11. #diff -u applet.order.current applet.order.correct
  12. #FAILCOUNT=$[$FAILCOUNT+$?]
  13. #rm -f applet.order.current applet.order.correct
  14. HELPDUMP=`busybox`
  15. # We need to test under calling the binary under other names.
  16. testing "busybox --help busybox" "busybox --help busybox" "$HELPDUMP\n\n" "" ""
  17. ln -s `which busybox` busybox-suffix
  18. for i in busybox ./busybox-suffix
  19. do
  20. # The gratuitous "\n"s are due to a shell idiosyncrasy:
  21. # environment variables seem to strip trailing whitespace.
  22. testing "" "$i" "$HELPDUMP\n\n" "" ""
  23. testing "$i unknown" "$i unknown 2>&1" \
  24. "unknown: applet not found\n" "" ""
  25. testing "$i --help" "$i --help 2>&1" "$HELPDUMP\n\n" "" ""
  26. optional CAT
  27. testing "" "$i cat" "moo" "" "moo"
  28. testing "$i --help cat" "$i --help cat 2>&1 | grep prints" \
  29. "Concatenates FILE(s) and prints them to stdout.\n" "" ""
  30. optional ""
  31. testing "$i --help unknown" "$i --help unknown 2>&1" \
  32. "unknown: applet not found\n" "" ""
  33. done
  34. rm busybox-suffix
  35. ln -s `which busybox` unknown
  36. testing "busybox as unknown name" "./unknown 2>&1" \
  37. "unknown: applet not found\n" "" ""
  38. rm unknown
  39. exit $FAILCOUNT