diff mbox series

[FFmpeg-devel,06/13] fate/vbn, tests/fate-run: Delete intermediate VBN-files after tests

Message ID AS8PR01MB7944AB017D126939A0AFAF568FFD9@AS8PR01MB7944.eurprd01.prod.exchangelabs.com
State Accepted
Commit 26e51325d441693561dcf24bb491c3d7f15eea88
Headers show
Series [FFmpeg-devel,01/13] fate/qt: Fix test requirements | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt April 28, 2022, 11:28 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 tests/fate-run.sh  | 22 ++++++++++++++++++----
 tests/fate/vbn.mak | 24 ++----------------------
 2 files changed, 20 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index a96ff049b0..3c62246c8a 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -393,16 +393,30 @@  cmp_metadata(){
 }
 
 refcmp_metadata_files(){
-    refcmp=$1
-    pixfmt=$2
-    file1=$3
-    file2=$4
+    file1=$1
+    file2=$2
+    refcmp=$3
+    pixfmt=$4
     fuzz=${5:-0.001}
     ffmpeg -auto_conversion_filters $FLAGS -i $file1 $FLAGS -i $file2 $ENC_OPTS \
         -lavfi "[0:v]format=${pixfmt}[v0];[1:v]format=${pixfmt}[v1];[v0][v1]${refcmp},metadata=print:file=-" \
         -f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
 }
 
+refcmp_metadata_transcode(){
+    srcfile=$1
+    enc_opt=$2
+    enc_fmt=$3
+    enc_ext=$4
+    shift 4
+    encfile="${outdir}/${test}.${enc_ext}"
+    cleanfiles="$cleanfiles $encfile"
+    tsrcfile=$(target_path $srcfile)
+    tencfile=$(target_path $encfile)
+    ffmpeg $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS -y -f $enc_fmt $tencfile || return
+    refcmp_metadata_files $tencfile $tsrcfile "$@"
+}
+
 pixfmt_conversion(){
     conversion="${test#pixfmt-}"
     outdir="tests/data/pixfmt"
diff --git a/tests/fate/vbn.mak b/tests/fate/vbn.mak
index 6c3fe82c99..91ce3c9639 100644
--- a/tests/fate/vbn.mak
+++ b/tests/fate/vbn.mak
@@ -2,34 +2,14 @@  fate-vbn-%: VBN_FILE = tests/data/$(subst fate-vbn-,,$(@)).vbn
 fate-vbn-%: PIX_FMT = rgba
 fate-vbn-raw-rgb24: PIX_FMT = rgb24
 fate-vbn-%: SRC = $(TARGET_SAMPLES)/png1/lena-$(PIX_FMT).png
-fate-vbn-%: CMD = refcmp_metadata_files psnr $(PIX_FMT) $(VBN_FILE) $(SRC)
-
-fate-vbn-dxt1: tests/data/dxt1.vbn
-fate-vbn-dxt5: tests/data/dxt5.vbn
-fate-vbn-raw-rgba: tests/data/raw-rgba.vbn
-fate-vbn-raw-rgb24: tests/data/raw-rgb24.vbn
+fate-vbn-%: ENC_OPTS = -c:v vbn -format $(word 3,$(subst -, ,$(@)))
+fate-vbn-%: CMD = refcmp_metadata_transcode "$(SRC)" "$(ENC_OPTS)" image2 vbn psnr $(PIX_FMT)
 
 FATE_VBN += fate-vbn-dxt1
 FATE_VBN += fate-vbn-dxt5
 FATE_VBN += fate-vbn-raw-rgba
 FATE_VBN += fate-vbn-raw-rgb24
 
-tests/data/dxt1.vbn: TAG = GEN
-tests/data/dxt1.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt1 $(TARGET_PATH)/$@ -y 2>/dev/null
-
-tests/data/dxt5.vbn: TAG = GEN
-tests/data/dxt5.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format dxt5 $(TARGET_PATH)/$@ -y 2>/dev/null
-
-tests/data/raw-rgba.vbn: TAG = GEN
-tests/data/raw-rgba.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgba.png -nostdin -c:v vbn -format raw $(TARGET_PATH)/$@ -y 2>/dev/null
-
-tests/data/raw-rgb24.vbn: TAG = GEN
-tests/data/raw-rgb24.vbn: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
-	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< -nostdin -i $(TARGET_SAMPLES)/png1/lena-rgb24.png -nostdin -c:v vbn -format raw $(TARGET_PATH)/$@ -y 2>/dev/null
-
 FATE_VBN-$(call ENCDEC2, VBN, WRAPPED_AVFRAME PNG, IMAGE2,        \
                          PSNR_FILTER METADATA_FILTER SCALE_FILTER \
                          NULL_MUXER PIPE_PROTOCOL) += $(FATE_VBN)