bashor

bash autotest

Oct 9th, 2011
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.48 KB | None | 0 0
  1. #!/bin/bash
  2. g++ $1 -o $2 -Wall
  3.  
  4. if [ $? -ne 0 ] ; then
  5.     exit 1
  6. fi
  7.  
  8. outs="outs"
  9. tests_dir="$2_tests"
  10.  
  11. if [ ! -e $outs ]; then
  12.     mkdir $outs
  13. fi
  14.  
  15. for i in $tests_dir/*.test; do
  16.     b=`basename "$i" ".test"`
  17.     outf=$outs/$b.out
  18.     expoutf=$tests_dir/${b}.testout
  19.  
  20.     ./$2 < "$i" > "$outf"
  21.     cmp "$outf" "$expoutf" &> /dev/null
  22.     if [ $? -eq 0 ]
  23.     then
  24.         echo "OK -- $b"
  25.     else
  26.         echo "FAIL($1) -- $b"
  27.         cat "$i"
  28.         echo -e "\n----"
  29.         cat "$outf"
  30.         echo
  31.     fi
  32.  
  33.     echo "====="
  34. done
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment