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