3
0

run-all 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. test -x msh || {
  3. echo "No ./msh - creating a link to ../../busybox"
  4. ln -s ../../busybox msh
  5. }
  6. PATH="$PWD:$PATH" # for msh
  7. export PATH
  8. THIS_SH="$PWD/msh"
  9. export THIS_SH
  10. do_test()
  11. {
  12. test -d "$1" || return 0
  13. # echo Running tests in directory "$1"
  14. (
  15. cd "$1" || { echo "cannot cd $1!"; exit 1; }
  16. for x in run-*; do
  17. test -f "$x" || continue
  18. case "$x" in
  19. "$0"|run-minimal|run-gprof) ;;
  20. *.orig|*~) ;;
  21. #*) echo $x ; sh $x ;;
  22. *)
  23. sh "$x" >"../$1-$x.fail" 2>&1 && \
  24. { echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail";
  25. ;;
  26. esac
  27. done
  28. # Many bash run-XXX scripts just do this,
  29. # no point in duplication it all over the place
  30. for x in *.tests; do
  31. test -x "$x" || continue
  32. name="${x%%.tests}"
  33. test -f "$name.right" || continue
  34. # echo Running test: "$name.right"
  35. {
  36. "$THIS_SH" "./$x" >"$name.xx" 2>&1
  37. diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
  38. } && echo "$1/$x: ok" || echo "$1/$x: fail"
  39. done
  40. )
  41. }
  42. # Main part of this script
  43. # Usage: run-all [directories]
  44. if [ $# -lt 1 ]; then
  45. # All sub directories
  46. modules=`ls -d msh-*`
  47. for module in $modules; do
  48. do_test $module
  49. done
  50. else
  51. while [ $# -ge 1 ]; do
  52. if [ -d $1 ]; then
  53. do_test $1
  54. fi
  55. shift
  56. done
  57. fi