DPDK patches and discussions
 help / color / mirror / Atom feed
From: Conor Walsh <conor.walsh@intel.com>
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 <conor.walsh@intel.com>
Subject: [dpdk-dev] [PATCH 4/4] build: add abi breakage checks to meson
Date: Thu, 10 Sep 2020 14:01:16 +0000	[thread overview]
Message-ID: <20200910140116.3995345-5-conor.walsh@intel.com> (raw)
In-Reply-To: <20200910140116.3995345-1-conor.walsh@intel.com>

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 <conor.walsh@intel.com>
---
 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('<VERSION>')
 	pmd_subdir_opt = abi_version.join(pmd_subdir_opt.split('<VERSION>'))
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: '',
-- 
2.25.1


  parent reply	other threads:[~2020-09-10 14:02 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 14:01 [dpdk-dev] [PATCH 0/4] abi breakage checks for meson Conor Walsh
2020-09-10 14:01 ` [dpdk-dev] [PATCH 1/4] devtools: bug fix for gen-abi.sh Conor Walsh
2020-09-10 14:01 ` [dpdk-dev] [PATCH 2/4] devtools: add generation of compressed abi dump archives Conor Walsh
2020-09-10 14:01 ` [dpdk-dev] [PATCH 3/4] buildtools: add script to setup abi checks for meson Conor Walsh
2020-09-10 14:01 ` Conor Walsh [this message]
2020-09-10 14:21 ` [dpdk-dev] [PATCH v2 0/4] abi breakage " Conor Walsh
2020-09-10 14:21   ` [dpdk-dev] [PATCH v2 1/4] devtools: bug fix for gen-abi.sh Conor Walsh
2020-09-10 14:21   ` [dpdk-dev] [PATCH v2 2/4] devtools: add generation of compressed abi dump archives Conor Walsh
2020-09-10 14:21   ` [dpdk-dev] [PATCH v2 3/4] buildtools: add script to setup abi checks for meson Conor Walsh
2020-09-10 14:21   ` [dpdk-dev] [PATCH v2 4/4] build: add abi breakage checks to meson Conor Walsh
2020-09-11 16:03   ` [dpdk-dev] [PATCH v3 0/4] abi breakage checks for meson Conor Walsh
2020-09-11 16:03     ` [dpdk-dev] [PATCH v3 1/4] devtools: bug fix for gen-abi.sh Conor Walsh
2020-09-11 16:03     ` [dpdk-dev] [PATCH v3 2/4] devtools: add generation of compressed abi dump archives Conor Walsh
2020-09-14 12:50       ` Burakov, Anatoly
2020-09-15 14:35         ` Aaron Conole
2020-09-15 14:49           ` Walsh, Conor
2020-09-11 16:03     ` [dpdk-dev] [PATCH v3 3/4] buildtools: add script to setup abi checks for meson Conor Walsh
2020-09-11 16:03     ` [dpdk-dev] [PATCH v3 4/4] build: add abi breakage checks to meson Conor Walsh
2020-09-14  8:08     ` [dpdk-dev] [PATCH v3 0/4] abi breakage checks for meson Thomas Monjalon
2020-09-14  8:30       ` Kinsella, Ray
2020-09-14  9:34       ` Kinsella, Ray
2020-09-18 12:11     ` [dpdk-dev] [PATCH v4 " Conor Walsh
2020-09-18 12:11       ` [dpdk-dev] [PATCH v4 1/4] devtools: bug fix for gen-abi.sh Conor Walsh
2020-09-18 12:11       ` [dpdk-dev] [PATCH v4 2/4] devtools: add generation of compressed abi dump archives Conor Walsh
2020-09-18 12:11       ` [dpdk-dev] [PATCH v4 3/4] buildtools: add script to setup abi checks for meson Conor Walsh
2020-09-18 12:11       ` [dpdk-dev] [PATCH v4 4/4] build: add abi breakage checks to meson Conor Walsh
2020-10-12  8:08       ` [dpdk-dev] [PATCH v5 0/4] devtools: abi breakage checks Conor Walsh
2020-10-12  8:08         ` [dpdk-dev] [PATCH v5 1/4] devtools: add generation of compressed abi dump archives Conor Walsh
2020-10-12  8:08         ` [dpdk-dev] [PATCH v5 2/4] devtools: abi and UX changes for test-meson-builds.sh Conor Walsh
2020-10-12  8:08         ` [dpdk-dev] [PATCH v5 3/4] devtools: change dump file not found to warning in check-abi.sh Conor Walsh
2020-10-12  8:08         ` [dpdk-dev] [PATCH v5 4/4] doc: test-meson-builds.sh doc updates Conor Walsh
2020-10-12 13:03         ` [dpdk-dev] [PATCH v6 0/4] devtools: abi breakage checks Conor Walsh
2020-10-12 13:03           ` [dpdk-dev] [PATCH v6 1/4] devtools: add generation of compressed abi dump archives Conor Walsh
2020-10-14  9:38             ` Kinsella, Ray
2020-10-12 13:03           ` [dpdk-dev] [PATCH v6 2/4] devtools: abi and UX changes for test-meson-builds.sh Conor Walsh
2020-10-14  9:43             ` Kinsella, Ray
2020-10-12 13:03           ` [dpdk-dev] [PATCH v6 3/4] devtools: change dump file not found to warning in check-abi.sh Conor Walsh
2020-10-14  9:44             ` Kinsella, Ray
2020-10-12 13:03           ` [dpdk-dev] [PATCH v6 4/4] doc: test-meson-builds.sh doc updates Conor Walsh
2020-10-14  9:46             ` Kinsella, Ray
2020-10-14  9:37           ` [dpdk-dev] [PATCH v6 0/4] devtools: abi breakage checks Kinsella, Ray
2020-10-14 10:33             ` Walsh, Conor
2020-10-14 10:41           ` [dpdk-dev] [PATCH v7 " Conor Walsh
2020-10-14 10:41             ` [dpdk-dev] [PATCH v7 1/4] devtools: add generation of compressed abi dump archives Conor Walsh
2020-10-15 10:15               ` Kinsella, Ray
2020-10-14 10:41             ` [dpdk-dev] [PATCH v7 2/4] devtools: abi and UX changes for test-meson-builds.sh Conor Walsh
2020-10-15 10:16               ` Kinsella, Ray
2020-10-14 10:41             ` [dpdk-dev] [PATCH v7 3/4] devtools: change not found to warning check-abi.sh Conor Walsh
2020-10-14 10:41             ` [dpdk-dev] [PATCH v7 4/4] doc: test-meson-builds.sh doc updates Conor Walsh
     [not found]             ` <7206c209-ed4a-2aeb-12d8-ee162ef92596@ashroe.eu>
     [not found]               ` <CAJFAV8wmpft6XLRg1RAL+d4ibbJVrR9C0ghkE-kqyig_q_Meeg@mail.gmail.com>
2020-11-03 10:07                 ` [dpdk-dev] [PATCH v7 0/4] devtools: abi breakage checks Kinsella, Ray
2020-11-10 12:53                   ` David Marchand
2020-11-10 13:54                     ` Kinsella, Ray
2020-11-10 13:57                       ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200910140116.3995345-5-conor.walsh@intel.com \
    --to=conor.walsh@intel.com \
    --cc=aconole@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=maicolgabriel@hotmail.com \
    --cc=nhorman@tuxdriver.com \
    --cc=ray.kinsella@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).