[v2,2/4] devtools: allow non-standard toolchain in meson test

Message ID 20200615222236.1894695-3-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series add PPC and Windows cross-compilation to meson test |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Thomas Monjalon June 15, 2020, 10:22 p.m. UTC
  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>
---
 devtools/test-meson-builds.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
  

Comments

David Christensen June 17, 2020, 9:06 p.m. UTC | #1
On 6/15/20 3:22 PM, Thomas Monjalon wrote:
> 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>
  

Patch

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index bee55ec038..9781eaf415 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -52,9 +52,15 @@  load_env () # <target compiler>
 	export CFLAGS=$default_cflags
 	export LDFLAGS=$default_ldflags
 	unset DPDK_MESON_OPTIONS
-	command -v $targetcc >/dev/null 2>&1 || return 1
-	DPDK_TARGET=$($targetcc -v 2>&1 | sed -n 's,^Target: ,,p')
+	if command -v $targetcc >/dev/null 2>&1 ; then
+		DPDK_TARGET=$($targetcc -v 2>&1 | sed -n 's,^Target: ,,p')
+	else # toolchain not yet in PATH: its name should be enough
+		DPDK_TARGET=$targetcc
+	fi
+	# config input: $DPDK_TARGET
 	. $srcdir/devtools/load-devel-config
+	# config output: $DPDK_MESON_OPTIONS, $PATH, $PKG_CONFIG_PATH, etc
+	command -v $targetcc >/dev/null 2>&1 || return 1
 }
 
 config () # <dir> <builddir> <meson options>