diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2020-03-27 23:42:03 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2020-03-27 23:54:40 +0000 |
commit | ba0d4bc94f655ff82d69276d79f9d85e8e8e01eb (patch) | |
tree | e801d42216b27e3da8b25aa58512d94780bcff76 | |
parent | net-im/signal-desktop-bin: bump to 1.32.3 (diff) | |
download | gentoo-ba0d4bc94f655ff82d69276d79f9d85e8e8e01eb.tar.gz gentoo-ba0d4bc94f655ff82d69276d79f9d85e8e8e01eb.tar.bz2 gentoo-ba0d4bc94f655ff82d69276d79f9d85e8e8e01eb.zip |
eclass/tests: add basic tests for multilib_env() expansion
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-x | eclass/tests/multilib.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh new file mode 100755 index 000000000000..308c456b98de --- /dev/null +++ b/eclass/tests/multilib.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# Copyright 1999-2020 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source tests-common.sh + +inherit multilib + +# Run 'multilib_env' and check what variables it expands to +test-multilib_env() { + local target=$1 exp_abi=$2 exp_vars=" $3" + tbegin "expand-target $1" + + # Reset default + unset MULTILIB_ABIS + unset DEFAULT_ABI + CFLAGS_default= + LDFLAGS_default= + LIBDIR_default=lib + CHOST_default=${target} + CTARGET_default=${CHOST_default} + LIBDIR_default=lib + + multilib_env ${target} + + local actual_abi="${DEFAULT_ABI}:${MULTILIB_ABIS}" + + local actual_vars="" + local abi var v + for abi in ${MULTILIB_ABIS}; do + actual_vars+=" ${abi}? (" + for var in CHOST LIBDIR CFLAGS LDFLAGS; do + v=${var}_${abi} + actual_vars+=" ${var}=${!v}" + done + actual_vars+=" )" + done + + [[ "${exp_abi}" == "${actual_abi}" && "${exp_vars}" == "${actual_vars}" ]] + + if ! tend $? ; then + printf '### EXPECTED ABI: %s\n' "${exp_abi}" + printf '### ACTUAL ABI: %s\n' "${actual_abi}" + printf '### EXPECTED VARS: %s\n' "${exp_vars}" + printf '### ACTUAL VARS: %s\n' "${actual_vars}" + fi +} + +# Pick a few interesting gargets from: +# $ grep -h -o -R 'CHOST=.*' ../../profiles/ | sort -u + +test-multilib_env \ + "x86_64-pc-linux-gnu" \ + "amd64:amd64 x86" \ + "amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )" +test-multilib_env \ + "x86_64-pc-linux-gnux32" \ + "x32:x32 amd64 x86" \ + "x32? ( CHOST=x86_64-pc-linux-gnux32 LIBDIR=libx32 CFLAGS=-mx32 LDFLAGS= ) amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )" + +texit |