From patchwork Tue Feb 2 23:25:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 25359 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 290AC44B4EE for ; Wed, 3 Feb 2021 01:25:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 07641689AB4; Wed, 3 Feb 2021 01:25:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4FF486883C9 for ; Wed, 3 Feb 2021 01:25:30 +0200 (EET) Received: by mail-wm1-f42.google.com with SMTP id l12so2865121wmq.2 for ; Tue, 02 Feb 2021 15:25:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=8V/OLvXbduoC6IIP3FR/uqrHZ76ay9l/fCQtYZPdnQ8=; b=I6OwFOLFteDGclh14M26oXE0grSh4LLkTlM4cNcIToZ9BZct2uIXM65G5Q7ofRvu2q rjNUaB8WaVZPPsrFNA4p8D9fJ3Z+qs7pQA5MywYY9k6Pvb7v4eVu0G+nYV54LesNVY6T 1jQ9tFRi1NQPNB9wPogfNrPJwpGS6pllQpAGUtHwCoNtEciDL1CXpel5AfwT/uoMo7Fy NQZE3BziI1lp+go/Fr5DeGWCHz5XCog2nUi/j1VF8CGqnSe/TMED1UYOjloLs28nV+f4 +zpE1gUf5Mtq7ZxrqkWQ6MSFojAnqT/MmYZbynr604Wh1NYYJNOKNmsPyfo26HEtteTU xtkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=8V/OLvXbduoC6IIP3FR/uqrHZ76ay9l/fCQtYZPdnQ8=; b=HTVYiHtE2A2UnYpmuB5xoS6fGw9wa6f9w73lJ3ortHYWob5cXx4YSU/hs6t3zcu7yp Xjlqhp9bqXCfuv2Ho6PjjQZWukHJ8o2oUJdI05zpahYqQveOQT/NUMEM+E2HGCDvpo/s nroixk1XM1H/tIrJSGGnk/JZX9fnpprjq2kOS7pAj9hm7O1Rscwp/qnQWgtv0d+Y8CC8 oKqzkM1IUNqIR6gDh3VDdda+R816xZwxsHF38XMFxPXWNNxk3uVb1gv3Djxs47KAFjsM b/2BLrkxb3PVDPDvdWRvRu6xcsLbIiqu+It+EiFlT+6wMCGLX4Rce00O2zf7o94vWfck qNAw== X-Gm-Message-State: AOAM531SmsgRSJHoRybYG6q/CdivVbifXyYYS1cG/a5g5bKrGV2uWJx0 D6Hnoa5HSAk43ul9y9FtUdctm9i65Ge9KQ== X-Google-Smtp-Source: ABdhPJybz83I1lDrEbhcbrWCe4djAVs+u8AgcntH//yNazVRBVh24Q+hMW3zN5r1xvAm970BWNPLiQ== X-Received: by 2002:a1c:cb:: with SMTP id 194mr323704wma.30.1612308329813; Tue, 02 Feb 2021 15:25:29 -0800 (PST) Received: from [192.168.0.3] (cpc91226-cmbg18-2-0-cust7.5-4.cable.virginm.net. [82.0.29.8]) by smtp.gmail.com with ESMTPSA id p9sm290339wrj.11.2021.02.02.15.25.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Feb 2021 15:25:29 -0800 (PST) To: FFmpeg development discussions and patches From: Mark Thompson Message-ID: Date: Tue, 2 Feb 2021 23:25:28 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH v4] fate: Add test for namespace prefixes in libraries X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 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