Collect list of seek tests in configure
[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}"
17
e153cfa8 18do_tiny_psnr(){
aab3ea5f 19 psnr=$(tests/tiny_psnr "$1" "$2" 2 0 0)
e153cfa8 20 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
83b203dc
MR
21 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
22 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
e153cfa8
MR
23 res=$(echo "$val $4 $5" | bc)
24 if [ "$res" != 1 ] || [ $size1 != $size2 ]; then
aab3ea5f
MR
25 echo "$psnr"
26 return 1
27 fi
28}
29
e153cfa8
MR
30oneoff(){
31 do_tiny_psnr "$1" "$2" MAXDIFF '<=' ${fuzz:-1}
32}
33
34stddev(){
35 do_tiny_psnr "$1" "$2" stddev '<=' ${fuzz:-1}
36}
37
2b18c451
MR
38ffmpeg(){
39 $target_exec $target_path/ffmpeg "$@"
40}
41
42framecrc(){
43 ffmpeg "$@" -f framecrc -
44}
45
46framemd5(){
47 ffmpeg "$@" -f framemd5 -
48}
49
50crc(){
51 ffmpeg "$@" -f crc -
52}
53
54md5(){
55 ffmpeg "$@" md5:
56}
57
58pcm(){
59 ffmpeg "$@" -vn -f s16le -
60}
61
150ef830
MR
62if ! test -e "$ref"; then
63 echo "reference file '$ref' not found"
64 exit 1
65fi
66
2fad0977
MR
67mkdir -p "$outdir"
68
cdaf4b79 69$command > "$outfile" 2>/dev/null || exit
3ade7d32
MR
70
71case $cmp in
72 diff) diff -u -w "$ref" "$outfile" ;;
aab3ea5f 73 oneoff) oneoff "$ref" "$outfile" "$fuzz" ;;
e153cfa8 74 stddev) stddev "$ref" "$outfile" "$fuzz" ;;
3ade7d32 75esac
7d610af6
MR
76
77test $? = 0 && rm $outfile