summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/distutils-r1.sh68
-rwxr-xr-xeclass/tests/flag-o-matic.sh4
-rwxr-xr-xeclass/tests/git-r3.sh7
-rwxr-xr-xeclass/tests/git-r3_GIT_DIR.sh6
-rwxr-xr-xeclass/tests/git-r3_subrepos.sh4
-rwxr-xr-xeclass/tests/python-utils-r1.sh94
-rwxr-xr-xeclass/tests/savedconfig.sh4
-rwxr-xr-xeclass/tests/scons-utils.sh4
-rw-r--r--eclass/tests/tests-common.sh2
-rwxr-xr-xeclass/tests/toolchain-funcs.sh22
-rwxr-xr-xeclass/tests/toolchain.sh2
11 files changed, 173 insertions, 44 deletions
diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh
index d557f6cad534..d251f85a5eb1 100755
--- a/eclass/tests/distutils-r1.sh
+++ b/eclass/tests/distutils-r1.sh
@@ -17,6 +17,37 @@ test-phase_name_free() {
fi
}
+test-distutils_enable_tests() {
+ local runner=${1}
+ local exp_IUSE=${2}
+ local exp_RESTRICT=${3}
+ local exp_DEPEND=${4}
+
+ local IUSE=${IUSE}
+ local RESTRICT=${RESTRICT}
+ local DEPEND=${DEPEND}
+
+ tbegin "${runner}"
+
+ distutils_enable_tests "${runner}"
+
+ local ret var
+ for var in IUSE RESTRICT DEPEND; do
+ local exp_var=exp_${var}
+ if [[ ${!var} != "${!exp_var}" ]]; then
+ eindent
+ eerror "${var} expected: ${!exp_var}"
+ eerror "${var} actual: ${!var}"
+ eoutdent
+ ret=1
+ tret=1
+ fi
+ done
+
+ tend ${ret}
+}
+
+DISTUTILS_USE_SETUPTOOLS=no
inherit distutils-r1
tbegin "sane function names"
@@ -27,6 +58,41 @@ test-phase_name_free python_compile
test-phase_name_free python_test
test-phase_name_free python_install
-tend ${failed}
+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(-)]"
+TEST_RESTRICT=" !test? ( test )"
+
+einfo "empty RDEPEND"
+eindent
+RDEPEND=""
+test-distutils_enable_tests pytest \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] )"
+test-distutils_enable_tests nose \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] )"
+test-distutils_enable_tests unittest \
+ "${BASE_IUSE}" "" "${BASE_DEPS}"
+test-distutils_enable_tests setup.py \
+ "${BASE_IUSE}" "" "${BASE_DEPS}"
+eoutdent
+
+einfo "non-empty RDEPEND"
+eindent
+BASE_RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
+RDEPEND=${BASE_RDEPEND}
+test-distutils_enable_tests pytest \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] ${BASE_RDEPEND} )"
+test-distutils_enable_tests nose \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] ${BASE_RDEPEND} )"
+test-distutils_enable_tests unittest \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
+test-distutils_enable_tests setup.py \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
+eoutdent
+
+eoutdent
texit
diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 691b052c3d43..b0b97ea0bc1e 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -63,7 +63,7 @@ CXXFLAGS="-O2 -B/foo -O1"
LDFLAGS="-O2 -B/foo -O1"
tbegin "strip-unsupported-flags for '-B/foo'"
strip-unsupported-flags
-[[ ${CFLAGS} == "-O2 -O1" ]] && [[ ${CXXFLAGS} == "-O2 -O1" ]] && [[ ${LDFLAGS} == "" ]]
+[[ ${CFLAGS} == "-O2 -B/foo -O1" ]] && [[ ${CXXFLAGS} == "-O2 -B/foo -O1" ]] && [[ ${LDFLAGS} == "-O2 -B/foo -O1" ]]
ftend
CFLAGS="-O2 -B /foo -O1"
@@ -71,7 +71,7 @@ CXXFLAGS="-O2 -B /foo -O1"
LDFLAGS="-O2 -B /foo -O1"
tbegin "strip-unsupported-flags for '-B /foo'"
strip-unsupported-flags
-[[ ${CFLAGS} == "-O2 -O1" ]] && [[ ${CXXFLAGS} == "-O2 -O1" ]] && [[ ${LDFLAGS} == "" ]]
+[[ ${CFLAGS} == "-O2 -B /foo -O1" ]] && [[ ${CXXFLAGS} == "-O2 -B /foo -O1" ]] && [[ ${LDFLAGS} == "-O2 -B /foo -O1" ]]
ftend
for var in $(all-flag-vars) ; do
diff --git a/eclass/tests/git-r3.sh b/eclass/tests/git-r3.sh
index 6ff6226c0aa6..2f452bfd68a8 100755
--- a/eclass/tests/git-r3.sh
+++ b/eclass/tests/git-r3.sh
@@ -1,7 +1,12 @@
#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+# git no longer allows ext: protocol, meh
+exit 0
+
+EAPI=7
+
source tests-common.sh
inherit git-r3
diff --git a/eclass/tests/git-r3_GIT_DIR.sh b/eclass/tests/git-r3_GIT_DIR.sh
index 06c4094ceb9e..c17ae7bb43c0 100755
--- a/eclass/tests/git-r3_GIT_DIR.sh
+++ b/eclass/tests/git-r3_GIT_DIR.sh
@@ -1,7 +1,9 @@
#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+EAPI=7
+
source tests-common.sh
inherit git-r3
@@ -13,6 +15,8 @@ cd "${testdir}" || die "unable to cd to testdir"
EGIT3_STORE_DIR=store
mkdir "${EGIT3_STORE_DIR}" || die "unable to mkdir store"
+git() { :; }
+
# Test cleaning up canonical repo URI
test_repouri() {
local uri=${1}
diff --git a/eclass/tests/git-r3_subrepos.sh b/eclass/tests/git-r3_subrepos.sh
index 5b814328a49e..0fcf1cd08081 100755
--- a/eclass/tests/git-r3_subrepos.sh
+++ b/eclass/tests/git-r3_subrepos.sh
@@ -1,7 +1,9 @@
#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+EAPI=7
+
source tests-common.sh
inherit git-r3
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 414ad5c53d6b..e883da38cead 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -1,8 +1,8 @@
#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=5
+EAPI=7
source tests-common.sh
test_var() {
@@ -71,17 +71,29 @@ fi
test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
-test_var EPYTHON python3_4 python3.4
-test_var PYTHON python3_4 /usr/bin/python3.4
-if [[ -x /usr/bin/python3.4 ]]; then
- abiflags=$(/usr/bin/python3.4 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
- test_var PYTHON_SITEDIR python3_4 "/usr/lib*/python3.4/site-packages"
- test_var PYTHON_INCLUDEDIR python3_4 "/usr/include/python3.4${abiflags}"
- test_var PYTHON_LIBPATH python3_4 "/usr/lib*/libpython3.4${abiflags}$(get_libname)"
- test_var PYTHON_CONFIG python3_4 "/usr/bin/python3.4${abiflags}-config"
+test_var EPYTHON python3_6 python3.6
+test_var PYTHON python3_6 /usr/bin/python3.6
+if [[ -x /usr/bin/python3.6 ]]; then
+ abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
+ test_var PYTHON_SITEDIR python3_6 "/usr/lib*/python3.6/site-packages"
+ test_var PYTHON_INCLUDEDIR python3_6 "/usr/include/python3.6${abiflags}"
+ test_var PYTHON_LIBPATH python3_6 "/usr/lib*/libpython3.6${abiflags}$(get_libname)"
+ test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
fi
-test_var PYTHON_PKG_DEP python3_4 '*dev-lang/python*:3.4'
-test_var PYTHON_SCRIPTDIR python3_4 /usr/lib/python-exec/python3.4
+test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
+test_var PYTHON_SCRIPTDIR python3_6 /usr/lib/python-exec/python3.6
+
+test_var EPYTHON python3_7 python3.7
+test_var PYTHON python3_7 /usr/bin/python3.7
+if [[ -x /usr/bin/python3.7 ]]; then
+ abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
+ test_var PYTHON_SITEDIR python3_7 "/usr/lib/python3.7/site-packages"
+ test_var PYTHON_INCLUDEDIR python3_7 "/usr/include/python3.7${abiflags}"
+ test_var PYTHON_LIBPATH python3_7 "/usr/lib*/libpython3.7${abiflags}$(get_libname)"
+ test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
+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
@@ -94,8 +106,8 @@ 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*/pypy/site-packages"
- test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy/include"
+ 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 '*virtual/pypy*:0='
test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy
@@ -103,8 +115,8 @@ 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
- test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3/site-packages"
- test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3/include"
+ test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3.?/site-packages"
+ test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3.?/include"
fi
test_var PYTHON_PKG_DEP pypy3 '*virtual/pypy3*:0='
test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
@@ -117,7 +129,7 @@ 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.4 '#!/usr/bin/python3.4'
+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'
@@ -126,9 +138,9 @@ test_fix_shebang '#!/usr/bin/python' jython2.7 '#!/usr/bin/jython2.7'
test_fix_shebang '#!/usr/bin/python2' python2.7 '#!/usr/bin/python2.7'
test_fix_shebang '#!/usr/bin/python3' python2.7 FAIL
test_fix_shebang '#!/usr/bin/python3' python2.7 '#!/usr/bin/python2.7' --force
-test_fix_shebang '#!/usr/bin/python3' python3.4 '#!/usr/bin/python3.4'
-test_fix_shebang '#!/usr/bin/python2' python3.4 FAIL
-test_fix_shebang '#!/usr/bin/python2' python3.4 '#!/usr/bin/python3.4' --force
+test_fix_shebang '#!/usr/bin/python3' python3.6 '#!/usr/bin/python3.6'
+test_fix_shebang '#!/usr/bin/python2' python3.6 FAIL
+test_fix_shebang '#!/usr/bin/python2' python3.6 '#!/usr/bin/python3.6' --force
# pythonX.Y matching (those mostly test the patterns)
test_fix_shebang '#!/usr/bin/python2.7' python2.7 '#!/usr/bin/python2.7'
@@ -145,8 +157,8 @@ 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.4 \
- '#!/mnt/python2/usr/bin/python3.4'
+test_fix_shebang '#!/mnt/python2/usr/bin/python' python3.6 \
+ '#!/mnt/python2/usr/bin/python3.6'
test_fix_shebang '#!/mnt/python2/usr/bin/python2' python2.7 \
'#!/mnt/python2/usr/bin/python2.7'
test_fix_shebang '#!/mnt/python2/usr/bin/env python' python2.7 \
@@ -168,9 +180,11 @@ test_is "_python_impl_supported python2_7" 0
test_is "_python_impl_supported python3_1" 1
test_is "_python_impl_supported python3_2" 1
test_is "_python_impl_supported python3_3" 1
-test_is "_python_impl_supported python3_4" 0
+test_is "_python_impl_supported python3_4" 1
test_is "_python_impl_supported python3_5" 0
test_is "_python_impl_supported python3_6" 0
+test_is "_python_impl_supported python3_7" 0
+test_is "_python_impl_supported python3_8" 0
test_is "_python_impl_supported pypy1_8" 1
test_is "_python_impl_supported pypy1_9" 1
test_is "_python_impl_supported pypy2_0" 1
@@ -178,6 +192,40 @@ test_is "_python_impl_supported pypy" 0
test_is "_python_impl_supported pypy3" 0
test_is "_python_impl_supported jython2_7" 0
+# 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
+
rm "${tmpfile}"
texit
diff --git a/eclass/tests/savedconfig.sh b/eclass/tests/savedconfig.sh
index 19da181d8404..7643cf4cc823 100755
--- a/eclass/tests/savedconfig.sh
+++ b/eclass/tests/savedconfig.sh
@@ -1,7 +1,9 @@
#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+EAPI=7
+
source tests-common.sh
inherit savedconfig
diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh
index 7a588863c6a9..873312f67d07 100755
--- a/eclass/tests/scons-utils.sh
+++ b/eclass/tests/scons-utils.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
@@ -27,7 +27,7 @@ test-scons_clean_makeopts() {
}
# jobcount expected for non-specified state
-jc=$(_scons_get_default_jobs)
+jc=$(( $(get_nproc) + 1 ))
# failed test counter
failed=0
diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh
index d52cf3a2687b..674eaa02cdc9 100644
--- a/eclass/tests/tests-common.sh
+++ b/eclass/tests/tests-common.sh
@@ -103,3 +103,5 @@ PV="0"
P="${PN}-${PV}"
PF=${P}
SLOT=0
+
+addwrite() { :; }
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index 79ba6fa407b5..1cf124520c3c 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -54,21 +54,21 @@ tend ${ret}
#
# TEST: tc-ld-is-gold
#
-tbegin "tc-ld-is-gold (bfd selected)"
-LD=ld.bfd tc-ld-is-gold && ret=1 || ret=0
+tbegin "tc-ld-is-gold (ld=bfd cc=bfd)"
+LD=ld.bfd LDFLAGS=-fuse-ld=bfd tc-ld-is-gold && ret=1 || ret=0
tend ${ret}
-tbegin "tc-ld-is-gold (gold selected)"
+tbegin "tc-ld-is-gold (ld=gold cc=default)"
LD=ld.gold tc-ld-is-gold
ret=$?
tend ${ret}
-tbegin "tc-ld-is-gold (bfd selected via flags)"
+tbegin "tc-ld-is-gold (ld=gold cc=bfd)"
LD=ld.gold LDFLAGS=-fuse-ld=bfd tc-ld-is-gold
ret=$?
tend ${ret}
-tbegin "tc-ld-is-gold (gold selected via flags)"
+tbegin "tc-ld-is-gold (ld=bfd cc=gold)"
LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold
ret=$?
tend ${ret}
@@ -78,14 +78,14 @@ tend ${ret}
#
tbegin "tc-ld-disable-gold (bfd selected)"
(
-export LD=ld.bfd LDFLAGS=
+export LD=ld.bfd LDFLAGS=-fuse-ld=bfd
ewarn() { :; }
tc-ld-disable-gold
-[[ ${LD} == "ld.bfd" && -z ${LDFLAGS} ]]
+[[ ${LD} == "ld.bfd" && ${LDFLAGS} == "-fuse-ld=bfd" ]]
)
tend $?
-tbegin "tc-ld-disable-gold (gold selected)"
+tbegin "tc-ld-disable-gold (ld=gold)"
(
export LD=ld.gold LDFLAGS=
ewarn() { :; }
@@ -94,7 +94,7 @@ tc-ld-disable-gold
)
tend $?
-tbegin "tc-ld-disable-gold (gold selected via flags)"
+tbegin "tc-ld-disable-gold (cc=gold)"
(
export LD= LDFLAGS="-fuse-ld=gold"
ewarn() { :; }
@@ -172,8 +172,8 @@ if type -P pathcc &>/dev/null; then
tend $?
fi
-for compiler in gcc clang; do
- if type -P ${compielr} &>/dev/null; then
+for compiler in gcc clang not-really-a-compiler; do
+ if type -P ${compiler} &>/dev/null; then
tbegin "tc-cpp-is-true ($compiler, defined)"
(
export CC=${compiler}
diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh
index 2c09f2238d74..56609aa180e4 100755
--- a/eclass/tests/toolchain.sh
+++ b/eclass/tests/toolchain.sh
@@ -150,7 +150,7 @@ test_var_assert() {
var_name=${1}
exp=${2}
- tbegin "asserv variable value: ${var_name} => ${exp}"
+ tbegin "assert variable value: ${var_name} => ${exp}"
if [[ ${!var_name} != ${exp} ]]; then
msg="Failure - Expected: \"${exp}\" Got: \"${!var_name}\""