2010-03-15 19:23:24 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2010-08-23 17:34:08 +00:00
|
|
|
export LC_ALL=C
|
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
base=$(dirname $0)
|
|
|
|
. "${base}/md5.sh"
|
|
|
|
|
2010-07-26 23:44:06 +00:00
|
|
|
base64=tests/base64
|
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
test="${1#fate-}"
|
2010-07-18 20:19:16 +00:00
|
|
|
samples=$2
|
2010-03-15 19:23:24 +00:00
|
|
|
target_exec=$3
|
2010-07-18 20:19:16 +00:00
|
|
|
target_path=$4
|
2010-03-15 19:23:24 +00:00
|
|
|
command=$5
|
2010-07-09 00:40:45 +00:00
|
|
|
cmp=${6:-diff}
|
|
|
|
ref=${7:-"${base}/ref/fate/${test}"}
|
|
|
|
fuzz=$8
|
2011-03-21 23:07:54 +00:00
|
|
|
threads=${9:-1}
|
2011-04-20 17:12:38 +00:00
|
|
|
thread_type=${10:-3}
|
2010-07-17 15:02:32 +00:00
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
outdir="tests/data/fate"
|
|
|
|
outfile="${outdir}/${test}"
|
2010-07-21 20:49:34 +00:00
|
|
|
errfile="${outdir}/${test}.err"
|
2010-07-26 23:44:06 +00:00
|
|
|
cmpfile="${outdir}/${test}.diff"
|
|
|
|
repfile="${outdir}/${test}.rep"
|
2010-03-15 19:23:24 +00:00
|
|
|
|
2010-07-17 15:02:34 +00:00
|
|
|
do_tiny_psnr(){
|
2010-07-09 00:40:51 +00:00
|
|
|
psnr=$(tests/tiny_psnr "$1" "$2" 2 0 0)
|
2010-07-17 15:02:34 +00:00
|
|
|
val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
|
2010-07-10 16:58:00 +00:00
|
|
|
size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
|
|
|
|
size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
|
2010-08-01 15:28:42 +00:00
|
|
|
res=$(echo "if ($val $4 $5) 1" | bc)
|
2010-07-17 15:02:34 +00:00
|
|
|
if [ "$res" != 1 ] || [ $size1 != $size2 ]; then
|
2010-07-09 00:40:51 +00:00
|
|
|
echo "$psnr"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-07-17 15:02:34 +00:00
|
|
|
oneoff(){
|
|
|
|
do_tiny_psnr "$1" "$2" MAXDIFF '<=' ${fuzz:-1}
|
|
|
|
}
|
|
|
|
|
|
|
|
stddev(){
|
|
|
|
do_tiny_psnr "$1" "$2" stddev '<=' ${fuzz:-1}
|
|
|
|
}
|
|
|
|
|
2010-08-04 06:56:59 +00:00
|
|
|
run(){
|
2010-09-23 09:55:31 +00:00
|
|
|
test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
|
2010-08-04 06:56:59 +00:00
|
|
|
$target_exec $target_path/"$@"
|
|
|
|
}
|
|
|
|
|
2010-07-18 20:19:30 +00:00
|
|
|
ffmpeg(){
|
2011-04-20 17:12:38 +00:00
|
|
|
run ffmpeg -v 0 -threads $threads -thread_type $thread_type "$@"
|
2010-07-18 20:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
framecrc(){
|
|
|
|
ffmpeg "$@" -f framecrc -
|
|
|
|
}
|
|
|
|
|
|
|
|
framemd5(){
|
|
|
|
ffmpeg "$@" -f framemd5 -
|
|
|
|
}
|
|
|
|
|
|
|
|
crc(){
|
|
|
|
ffmpeg "$@" -f crc -
|
|
|
|
}
|
|
|
|
|
|
|
|
md5(){
|
|
|
|
ffmpeg "$@" md5:
|
|
|
|
}
|
|
|
|
|
|
|
|
pcm(){
|
|
|
|
ffmpeg "$@" -vn -f s16le -
|
|
|
|
}
|
|
|
|
|
2010-07-20 10:19:28 +00:00
|
|
|
regtest(){
|
|
|
|
t="${test#$2-}"
|
|
|
|
ref=${base}/ref/$2/$t
|
2011-04-20 17:12:38 +00:00
|
|
|
${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type"
|
2010-07-20 10:19:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
codectest(){
|
|
|
|
regtest codec $1 tests/$1
|
|
|
|
}
|
|
|
|
|
|
|
|
lavftest(){
|
|
|
|
regtest lavf lavf tests/vsynth1
|
|
|
|
}
|
|
|
|
|
|
|
|
lavfitest(){
|
2010-07-24 17:13:32 +00:00
|
|
|
cleanfiles="tests/data/lavfi/${test#lavfi-}.nut"
|
2010-07-20 10:19:28 +00:00
|
|
|
regtest lavfi lavfi tests/vsynth1
|
|
|
|
}
|
|
|
|
|
|
|
|
seektest(){
|
|
|
|
t="${test#seek-}"
|
|
|
|
ref=${base}/ref/seek/$t
|
|
|
|
case $t in
|
|
|
|
image_*) file="tests/data/images/${t#image_}/%02d.${t#image_}" ;;
|
|
|
|
*) file=$(echo $t | tr _ '?')
|
|
|
|
for d in acodec vsynth2 lavf; do
|
|
|
|
test -f tests/data/$d/$file && break
|
|
|
|
done
|
|
|
|
file=$(echo tests/data/$d/$file)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
$target_exec $target_path/tests/seek_test $target_path/$file
|
|
|
|
}
|
2010-07-09 23:55:16 +00:00
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
mkdir -p "$outdir"
|
|
|
|
|
2010-09-23 09:55:31 +00:00
|
|
|
exec 3>&2
|
2010-07-21 20:49:34 +00:00
|
|
|
$command > "$outfile" 2>$errfile
|
2010-07-20 12:54:43 +00:00
|
|
|
err=$?
|
2010-07-09 00:40:45 +00:00
|
|
|
|
2010-07-31 16:53:09 +00:00
|
|
|
if [ $err -gt 128 ]; then
|
|
|
|
sig=$(kill -l $err 2>/dev/null)
|
2010-08-01 12:29:03 +00:00
|
|
|
test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
|
2010-07-31 16:53:09 +00:00
|
|
|
fi
|
|
|
|
|
2010-07-26 23:44:06 +00:00
|
|
|
if test -e "$ref"; then
|
|
|
|
case $cmp in
|
|
|
|
diff) diff -u -w "$ref" "$outfile" >$cmpfile ;;
|
|
|
|
oneoff) oneoff "$ref" "$outfile" "$fuzz" >$cmpfile ;;
|
|
|
|
stddev) stddev "$ref" "$outfile" "$fuzz" >$cmpfile ;;
|
|
|
|
esac
|
|
|
|
cmperr=$?
|
|
|
|
test $err = 0 && err=$cmperr
|
|
|
|
test $err = 0 || cat $cmpfile
|
|
|
|
else
|
2010-07-20 10:19:28 +00:00
|
|
|
echo "reference file '$ref' not found"
|
2010-07-26 23:44:06 +00:00
|
|
|
err=1
|
2010-07-20 10:19:28 +00:00
|
|
|
fi
|
|
|
|
|
2010-07-31 16:53:09 +00:00
|
|
|
echo "${test}:${sig:-$err}:$($base64 <$cmpfile):$($base64 <$errfile)" >$repfile
|
2010-07-09 23:36:04 +00:00
|
|
|
|
2010-07-26 23:44:06 +00:00
|
|
|
test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles
|
|
|
|
exit $err
|