DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, david.marchand@redhat.com,
	bruce.richardson@intel.com, ray.kinsella@intel.com,
	tdu@semihalf.com, zr@semihalf.com, cernay@netcope.com,
	Kevin Laatz <kevin.laatz@intel.com>
Subject: [dpdk-dev] [PATCH v5 2/3] build: add abi checks to meson
Date: Fri, 13 Dec 2019 14:03:01 +0000	[thread overview]
Message-ID: <20191213140302.4252-3-kevin.laatz@intel.com> (raw)
In-Reply-To: <20191213140302.4252-1-kevin.laatz@intel.com>

This patch adds a script to generate ABI dump files. These files will be
required to perform ABI compatibility checks during the build later in the
patchset. This script should be run on a DPDK version with a stable ABI.

Since this is a tool designed for human use, we simplify it to just work
off a whole build directory, taking the parameter of the builddir and
generating the lib|drivers/abi dir. This is hardcoded into the script since
the meson build expects the .dump files in these directories.

The running of the scripts can be enabled/disabled using the new meson
option added in this patch.  If enabled, the lib and drivers .so files will
be compared against any existing ABI dump files in lib|drivers/abi of the
source directory. If there are any incompatibilities, the build will fail
and display the incompatibility.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

---
v2:
  - fixed conditional around abi check custom target
  - fixed conditional around abi check custom target
v3:
  - fix typo in meson option name
v4:
  - squash commits 3,4,5,6 into a single commit
  - changes meson option from type boolean to feature
  - update travis packages
  - move check for windows to earlier in build
  - add abignore file to suppress experimental functions
  - make the directories we store dump files in hidden
v5:
  - remove travis build with abi checks. This can be added as a separate
    patch once the issue are fixed.
---
 buildtools/dpdk.abignore |  2 ++
 buildtools/meson.build   |  3 +++
 config/meson.build       | 10 ++++++++++
 devtools/gen-abi-dump.sh | 24 ++++++++++++++++++++++++
 drivers/meson.build      | 13 +++++++++++++
 lib/meson.build          | 13 +++++++++++++
 meson.build              |  4 ++++
 meson_options.txt        |  2 ++
 8 files changed, 71 insertions(+)
 create mode 100644 buildtools/dpdk.abignore
 create mode 100755 devtools/gen-abi-dump.sh

diff --git a/buildtools/dpdk.abignore b/buildtools/dpdk.abignore
new file mode 100644
index 000000000..b866b7f26
--- /dev/null
+++ b/buildtools/dpdk.abignore
@@ -0,0 +1,2 @@
+[suppress_function]
+        symbol_version = EXPERIMENTAL
diff --git a/buildtools/meson.build b/buildtools/meson.build
index 6ef2c5721..378f8d07e 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -7,6 +7,9 @@ pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 
 check_experimental_syms = find_program('check-experimental-syms.sh')
 
+abidiff = find_program('abidiff', required: compat_checks)
+abignore = files('dpdk.abignore')
+
 # set up map-to-def 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 01911ecf9..ea680af33 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -34,6 +34,16 @@ stable_so_version = abi_va.length() == 2 ? abi_va[0] : abi_va[0] + '.' + abi_va[
 experimental_abi_version = '0.' + ''.join(abi_va)
 experimental_so_version = '0.' + ''.join(stable_so_version.split('.'))
 
+# compatibility checks not available on windows
+compat_checks = disabler()
+if not is_windows
+	compat_checks = get_option('compat_checks')
+endif
+
+if not get_option('debug') and compat_checks.enabled()
+	error('Build type must have debug symbols when compat_checks=enabled')
+endif
+
 # extract all version information into the build configuration
 dpdk_conf.set('RTE_VER_YEAR', pver.get(0).to_int())
 dpdk_conf.set('RTE_VER_MONTH', pver.get(1).to_int())
diff --git a/devtools/gen-abi-dump.sh b/devtools/gen-abi-dump.sh
new file mode 100755
index 000000000..bc6eac8c8
--- /dev/null
+++ b/devtools/gen-abi-dump.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+builddir=$1
+
+if [ -z "$builddir" ] ; then
+	echo "Usage: $(basename $0) build_dir"
+	exit 1
+fi
+
+if [ ! -d "$builddir" ] ; then
+	echo "Error: build directory, '$builddir', doesn't exist"
+	exit 1
+fi
+
+for d in lib drivers ; do
+	mkdir -p $d/.abi
+
+	for f in $builddir/$d/*.so* ; do
+		test -L "$f" && continue
+
+		libname=$(basename $f)
+		abidw --out-file $d/.abi/${libname%.so*}.dump $f || exit 1
+	done
+done
diff --git a/drivers/meson.build b/drivers/meson.build
index 4b17662b7..db58a67b9 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -196,6 +196,19 @@ foreach class:dpdk_driver_classes
 					include_directories: includes,
 					dependencies: static_deps)
 
+			if abidiff.found()
+				custom_target('lib' + lib_name + '.abi_chk',
+					command: [abidiff, '--no-added-syms',
+						'--suppr', abignore,
+						files('.abi/lib' + lib_name + '.dump'),
+						'@INPUT@'],
+					input: shared_lib,
+					output: 'lib' + lib_name + '.abi_chk',
+					capture: true,
+					install: false,
+					build_by_default: is_experimental == 0)
+			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 0af3efab2..f0aba6635 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -180,6 +180,19 @@ foreach l:libraries
 					include_directories: includes,
 					dependencies: shared_deps)
 
+			if abidiff.found()
+				custom_target(dir_name + '.abi_chk',
+					command: [abidiff, '--no-added-syms',
+						'--suppr', abignore,
+						files('.abi/' + dir_name + '.dump'),
+						'@INPUT@'],
+					input: shared_lib,
+					output: dir_name + '.abi_chk',
+					capture: true,
+					install: false,
+					build_by_default: is_experimental == 0)
+			endif
+
 			dpdk_libraries = [shared_lib] + dpdk_libraries
 			dpdk_static_libraries = [static_lib] + dpdk_static_libraries
 		endif # sources.length() > 0
diff --git a/meson.build b/meson.build
index b7ae9c8d9..e840ccea7 100644
--- a/meson.build
+++ b/meson.build
@@ -128,3 +128,7 @@ foreach drv:dpdk_drvs_disabled
 	output_message += drv + ':\t' + reason + '\n\t'
 endforeach
 message(output_message + '\n')
+
+if compat_checks.auto() and not get_option('debug')
+	warning('Build type must be have debug symbols to run compatibility checks!\n')
+endif
diff --git a/meson_options.txt b/meson_options.txt
index bc369d06c..0c651cef3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,7 @@
 # Please keep these options sorted alphabetically.
 
+option('compat_checks', type: 'feature', value: 'auto',
+	description: 'Enable abi compatibility checks and experimental syms checks to run during the build. This requires debug build to be enabled.')
 option('disable_drivers', type: 'string', value: '',
 	description: 'Comma-separated list of drivers to explicitly disable.')
 option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-<VERSION>',
-- 
2.17.1


  reply	other threads:[~2019-12-13 14:03 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23  1:07 [dpdk-dev] [RFC 0/6] Add ABI compatibility checks to the meson build Kevin Laatz
2019-10-23  1:07 ` [dpdk-dev] [RFC 1/6] build: enable debug info by default in meson builds Kevin Laatz
2019-10-23  1:07 ` [dpdk-dev] [RFC 2/6] build: use meson warning levels Kevin Laatz
2019-10-23  1:07 ` [dpdk-dev] [RFC 3/6] devtools: add abi dump generation script Kevin Laatz
2019-10-23  1:07 ` [dpdk-dev] [RFC 4/6] build: add meson option for abi related checks Kevin Laatz
2019-10-23  1:07 ` [dpdk-dev] [RFC 5/6] build: add lib abi checks to meson Kevin Laatz
2019-10-23  1:07 ` [dpdk-dev] [RFC 6/6] build: add drivers " Kevin Laatz
2019-11-29 12:13 ` [dpdk-dev] [RFC 0/6] Add ABI compatibility checks to the meson build David Marchand
2019-11-29 17:10 ` [dpdk-dev] [PATCH v2 0/7] " Kevin Laatz
2019-11-29 17:10   ` [dpdk-dev] [PATCH v2 1/7] build: enable debug info by default in meson builds Kevin Laatz
2019-11-29 17:10   ` [dpdk-dev] [PATCH v2 2/7] build: use meson warning levels Kevin Laatz
2019-11-29 17:10   ` [dpdk-dev] [PATCH v2 3/7] devtools: add abi dump generation script Kevin Laatz
2019-11-29 17:10   ` [dpdk-dev] [PATCH v2 4/7] build: add meson option for abi related checks Kevin Laatz
2019-11-29 17:10   ` [dpdk-dev] [PATCH v2 5/7] build: add lib abi checks to meson Kevin Laatz
2019-11-29 17:10   ` [dpdk-dev] [PATCH v2 6/7] build: add drivers " Kevin Laatz
2019-11-29 17:10   ` [dpdk-dev] [PATCH v2 7/7] build: clean up experimental syms check Kevin Laatz
2019-11-29 21:08   ` [dpdk-dev] [PATCH v3 0/7] Add ABI compatibility checks to the meson build Kevin Laatz
2019-11-29 21:08     ` [dpdk-dev] [PATCH v3 1/7] build: enable debug info by default in meson builds Kevin Laatz
2019-11-29 21:09     ` [dpdk-dev] [PATCH v3 2/7] build: use meson warning levels Kevin Laatz
2019-11-29 21:09     ` [dpdk-dev] [PATCH v3 3/7] devtools: add abi dump generation script Kevin Laatz
2019-11-29 21:09     ` [dpdk-dev] [PATCH v3 4/7] build: add meson option for abi related checks Kevin Laatz
2019-11-29 21:09     ` [dpdk-dev] [PATCH v3 5/7] build: add lib abi checks to meson Kevin Laatz
2019-11-29 21:09     ` [dpdk-dev] [PATCH v3 6/7] build: add drivers " Kevin Laatz
2019-11-29 21:09     ` [dpdk-dev] [PATCH v3 7/7] build: clean up experimental syms check Kevin Laatz
2019-12-03 11:03     ` [dpdk-dev] [PATCH v3 0/7] Add ABI compatibility checks to the meson build David Marchand
2019-12-03 15:27       ` Laatz, Kevin
2019-12-04  8:47         ` David Marchand
2019-12-04 10:46           ` Bruce Richardson
2019-12-04 11:56           ` Neil Horman
2019-12-04 12:00             ` David Marchand
2019-12-10 11:07         ` David Marchand
2019-12-10 11:36           ` Laatz, Kevin
2019-12-11 18:21     ` [dpdk-dev] [PATCH v4 0/3] " Kevin Laatz
2019-12-11 18:21       ` [dpdk-dev] [PATCH v4 2/3] build: add abi checks to meson Kevin Laatz
2019-12-11 18:21       ` [dpdk-dev] [PATCH v4 3/3] build: clean up experimental syms check Kevin Laatz
     [not found]       ` <20191211182147.19355-2-kevin.laatz@intel.com>
2019-12-12  8:43         ` [dpdk-dev] [PATCH v4 1/3] build: add dump files for v20.0 ABI David Marchand
2019-12-12  9:36           ` David Marchand
2019-12-12  9:45             ` Laatz, Kevin
2019-12-12  9:45           ` Laatz, Kevin
2019-12-13 14:02       ` [dpdk-dev] [PATCH v5 0/3] Add ABI compatibility checks to the meson build Kevin Laatz
2019-12-13 14:03         ` Kevin Laatz [this message]
2019-12-13 14:03         ` [dpdk-dev] [PATCH v5 3/3] build: clean up experimental syms check Kevin Laatz
2019-12-13 16:40         ` [dpdk-dev] [PATCH v6 00/11] Add ABI compatibility checks to the meson build Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 01/11] lib: add dump files for v20.0 ABI Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 02/11] drivers/bus: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 03/11] drivers/mempool: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 04/11] drivers/common: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 05/11] drivers/raw: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 06/11] drivers/crypto: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 07/11] drivers/compress: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 08/11] drivers/net: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 09/11] drivers/net/intel: " Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 10/11] build: add abi checks to meson Kevin Laatz
2019-12-13 16:41           ` [dpdk-dev] [PATCH v6 11/11] build: clean up experimental syms check Kevin Laatz
2019-12-19 21:58           ` [dpdk-dev] [PATCH v6 00/11] Add ABI compatibility checks to the meson build David Marchand
2019-12-20 10:20             ` Thomas Monjalon
2019-12-20 11:04             ` Bruce Richardson
2019-12-20 13:19               ` David Marchand
2019-12-20 14:17                 ` Bruce Richardson
2020-01-06 13:20                   ` Aaron Conole

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=20191213140302.4252-3-kevin.laatz@intel.com \
    --to=kevin.laatz@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=cernay@netcope.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ray.kinsella@intel.com \
    --cc=tdu@semihalf.com \
    --cc=thomas@monjalon.net \
    --cc=zr@semihalf.com \
    /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).