summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/multiprocessing_makeopts_jobs.sh15
-rwxr-xr-xeclass/tests/python-utils-r1.sh142
-rwxr-xr-xeclass/tests/qmail.sh3
3 files changed, 84 insertions, 76 deletions
diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh
index 70a6085d5362..37d5a7257775 100755
--- a/eclass/tests/multiprocessing_makeopts_jobs.sh
+++ b/eclass/tests/multiprocessing_makeopts_jobs.sh
@@ -16,14 +16,19 @@ test-makeopts_jobs() {
tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'"
else
[[ ${direct} == "${exp}" ]]
- tend $? "Got back: ${act}"
+ tend $? "Got back: ${direct}"
fi
}
+# override to avoid relying on a specific value
+get_nproc() {
+ echo 41
+}
+
tests=(
- 999 "-j"
- 999 "--jobs"
- 999 "-j -l9"
+ 42 "-j"
+ 42 "--jobs"
+ 42 "-j -l9"
1 ""
1 "-l9 -w"
1 "-l9 -w-j4"
@@ -37,7 +42,7 @@ tests=(
7 "-l3 --jobs 7 -w"
4 "-j1 -j 2 --jobs 3 --jobs=4"
8 " -j 8 "
- 999 "-kj"
+ 42 "-kj"
4 "-kj4"
5 "-kj 5"
)
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index ef7687b8a9cf..6abf10cadabd 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -64,6 +64,8 @@ tmpfile=$(mktemp)
inherit python-utils-r1
+ebegin "Testing python2.7"
+eindent
test_var EPYTHON python2_7 python2.7
test_var PYTHON python2_7 /usr/bin/python2.7
if [[ -x /usr/bin/python2.7 ]]; then
@@ -76,77 +78,64 @@ if [[ -x /usr/bin/python2.7 ]]; then
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
+eoutdent
-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"
- test_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
- test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
-fi
-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"
- test_var PYTHON_CFLAGS python3_7 "*-I/usr/include/python3.7*"
- test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
-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 python3_8 python3.8
-test_var PYTHON python3_8 /usr/bin/python3.8
-if [[ -x /usr/bin/python3.8 ]]; then
- abiflags=$(/usr/bin/python3.8 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
- test_var PYTHON_SITEDIR python3_8 "/usr/lib/python3.8/site-packages"
- test_var PYTHON_INCLUDEDIR python3_8 "/usr/include/python3.8${abiflags}"
- test_var PYTHON_LIBPATH python3_8 "/usr/lib*/libpython3.8${abiflags}$(get_libname)"
- test_var PYTHON_CONFIG python3_8 "/usr/bin/python3.8${abiflags}-config"
- test_var PYTHON_CFLAGS python3_8 "*-I/usr/include/python3.8*"
- test_var PYTHON_LIBS python3_8 "*-lpython3.8*"
-fi
-test_var PYTHON_PKG_DEP python3_8 '*dev-lang/python*:3.8'
-test_var PYTHON_SCRIPTDIR python3_8 /usr/lib/python-exec/python3.8
-
-test_var EPYTHON python3_9 python3.9
-test_var PYTHON python3_9 /usr/bin/python3.9
-if [[ -x /usr/bin/python3.9 ]]; then
- abiflags=$(/usr/bin/python3.9 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
- test_var PYTHON_SITEDIR python3_9 "/usr/lib/python3.9/site-packages"
- test_var PYTHON_INCLUDEDIR python3_9 "/usr/include/python3.9${abiflags}"
- test_var PYTHON_LIBPATH python3_9 "/usr/lib*/libpython3.9${abiflags}$(get_libname)"
- test_var PYTHON_CONFIG python3_9 "/usr/bin/python3.9${abiflags}-config"
- test_var PYTHON_CFLAGS python3_9 "*-I/usr/include/python3.9*"
- test_var PYTHON_LIBS python3_9 "*-lpython3.9*"
-fi
-test_var PYTHON_PKG_DEP python3_9 '*dev-lang/python*:3.9'
-test_var PYTHON_SCRIPTDIR python3_9 /usr/lib/python-exec/python3.9
-
-test_var EPYTHON python3_10 python3.10
-test_var PYTHON python3_10 /usr/bin/python3.10
-if [[ -x /usr/bin/python3.10 ]]; then
- abiflags=$(/usr/bin/python3.10 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
- test_var PYTHON_SITEDIR python3_10 "/usr/lib/python3.10/site-packages"
- test_var PYTHON_INCLUDEDIR python3_10 "/usr/include/python3.10${abiflags}"
- test_var PYTHON_LIBPATH python3_10 "/usr/lib*/libpython3.10${abiflags}$(get_libname)"
- test_var PYTHON_CONFIG python3_10 "/usr/bin/python3.10${abiflags}-config"
- test_var PYTHON_CFLAGS python3_10 "*-I/usr/include/python3.10*"
- test_var PYTHON_LIBS python3_10 "*-lpython3.10*"
-fi
-test_var PYTHON_PKG_DEP python3_10 '*dev-lang/python*:3.10'
-test_var PYTHON_SCRIPTDIR python3_10 /usr/lib/python-exec/python3.10
+for minor in 6 7 8 9 10 11; do
+ ebegin "Testing python3.${minor}"
+ eindent
+ test_var EPYTHON "python3_${minor}" "python3.${minor}"
+ test_var PYTHON "python3_${minor}" "/usr/bin/python3.${minor}"
+ if [[ -x /usr/bin/python3.${minor} ]]; then
+ abiflags=$(/usr/bin/python3.${minor} -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
+ test_var PYTHON_SITEDIR "python3_${minor}" "/usr/lib*/python3.${minor}/site-packages"
+ test_var PYTHON_INCLUDEDIR "python3_${minor}" "/usr/include/python3.${minor}${abiflags}"
+ test_var PYTHON_LIBPATH "python3_${minor}" "/usr/lib*/libpython3.${minor}${abiflags}$(get_libname)"
+ test_var PYTHON_CONFIG "python3_${minor}" "/usr/bin/python3.${minor}${abiflags}-config"
+ test_var PYTHON_CFLAGS "python3_${minor}" "*-I/usr/include/python3.${minor}*"
+ test_var PYTHON_LIBS "python3_${minor}" "*-lpython3.${minor}*"
+ fi
+ test_var PYTHON_PKG_DEP "python3_${minor}" "*dev-lang/python*:3.${minor}"
+ test_var PYTHON_SCRIPTDIR "python3_${minor}" "/usr/lib/python-exec/python3.${minor}"
+
+ tbegin "Testing that python3_${minor} is present in an impl array"
+ has "python3_${minor}" "${_PYTHON_ALL_IMPLS[@]}"
+ has_in_all=${?}
+ has "python3_${minor}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
+ has_in_historical=${?}
+ if [[ ${has_in_all} -eq ${has_in_historical} ]]; then
+ if [[ ${has_in_all} -eq 1 ]]; then
+ eerror "python3_${minor} not found in _PYTHON_ALL_IMPLS or _PYTHON_HISTORICAL_IMPLS"
+ else
+ eerror "python3_${minor} listed both in _PYTHON_ALL_IMPLS and _PYTHON_HISTORICAL_IMPLS"
+ fi
+ fi
+ tend ${?}
+
+ tbegin "Testing that PYTHON_COMPAT accepts the impl"
+ (
+ # NB: we add pypy3 as we need to always have at least one
+ # non-historical impl
+ PYTHON_COMPAT=( pypy3 "python3_${minor}" )
+ _python_set_impls
+ )
+ tend ${?}
+
+ # these tests apply to py3.8+ only
+ if [[ ${minor} -ge 8 ]]; then
+ tbegin "Testing that _python_verify_patterns accepts stdlib version"
+ ( _python_verify_patterns "3.${minor}" )
+ tend ${?}
+
+ tbegin "Testing _python_impl_matches on stdlib version"
+ _python_impl_matches "python3_${minor}" "3.${minor}"
+ tend ${?}
+ fi
+
+ eoutdent
+done
+ebegin "Testing pypy3"
+eindent
test_var EPYTHON pypy3 pypy3
test_var PYTHON pypy3 /usr/bin/pypy3
if [[ -x /usr/bin/pypy3 ]]; then
@@ -155,9 +144,10 @@ if [[ -x /usr/bin/pypy3 ]]; then
fi
test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0='
test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
+eoutdent
for EPREFIX in '' /foo; do
- einfo "with EPREFIX=${EPREFIX@Q}"
+ einfo "Testing python_fix_shebang with EPREFIX=${EPREFIX@Q}"
eindent
# generic shebangs
test_fix_shebang '#!/usr/bin/python' python3.6 \
@@ -212,6 +202,8 @@ for EPREFIX in '' /foo; do
done
# check _python_impl_matches behavior
+einfo "Testing python_impl_matches"
+eindent
test_is "_python_impl_matches python3_6 -3" 0
test_is "_python_impl_matches python3_7 -3" 0
test_is "_python_impl_matches pypy3 -3" 0
@@ -223,6 +215,16 @@ test_is "_python_impl_matches python3_6 python*" 0
test_is "_python_impl_matches python3_7 python*" 0
test_is "_python_impl_matches pypy3 python*" 1
set +f
+test_is "_python_impl_matches python3_8 3.8" 0
+test_is "_python_impl_matches python3_8 3.9" 1
+test_is "_python_impl_matches python3_8 3.10" 1
+test_is "_python_impl_matches python3_9 3.8" 1
+test_is "_python_impl_matches python3_9 3.9" 0
+test_is "_python_impl_matches python3_9 3.10" 1
+test_is "_python_impl_matches pypy3 3.8" 1
+test_is "_python_impl_matches pypy3 3.9" 0
+test_is "_python_impl_matches pypy3 3.10" 1
+eoutdent
rm "${tmpfile}"
diff --git a/eclass/tests/qmail.sh b/eclass/tests/qmail.sh
index 8cf0abdae1a6..16e52741c23c 100755
--- a/eclass/tests/qmail.sh
+++ b/eclass/tests/qmail.sh
@@ -13,7 +13,8 @@ test_low_numbers() {
for i in $(seq 0 6); do
if is_prime ${i}; then
- return tend 1 "${i} badly accepted"
+ tend 1 "${i} badly accepted"
+ return
fi
done