[09/20] tests: Move streamed_images() to fate-run.sh

Message ID 20180920084729.4523-10-diego@biurrun.de
State New
Headers show
Series
  • [01/20] tests: Use more consistent names for tests
Related show

Commit Message

Diego Biurrun Sept. 20, 2018, 8:47 a.m.
---
 tests/fate-run.sh        | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/fate/avformat.mak  | 17 +++++++++++-----
 tests/lavf-regression.sh | 20 -------------------
 tests/ref/lavf/pbmpipe   |  6 +++---
 tests/ref/lavf/pgmpipe   |  6 +++---
 tests/ref/lavf/ppmpipe   |  6 +++---
 6 files changed, 72 insertions(+), 34 deletions(-)

Patch

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 8de749d4a7..41cb2be1fb 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -152,6 +152,57 @@  enc_dec(){
     tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
 }
 
+datadir="tests/data"
+target_datadir="${target_path}/${datadir}"
+
+this="$test.lavf"
+
+# various files
+avconv2="$target_exec ${target_path}/avconv"
+raw_src="${target_path}/tests/vsynth1/%02d.pgm"
+raw_dst="$datadir/$this.out.yuv"
+pcm_src="$target_datadir/asynth1.sw"
+crcfile="$datadir/$this.crc"
+target_crcfile="$target_datadir/$this.crc"
+
+echov(){
+    echo "$@" >&3
+}
+
+AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
+COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
+DEC_OPTS="$COMMON_OPTS -threads $threads"
+ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
+
+run_avconv(){
+    $echov $avconv2 $AVCONV_OPTS $*
+    $avconv2 $AVCONV_OPTS $*
+}
+
+do_avconv(){
+    f="$1"
+    shift
+    set -- $* ${target_path}/$f
+    run_avconv $*
+    do_md5sum $f
+    echo $(wc -c $f)
+}
+
+do_avconv_crc(){
+    f="$1"
+    shift
+    run_avconv $* -f crc "$target_crcfile"
+    echo "$f $(cat $crcfile)"
+}
+
+streamed_images(){
+    t="${test#lavf-}"
+    t="${t%pipe}"
+    file=${outdir}/${t}pipe.$t
+    do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src -f image2pipe $ENC_OPTS -t 1 -qscale 10
+    do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
+}
+
 lavftest(){
     t="${test#lavf-}"
     ref=${base}/ref/lavf/$t
diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak
index 6ffcde3f2b..51a9e2acaf 100644
--- a/tests/fate/avformat.mak
+++ b/tests/fate/avformat.mak
@@ -20,13 +20,10 @@  FATE_LAVF-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF_D10 MXF)        += mxf_d10
 FATE_LAVF-$(call ENCDEC2, MPEG4,      MP2,       NUT)                += nut
 FATE_LAVF-$(call ENCDEC,  FLAC,                  OGG)                += ogg
 FATE_LAVF-$(call ENCDEC,  PAM,                   IMAGE2)             += pam
-FATE_LAVF-$(call ENCDEC,  PBM,                   IMAGE2PIPE)         += pbmpipe
 FATE_LAVF-$(call ENCDEC,  PCX,                   IMAGE2)             += pcx
 FATE_LAVF-$(call ENCDEC,  PGM,                   IMAGE2)             += pgm
-FATE_LAVF-$(call ENCDEC,  PGM,                   IMAGE2PIPE)         += pgmpipe
 FATE_LAVF-$(call ENCDEC,  PNG,                   IMAGE2)             += png
 FATE_LAVF-$(call ENCDEC,  PPM,                   IMAGE2)             += ppm
-FATE_LAVF-$(call ENCDEC,  PPM,                   IMAGE2PIPE)         += ppmpipe
 FATE_LAVF-$(call ENCMUX,  RV10 AC3_FIXED,        RM)                 += rm
 FATE_LAVF-$(call ENCDEC,  PCM_U8,                RSO)                += rso
 FATE_LAVF-$(call ENCDEC,  SGI,                   IMAGE2)             += sgi
@@ -42,11 +39,21 @@  FATE_LAVF-$(call ENCDEC,  PCM_S16LE,             WAV)                += wav
 FATE_LAVF-$(call ENCDEC,  XWD,                   IMAGE2)             += xwd
 FATE_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER)                               += y4m
 
+FATE_LAVF_PIPE-$(call ENCDEC,  PBM,              IMAGE2PIPE)         += pbmpipe
+FATE_LAVF_PIPE-$(call ENCDEC,  PGM,              IMAGE2PIPE)         += pgmpipe
+FATE_LAVF_PIPE-$(call ENCDEC,  PPM,              IMAGE2PIPE)         += ppmpipe
+
+FATE_LAVF_PIPE = $(FATE_LAVF_PIPE-yes:%=fate-lavf-%)
+
+$(FATE_LAVF_PIPE): CMD = streamed_images
+$(FATE_LAVF_PIPE): REF = $(SRC_PATH)/tests/ref/lavf/$(@:fate-lavf-%=%)
+$(FATE_LAVF_PIPE): $(VREF)
+
 FATE_LAVF += $(FATE_LAVF-yes:%=fate-lavf-%)
 FATE_LAVF += fate-lavf-pixfmt
 
 $(FATE_LAVF): $(AREF) $(VREF)
 $(FATE_LAVF): CMD = lavftest
 
-FATE_AVCONV += $(FATE_LAVF)
-fate-lavf:     $(FATE_LAVF)
+FATE_AVCONV += $(FATE_LAVF) $(FATE_LAVF_PIPE)
+fate-lavf:     $(FATE_LAVF) $(FATE_LAVF_PIPE)
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
index c6fbf68c31..dd73476669 100755
--- a/tests/lavf-regression.sh
+++ b/tests/lavf-regression.sh
@@ -18,14 +18,6 @@  do_lavf()
     do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
 }
 
-do_streamed_images()
-{
-    t="${test%pipe}"
-    file=${outdir}${t}pipe.$t
-    do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src -f image2pipe $ENC_OPTS -t 1 -qscale 10
-    do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
-}
-
 do_image_formats()
 {
     outdir="$datadir/images/$test/"
@@ -110,18 +102,6 @@  fi
 #do_avconv $file -t 1 -qscale 10 -f image2 -c:v pgmyuv -i $raw_src
 #do_avconv_crc $file -i $target_path/$file
 
-if [ -n "$do_pbmpipe" ] ; then
-do_streamed_images
-fi
-
-if [ -n "$do_pgmpipe" ] ; then
-do_streamed_images
-fi
-
-if [ -n "$do_ppmpipe" ] ; then
-do_streamed_images
-fi
-
 if [ -n "$do_gif" ] ; then
 file=${outdir}lavf.gif
 do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
diff --git a/tests/ref/lavf/pbmpipe b/tests/ref/lavf/pbmpipe
index d1c56dbcf2..af1b36c22a 100644
--- a/tests/ref/lavf/pbmpipe
+++ b/tests/ref/lavf/pbmpipe
@@ -1,3 +1,3 @@ 
-8ced96f5b6b7362358199ae993b4ceb7 *./tests/data/fate/pbmpipe.pbm
-317075 ./tests/data/fate/pbmpipe.pbm
-./tests/data/fate/pbmpipe.pbm CRC=0xfae0a1ba
+8ced96f5b6b7362358199ae993b4ceb7 *tests/data/fate/pbmpipe.pbm
+317075 tests/data/fate/pbmpipe.pbm
+tests/data/fate/pbmpipe.pbm CRC=0xfae0a1ba
diff --git a/tests/ref/lavf/pgmpipe b/tests/ref/lavf/pgmpipe
index a6aa06134a..e4d897e472 100644
--- a/tests/ref/lavf/pgmpipe
+++ b/tests/ref/lavf/pgmpipe
@@ -1,3 +1,3 @@ 
-04e66c8e9e064c8310bd657ee559bd70 *./tests/data/fate/pgmpipe.pgm
-2534775 ./tests/data/fate/pgmpipe.pgm
-./tests/data/fate/pgmpipe.pgm CRC=0xadf48ba9
+04e66c8e9e064c8310bd657ee559bd70 *tests/data/fate/pgmpipe.pgm
+2534775 tests/data/fate/pgmpipe.pgm
+tests/data/fate/pgmpipe.pgm CRC=0xadf48ba9
diff --git a/tests/ref/lavf/ppmpipe b/tests/ref/lavf/ppmpipe
index 1d86ce4100..c7f8266415 100644
--- a/tests/ref/lavf/ppmpipe
+++ b/tests/ref/lavf/ppmpipe
@@ -1,3 +1,3 @@ 
-74f1f6651ad8f192a7b4c11c2b6c71e5 *./tests/data/fate/ppmpipe.ppm
-7603575 ./tests/data/fate/ppmpipe.ppm
-./tests/data/fate/ppmpipe.ppm CRC=0x87b3c15f
+74f1f6651ad8f192a7b4c11c2b6c71e5 *tests/data/fate/ppmpipe.ppm
+7603575 tests/data/fate/ppmpipe.ppm
+tests/data/fate/ppmpipe.ppm CRC=0x87b3c15f