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