[FFmpeg-devel] [PATCH v3 2/2] fate: Add test for namespace prefixes in libraries
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Tue Jan 26 00:23:46 EET 2021
Mark Thompson:
> Ensures that external symbols in the built static libraries either have
> correct namespace prefixes or are on a known list of exceptions.
> ---
> tests/Makefile | 1 +
> tests/fate/namespace.mak | 19 ++++++++++
> tests/fate/namespace.sh | 15 ++++++++
> tests/ref/fate/namespace-avcodec | 0
> tests/ref/fate/namespace-avdevice | 0
> tests/ref/fate/namespace-avfilter | 0
> tests/ref/fate/namespace-avformat | 0
> tests/ref/fate/namespace-avutil | 0
> tests/ref/fate/namespace-postproc | 0
> tests/ref/fate/namespace-swresample | 0
> tests/ref/fate/namespace-swscale | 58 +++++++++++++++++++++++++++++
> 11 files changed, 93 insertions(+)
> create mode 100644 tests/fate/namespace.mak
> create mode 100755 tests/fate/namespace.sh
> create mode 100644 tests/ref/fate/namespace-avcodec
> create mode 100644 tests/ref/fate/namespace-avdevice
> create mode 100644 tests/ref/fate/namespace-avfilter
> create mode 100644 tests/ref/fate/namespace-avformat
> create mode 100644 tests/ref/fate/namespace-avutil
> create mode 100644 tests/ref/fate/namespace-postproc
> create mode 100644 tests/ref/fate/namespace-swresample
> create mode 100644 tests/ref/fate/namespace-swscale
>
> 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..0021e7152d
> --- /dev/null
> +++ b/tests/fate/namespace.mak
> @@ -0,0 +1,19 @@
> +
> +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)"
> +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..16d306eafc
> --- /dev/null
> +++ b/tests/fate/namespace.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +$1 |
> + grep ' [TDBR] ' | # 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\)_' | # libavformat internal ffio/ffurl APIs.
> + grep -v '^rgb2rgb_init_' | # libswscale arch-specific init function.
> + sed 's/ .*//' | # Remove everything except the symbol name.
> + sort # Sort to allow deterministic comparison.
> +
> +exit 0
> diff --git a/tests/ref/fate/namespace-avcodec b/tests/ref/fate/namespace-avcodec
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/ref/fate/namespace-avdevice b/tests/ref/fate/namespace-avdevice
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/ref/fate/namespace-avfilter b/tests/ref/fate/namespace-avfilter
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/ref/fate/namespace-avformat b/tests/ref/fate/namespace-avformat
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/ref/fate/namespace-avutil b/tests/ref/fate/namespace-avutil
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/ref/fate/namespace-postproc b/tests/ref/fate/namespace-postproc
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/ref/fate/namespace-swresample b/tests/ref/fate/namespace-swresample
> new file mode 100644
> index 0000000000..e69de29bb2
> diff --git a/tests/ref/fate/namespace-swscale b/tests/ref/fate/namespace-swscale
> new file mode 100644
> index 0000000000..a7aa4504ae
> --- /dev/null
> +++ b/tests/ref/fate/namespace-swscale
> @@ -0,0 +1,58 @@
> +deinterleaveBytes
> +interleaveBytes
> +planar2x
> +rgb12to15
> +rgb12tobgr12
> +rgb15to16
> +rgb15to24
> +rgb15to32
> +rgb15tobgr15
> +rgb15tobgr16
> +rgb15tobgr24
> +rgb15tobgr32
> +rgb16to15
> +rgb16to24
> +rgb16to32
> +rgb16tobgr15
> +rgb16tobgr16
> +rgb16tobgr24
> +rgb16tobgr32
> +rgb24to15
> +rgb24to16
> +rgb24to32
> +rgb24tobgr15
> +rgb24tobgr16
> +rgb24tobgr24
> +rgb24tobgr32
> +rgb32to15
> +rgb32to16
> +rgb32to24
> +rgb32tobgr15
> +rgb32tobgr16
> +rgb32tobgr24
> +rgb48to64_bswap
> +rgb48to64_nobswap
> +rgb48tobgr48_bswap
> +rgb48tobgr48_nobswap
> +rgb48tobgr64_bswap
> +rgb48tobgr64_nobswap
> +rgb64to48_bswap
> +rgb64to48_nobswap
> +rgb64tobgr48_bswap
> +rgb64tobgr48_nobswap
> +shuffle_bytes_0321
> +shuffle_bytes_1230
> +shuffle_bytes_2103
> +shuffle_bytes_3012
> +shuffle_bytes_3210
> +uyvytoyuv420
> +uyvytoyuv422
> +vu9_to_vu12
> +yuv422ptouyvy
> +yuv422ptoyuy2
> +yuy2toyv12
> +yuyvtoyuv420
> +yuyvtoyuv422
> +yv12touyvy
> +yv12toyuy2
> +yvu9_to_yuy2
>
Why don't you just simply add the proper prefix for these symbols and
adapt the test to not allow exceptions?
- Andreas
More information about the ffmpeg-devel
mailing list