fate-run.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. #! /bin/sh
  2. export LC_ALL=C
  3. base=$(dirname $0)
  4. . "${base}/md5.sh"
  5. base64=tests/base64${HOSTEXECSUF}
  6. test="${1#fate-}"
  7. target_samples=$2
  8. target_exec=$3
  9. target_path=$4
  10. command=$5
  11. cmp=${6:-diff}
  12. ref=${7:-"${base}/ref/fate/${test}"}
  13. fuzz=${8:-1}
  14. threads=${9:-1}
  15. thread_type=${10:-frame+slice}
  16. cpuflags=${11:-all}
  17. cmp_shift=${12:-0}
  18. cmp_target=${13:-0}
  19. size_tolerance=${14:-0}
  20. cmp_unit=${15:-2}
  21. gen=${16:-no}
  22. hwaccel=${17:-none}
  23. report_type=${18:-standard}
  24. keep=${19:-0}
  25. outdir="tests/data/fate"
  26. outfile="${outdir}/${test}"
  27. errfile="${outdir}/${test}.err"
  28. cmpfile="${outdir}/${test}.diff"
  29. repfile="${outdir}/${test}.rep"
  30. target_path(){
  31. test ${1} = ${1#/} && p=${target_path}/
  32. echo ${p}${1}
  33. }
  34. # $1=value1, $2=value2, $3=threshold
  35. # prints 0 if absolute difference between value1 and value2 is <= threshold
  36. compare(){
  37. awk "BEGIN { v = $1 - $2; printf ((v < 0 ? -v : v) > $3) }"
  38. }
  39. do_tiny_psnr(){
  40. psnr=$(tests/tiny_psnr${HOSTEXECSUF} "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
  41. val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
  42. size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
  43. size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
  44. val_cmp=$(compare $val $cmp_target $fuzz)
  45. size_cmp=$(compare $size1 $size2 $size_tolerance)
  46. if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
  47. echo "$psnr"
  48. if [ "$val_cmp" != 0 ]; then
  49. echo "$3: |$val - $cmp_target| >= $fuzz"
  50. fi
  51. if [ "$size_cmp" != 0 ]; then
  52. echo "size: |$size1 - $size2| >= $size_tolerance"
  53. fi
  54. return 1
  55. fi
  56. }
  57. oneoff(){
  58. do_tiny_psnr "$1" "$2" MAXDIFF
  59. }
  60. stddev(){
  61. do_tiny_psnr "$1" "$2" stddev
  62. }
  63. oneline(){
  64. printf '%s\n' "$1" | diff -u -b - "$2"
  65. }
  66. run(){
  67. test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
  68. $target_exec $target_path/"$@"
  69. }
  70. runecho(){
  71. test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
  72. $target_exec $target_path/"$@" >&3
  73. }
  74. probefmt(){
  75. run ffprobe${PROGSUF}${EXECSUF} -show_entries format=format_name -print_format default=nw=1:nk=1 -v 0 "$@"
  76. }
  77. probetags(){
  78. run ffprobe${PROGSUF}${EXECSUF} -show_entries format_tags -v 0 "$@"
  79. }
  80. runlocal(){
  81. test "${V:-0}" -gt 0 && echo ${base}/"$@" ${base} >&3
  82. ${base}/"$@" ${base}
  83. }
  84. probeframes(){
  85. run ffprobe${PROGSUF}${EXECSUF} -show_frames -v 0 "$@"
  86. }
  87. probechapters(){
  88. run ffprobe${PROGSUF}${EXECSUF} -show_chapters -v 0 "$@"
  89. }
  90. probegaplessinfo(){
  91. filename="$1"
  92. shift
  93. run ffprobe${PROGSUF}${EXECSUF} -bitexact -select_streams a -show_entries format=start_time,duration:stream=index,start_pts,duration_ts -v 0 "$filename" "$@"
  94. pktfile1="${outdir}/${test}.pkts"
  95. framefile1="${outdir}/${test}.frames"
  96. cleanfiles="$cleanfiles $pktfile1 $framefile1"
  97. run ffprobe${PROGSUF}${EXECSUF} -bitexact -select_streams a -of compact -count_packets -show_entries packet=pts,dts,duration,flags:stream=nb_read_packets -v 0 "$filename" "$@" > "$pktfile1"
  98. head -n 8 "$pktfile1"
  99. tail -n 9 "$pktfile1"
  100. run ffprobe${PROGSUF}${EXECSUF} -bitexact -select_streams a -of compact -count_frames -show_entries frame=pkt_pts,pkt_dts,best_effort_timestamp,pkt_duration,nb_samples:stream=nb_read_frames -v 0 "$filename" "$@" > "$framefile1"
  101. head -n 8 "$framefile1"
  102. tail -n 9 "$framefile1"
  103. }
  104. ffmpeg(){
  105. dec_opts="-hwaccel $hwaccel -threads $threads -thread_type $thread_type"
  106. ffmpeg_args="-nostdin -nostats -cpuflags $cpuflags"
  107. for arg in $@; do
  108. [ x${arg} = x-i ] && ffmpeg_args="${ffmpeg_args} ${dec_opts}"
  109. ffmpeg_args="${ffmpeg_args} ${arg}"
  110. done
  111. run ffmpeg${PROGSUF}${EXECSUF} ${ffmpeg_args}
  112. }
  113. framecrc(){
  114. ffmpeg "$@" -bitexact -f framecrc -
  115. }
  116. ffmetadata(){
  117. ffmpeg "$@" -bitexact -f ffmetadata -
  118. }
  119. framemd5(){
  120. ffmpeg "$@" -bitexact -f framemd5 -
  121. }
  122. crc(){
  123. ffmpeg "$@" -f crc -
  124. }
  125. md5pipe(){
  126. ffmpeg "$@" md5:
  127. }
  128. md5(){
  129. encfile="${outdir}/${test}.out"
  130. cleanfiles="$cleanfiles $encfile"
  131. ffmpeg "$@" $encfile
  132. do_md5sum $encfile | awk '{print $1}'
  133. }
  134. pcm(){
  135. ffmpeg "$@" -vn -f s16le -
  136. }
  137. fmtstdout(){
  138. fmt=$1
  139. shift 1
  140. ffmpeg -bitexact "$@" -f $fmt -
  141. }
  142. enc_dec_pcm(){
  143. out_fmt=$1
  144. dec_fmt=$2
  145. pcm_fmt=$3
  146. src_file=$(target_path $4)
  147. shift 4
  148. encfile="${outdir}/${test}.${out_fmt}"
  149. cleanfiles=$encfile
  150. encfile=$(target_path ${encfile})
  151. ffmpeg -i $src_file "$@" -f $out_fmt -y ${encfile} || return
  152. ffmpeg -bitexact -i ${encfile} -c:a pcm_${pcm_fmt} -fflags +bitexact -f ${dec_fmt} -
  153. }
  154. FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
  155. DEC_OPTS="-threads $threads -idct simple $FLAGS"
  156. ENC_OPTS="-threads 1 -idct simple -dct fastint"
  157. enc_dec(){
  158. src_fmt=$1
  159. srcfile=$2
  160. enc_fmt=$3
  161. enc_opt=$4
  162. dec_fmt=$5
  163. dec_opt=$6
  164. encfile="${outdir}/${test}.${enc_fmt}"
  165. decfile="${outdir}/${test}.out.${dec_fmt}"
  166. cleanfiles="$cleanfiles $decfile"
  167. test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
  168. tsrcfile=$(target_path $srcfile)
  169. tencfile=$(target_path $encfile)
  170. tdecfile=$(target_path $decfile)
  171. ffmpeg -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
  172. -f $enc_fmt -y $tencfile || return
  173. do_md5sum $encfile
  174. echo $(wc -c $encfile)
  175. ffmpeg $8 $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
  176. -f $dec_fmt -y $tdecfile || return
  177. do_md5sum $decfile
  178. tests/tiny_psnr${HOSTEXECSUF} $srcfile $decfile $cmp_unit $cmp_shift
  179. }
  180. transcode(){
  181. src_fmt=$1
  182. srcfile=$2
  183. enc_fmt=$3
  184. enc_opt=$4
  185. final_decode=$5
  186. encfile="${outdir}/${test}.${enc_fmt}"
  187. test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
  188. tsrcfile=$(target_path $srcfile)
  189. tencfile=$(target_path $encfile)
  190. ffmpeg -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
  191. -f $enc_fmt -y $tencfile || return
  192. do_md5sum $encfile
  193. echo $(wc -c $encfile)
  194. ffmpeg $DEC_OPTS -i $encfile $ENC_OPTS $FLAGS $final_decode \
  195. -f framecrc - || return
  196. }
  197. stream_remux(){
  198. src_fmt=$1
  199. srcfile=$2
  200. enc_fmt=$3
  201. stream_maps=$4
  202. final_decode=$5
  203. encfile="${outdir}/${test}.${enc_fmt}"
  204. test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
  205. tsrcfile=$(target_path $srcfile)
  206. tencfile=$(target_path $encfile)
  207. ffmpeg -f $src_fmt -i $tsrcfile $stream_maps -codec copy $FLAGS \
  208. -f $enc_fmt -y $tencfile || return
  209. ffmpeg $DEC_OPTS -i $encfile $ENC_OPTS $FLAGS $final_decode \
  210. -f framecrc - || return
  211. }
  212. # FIXME: There is a certain duplication between the avconv-related helper
  213. # functions above and below that should be refactored.
  214. ffmpeg2="$target_exec ${target_path}/ffmpeg${PROGSUF}${EXECSUF}"
  215. raw_src="${target_path}/tests/vsynth1/%02d.pgm"
  216. pcm_src="${target_path}/tests/data/asynth1.sw"
  217. crcfile="tests/data/$test.lavf.crc"
  218. target_crcfile="${target_path}/$crcfile"
  219. [ "${V-0}" -gt 0 ] && echov=echov || echov=:
  220. echov(){
  221. echo "$@" >&3
  222. }
  223. AVCONV_OPTS="-nostdin -nostats -y -cpuflags $cpuflags"
  224. COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
  225. DEC_OPTS="$COMMON_OPTS -threads $threads"
  226. ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
  227. run_avconv(){
  228. $echov $ffmpeg2 $AVCONV_OPTS $*
  229. $ffmpeg2 $AVCONV_OPTS $*
  230. }
  231. do_avconv(){
  232. f="$1"
  233. shift
  234. set -- $* ${target_path}/$f
  235. run_avconv $*
  236. do_md5sum $f
  237. echo $(wc -c $f)
  238. }
  239. do_avconv_crc(){
  240. f="$1"
  241. shift
  242. run_avconv $* -f crc "$target_crcfile"
  243. echo "$f $(cat $crcfile)"
  244. }
  245. lavf_audio(){
  246. t="${test#lavf-}"
  247. outdir="tests/data/lavf"
  248. file=${outdir}/lavf.$t
  249. do_avconv $file $DEC_OPTS $1 -ar 44100 -f s16le -i $pcm_src "$ENC_OPTS -metadata title=lavftest" -t 1 -qscale 10 $2
  250. do_avconv_crc $file $DEC_OPTS $3 -i $target_path/$file
  251. }
  252. lavf_container(){
  253. t="${test#lavf-}"
  254. outdir="tests/data/lavf"
  255. file=${outdir}/lavf.$t
  256. do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le $1 -i $pcm_src "$ENC_OPTS -metadata title=lavftest" -b:a 64k -t 1 -qscale:v 10 $2
  257. test "$3" = "disable_crc" ||
  258. do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
  259. }
  260. lavf_container_attach() { lavf_container "" "$1 -attach ${raw_src%/*}/00.pgm -metadata:s:t mimetype=image/x-portable-greymap"; }
  261. lavf_container_timecode_nodrop() { lavf_container "" "$1 -timecode 02:56:14:13"; }
  262. lavf_container_timecode_drop() { lavf_container "" "$1 -timecode 02:56:14.13 -r 30000/1001"; }
  263. lavf_container_timecode()
  264. {
  265. lavf_container_timecode_nodrop "$@"
  266. lavf_container_timecode_drop "$@"
  267. lavf_container "" "$1"
  268. }
  269. lavf_container_fate()
  270. {
  271. t="${test#lavf-fate-}"
  272. outdir="tests/data/lavf-fate"
  273. file=${outdir}/lavf.$t
  274. input="${target_samples}/$1"
  275. do_avconv $file $DEC_OPTS $2 -i "$input" "$ENC_OPTS -metadata title=lavftest" -vcodec copy -acodec copy
  276. do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
  277. }
  278. lavf_image(){
  279. t="${test#lavf-}"
  280. outdir="tests/data/images/$t"
  281. mkdir -p "$outdir"
  282. file=${outdir}/%02d.$t
  283. run_avconv $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $1 "$ENC_OPTS -metadata title=lavftest" -frames 13 -y -qscale 10 $target_path/$file
  284. do_md5sum ${outdir}/02.$t
  285. do_avconv_crc $file $DEC_OPTS $2 -i $target_path/$file $2
  286. echo $(wc -c ${outdir}/02.$t)
  287. }
  288. lavf_image2pipe(){
  289. t="${test#lavf-}"
  290. t="${t%pipe}"
  291. outdir="tests/data/lavf"
  292. file=${outdir}/${t}pipe.$t
  293. do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src -f image2pipe "$ENC_OPTS -metadata title=lavftest" -t 1 -qscale 10
  294. do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
  295. }
  296. lavf_video(){
  297. t="${test#lavf-}"
  298. outdir="tests/data/lavf"
  299. file=${outdir}/lavf.$t
  300. do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src "$ENC_OPTS -metadata title=lavftest" -t 1 -qscale 10 $1 $2
  301. do_avconv_crc $file $DEC_OPTS -i $target_path/$file $1
  302. }
  303. refcmp_metadata(){
  304. refcmp=$1
  305. pixfmt=$2
  306. fuzz=${3:-0.001}
  307. ffmpeg $FLAGS $ENC_OPTS \
  308. -lavfi "testsrc2=size=300x200:rate=1:duration=5,format=${pixfmt},split[ref][tmp];[tmp]avgblur=4[enc];[enc][ref]${refcmp},metadata=print:file=-" \
  309. -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
  310. }
  311. pixfmt_conversion(){
  312. conversion="${test#pixfmt-}"
  313. outdir="tests/data/pixfmt"
  314. raw_dst="$outdir/$conversion.out.yuv"
  315. file=${outdir}/${conversion}.yuv
  316. run_avconv $DEC_OPTS -r 1 -f image2 -c:v pgmyuv -i $raw_src \
  317. $ENC_OPTS -f rawvideo -t 1 -s 352x288 -pix_fmt $conversion $target_path/$raw_dst
  318. do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $conversion -i $target_path/$raw_dst \
  319. $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
  320. }
  321. video_filter(){
  322. filters=$1
  323. shift
  324. label=${test#filter-}
  325. raw_src="${target_path}/tests/vsynth1/%02d.pgm"
  326. printf '%-20s' $label
  327. ffmpeg $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
  328. $FLAGS $ENC_OPTS -vf "$filters" -vcodec rawvideo -frames:v 5 $* -f nut md5:
  329. }
  330. pixfmts(){
  331. filter=${test#filter-pixfmts-}
  332. filter=${filter%_*}
  333. filter_args=$1
  334. prefilter_chain=$2
  335. nframes=${3:-1}
  336. showfiltfmts="$target_exec $target_path/libavfilter/tests/filtfmts${EXECSUF}"
  337. scale_exclude_fmts=${outfile}_scale_exclude_fmts
  338. scale_in_fmts=${outfile}_scale_in_fmts
  339. scale_out_fmts=${outfile}_scale_out_fmts
  340. in_fmts=${outfile}_in_fmts
  341. # exclude pixel formats which are not supported as input
  342. $showfiltfmts scale | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_in_fmts
  343. $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_out_fmts
  344. comm -12 $scale_in_fmts $scale_out_fmts >$scale_exclude_fmts
  345. $showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$in_fmts
  346. pix_fmts=$(comm -12 $scale_exclude_fmts $in_fmts)
  347. outertest=$test
  348. for pix_fmt in $pix_fmts; do
  349. test=$pix_fmt
  350. video_filter "${prefilter_chain}format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt -frames:v $nframes
  351. done
  352. rm $in_fmts $scale_in_fmts $scale_out_fmts $scale_exclude_fmts
  353. test=$outertest
  354. }
  355. gapless(){
  356. sample=$(target_path $1)
  357. extra_args=$2
  358. decfile1="${outdir}/${test}.out-1"
  359. decfile2="${outdir}/${test}.out-2"
  360. decfile3="${outdir}/${test}.out-3"
  361. cleanfiles="$cleanfiles $decfile1 $decfile2 $decfile3"
  362. # test packet data
  363. ffmpeg $extra_args -i "$sample" -bitexact -c:a copy -f framecrc -y $decfile1
  364. do_md5sum $decfile1
  365. # test decoded (and cut) data
  366. ffmpeg $extra_args -i "$sample" -bitexact -f wav md5:
  367. # the same as above again, with seeking to the start
  368. ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -bitexact -c:a copy -f framecrc -y $decfile2
  369. do_md5sum $decfile2
  370. ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -bitexact -f wav md5:
  371. # test packet data, with seeking to a specific position
  372. ffmpeg $extra_args -ss 5 -seek_timestamp 1 -i "$sample" -bitexact -c:a copy -f framecrc -y $decfile3
  373. do_md5sum $decfile3
  374. }
  375. gaplessenc(){
  376. sample=$(target_path $1)
  377. format=$2
  378. codec=$3
  379. file1="${outdir}/${test}.out-1"
  380. cleanfiles="$cleanfiles $file1"
  381. # test data after reencoding
  382. ffmpeg -i "$sample" -bitexact -map 0:a -c:a $codec -f $format -y "$file1"
  383. probegaplessinfo "$file1"
  384. }
  385. audio_match(){
  386. sample=$(target_path $1)
  387. trefile=$(target_path $2)
  388. extra_args=$3
  389. decfile="${outdir}/${test}.wav"
  390. cleanfiles="$cleanfiles $decfile"
  391. ffmpeg -i "$sample" -bitexact $extra_args -y $decfile
  392. tests/audiomatch${HOSTEXECSUF} $decfile $trefile
  393. }
  394. concat(){
  395. template=$1
  396. sample=$2
  397. mode=$3
  398. extra_args=$4
  399. concatfile="${outdir}/${test}.ffconcat"
  400. packetfile="${outdir}/${test}.ffprobe"
  401. cleanfiles="$concatfile $packetfile"
  402. awk "{gsub(/%SRCFILE%/, \"$sample\"); print}" $template > $concatfile
  403. if [ "$mode" = "md5" ]; then
  404. run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_streams -show_packets -v 0 -fflags keepside -safe 0 $extra_args $concatfile | tr -d '\r' > $packetfile
  405. do_md5sum $packetfile
  406. else
  407. run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_streams -show_packets -v 0 -of compact=p=0:nk=1 -fflags keepside -safe 0 $extra_args $concatfile
  408. fi
  409. }
  410. null(){
  411. :
  412. }
  413. # Disable globbing: command arguments may contain globbing characters and
  414. # must be kept verbatim
  415. set -f
  416. exec 3>&2
  417. eval $command >"$outfile" 2>$errfile
  418. err=$?
  419. if [ $err -gt 128 ]; then
  420. sig=$(kill -l $err 2>/dev/null)
  421. test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
  422. fi
  423. if test -e "$ref" || test $cmp = "oneline" || test $cmp = "null" || test $cmp = "grep" ; then
  424. case $cmp in
  425. diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
  426. rawdiff)diff -u "$ref" "$outfile" >$cmpfile ;;
  427. oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
  428. stddev) stddev "$ref" "$outfile" >$cmpfile ;;
  429. oneline)oneline "$ref" "$outfile" >$cmpfile ;;
  430. grep) grep "$ref" "$errfile" >$cmpfile ;;
  431. null) cat "$outfile" >$cmpfile ;;
  432. esac
  433. cmperr=$?
  434. test $err = 0 && err=$cmperr
  435. if [ "$report_type" = "ignore" ]; then
  436. test $err = 0 || echo "IGNORE\t${test}" && err=0 && unset sig
  437. else
  438. test $err = 0 || cat $cmpfile
  439. fi
  440. else
  441. echo "reference file '$ref' not found"
  442. err=1
  443. fi
  444. if [ $err -eq 0 ] && test $report_type = "standard" ; then
  445. unset cmpo erro
  446. else
  447. cmpo="$($base64 <$cmpfile)"
  448. erro="$($base64 <$errfile)"
  449. fi
  450. echo "${test}:${sig:-$err}:$cmpo:$erro" >$repfile
  451. if test $err != 0 && test $gen != "no" ; then
  452. echo "GEN $ref"
  453. cp -f "$outfile" "$ref"
  454. err=$?
  455. fi
  456. if test $err = 0; then
  457. if test $keep = 0; then
  458. rm -f $outfile $errfile $cmpfile $cleanfiles
  459. fi
  460. elif test $gen = "no"; then
  461. echo "Test $test failed. Look at $errfile for details."
  462. test "${V:-0}" -gt 0 && cat $errfile
  463. else
  464. echo "Updating reference failed, possibly no output file was generated."
  465. fi
  466. exit $err