BASH   13

all test sh

Guest on 13th May 2022 01:41:11 AM

  1. #!/bin/sh
  2.  
  3. cd ${0%/*}
  4.  
  5. #set -e
  6. fail=0
  7. tests=0
  8. #all_tests=${__dirname:}
  9. #echo PLAN ${#all_tests}
  10. for test in test/*.sh ;
  11. do
  12.   tests=$((tests+1))
  13.   echo TEST: $test
  14.   ./$test
  15.   ret=$?
  16.   if [ $ret -eq 0 ] ; then
  17.     echo OK: ---- $test
  18.     passed=$((passed+1))
  19.   else
  20.     echo FAIL: $test $fail
  21.     fail=$((fail+ret))
  22.   fi
  23. done
  24.  
  25. if [ $fail -eq 0 ]; then
  26.   echo -n 'SUCCESS '
  27.   exitcode=0
  28. else
  29.   echo -n 'FAILURE '
  30.   exitcode=1
  31. fi
  32. echo   $passed / $tests
  33. exit $exitcode

Raw Paste


Login or Register to edit or fork this paste. It's free.