run_tests 696 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. NCD=$1
  3. USE_VALGRIND=$2
  4. if [[ -z $NCD ]] || [[ -n $USE_VALGRIND && $USE_VALGRIND != use_valgrind ]]; then
  5. echo "Usage: $0 <ncd_command> [use_valgrind]"
  6. exit 1
  7. fi
  8. if [[ ! -e ./run_tests ]]; then
  9. echo "Must run from the tests directory"
  10. exit 1
  11. fi
  12. failed=0
  13. for file in ./*.ncd; do
  14. echo "Running: $file"
  15. if [[ $USE_VALGRIND = use_valgrind ]]; then
  16. valgrind --error-exitcode=1 --leak-check=full "$NCD" --loglevel none --config-file "$file"
  17. else
  18. "$NCD" --loglevel none --config-file "$file"
  19. fi
  20. res=$?
  21. if [[ ! $res -eq 0 ]]; then
  22. echo "FAILED"
  23. let failed+=1
  24. fi
  25. done
  26. if [[ $failed -gt 0 ]]; then
  27. echo "$failed tests FAILED"
  28. exit 1
  29. fi
  30. echo "all tests passed"
  31. exit 0