From patchwork Thu Sep 10 14:01:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Conor Walsh X-Patchwork-Id: 77144 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AE30DA04B5; Thu, 10 Sep 2020 16:01:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 816E11C0CC; Thu, 10 Sep 2020 16:01:38 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2811C1DB8 for ; Thu, 10 Sep 2020 16:01:36 +0200 (CEST) IronPort-SDR: 5D4T9DhF5re4gslfN0cc4IXzQzmS9OZZQvLE7rWjHaswXJfTjvy7WRRV9w3Q/ULlsc67/j5fFS 9IFBquD0+97Q== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="146238727" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="146238727" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 07:01:35 -0700 IronPort-SDR: ADs4vHv36CslNQLzXVYyrmsJ2kvaGEuVk3OYFz8Bw9ExMm10k36fGZMvj+vDMPrt+kZnLKmByK wCZExg4PXgNg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="449607453" Received: from silpixa00400466.ir.intel.com ([10.237.213.195]) by orsmga004.jf.intel.com with ESMTP; 10 Sep 2020 07:01:33 -0700 From: Conor Walsh To: dev@dpdk.org Cc: david.marchand@redhat.com, ray.kinsella@intel.com, nhorman@tuxdriver.com, aconole@redhat.com, maicolgabriel@hotmail.com, thomas@monjalon.net, bruce.richardson@intel.com, Conor Walsh Date: Thu, 10 Sep 2020 14:01:13 +0000 Message-Id: <20200910140116.3995345-2-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910140116.3995345-1-conor.walsh@intel.com> References: <20200910140116.3995345-1-conor.walsh@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/4] devtools: bug fix for gen-abi.sh X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes a bug with the gen-abi.sh script in devtools. When ran on an install directory the script would try to generate .dump files from directories as well as the .so files which is not correct. Example error: abidw: gcc/lib/librte_net.so.21.0.p is not a regular file To rectify this the regex that finds the appropriate .so files has been changed and the file test has been removed. This change was tested with the ABI_CHECK Travis checks in DPDK 20.08. Travis build: https://travis-ci.com/github/conorwalsh-intel/dpdk/jobs/382812849 Signed-off-by: Conor Walsh --- devtools/gen-abi.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/devtools/gen-abi.sh b/devtools/gen-abi.sh index c44b0e228..da6fe0556 100755 --- a/devtools/gen-abi.sh +++ b/devtools/gen-abi.sh @@ -16,11 +16,7 @@ fi dumpdir=$installdir/dump rm -rf $dumpdir mkdir -p $dumpdir -for f in $(find $installdir -name "*.so.*"); do - if test -L $f; then - continue - fi - +for f in $(find $installdir -name "*.so"); do libname=$(basename $f) abidw --out-file $dumpdir/${libname%.so*}.dump $f done From patchwork Thu Sep 10 14:01:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Conor Walsh X-Patchwork-Id: 77145 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45F4AA04B5; Thu, 10 Sep 2020 16:01:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C782C1C0D4; Thu, 10 Sep 2020 16:01:39 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 8C1E51C0CD for ; Thu, 10 Sep 2020 16:01:38 +0200 (CEST) IronPort-SDR: +tsyqoTFb/TfQENRSm50OHq0E1EnSmJRf2pis/A9KXoUPBiBkFLKAkgy0vhM9Xg3eiTZOt8sXt brU9XvXXrnHw== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="146238733" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="146238733" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 07:01:38 -0700 IronPort-SDR: XAdkRdXkWqs4fiuzEt35UJMUQDdhkqPNPGAI3rEinp/YiVETom/kBvhIFFZVq1xXubco+a3eJC bjNs8vjVc0yQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="449607490" Received: from silpixa00400466.ir.intel.com ([10.237.213.195]) by orsmga004.jf.intel.com with ESMTP; 10 Sep 2020 07:01:36 -0700 From: Conor Walsh To: dev@dpdk.org Cc: david.marchand@redhat.com, ray.kinsella@intel.com, nhorman@tuxdriver.com, aconole@redhat.com, maicolgabriel@hotmail.com, thomas@monjalon.net, bruce.richardson@intel.com, Conor Walsh Date: Thu, 10 Sep 2020 14:01:14 +0000 Message-Id: <20200910140116.3995345-3-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910140116.3995345-1-conor.walsh@intel.com> References: <20200910140116.3995345-1-conor.walsh@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/4] devtools: add generation of compressed abi dump archives X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds a script that generates a compressed archive containing .dump files which can be used to perform ABI breakage checking for the build specified in the parameters. Invoke using "./gen-abi-tarball.py -t -a [-cf ]" - : dpdk tag e.g. "v20.11" - : required architecture e.g. "arm" or "x86_64" - : configuration file for cross compiling for another system, this flag is not required. e.g. "config/arm/arm64_armv8_linux_gcc" E.g. "./gen-abi-tarball.py -t latest -a x86_64" If a compiler is not specified using the CC environmental variable then the script will default to using gcc. Using these parameters the script will produce a .tar.gz archive containing .dump files required to do ABI breakage checking Signed-off-by: Conor Walsh --- devtools/gen-abi-tarball.py | 125 ++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100755 devtools/gen-abi-tarball.py diff --git a/devtools/gen-abi-tarball.py b/devtools/gen-abi-tarball.py new file mode 100755 index 000000000..ce7a0c6ac --- /dev/null +++ b/devtools/gen-abi-tarball.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +import sys +import os +import argparse + +# Get command line arguments +parser = argparse.ArgumentParser(usage='\rThis script is intended to generate ABI dump tarballs\n'+ + 'Supported enviromental variables\n'+ + '\t- CC: The required compiler will be determined using this environmental variable.\n') +parser.add_argument('-t', '--tag', type=str, dest='tag', help='DPDK tag e.g. latest or v20.11') +parser.add_argument('-cf', '--cross-file', type=str, dest='crosscompile', help='Set the location of a cross compile config') +parser.add_argument('-a', '--arch', type=str, dest='arch', help='Arch arm or x86_64') +args = parser.parse_args() + +# Get the DPDK tag if not supplied set as latest +if args.tag: + user_tag = args.tag +else: + user_tag = 'latest' + print('No tag supplied defaulting to latest') + +# Get the cross-compile option +if args.crosscompile: + cross_comp = args.crosscompile + if not args.arch: + print('ERROR Arch must be set using -a when using cross compile') + exit() + cross_comp = os.path.abspath(cross_comp) + cross_comp_meson = '--cross-file '+cross_comp +else: + cross_comp = '' + cross_comp_meson = '' + +# Get the required system architecture if not supplied set as x86_64 +if args.arch: + arch = args.arch +else: + arch = os.popen('uname -m').read().strip() + print('No system architecture supplied defaulting to '+arch) + +tag = '' +# If the user did not supply tag or wants latest then get latest tag +if user_tag == 'latest': + # Get latest quarterly build tag from git repo + tag = os.popen('git ls-remote --tags http://dpdk.org/git/dpdk | grep -v "rc\|{}" | tail -n 1 | sed "s/.*\///"').read().strip() +else: + tag = user_tag + # If the user supplied tag is not in the DPDK repo then fail + tag_check = int(os.popen('git ls-remote http://dpdk.org/git/dpdk refs/tags/'+tag+' | wc -l').read().strip()) + if tag_check != 1: + print('ERROR supplied tag does not exist in DPDK repo') + exit() + +# Get the specified compiler from system +comp_env = 'CC' +if comp_env in os.environ: + comp = os.environ[comp_env] + comp_default = '' +else: + print('No compiler specified, defaulting to gcc') + comp = 'gcc' + comp_default = 'CC=gcc' + +# Print the configuration to the user +print('\nSelected Build: '+tag+', Compiler: '+comp+', Architecture: '+arch+', Cross Compile: '+cross_comp) + +# Store the base directory script is working from +baseDir = os.getcwd() +# Store devtools dir +devtoolsDir = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))) + +# Create directory for DPDK git repo and build +try: + os.mkdir('dump_dpdk') +except OSError as error: + print('ERROR The dump_dpdk directory could not be created, ensure it does not exist before start') + exit() +os.chdir('dump_dpdk') +# Clone DPDK and switch to specified tag +print('Cloning '+tag+' from DPDK git') +os.popen('git clone --quiet http://dpdk.org/git/dpdk >/dev/null').read() +os.chdir('dpdk') +os.popen('git checkout --quiet '+tag+' >/dev/null').read() + +# Create build folder with meson and set debug build and cross compile (if needed) +print('Configuring Meson') +os.popen(comp_default+' meson dumpbuild '+cross_comp_meson+' >/dev/null').read() +os.chdir('dumpbuild') +os.popen('meson configure -Dbuildtype=debug >/dev/null').read() +print('Building DPDK . . .') +#Build DPDK with ninja +os.popen('ninja >/dev/null').read() +gccDir = os.getcwd() + +# Create directory for abi dump files +dumpDir = os.path.join(baseDir,tag+'-'+comp+'-'+arch+'-abi_dump') +try: + os.mkdir(dumpDir) +except OSError as error: + print('ERROR The '+dumpDir+' directory could not be created') + os.popen('rm -rf '+os.path.join(baseDir,'dump_dpdk')).read() + exit() + +# Create dump files and output to dump directory +print('Generating ABI dump files') +genabiout = os.popen(os.path.join(devtoolsDir,'gen-abi.sh')+' '+gccDir).read() +os.popen('cp dump/* '+dumpDir).read() + +# Compress the dump directory +print('Creating Tarball of dump files') +os.chdir(baseDir) +origSize = os.popen('du -sh '+dumpDir+' | sed "s/\s.*$//"').read() +os.popen('tar -czf '+dumpDir.split('/')[-1]+'.tar.gz '+dumpDir.split('/')[-1]+' >/dev/null').read() +newSize = os.popen('du -sh '+dumpDir+'.tar.gz | sed "s/\s.*$//"').read() + +# Remove all temporary directories +print('Cleaning up temporary directories') +os.popen('rm -rf '+dumpDir).read() +os.popen('rm -rf '+os.path.join(baseDir,'dump_dpdk')).read() + +#Print output of the script to the user +print('\nDump of DPDK ABI '+tag+' is available in '+dumpDir.split('/')[-1]+'.tar.gz (Original Size: '+origSize.strip()+', Compressed Size:'+newSize.strip()+')\n') From patchwork Thu Sep 10 14:01:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Conor Walsh X-Patchwork-Id: 77146 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2629DA04B5; Thu, 10 Sep 2020 16:02:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E69941C0DB; Thu, 10 Sep 2020 16:01:44 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 394681C0DA for ; Thu, 10 Sep 2020 16:01:43 +0200 (CEST) IronPort-SDR: ggVGCCvVRHfWJBVQRsSL0wEn1C6DS3y23L2kEGBTKsFrMab4/PtQzu6fSnqELx6VW70Fy7rxUC uygfRqQjFiPA== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="146238764" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="146238764" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 07:01:42 -0700 IronPort-SDR: x3MFNyG6GFZ0qbzLXWPnbW+jw6ZmLbQoFG3XUx0ScOM1xG1UL7sBGIVs9m5xoUpGjsqm0HBh/s ZRgSNmODTNmw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="449607524" Received: from silpixa00400466.ir.intel.com ([10.237.213.195]) by orsmga004.jf.intel.com with ESMTP; 10 Sep 2020 07:01:38 -0700 From: Conor Walsh To: dev@dpdk.org Cc: david.marchand@redhat.com, ray.kinsella@intel.com, nhorman@tuxdriver.com, aconole@redhat.com, maicolgabriel@hotmail.com, thomas@monjalon.net, bruce.richardson@intel.com, Conor Walsh Date: Thu, 10 Sep 2020 14:01:15 +0000 Message-Id: <20200910140116.3995345-4-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910140116.3995345-1-conor.walsh@intel.com> References: <20200910140116.3995345-1-conor.walsh@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/4] buildtools: add script to setup abi checks for meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds a script that is intended to be invoked by meson to do the required setup for performing ABI breakage checks at build time. The required ABI dump archives can come from several sources including being generated at build time or prebuilt archives can be pulled from a remote http location or local directory. Invoke using "./abi-setup.py -t -d " - : dpdk tag e.g. "v20.11" - : path to dpdk source directory E.g. "./abi-setup.py -t v20.08 -d /root/dpdk" As this script is intended to be run by meson during a build some options can be specified by environmental variables: - DPDK_ABI_DUMPS_PATH: Can be used to specify a custom directory for the systems dump directories. - CC: The required compiler will be determined using this environmental variable - DPDK_ABI_TAR_URI: Can be used to specify a location that the script can pull prebuilt or cached dump archives from. This can be a remote http location or a local directory After the script has setup an appropriate ABI dump directory using one of the multiple methods available to it, it will print the location of this directory to the command line. Signed-off-by: Conor Walsh --- buildtools/abi-setup.py | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 buildtools/abi-setup.py diff --git a/buildtools/abi-setup.py b/buildtools/abi-setup.py new file mode 100755 index 000000000..a3c34536e --- /dev/null +++ b/buildtools/abi-setup.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +import sys +import os +import argparse + +# Get command line arguments +parser = argparse.ArgumentParser(usage='\rThis script is intended to setup ABI dumps for meson to perform ABI checks\n'+ + 'Supported enviromental variables\n'+ + '\t- DPDK_ABI_DUMPS_PATH: Can be used to specify a custom directory for the systems dump directories.\n'+ + '\t- CC: The required compiler will be determined using this environmental variable.\n'+ + '\t- DPDK_ABI_TAR_URI: Can be used to specify a location that the script can pull prebuilt or cached dump archives from. This can be a remote http location or a local directory.\n') +parser.add_argument('-t', '--tag', dest='tag', type=str, help='DPDK tag e.g. latest or v20.11') +parser.add_argument('-d', '--dpdk', dest='dpdk', type=str, help='Path to DPDK source directory') +args = parser.parse_args() + +# Get the DPDK tag if not supplied set as latest +if args.tag: + user_tag = args.tag +else: + user_tag = 'latest' + +tag = '' +# If the user did not supply tag or wants latest then get latest tag +if user_tag == 'latest': + # Get latest quarterly build tag from git repo + tag = os.popen('git ls-remote --tags http://dpdk.org/git/dpdk | grep -v "rc\|{}" | tail -n 1 | sed "s/.*\///"').read().strip() +else: + tag = user_tag + # If the user supplied tag does not exist then fail + tag_check = int(os.popen('git ls-remote http://dpdk.org/git/dpdk refs/tags/'+tag+' | wc -l').read().strip()) + if tag_check != 1: + print('ERROR supplied tag does not exist in DPDK repo') + exit() + +# Get the specified compiler from system +comp_env = 'CC' +if comp_env in os.environ: + comp = os.environ[comp_env] +else: + comp = 'gcc' + +# Get the systems architecture +arch = os.popen('uname -m').read().strip() + +# Get devtools path +devtools_path = '' +if args.dpdk: + devtools_path = os.path.abspath(os.path.join(args.dpdk,'devtools')) +else: + print('ERROR DPDK source directory must be specified') + exit() + +# Get the abi dumps folder from args or env fail if none supplied +abi_folder = '' +abi_env = 'DPDK_ABI_DUMPS_PATH' +if abi_env in os.environ: + abi_folder = os.path.abspath(os.environ[abi_env]) +else: + abi_folder = os.path.abspath(os.path.join(args.dpdk,'abi_dumps')) + +# If the directory doesn't exist create it and add a README to explain what it does +if not os.path.exists(abi_folder): + os.makedirs(abi_folder) + f=open(abi_folder+'/README','w+') + f.write('This directory has been setup to contain the ABI dump folders needed to perform ABI checks\n') + f.write('Directories here must be in the format {DPDK Tag}-{Compiler ID}-{Architecture}-abi_dump\n') + f.write('e.g. v20.11-gcc-x86_64-abi_dump\n') + f.write('Directories that do not use this format will not be picked up by the meson ABI checks\n') + f.write('This directory is managed automatically unless desired by the user\n') + f.close() + +# Move to abi folder +os.chdir(abi_folder) +abi_dump=tag+'-'+comp+'-'+arch+'-abi_dump' +# Download and untar abi dump if not present +if not os.path.exists(abi_dump): + # Check DPDK_ABI_TAR_URI for the location of the tarballs local or web + tar_uri_env = 'DPDK_ABI_TAR_URI' + if tar_uri_env in os.environ: + abi_tar_uri = os.environ[tar_uri_env] + if abi_tar_uri.startswith('http'): + # Wget the required tarball + os.popen('wget '+os.path.join(abi_tar_uri,abi_dump)+'.tar.gz >/dev/null 2>&1').read() + else: + abi_tar_uri = os.path.abspath(abi_tar_uri) + os.popen('cp '+os.path.join(abi_tar_uri,abi_dump)+'.tar.gz . >/dev/null 2>&1').read() + # Check tarball was downloaded + if os.path.isfile(abi_dump+'.tar.gz'): + os.popen('tar -xzf '+abi_dump+'.tar.gz >/dev/null 2>&1').read() + os.popen('rm -rf '+abi_dump+'.tar.gz').read() + # If the tarball was not found then generate it + else: + os.popen(os.path.join(devtools_path,'gen-abi-tarball.py')+' -t '+tag+' -a '+arch+' >/dev/null 2>&1').read() + if not os.path.isfile(abi_dump+'.tar.gz'): + print('ERROR ABI check generation failed '+os.path.join(devtools_path,'gen-abi-tarball.py')+' -t '+tag+' -a '+arch) + exit() + os.popen('tar -xzf '+abi_dump+'.tar.gz >/dev/null 2>&1').read() + os.popen('rm -rf '+abi_dump+'.tar.gz').read() + +# Tell user where specified directory is +print(os.path.abspath(abi_dump)) From patchwork Thu Sep 10 14:01:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Conor Walsh X-Patchwork-Id: 77147 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 07FA8A04B5; Thu, 10 Sep 2020 16:02:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28E1C1C10F; Thu, 10 Sep 2020 16:01:47 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 9D36E1C10C for ; Thu, 10 Sep 2020 16:01:45 +0200 (CEST) IronPort-SDR: VqyjI1TwWQkN3Lqt8KlIuLRVSNyy3+s1flMtkBKgYUjVg6NLsinSRgu/mDurQwKmlP+/NPFWRn /q/jH1uJ2esg== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="146238775" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="146238775" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 07:01:45 -0700 IronPort-SDR: s7ztu8pbDEnAUF9iTuAHI5Auxx2lnifq2qv3IEOn9ITK4Tnz9ntOonwWpRuMbib4Sf8L3dfT9W UAUNiVjs45XQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="449607539" Received: from silpixa00400466.ir.intel.com ([10.237.213.195]) by orsmga004.jf.intel.com with ESMTP; 10 Sep 2020 07:01:43 -0700 From: Conor Walsh To: dev@dpdk.org Cc: david.marchand@redhat.com, ray.kinsella@intel.com, nhorman@tuxdriver.com, aconole@redhat.com, maicolgabriel@hotmail.com, thomas@monjalon.net, bruce.richardson@intel.com, Conor Walsh Date: Thu, 10 Sep 2020 14:01:16 +0000 Message-Id: <20200910140116.3995345-5-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910140116.3995345-1-conor.walsh@intel.com> References: <20200910140116.3995345-1-conor.walsh@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 4/4] build: add abi breakage checks to meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds the ability to run ABI breakage checks to meson. To do this the developer needs to set the meson build type to debug and set the version of DPDK that they want to check the ABI against. The option "abi_checks" has been added to meson for this, the option accepts DPDK tags e.g. "latest" or "v20.11". Example meson command: "meson -Dbuildtype=debug -Dabi_checks=v20.11 build" When the build is done using ninja the ABI checks will be performed if any breakages are present the build will fail. Signed-off-by: Conor Walsh --- buildtools/meson.build | 20 ++++++++++++++++++++ config/meson.build | 9 +++++++++ drivers/meson.build | 15 +++++++++++++++ lib/meson.build | 15 +++++++++++++++ meson_options.txt | 2 ++ 5 files changed, 61 insertions(+) diff --git a/buildtools/meson.build b/buildtools/meson.build index 04808dabc..63513a273 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -8,6 +8,26 @@ check_symbols = find_program('check-symbols.sh') ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') binutils_avx512_check = find_program('binutils-avx512-check.sh') +abi_checks = get_option('abi_checks') +abi_dir = '' +# If abi checks enabled setup abi dump directory +if abi_checks!='' + message('ABI Checks are being setup, If DPDK_ABI_TAR_URI has not been set these checks may be need to be generated this could take several minutes') + setup_check = run_command('abi-setup.py','-t',abi_checks,'-d',meson.source_root()).stdout().strip() + # Check if error returned from script + if setup_check.startswith('ERROR') + error('ABI checks setup failed: '+setup_check) + # No error then set abi directory + else + abi_dir=setup_check + endif +endif +abidiff = find_program('abidiff', required: abi_checks!='') +if abidiff.found()==false and abi_checks!='' + error('ABI checks require abidiff to to be completed') +endif +abignore = files(meson.source_root()+'/devtools/libabigail.abignore') + # set up map-to-win script using python, either built-in or external python3 = import('python').find_installation(required: false) if python3.found() diff --git a/config/meson.build b/config/meson.build index 6996e5cbe..65f8ea4d7 100644 --- a/config/meson.build +++ b/config/meson.build @@ -47,6 +47,15 @@ else dpdk_conf.set('RTE_VER_RELEASE', 99) endif +# abi checks cannot be run on windows +if is_windows and abi_checks!='' + error('ABI checks cannot be run on windows') +endif +# abi checks can only be run on a debug build +if not get_option('debug') and abi_checks!='' + error('Build type must have debug symbols when abi_checks=enabled') +endif + pmd_subdir_opt = get_option('drivers_install_subdir') if pmd_subdir_opt.contains('') pmd_subdir_opt = abi_version.join(pmd_subdir_opt.split('')) diff --git a/drivers/meson.build b/drivers/meson.build index 5f9526557..c82fbc250 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -208,6 +208,21 @@ foreach subpath:subdirs include_directories: includes, dependencies: static_deps) + # If abidiff found, abi checks are enabled and the abi dump files for the library are available run abi check + dump_name = abi_dir+'/lib' + lib_name + '.dump' + if abidiff.found() and abi_checks!='' and run_command('[', '-f', dump_name, ']').returncode() == 0 + custom_target('lib' + lib_name + '.abi_chk', + command: [abidiff, '--no-added-syms', + '--suppr', abignore, + files(dump_name), + '@INPUT@'], + input: shared_lib, + output: 'lib' + lib_name + '.abi_chk', + capture: true, + install: false, + build_by_default: true) + endif + dpdk_drivers += static_lib set_variable('shared_@0@'.format(lib_name), shared_dep) diff --git a/lib/meson.build b/lib/meson.build index 3852c0156..e864e0440 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -190,6 +190,21 @@ foreach l:libraries include_directories: includes, dependencies: shared_deps) + # If abidiff found, abi checks are enabled and the abi dump files for the library are available run abi check + dump_name = abi_dir+'/' + dir_name + '.dump' + if abidiff.found() and abi_checks!='' and run_command('[', '-f', dump_name, ']').returncode() == 0 + custom_target(dir_name + '.abi_chk', + command: [abidiff, '--no-added-syms', + '--suppr', abignore, + files(dump_name), + '@INPUT@'], + input: shared_lib, + output: dir_name + '.abi_chk', + capture: true, + install: false, + build_by_default: true) + endif + dpdk_libraries = [shared_lib] + dpdk_libraries dpdk_static_libraries = [static_lib] + dpdk_static_libraries endif # sources.length() > 0 diff --git a/meson_options.txt b/meson_options.txt index 9bf18ab6b..26ac48f45 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,7 @@ # Please keep these options sorted alphabetically. +option('abi_checks', type: 'string', value: '', + description: 'Enable abi compatibility checks to run during the build. This requires debug build to be enabled. Input is latest or git tag e.g. v20.11') option('armv8_crypto_dir', type: 'string', value: '', description: 'path to the armv8_crypto library installation directory') option('disable_drivers', type: 'string', value: '',