Ensures that external symbols in the built static libraries either have correct namespace prefixes or are on a known list of exceptions.
Does not run on Windows, because headers there introduce additional global symbols which would cause this test to fail unhelpfully. --- Now without exceptions and disabled on Windows. Requires <https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-January/275452.html> from Andreas applied beforehand to fix namespace problems in swscale. Does anyone know a cleaner way of filtering out Windows for testing? It could go inside the ALLYES if there were a CONFIG_ option matching it, but as far as I can tell there isn't. Thanks, - Mark tests/Makefile | 1 + tests/fate/namespace.mak | 26 ++++++++++++++++++++++++++ tests/fate/namespace.sh | 18 ++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/fate/namespace.mak create mode 100755 tests/fate/namespace.sh diff --git a/tests/Makefile b/tests/Makefile index 7844901e53..94057eb81d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -173,6 +173,7 @@ include $(SRC_PATH)/tests/fate/mpeg4.mak include $(SRC_PATH)/tests/fate/mpegps.mak include $(SRC_PATH)/tests/fate/mpegts.mak include $(SRC_PATH)/tests/fate/mxf.mak +include $(SRC_PATH)/tests/fate/namespace.mak include $(SRC_PATH)/tests/fate/opus.mak include $(SRC_PATH)/tests/fate/pcm.mak include $(SRC_PATH)/tests/fate/pixfmt.mak diff --git a/tests/fate/namespace.mak b/tests/fate/namespace.mak new file mode 100644 index 0000000000..2c5e192ea5 --- /dev/null +++ b/tests/fate/namespace.mak @@ -0,0 +1,26 @@ + +# These tests are disabled on Windows, because headers there additional +# global symbols which would cause them to fail unhelpfully. +ifneq ($(HAVE_WINDOWS_H),yes) + +define FATE_NAMESPACE +# (library_name, config_option) +FATE_NAMESPACE-$(call ALLYES, STATIC $(2)) += fate-namespace-$(1) +fate-namespace-$(1): lib$(1)/$(LIBPREF)$(1)$(LIBSUF) +fate-namespace-$(1): CMD = runlocal fate/namespace.sh "$(NM_CMD) -P lib$(1)/$(LIBPREF)$(1)$(LIBSUF)" +fate-namespace-$(1): CMP = null +endef + +$(eval $(call FATE_NAMESPACE,avutil, AVUTIL)) +$(eval $(call FATE_NAMESPACE,avcodec, AVCODEC)) +$(eval $(call FATE_NAMESPACE,avformat, AVFORMAT)) +$(eval $(call FATE_NAMESPACE,avfilter, AVFILTER)) +$(eval $(call FATE_NAMESPACE,avdevice, AVDEVICE)) +$(eval $(call FATE_NAMESPACE,swscale, SWSCALE)) +$(eval $(call FATE_NAMESPACE,swresample, SWRESAMPLE)) +$(eval $(call FATE_NAMESPACE,postproc, POSTPROC)) + +FATE += $(FATE_NAMESPACE-yes) +fate-namespace: $(FATE_NAMESPACE-yes) + +endif diff --git a/tests/fate/namespace.sh b/tests/fate/namespace.sh new file mode 100755 index 0000000000..9a6df9783f --- /dev/null +++ b/tests/fate/namespace.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if $1 | + grep ' [TDBR] ' | # Filter to all global text/(ro)data/bss symbols. + grep -v '^ff_' | # Internal-only globals. + grep -v '^av' | # libav* external API. + grep -v '^sws' | # libswscale external API. + grep -v '^swr' | # libswresample external API. + grep -v '^\(postproc\|pp\)_' | # libpostproc external API. + grep -v '^\(ffio\|ffurl\)_' | # libavformat internal ffio/ffurl APIs. + grep -v '^_[A-Z_]' | # Reserved symbols added by the implementation. + grep '^[A-Za-z0-9_]* ' # Only consider normal symbol names. +then + # Any output is an error. + exit 1 +else + exit 0 +fi -- 2.29.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".