summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-04-12 03:41:30 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-04-12 03:41:30 +0100
commit623ee73d661e5ed8475cb264511f683407d87365 (patch)
tree993eb27c93ec7a2d2d19550300d888fc1fed9e69 /eclass/tests
parentceeeb463cc1eef97fd62eaee8bf2196ba04bc384 (diff)
gentoo Easter resync : 12.04.2020
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/distutils-r1.sh2
-rwxr-xr-xeclass/tests/multilib.sh65
-rwxr-xr-xeclass/tests/python-utils-r1.sh33
3 files changed, 67 insertions, 33 deletions
diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh
index 9ef4562edf1a..10f57b59edf9 100755
--- a/eclass/tests/distutils-r1.sh
+++ b/eclass/tests/distutils-r1.sh
@@ -63,7 +63,7 @@ tend
einfo distutils_enable_tests
eindent
BASE_IUSE="python_targets_python2_7"
-BASE_DEPS="python_targets_python2_7? ( >=dev-lang/python-2.7.5-r2:2.7 ) >=dev-lang/python-exec-2:=[python_targets_python2_7(-)?,-python_single_target_python2_7(-)]"
+BASE_DEPS="python_targets_python2_7? ( >=dev-lang/python-2.7.17-r1:2.7 ) >=dev-lang/python-exec-2:=[python_targets_python2_7(-)?,-python_single_target_python2_7(-)]"
TEST_RESTRICT=" !test? ( test )"
einfo "empty RDEPEND"
diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh
new file mode 100755
index 000000000000..a483d4bef360
--- /dev/null
+++ b/eclass/tests/multilib.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2020 Gentoo Authors
+# 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 targets 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= )"
+test-multilib_env \
+ "x86_64-gentoo-linux-musl" \
+ "default:default" \
+ "default? ( CHOST=x86_64-gentoo-linux-musl LIBDIR=lib CFLAGS= LDFLAGS= )"
+
+texit
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 4367890a08a1..377bb474a3ac 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -13,7 +13,7 @@ test_var() {
tbegin "${var} for ${impl}"
local ${var}
- python_export ${impl} PYTHON ${var}
+ _python_export ${impl} PYTHON ${var}
[[ ${!var} == ${expect} ]] || eerror "(${impl}: ${var}: ${!var} != ${expect}"
tend ${?}
@@ -101,23 +101,6 @@ fi
test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
test_var PYTHON_SCRIPTDIR python3_7 /usr/lib/python-exec/python3.7
-test_var EPYTHON jython2_7 jython2.7
-test_var PYTHON jython2_7 /usr/bin/jython2.7
-if [[ -x /usr/bin/jython2.7 ]]; then
- test_var PYTHON_SITEDIR jython2_7 /usr/share/jython-2.7/Lib/site-packages
-fi
-test_var PYTHON_PKG_DEP jython2_7 '*dev-java/jython*:2.7'
-test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
-
-test_var EPYTHON pypy pypy
-test_var PYTHON pypy /usr/bin/pypy
-if [[ -x /usr/bin/pypy ]]; then
- test_var PYTHON_SITEDIR pypy "/usr/lib*/pypy2.7/site-packages"
- test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy2.7/include"
-fi
-test_var PYTHON_PKG_DEP pypy '*dev-python/pypy*:0='
-test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
-
test_var EPYTHON pypy3 pypy3
test_var PYTHON pypy3 /usr/bin/pypy3
if [[ -x /usr/bin/pypy3 ]]; then
@@ -129,16 +112,13 @@ test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
test_is "python_is_python3 python2.7" 1
test_is "python_is_python3 python3.2" 0
-test_is "python_is_python3 jython2.7" 1
test_is "python_is_python3 pypy" 1
test_is "python_is_python3 pypy3" 0
# generic shebangs
test_fix_shebang '#!/usr/bin/python' python2.7 '#!/usr/bin/python2.7'
test_fix_shebang '#!/usr/bin/python' python3.6 '#!/usr/bin/python3.6'
-test_fix_shebang '#!/usr/bin/python' pypy '#!/usr/bin/pypy'
test_fix_shebang '#!/usr/bin/python' pypy3 '#!/usr/bin/pypy3'
-test_fix_shebang '#!/usr/bin/python' jython2.7 '#!/usr/bin/jython2.7'
# python2/python3 matching
test_fix_shebang '#!/usr/bin/python2' python2.7 '#!/usr/bin/python2.7'
@@ -155,12 +135,8 @@ test_fix_shebang '#!/usr/bin/python2.7' python3.2 '#!/usr/bin/python3.2' --force
test_fix_shebang '#!/usr/bin/python3.2' python3.2 '#!/usr/bin/python3.2'
test_fix_shebang '#!/usr/bin/python3.2' python2.7 FAIL
test_fix_shebang '#!/usr/bin/python3.2' python2.7 '#!/usr/bin/python2.7' --force
-test_fix_shebang '#!/usr/bin/pypy' pypy '#!/usr/bin/pypy'
test_fix_shebang '#!/usr/bin/pypy' python2.7 FAIL
test_fix_shebang '#!/usr/bin/pypy' python2.7 '#!/usr/bin/python2.7' --force
-test_fix_shebang '#!/usr/bin/jython2.7' jython2.7 '#!/usr/bin/jython2.7'
-test_fix_shebang '#!/usr/bin/jython2.7' jython3.2 FAIL
-test_fix_shebang '#!/usr/bin/jython2.7' jython3.2 '#!/usr/bin/jython3.2' --force
# fancy path handling
test_fix_shebang '#!/mnt/python2/usr/bin/python' python3.6 \
@@ -196,39 +172,32 @@ test_is "_python_impl_supported pypy1_9" 1
test_is "_python_impl_supported pypy2_0" 1
test_is "_python_impl_supported pypy" 1
test_is "_python_impl_supported pypy3" 0
-test_is "_python_impl_supported jython2_7" 1
# check _python_impl_matches behavior
test_is "_python_impl_matches python2_7 -2" 0
test_is "_python_impl_matches python3_6 -2" 1
test_is "_python_impl_matches python3_7 -2" 1
-test_is "_python_impl_matches pypy -2" 0
test_is "_python_impl_matches pypy3 -2" 1
test_is "_python_impl_matches python2_7 -3" 1
test_is "_python_impl_matches python3_6 -3" 0
test_is "_python_impl_matches python3_7 -3" 0
-test_is "_python_impl_matches pypy -3" 1
test_is "_python_impl_matches pypy3 -3" 0
test_is "_python_impl_matches python2_7 -2 python3_6" 0
test_is "_python_impl_matches python3_6 -2 python3_6" 0
test_is "_python_impl_matches python3_7 -2 python3_6" 1
-test_is "_python_impl_matches pypy -2 python3_6" 0
test_is "_python_impl_matches pypy3 -2 python3_6" 1
test_is "_python_impl_matches python2_7 pypy3 -2 python3_6" 0
test_is "_python_impl_matches python3_6 pypy3 -2 python3_6" 0
test_is "_python_impl_matches python3_7 pypy3 -2 python3_6" 1
-test_is "_python_impl_matches pypy pypy3 -2 python3_6" 0
test_is "_python_impl_matches pypy3 pypy3 -2 python3_6" 0
set -f
test_is "_python_impl_matches python2_7 pypy*" 1
test_is "_python_impl_matches python3_6 pypy*" 1
test_is "_python_impl_matches python3_7 pypy*" 1
-test_is "_python_impl_matches pypy pypy*" 0
test_is "_python_impl_matches pypy3 pypy*" 0
test_is "_python_impl_matches python2_7 python*" 0
test_is "_python_impl_matches python3_6 python*" 0
test_is "_python_impl_matches python3_7 python*" 0
-test_is "_python_impl_matches pypy python*" 1
test_is "_python_impl_matches pypy3 python*" 1
set +f