configure: extract detailed compiler identification
[libav.git] / tests / fate-run.sh
CommitLineData
2fad0977
MR
1#! /bin/sh
2
3base=$(dirname $0)
4. "${base}/md5.sh"
5
6test="${1#fate-}"
122a9af7 7samples=$2
2fad0977 8target_exec=$3
122a9af7 9target_path=$4
2fad0977 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}"
bcb0a154 17errfile="${outdir}/${test}.err"
2fad0977 18
e153cfa8 19do_tiny_psnr(){
aab3ea5f 20 psnr=$(tests/tiny_psnr "$1" "$2" 2 0 0)
e153cfa8 21 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
83b203dc
MR
22 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
23 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
e153cfa8
MR
24 res=$(echo "$val $4 $5" | bc)
25 if [ "$res" != 1 ] || [ $size1 != $size2 ]; then
aab3ea5f
MR
26 echo "$psnr"
27 return 1
28 fi
29}
30
e153cfa8
MR
31oneoff(){
32 do_tiny_psnr "$1" "$2" MAXDIFF '<=' ${fuzz:-1}
33}
34
35stddev(){
36 do_tiny_psnr "$1" "$2" stddev '<=' ${fuzz:-1}
37}
38
2b18c451
MR
39ffmpeg(){
40 $target_exec $target_path/ffmpeg "$@"
41}
42
43framecrc(){
44 ffmpeg "$@" -f framecrc -
45}
46
47framemd5(){
48 ffmpeg "$@" -f framemd5 -
49}
50
51crc(){
52 ffmpeg "$@" -f crc -
53}
54
55md5(){
56 ffmpeg "$@" md5:
57}
58
59pcm(){
60 ffmpeg "$@" -vn -f s16le -
61}
62
9a3f31ef
MR
63regtest(){
64 t="${test#$2-}"
65 ref=${base}/ref/$2/$t
157c9241 66 cleanfiles="$cleanfiles $outfile $errfile"
9a3f31ef 67 outfile=tests/data/regression/$2/$t
bcb0a154 68 errfile=tests/data/$t.$2.err
9a3f31ef
MR
69 ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path"
70}
71
72codectest(){
73 regtest codec $1 tests/$1
74}
75
76lavftest(){
77 regtest lavf lavf tests/vsynth1
78}
79
80lavfitest(){
8fae6e7c 81 cleanfiles="tests/data/lavfi/${test#lavfi-}.nut"
9a3f31ef
MR
82 regtest lavfi lavfi tests/vsynth1
83}
84
85seektest(){
86 t="${test#seek-}"
87 ref=${base}/ref/seek/$t
88 case $t in
89 image_*) file="tests/data/images/${t#image_}/%02d.${t#image_}" ;;
90 *) file=$(echo $t | tr _ '?')
91 for d in acodec vsynth2 lavf; do
92 test -f tests/data/$d/$file && break
93 done
94 file=$(echo tests/data/$d/$file)
95 ;;
96 esac
97 $target_exec $target_path/tests/seek_test $target_path/$file
98}
150ef830 99
2fad0977
MR
100mkdir -p "$outdir"
101
bcb0a154 102$command > "$outfile" 2>$errfile
ffe72624 103err=$?
3ade7d32 104
9a3f31ef
MR
105if ! test -e "$ref"; then
106 echo "reference file '$ref' not found"
107 exit 1
108fi
109
3ade7d32
MR
110case $cmp in
111 diff) diff -u -w "$ref" "$outfile" ;;
aab3ea5f 112 oneoff) oneoff "$ref" "$outfile" "$fuzz" ;;
e153cfa8 113 stddev) stddev "$ref" "$outfile" "$fuzz" ;;
3ade7d32 114esac
7d610af6 115
ffe72624
MR
116cmperr=$?
117test $err = 0 && err=$cmperr
157c9241 118test $err = 0 && rm -f $outfile $errfile $cleanfiles