Guest User

Untitled

a guest
Jul 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. DIR=$1
  4. PROG=$2
  5. VAL="valgrind --error-exitcode=15 --leak-check=full \
  6. --show-leak-kinds=all --errors-for-leak-kinds=all -q"
  7. TOTAL=0
  8. PASSED=0
  9. FAILED=0
  10.  
  11. for f in $DIR/*.in ; do
  12. echo "">temp.out
  13. echo "">temp.err
  14. ((TOTAL++))
  15. printf "Test [$TOTAL] ${f#*$DIR/} "
  16. if [ "${3}" == "-v" ]; then
  17. $VAL ./$PROG <${f} 1>temp.out 2>temp.err
  18. else
  19. ./$PROG <$f 1>temp.out 2>temp>err
  20. fi
  21.  
  22. if [ "$(diff -q temp.out ${f%.in}.out)" != "" ] \
  23. || [ "$(diff -q temp.err ${f%.in}.err)" != "" ]; then
  24. printf "Failed\n"
  25. ((FAILED++))
  26. else
  27. printf "Passed\n"
  28. ((PASSED++))
  29. fi
  30. done
  31.  
  32. printf "$PASSED/$TOTAL Passed "
  33. printf "$PASSED/$TOTAL Failed\n"
  34.  
  35. rm -f temp.out temp.err
Add Comment
Please, Sign In to add comment