From f531a1a4e8f5bbc66d6077efe3b4f90f76cc5f51 Mon Sep 17 00:00:00 2001 From: Tobias Rapp Date: Fri, 16 Apr 2021 10:46:41 +0200 Subject: [PATCH] fate/ffprobe: Verify ffprobe XML output against schema file Adds schema validation for ffprobe XML output so that updating the ffprobe.xsd file upon changes to ffprobe is not forgotten. This was suggested by Marton Balint in: http://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/278428.html The schema FATE test is only run if xmllint command is available. Signed-off-by: Tobias Rapp --- configure | 3 ++ tests/fate/ffprobe.mak | 6 ++++ tests/ref/fate/ffprobe_xsd | 57 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 tests/ref/fate/ffprobe_xsd diff --git a/configure b/configure index b3b8065188..2d2d125fd3 100755 --- a/configure +++ b/configure @@ -2370,6 +2370,7 @@ HAVE_LIST=" perl pod2man texi2html + xmllint zlib_gzip " @@ -6654,6 +6655,7 @@ disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && perl -v > /dev/null 2>&1 && enable perl || disable perl pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout +xmllint --version > /dev/null 2>&1 && enable xmllint || disable xmllint # check V4L2 codecs available in the API if enabled v4l2_m2m; then @@ -7417,6 +7419,7 @@ echo "perl enabled ${perl-no}" echo "pod2man enabled ${pod2man-no}" echo "makeinfo enabled ${makeinfo-no}" echo "makeinfo supports HTML ${makeinfo_html-no}" +echo "xmllint enabled ${xmllint-no}" test -n "$random_seed" && echo "random seed ${random_seed}" echo diff --git a/tests/fate/ffprobe.mak b/tests/fate/ffprobe.mak index c867bebf41..d2abe8a11e 100644 --- a/tests/fate/ffprobe.mak +++ b/tests/fate/ffprobe.mak @@ -29,6 +29,12 @@ FATE_FFPROBE-$(CONFIG_AVDEVICE) += fate-ffprobe_xml fate-ffprobe_xml: $(FFPROBE_TEST_FILE) fate-ffprobe_xml: CMD = run $(FFPROBE_COMMAND) -of xml +FATE_FFPROBE_SCHEMA-$(CONFIG_AVDEVICE) += fate-ffprobe_xsd +fate-ffprobe_xsd: $(FFPROBE_TEST_FILE) +fate-ffprobe_xsd: CMD = run $(FFPROBE_COMMAND) -noprivate -of xml=q=1:x=1 | \ + xmllint --schema $(SRC_PATH)/doc/ffprobe.xsd - + +FATE_FFPROBE-$(HAVE_XMLLINT) += $(FATE_FFPROBE_SCHEMA-yes) FATE_FFPROBE += $(FATE_FFPROBE-yes) fate-ffprobe: $(FATE_FFPROBE) diff --git a/tests/ref/fate/ffprobe_xsd b/tests/ref/fate/ffprobe_xsd new file mode 100644 index 0000000000..cb3413eee5 --- /dev/null +++ b/tests/ref/fate/ffprobe_xsd @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +