[11/11] tests: Add a convenience function for video-only lavf tests

Message ID 20190204104732.2779-12-diego@biurrun.de
State New
Headers show
Series
  • [01/11] build: Rename OBJDIRS variable to OUTDIRS
Related show

Commit Message

Diego Biurrun Feb. 4, 2019, 10:47 a.m.
Rename a test in the process for consistency and simplicity and
remove the remnants of the now-unused lavf regression test scripts.
---
 tests/Makefile                             |  2 +-
 tests/fate-run.sh                          |  8 ++--
 tests/fate/avformat.mak                    | 10 -----
 tests/fate/lavf-video.mak                  | 13 ++++++
 tests/fate/seek.mak                        |  4 +-
 tests/lavf-regression.sh                   | 30 -------------
 tests/ref/lavf/gif                         |  6 +--
 tests/ref/lavf/y4m                         |  3 ++
 tests/ref/lavf/yuv4mpeg                    |  3 --
 tests/ref/seek/{lavf-yuv4mpeg => lavf-y4m} |  0
 tests/regression-funcs.sh                  | 67 ------------------------------
 11 files changed, 27 insertions(+), 119 deletions(-)
 delete mode 100644 tests/fate/avformat.mak
 create mode 100644 tests/fate/lavf-video.mak
 delete mode 100755 tests/lavf-regression.sh
 create mode 100644 tests/ref/lavf/y4m
 delete mode 100644 tests/ref/lavf/yuv4mpeg
 rename tests/ref/seek/{lavf-yuv4mpeg => lavf-y4m} (100%)
 delete mode 100755 tests/regression-funcs.sh

Patch

diff --git a/tests/Makefile b/tests/Makefile
index 8a28cbf58a..76e751c7fa 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -60,11 +60,11 @@  PARSERDEMDEC       = $(call ALLYES, $(1)_PARSER $(2)_DEMUXER $(3)_DECODER)
 include $(SRC_PATH)/tests/fate/acodec.mak
 include $(SRC_PATH)/tests/fate/vcodec.mak
 
-include $(SRC_PATH)/tests/fate/avformat.mak
 include $(SRC_PATH)/tests/fate/lavf-audio.mak
 include $(SRC_PATH)/tests/fate/lavf-container.mak
 include $(SRC_PATH)/tests/fate/lavf-image.mak
 include $(SRC_PATH)/tests/fate/lavf-image2pipe.mak
+include $(SRC_PATH)/tests/fate/lavf-video.mak
 include $(SRC_PATH)/tests/fate/seek.mak
 
 include $(SRC_PATH)/tests/fate/aac.mak
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index c8ac6a1385..b613678a92 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -226,10 +226,12 @@  lavf_image2pipe(){
     do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
 }
 
-lavftest(){
+lavf_video(){
     t="${test#lavf-}"
-    ref=${base}/ref/lavf/$t
-    ${base}/lavf-regression.sh $t lavf tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
+    outdir="tests/data/lavf"
+    file=${outdir}/lavf.$t
+    do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 $1
+    do_avconv_crc $file $DEC_OPTS -i $target_path/$file $1
 }
 
 pixfmt_conversion(){
diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak
deleted file mode 100644
index 7c984e4fcd..0000000000
--- a/tests/fate/avformat.mak
+++ /dev/null
@@ -1,10 +0,0 @@ 
-FATE_LAVF-$(call ENCDEC,  GIF,                   IMAGE2)             += gif
-FATE_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER)                               += yuv4mpeg
-
-FATE_LAVF += $(FATE_LAVF-yes:%=fate-lavf-%)
-
-$(FATE_LAVF): $(AREF) $(VREF)
-$(FATE_LAVF): CMD = lavftest
-
-FATE_AVCONV += $(FATE_LAVF)
-fate-lavf:     $(FATE_LAVF)
diff --git a/tests/fate/lavf-video.mak b/tests/fate/lavf-video.mak
new file mode 100644
index 0000000000..d964e91404
--- /dev/null
+++ b/tests/fate/lavf-video.mak
@@ -0,0 +1,13 @@ 
+FATE_LAVF_VIDEO-$(call ENCDEC,  GIF,        IMAGE2)             += gif
+FATE_LAVF_VIDEO-$(CONFIG_YUV4MPEGPIPE_MUXER)                    += y4m
+
+FATE_LAVF_VIDEO = $(FATE_LAVF_VIDEO-yes:%=fate-lavf-%)
+
+$(FATE_LAVF_VIDEO): CMD = lavf_video
+$(FATE_LAVF_VIDEO): REF = $(SRC_PATH)/tests/ref/lavf/$(@:fate-lavf-%=%)
+$(FATE_LAVF_VIDEO): $(VREF)
+
+fate-lavf-gif: CMD = lavf_video "-pix_fmt rgb24"
+
+FATE_AVCONV += $(FATE_LAVF_VIDEO)
+fate-lavf-video fate-lavf: $(FATE_LAVF_VIDEO)
diff --git a/tests/fate/seek.mak b/tests/fate/seek.mak
index 937d284a15..c7e56f811a 100644
--- a/tests/fate/seek.mak
+++ b/tests/fate/seek.mak
@@ -178,7 +178,7 @@  FATE_SEEK_LAVF-$(call ENCDEC,  TIFF,                  IMAGE2)      += tiff
 FATE_SEEK_LAVF-$(call ENCDEC2, MPEG2VIDEO, MP2,       MPEGTS)      += ts
 FATE_SEEK_LAVF-$(call ENCDEC,  PCM_U8,                VOC)         += voc
 FATE_SEEK_LAVF-$(call ENCDEC,  PCM_S16LE,             WAV)         += wav
-FATE_SEEK_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER)                        += yuv4mpeg
+FATE_SEEK_LAVF-$(CONFIG_YUV4MPEGPIPE_MUXER)                        += y4m
 
 fate-seek-lavf-aiff:     SRC = lavf/lavf.aiff
 fate-seek-lavf-al:       SRC = lavf/lavf.al
@@ -214,7 +214,7 @@  fate-seek-lavf-tiff:     SRC = images/tiff/%02d.tiff
 fate-seek-lavf-ts:       SRC = lavf/lavf.ts
 fate-seek-lavf-voc:      SRC = lavf/lavf.voc
 fate-seek-lavf-wav:      SRC = lavf/lavf.wav
-fate-seek-lavf-yuv4mpeg: SRC = lavf/lavf.y4m
+fate-seek-lavf-y4m:      SRC = lavf/lavf.y4m
 
 FATE_SEEK += $(FATE_SEEK_LAVF-yes:%=fate-seek-lavf-%)
 
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
deleted file mode 100755
index 4e346e2c07..0000000000
--- a/tests/lavf-regression.sh
+++ /dev/null
@@ -1,30 +0,0 @@ 
-#!/bin/sh
-#
-# automatic regression test for libavformat
-#
-#
-#set -x
-
-set -e
-
-. $(dirname $0)/regression-funcs.sh
-
-eval do_$test=y
-
-# streamed images
-# mjpeg
-#file=${outfile}lavf.mjpeg
-#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_gif" ] ; then
-file=${outfile}lavf.gif
-do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
-do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
-fi
-
-if [ -n "$do_yuv4mpeg" ] ; then
-file=${outfile}lavf.y4m
-do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
-do_avconv_crc $file -i $target_path/$file
-fi
diff --git a/tests/ref/lavf/gif b/tests/ref/lavf/gif
index 4a4ebfb9dc..f28dc555f6 100644
--- a/tests/ref/lavf/gif
+++ b/tests/ref/lavf/gif
@@ -1,3 +1,3 @@ 
-e6089fd4ef3b9df44090ab3650bdd810 *./tests/data/lavf/lavf.gif
-2906401 ./tests/data/lavf/lavf.gif
-./tests/data/lavf/lavf.gif CRC=0xe5605ff6
+e6089fd4ef3b9df44090ab3650bdd810 *tests/data/lavf/lavf.gif
+2906401 tests/data/lavf/lavf.gif
+tests/data/lavf/lavf.gif CRC=0xe5605ff6
diff --git a/tests/ref/lavf/y4m b/tests/ref/lavf/y4m
new file mode 100644
index 0000000000..82c7087673
--- /dev/null
+++ b/tests/ref/lavf/y4m
@@ -0,0 +1,3 @@ 
+ec8178cb152f9cdbfd9cb724d977db2e *tests/data/lavf/lavf.y4m
+3801808 tests/data/lavf/lavf.y4m
+tests/data/lavf/lavf.y4m CRC=0x0a941f26
diff --git a/tests/ref/lavf/yuv4mpeg b/tests/ref/lavf/yuv4mpeg
deleted file mode 100644
index 367b37621d..0000000000
--- a/tests/ref/lavf/yuv4mpeg
+++ /dev/null
@@ -1,3 +0,0 @@ 
-ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
-3801808 ./tests/data/lavf/lavf.y4m
-./tests/data/lavf/lavf.y4m CRC=0x0a941f26
diff --git a/tests/ref/seek/lavf-yuv4mpeg b/tests/ref/seek/lavf-y4m
similarity index 100%
rename from tests/ref/seek/lavf-yuv4mpeg
rename to tests/ref/seek/lavf-y4m
diff --git a/tests/regression-funcs.sh b/tests/regression-funcs.sh
deleted file mode 100755
index fad2057a73..0000000000
--- a/tests/regression-funcs.sh
+++ /dev/null
@@ -1,67 +0,0 @@ 
-#!/bin/sh
-#
-# common regression functions for avconv
-#
-#
-
-test="${1#regtest-}"
-test_ref=$2
-raw_src_dir=$3
-target_exec=$4
-target_path=$5
-threads=${6:-1}
-cpuflags=${8:-all}
-
-datadir="./tests/data"
-target_datadir="${target_path}/${datadir}"
-
-this="$test.$test_ref"
-outfile="$datadir/$test_ref/"
-
-# various files
-avconv="$target_exec ${target_path}/avconv"
-raw_src="${target_path}/$raw_src_dir/%02d.pgm"
-raw_dst="$datadir/$this.out.yuv"
-pcm_src="$target_datadir/asynth1.sw"
-crcfile="$datadir/$this.crc"
-target_crcfile="$target_datadir/$this.crc"
-
-cleanfiles="$raw_dst $crcfile"
-trap 'rm -f -- $cleanfiles' EXIT
-
-[ "${V-0}" -gt 0 ] && echov=echov || echov=:
-
-echov(){
-    echo "$@" >&3
-}
-
-. $(dirname $0)/md5.sh
-
-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 $avconv $AVCONV_OPTS $*
-    $avconv $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)"
-}