[FFmpeg-devel] [PATCH 5/5] fate: Add test for namespace prefixes in libraries
Mark Thompson
sw at jkqxz.net
Sun Jun 24 21:25:39 EEST 2018
Ensures that there are no external symbols in the built static libraries
which do not have suitable namespace prefixes.
---
Not sure whether this will actually work on all platforms? (Only tested with Linux/binutils.)
tests/Makefile | 1 +
tests/fate/namespace.mak | 20 ++++++++++++++++++++
tests/fate/namespace.sh | 17 +++++++++++++++++
3 files changed, 38 insertions(+)
create mode 100644 tests/fate/namespace.mak
create mode 100755 tests/fate/namespace.sh
diff --git a/tests/Makefile b/tests/Makefile
index e564279b0a..f09c57ac0f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -154,6 +154,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/pixlet.mak
diff --git a/tests/fate/namespace.mak b/tests/fate/namespace.mak
new file mode 100644
index 0000000000..84a1fb17c6
--- /dev/null
+++ b/tests/fate/namespace.mak
@@ -0,0 +1,20 @@
+
+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) 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)
diff --git a/tests/fate/namespace.sh b/tests/fate/namespace.sh
new file mode 100755
index 0000000000..5d43cc2916
--- /dev/null
+++ b/tests/fate/namespace.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if $1 |
+ grep ' [TDB] ' | # Filter to all global text/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\)_' | # Special-case internal ffio/ffurl APIs.
+ grep -v ' rgb2rgb_init_x86\| rgb\(12\|15\|16\|24\|32\|48\|64\)to' # Special-case RGB conversion functions in libswscale.
+then
+ # Any output is an error.
+ exit 1
+else
+ exit 0
+fi
--
2.17.1
More information about the ffmpeg-devel
mailing list