You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
882B

  1. #! /bin/sh
  2. base=$(dirname $0)
  3. . "${base}/md5.sh"
  4. test="${1#fate-}"
  5. SAMPLES_PATH=$2
  6. target_exec=$3
  7. BUILD_PATH=$4
  8. command=$5
  9. cmp=${6:-diff}
  10. ref=${7:-"${base}/ref/fate/${test}"}
  11. fuzz=$8
  12. outdir="tests/data/fate"
  13. outfile="${outdir}/${test}"
  14. oneoff(){
  15. psnr=$(tests/tiny_psnr "$1" "$2" 2 0 0)
  16. max=$(expr "$psnr" : '.*MAXDIFF: *\([0-9]*\)')
  17. size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
  18. size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
  19. if [ $max -gt ${3:-1} ] || [ $size1 != $size2 ]; then
  20. echo "$psnr"
  21. return 1
  22. fi
  23. }
  24. if ! test -e "$ref"; then
  25. echo "reference file '$ref' not found"
  26. exit 1
  27. fi
  28. mkdir -p "$outdir"
  29. eval $target_exec $command > "$outfile" 2>/dev/null || exit
  30. case $cmp in
  31. diff) diff -u -w "$ref" "$outfile" ;;
  32. oneoff) oneoff "$ref" "$outfile" "$fuzz" ;;
  33. esac
  34. test $? = 0 && rm $outfile