Download | Plain Text | No Line Numbers


  1. #!/bin/bash
  2.  
  3. inputs=( $(ls test/input_* | sort -n) )
  4.  
  5. for input in ${inputs[@]}
  6. do
  7. echo "Testing $input ..."
  8.  
  9. files=()
  10. for tag in "#in: " "#out: " "#ref: "
  11. do
  12. tmp=$(grep "$tag" "$input")
  13. if [ -z "$tmp" ]
  14. then
  15. echo " ERROR: Tag '$tag' missing"
  16. exit 1
  17. fi
  18.  
  19. tmp=${tmp:${#tag}}
  20. #if [ ! -e "$tmp" ]
  21. #then
  22. # echo " ERROR: File '$tmp' doesn't exist"
  23. # exit 1
  24. #fi
  25.  
  26. files+=("$tmp")
  27. done
  28.  
  29. rm -f "${files[1]}"
  30. ./imgsynth2 -i "$input"
  31. ret=$?
  32. if [ $ret -ne 0 ]
  33. then
  34. echo " ERROR: Script didn't exit properly"
  35. exit 1
  36. fi
  37.  
  38. md5_1=$(md5sum < "${files[1]}")
  39. md5_2=$(md5sum < "${files[2]}")
  40. if [ "$md5_1" != "$md5_2" ]
  41. then
  42. echo " ERROR: ${files[1]} and ${files[2]} differ"
  43. exit 1
  44. else
  45. echo " Test successful"
  46. fi
  47. done
  48.  
  49.