[FFmpeg-devel] [PATCH 5/5] tests: add coverage for libavfilter's format negotiation

Nicolas George george at nsup.org
Wed Mar 2 20:40:23 EET 2022


Signed-off-by: Nicolas George <george at nsup.org>
---
 tests/Makefile                               |  1 +
 tests/fate-run.sh                            |  4 ++++
 tests/fate/libavfilter.mak                   |  9 +++++++++
 tests/ref/fate/libavfilter-negotiation-alpha | 20 ++++++++++++++++++++
 4 files changed, 34 insertions(+)
 create mode 100644 tests/fate/libavfilter.mak
 create mode 100644 tests/ref/fate/libavfilter-negotiation-alpha


This is not to be the only test, I intend to cover all the logic in
pick_format() and the logic in swap_*().

But I would rather have you have a quick look at the makefile hackery
before writing too many tests that would need changing.


diff --git a/tests/Makefile b/tests/Makefile
index c4c31ae871..2bff4b339d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -157,6 +157,7 @@ include $(SRC_PATH)/tests/fate/imf.mak
 include $(SRC_PATH)/tests/fate/indeo.mak
 include $(SRC_PATH)/tests/fate/libavcodec.mak
 include $(SRC_PATH)/tests/fate/libavdevice.mak
+include $(SRC_PATH)/tests/fate/libavfilter.mak
 include $(SRC_PATH)/tests/fate/libavformat.mak
 include $(SRC_PATH)/tests/fate/libavutil.mak
 include $(SRC_PATH)/tests/fate/libswresample.mak
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index fbfc0a925d..82d40f5ebc 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -509,6 +509,10 @@ venc_data(){
     run tools/venc_data_dump${EXECSUF} ${file} ${stream} ${frames} ${threads} ${thread_type}
 }
 
+lavfi_dump(){
+    run ffmpeg${PROGSUF}${EXECSUF} -lavfi_dump -lavfi "$@" -f null -
+}
+
 null(){
     :
 }
diff --git a/tests/fate/libavfilter.mak b/tests/fate/libavfilter.mak
new file mode 100644
index 0000000000..692f1d4960
--- /dev/null
+++ b/tests/fate/libavfilter.mak
@@ -0,0 +1,9 @@
+# avfiltergraph.c : pick_format() : video / don't lose alpha
+FATE_LIBAVFILTER_NEGOTIATION_VIDEO += fate-libavfilter-negotiation-alpha
+fate-libavfilter-negotiation-alpha: CMD = lavfi_dump testsrc2=d=0,format=rgba,scale,format=yuv444p/yuva444p
+
+FATE_LIBAVFILTER-$(call ALLYES, TESTSRC2_FILTER FORMAT_FILTER SCALE_FILTER) += $(FATE_LIBAVFILTER_NEGOTIATION_VIDEO)
+
+fate-libavfilter: $(FATE_LIBAVFILTER) $(FATE_LIBAVFILTER-yes)
+fate-libavfilter-negotiation: $(FATE_LIBAVFILTER_NEGOTIATION) $(FATE_LIBAVFILTER_NEGOTIATION-yes)
+FATE_FFMPEG += $(FATE_LIBAVFILTER-yes)
diff --git a/tests/ref/fate/libavfilter-negotiation-alpha b/tests/ref/fate/libavfilter-negotiation-alpha
new file mode 100644
index 0000000000..00175f65cb
--- /dev/null
+++ b/tests/ref/fate/libavfilter-negotiation-alpha
@@ -0,0 +1,20 @@
+Dump of complex filter graph #0:
+
+Filter: Parsed_testsrc2_0 (testsrc2)
+  out 0: default → Parsed_format_1.0:default [320x240 1:1 rgba]
+
+Filter: Parsed_format_1 (format)
+  in 0: default ← Parsed_testsrc2_0.0:default [320x240 1:1 rgba]
+  out 0: default → Parsed_scale_2.0:default [320x240 1:1 rgba]
+
+Filter: Parsed_scale_2 (scale)
+  in 0: default ← Parsed_format_1.0:default [320x240 1:1 rgba]
+  out 0: default → Parsed_format_3.0:default [320x240 1:1 yuva444p]
+
+Filter: Parsed_format_3 (format)
+  in 0: default ← Parsed_scale_2.0:default [320x240 1:1 yuva444p]
+  out 0: default → out_0_0.0:default [320x240 1:1 yuva444p]
+
+Filter: out_0_0 (buffersink)
+  in 0: default ← Parsed_format_3.0:default [320x240 1:1 yuva444p]
+
-- 
2.34.1



More information about the ffmpeg-devel mailing list