Commit graph

37 commits

Author SHA1 Message Date
Thomas Monjalon 0b8086ce3f devtools: remove useless files from ABI reference
When building an ABI reference with meson, some static libraries
are built and linked in apps. They are useless and take a lot of space.
Those binaries, and other useless files (examples and doc files)
in the share/ directory, are removed after being installed.

In order to save time when building the ABI reference,
the examples (which are not installed anyway) are not compiled.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-07-03 10:10:22 +02:00
Bruce Richardson ca39d3a801 devtools: test static linkage with pkg-config
The pkg-config file was tested by building some of the examples using make,
pulling the cflags and ldflags from the pkg-config file for DPDK. However,
this only tested the shared library linkage, and not the static, so this
patch updates it to test both.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
2020-07-01 19:30:52 +02:00
Thomas Monjalon 3b6431396a devtools: add Windows cross-build test with MinGW
The Meson cross file is renamed from meson_mingw.txt to cross-mingw,
and is added to test-meson-builds.sh.

The only example supported on Windows so far is "helloworld",
that's why the default list of examples is overridden.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2020-06-30 01:18:35 +02:00
Thomas Monjalon b2b3858a08 devtools: add ppc64 in meson build test
Add cross-compilation support of a PPC target in the build test matrix.
The CPU is defined as Power8, running as little endian.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
2020-06-30 01:18:35 +02:00
Thomas Monjalon 3932237f10 devtools: allow non-standard toolchain in meson test
If a compiler is not found in $PATH, the compilation test is skipped.
In some cases, the compiler could be found after extending $PATH
in an environment configuration script (called by load-devel-config).

The decision to skip is deferred to a later stage, after loading the
configuration script.

In such case, the variable DPDK_TARGET, used by the configuration script
as input, is the compiler name.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
2020-06-30 01:18:35 +02:00
Thomas Monjalon 444e556776 devtools: shrink cross-compilation test definition
Each cross-compilation case needs to define the target compiler
and the meson cross file.
Given the compiler is already defined in the cross file,
the latter is enough.

The function "build" is changed to accept a cross file alternatively
to the compiler name. In the case of a file (detected if readable),
the compiler is extracted with sed and tr, and the option --cross-file
is automatically added.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
2020-06-30 01:18:35 +02:00
Thomas Monjalon ef5391b765 devtools: allow warnings in ABI reference build
There is no point in forcing warning-free compilation when building
an ABI reference. It is only preventing from compiling ABI reference
of old releases with recent compilers.

Note: DPDK 20.02 is built (with warnings) by GCC 10 if using -fcommon.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
2020-05-21 15:41:49 +02:00
Thomas Monjalon 1cab496414 devtools: reduce examples in static builds
Static builds can take a lot of space, so reduce the number of examples
built when testing those static builds.

As makefile-based build is close to end of life, completely skip examples
in case of static linkage with make.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-21 11:17:38 +02:00
David Marchand 0f96499d5d devtools: silence meson install
Installing with ninja is quite verbose by default, hide ninja output under
TEST_MESON_BUILD_VERBOSE and TEST_MESON_BUILD_VERY_VERBOSE options.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2020-03-23 14:19:45 +01:00
David Marchand 777014e56d devtools: add ABI checks
For normal developers, those checks are disabled.

Enabling them requires a configuration that will trigger the ABI dumps
generation as part of the existing devtools/test-build.sh and
devtools/test-meson-builds.sh scripts.

Those checks are enabled in the CI for the default meson options on x86
and aarch64 so that proposed patches are validated via our CI robot.
A cache of the ABI is stored in travis jobs to avoid rebuilding too
often.

Checks can be informational only, by setting ABI_CHECKS_WARN_ONLY when
breaking the ABI in a future release.

Explicit suppression rules have been added on internal structures
exposed to crypto drivers as the current ABI policy does not apply to
them.
This could be improved in the future by carefully splitting the headers
content with application and driver "users" in mind.

We currently have issues reported for librte_crypto recent changes for
which suppression rules have been added too.

Mellanox glue libraries are explicitly skipped as they are not part of
the application ABI.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2020-02-05 15:14:46 +01:00
David Marchand d6f923ba4a devtools: split meson build helper
No functional change intended, prepare for reusing this code.
The config and compilation parts are separated in helpers.
Unsetting CC is moved to the caller of the helper.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2020-02-05 15:14:46 +01:00
Bruce Richardson aa75995509 devtools: control location of test builds
By default, both test-build.sh and test-meson-builds.sh scripts create the
builds they generate in the current working directory, leading to a large
number of build directories being present when testing patches. This
patchset modifies both scripts to use a DPDK_BUILD_TEST_DIR environment
variable to control where the build outputs are put.

For example, doing:
    export DPDK_BUILD_TEST_DIR=__builds
    ./devtools/test-meson-builds.sh && ./devtools/test-build.sh \
            x86_64-native-linux-clang+shared i686-native-linux-gcc

gives a "__builds" directory with 14 meson and 2 make builds (with the
meson build count depending on compiler availability)

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2019-11-28 22:31:53 +01:00
David Marchand bd711af366 devtools: reset compilation flags for each target
Same idea than overriding PATH and PKG_CONFIG_PATH, it can be quite
useful to override compilation flags like CFLAGS, CPPFLAGS and LDFLAGS
for cross compilation or libraries that won't provide a pkg-config file.

Fixes: 2722367412 ("devtools: load target-specific compilation environment")

Signed-off-by: David Marchand <david.marchand@redhat.com>
2019-11-28 00:33:58 +01:00
Thomas Monjalon 3dd4330457 devtools: reduce list of Arm builds tested with meson
The list of Arm configs is growing:
	config/arm/arm64_armada_linux_gcc
	config/arm/arm64_armv8_linux_gcc
	config/arm/arm64_bluefield_linux_gcc
	config/arm/arm64_dpaa_linux_gcc
	config/arm/arm64_emag_linux_gcc
	config/arm/arm64_n1sdp_linux_gcc
	config/arm/arm64_octeontx2_linux_gcc
	config/arm/arm64_thunderx2_linux_gcc
	config/arm/arm64_thunderx_linux_gcc

In order to keep testing time reasonable,
and also because n1sdp is merged without a related fix in tests,
the list of configs is reduced in the script test-meson-builds.sh.

The list of tested Arm builds becomes:
	build-arm64-host-clang (armv8a)
	build-arm64-bluefield
	build-arm64-dpaa
	build-arm64-octeontx2

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2019-11-21 00:23:58 +01:00
Bruce Richardson 12a652a02b examples: fix build with old pkg-config
Not all versions of pkg-config in distros have support for the
--define-prefix flag [1], causing errors when building examples manually or
with test-meson-builds.sh script [2].

For the former case, we need to remove the hard-coded use of the flag in
the Makefiles.

For the latter case, the flag is necessary for builds to succeed, so we
skip the tests when it's not present, passing it as part of the pkg-config
command if it is supported.

[1]
CentOS Linux release 7.7.1908 (Core)
pkg-config version 0.27.1

[2]
 ## Building cmdline
Unknown option --define-prefix
gmake: Entering directory
`...ild-x86-default/install-root/usr/local/share/dpdk/examples/cmdline'
rm -f build/cmdline build/cmdline-static build/cmdline-shared
test -d build && rmdir -p build || true
Unknown option --define-prefix
Unknown option --define-prefix
gcc -O3  main.c commands.c parse_obj_list.c -o build/cmdline-shared
main.c:14:28: fatal error: cmdline_rdline.h: No such file or directory

Fixes: ca9268529d ("examples: support relocated DPDK install")
Fixes: 7f80a2102b ("devtools: test pkg-config file")
Cc: stable@dpdk.org

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-11-20 22:47:15 +01:00
Thomas Monjalon bd253daa77 devtools: fix test of ninja install
When trying to compile some examples with libdpdk.pc,
the right environment (for default target) was not loaded.
The consequence is to not detect some dependencies because
of missing directories in PKG_CONFIG_PATH.

The environment preparation is moved to a dedicate function,
and called for the default target (cc),
before testing the install output of the default build.

Fixes: 2722367412 ("devtools: load target-specific compilation environment")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2019-09-15 20:51:04 +02:00
Thomas Monjalon 54a88d1b16 devtools: fix check of ccache for meson build
The meson build test fails if ccache is not available.
The use of ccache must be optional.
And if used, the compiler to check is the last word of $CC.

Fixes: e0ae780e65 ("devtools: test compiler availability only once")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-09-13 12:32:32 +02:00
Thomas Monjalon 2722367412 devtools: load target-specific compilation environment
In order to re-use the same test environment as with
test-build.sh, the configuration file is loaded at each build,
after adjusting the variable DPDK_TARGET.

This is especially useful to set the variable PKG_CONFIG_PATH,
or define some meson options (without -D) in DPDK_MESON_OPTIONS.

The DPDK_TARGET values can be
	aarch64-*, powerpc64-*, x86_64-*.
The matching DPDK_TARGET values for test-build.sh are
	arm64-*, ppc_64-*, x86_64-*.
The advised expressions to use in the common configuration file are:
	if echo $DPDK_TARGET | grep -q '^a.*64-' ; then
	elif echo $DPDK_TARGET | grep -q '^p.*pc.*64' ; then
	elif echo $DPDK_TARGET | grep -q '^x86_64' ; then
	fi

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-09-13 00:28:52 +02:00
Thomas Monjalon e0ae780e65 devtools: test compiler availability only once
The compilation test is skipped if the compiler is not available.
In the case of gcc/arm, it was tested both in the generic function
"build" and in the cross-compilation section.

By passing the compiler as argument of the generic function,
the test with "command" is done only once.

This small clean-up has the benefit of introducing the compiler
parameter to be used later in another improvement.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-09-13 00:25:46 +02:00
Bruce Richardson 85cf6dc3a5 devtools: fix lib directory in pkg-config test
With Debian and Ubuntu, the default installation path for the 64-bit
libraries is set to e.g. /usr/local/lib/x86_64-linux-gnu/, compared to
/usr/local/lib64 on Fedora and Redhat distributions. This causes issues
when using "pkg-config --define-prefix" since pkg-config assumes the prefix
to be the grandparent of where the .pc file is. On Ubuntu we then get the
cflags include path as being "/path/to/install-root/usr/local/lib/include"
i.e. with an extra "lib" in the path.

This issue only applies for test installs on Ubuntu and similar distros,
and is not a problem for regular installs since the --define-prefix
parameter would not be passed to pkg-config in those cases.

The workaround for this in our test build script is to explicitly make
"lib" the "libdir" setting for the install, overriding the distro-provided
default.

Fixes: 7f80a2102b ("devtools: test pkg-config file")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-07-03 23:10:26 +02:00
Bruce Richardson 7f80a2102b devtools: test pkg-config file
The pkg-config file generated as part of the build of DPDK should allow
applications to be built with an installed DPDK. We can test this as
part of the build by doing an install of DPDK to a temporary directory
within the build folder, and by then compiling up a few sample apps
using make working off that directory.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-07-02 18:10:02 +02:00
Bruce Richardson d6917418e4 devtools: test meson build with available compilers
Allow the script to run with a reduced set of builds if clang, or
other compilers, are missing.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-07-02 18:07:58 +02:00
Bruce Richardson e5f7bd199d devtools: fix meson build test for plain bourne shell
The pipefail option is not supported in /bin/sh, just in bash/ksh and
similar shells - which means it's there by default on most Linux distros
but not on e.g. FreeBSD. Therefore we check for it's presence before
setting the option, and if it's missing, we upgrade verbosity level if
needed to ensure we never hide any build failures.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-04-19 23:21:13 +02:00
Bruce Richardson c039a73fc6 devtools: fix bash-isms in meson test
The use of "==" is non-standard extension from bash, so use "="
for comparisons instead.

Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-04-17 17:16:47 +02:00
Bruce Richardson 2660c6f653 devtools: support older compilers with meson test
Older versions of GCC, such as on Redhat/CentOS 7, don't support
-march=nehalem, but need -march=corei7 instead.

Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-04-17 17:16:01 +02:00
Bruce Richardson e887ebb663 devtools: skip meson build for missing compilers
If either gcc or clang are missing, skip doing those builds.
This allows a setup to only do, e.g. gcc tests.

Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2019-04-17 17:15:55 +02:00
Bruce Richardson d6cefc11e0 devtools: allow test build outside source directory
The test-meson-builds.sh script correctly detects the source directory and
builds the native builds successfully in a directory outside of the source
tree. However, the paths to the cross-files are not prefixed with the
source directory path, so the cross-builds all fail. Fix this by prepending
the source directory path appropriately.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-04-01 19:03:35 +02:00
Bruce Richardson 5d91766730 devtools: fix meson build test to exit on failure
When piping the ninja command through cat, we lose the error value from
the call to ninja in the case of failure. This prevents the script from
exiting at the first broken build. Fix this by setting the "pipefail"
shell option.

Fixes: 4bcb9b7686 ("devtools: add verbose option to meson build test")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-13 11:09:55 +01:00
Bruce Richardson ae2f2fee24 build: rename linuxapp to linux in meson cross files
Rename the cross files for meson compilation from having linuxapp
in the name to just linux in the name.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-12 23:03:34 +01:00
Bruce Richardson 4bcb9b7686 devtools: add verbose option to meson build test
When running ninja, the commands are, by default, always printed on top of
each other. For those who want more detail in the output, two levels of
verbose output has been added to the test-meson-builds script. When "-v" is
passed, or the "TEST_MESON_BUILD_VERBOSE" flag is set in the environment,
then the output of ninja is passed through "cat" to prevent each line
overwriting the next. If "-vv" is passed, or
"TEST_MESON_BUILD_VERY_VERBOSE" is set in the environment, then ninja is
called with the "-v" flag to print out each command in full as it is
executing.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-01 15:19:35 +01:00
Bruce Richardson 3655096fb1 devtools: fix build test on FreeBSD
readlink option "-m" is not supported on FreeBSD (checked on BSD 11),
so change to the largely-equivalent "-f" flag.

Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-02-26 17:43:36 +01:00
Bruce Richardson 85e5fd8be0 devtools: fix build check for whether meson has run
The current check to see whether we need to call meson or just ninja
simply checked if the build directory existed. However, if meson was run
but failed, the build directory would still exist. We can fix this by
instead checking for the build.ninja file inside the directory. Once that
is present, we can use ninja safely and let it worry about rerunning
meson if necessary.

Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2019-01-14 12:24:57 +01:00
Bruce Richardson e4f2047190 devtools: use shared libs to save space in build test
For usability, the default build type in meson is static, so that
binaries can be run from the build directory easily. However, static
builds take more space, so for build-testing purposes default to using
shared builds where possible.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
2018-09-18 15:11:46 +02:00
Gavin Hu 44e830c4e9 devtools: expand meson cross compiling test coverage
The default test script covers only default host cc compiler, either gcc or
clang, the fix is to increase the coverage by adding one more to cover
clang and the others for gcc.

Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-07-11 21:14:21 +02:00
Gavin Hu c0d022070f devtools: fix ninja command in build test
On some linux distributions, eg: CentOS, the ninja executable has a
different name: ninja-build, this patch is to check and adapt to it
accordingly.

./devtools/test-meson-builds.sh: line 24: ninja: command not found

Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Song Zhu <song.zhu@arm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-07-11 21:14:21 +02:00
Bruce Richardson 03843d4df3 devtools: fix ARM builds test with meson
For cross-builds the CC environmental variable only applies for compiling
native binaries i.e. pmdinfogen, so setting it to a cross-build compiler
will only cause problems. Leave the value unset in the script to use the
platform-default compiler.

Fixes: a55277a788 ("devtools: add test script for meson builds")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-06-14 17:46:02 +02:00
Bruce Richardson a55277a788 devtools: add test script for meson builds
To simplify testing with the meson and ninja builds, we can add a script
to set up and do multiple builds. Currently this script sets up:

* clang and gcc builds
* builds using static and shared linkage for binaries (libs are always
   built as both)
* a build using the lowest instruction-set level for x86 (-march=nehalem)
* cross-builds for each cross-file listed in config/arm

Each build is configured in a directory ending in *-build, and then for
the build stage, we just call ninja in each directory in turn. [i.e. we
assume every directory starting with "build-" is a meson build, which is
probably an ok assumption].

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-05-29 17:36:59 +02:00