Statistics
| Branch: | Revision:

ffmpeg / tests / fate-run.sh @ 83b203dc

History | View | Annotate | Download (882 Bytes)

1
#! /bin/sh
2

    
3
base=$(dirname $0)
4
. "${base}/md5.sh"
5

    
6
test="${1#fate-}"
7
SAMPLES_PATH=$2
8
target_exec=$3
9
BUILD_PATH=$4
10
command=$5
11
cmp=${6:-diff}
12

    
13
ref=${7:-"${base}/ref/fate/${test}"}
14
fuzz=$8
15
outdir="tests/data/fate"
16
outfile="${outdir}/${test}"
17

    
18
oneoff(){
19
    psnr=$(tests/tiny_psnr "$1" "$2" 2 0 0)
20
    max=$(expr "$psnr" : '.*MAXDIFF: *\([0-9]*\)')
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
24
        echo "$psnr"
25
        return 1
26
    fi
27
}
28

    
29
if ! test -e "$ref"; then
30
    echo "reference file '$ref' not found"
31
    exit 1
32
fi
33

    
34
mkdir -p "$outdir"
35

    
36
eval $target_exec $command > "$outfile" 2>/dev/null || exit
37

    
38
case $cmp in
39
    diff)   diff -u -w "$ref" "$outfile"            ;;
40
    oneoff) oneoff     "$ref" "$outfile" "$fuzz"    ;;
41
esac
42

    
43
test $? = 0 && rm $outfile