[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 0e3fcf7b631e7afe04af8ac80bae2759d222d2de Author: Sam James gentoo org> AuthorDate: Thu Sep 19 04:12:46 2024 + Commit: Sam James gentoo org> CommitDate: Thu Sep 19 04:13:46 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e3fcf7b eclass/tests: fix toolchain.sh tests by dropping old GCC support eb49d171430cc2baffbf9d37493a78cc02b33fe2 dropped old GCC support but the tests weren't updated. Closes: https://bugs.gentoo.org/939817 Fixes: eb49d171430cc2baffbf9d37493a78cc02b33fe2 Signed-off-by: Sam James gentoo.org> eclass/tests/toolchain.sh | 17 - 1 file changed, 17 deletions(-) diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 6f8df5b4fc4a..1ba2e6b1f29d 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -49,10 +49,6 @@ test_downgrade_arch_flags 4.5 "-march=core2" "-march=haswell" test_downgrade_arch_flags 4.4 "-march=core2" "-march=haswell" test_downgrade_arch_flags 4.3 "-march=core2" "-march=haswell" test_downgrade_arch_flags 4.2 "-march=nocona" "-march=haswell" -test_downgrade_arch_flags 4.1 "-march=nocona" "-march=haswell" -test_downgrade_arch_flags 4.0 "-march=nocona" "-march=haswell" -test_downgrade_arch_flags 3.4 "-march=nocona" "-march=haswell" -test_downgrade_arch_flags 3.3 "-march=nocona" "-march=haswell" test_downgrade_arch_flags 4.9 "-march=bdver4" "-march=bdver4" test_downgrade_arch_flags 4.8 "-march=bdver3" "-march=bdver4" @@ -62,31 +58,18 @@ test_downgrade_arch_flags 4.5 "-march=amdfam10" "-march=bdver4" test_downgrade_arch_flags 4.4 "-march=amdfam10" "-march=bdver4" test_downgrade_arch_flags 4.3 "-march=amdfam10" "-march=bdver4" test_downgrade_arch_flags 4.2 "-march=k8" "-march=bdver4" -test_downgrade_arch_flags 4.1 "-march=k8" "-march=bdver4" -test_downgrade_arch_flags 4.0 "-march=k8" "-march=bdver4" -test_downgrade_arch_flags 3.4 "-march=k8" "-march=bdver4" -test_downgrade_arch_flags 3.3 "-march=x86-64" "-march=bdver4" - -test_downgrade_arch_flags 3.4 "-march=c3-2" "-march=c3-2" -test_downgrade_arch_flags 3.3 "-march=c3" "-march=c3-2" test_downgrade_arch_flags 4.5 "-march=garbage""-march=garbage" test_downgrade_arch_flags 10 "-mtune=intel" "-mtune=intel" test_downgrade_arch_flags 4.9 "-mtune=intel" "-mtune=intel" test_downgrade_arch_flags 4.8 "-mtune=generic""-mtune=intel" -test_downgrade_arch_flags 3.4 "" "-mtune=generic" -test_downgrade_arch_flags 3.4 "" "-mtune=x86-64" -test_downgrade_arch_flags 3.3 "" "-mtune=anything" test_downgrade_arch_flags 4.5 "-march=amdfam10 -mtune=generic" "-march=btver2 -mtune=generic" -test_downgrade_arch_flags 3.3 "-march=k6-2" "-march=geode -mtune=barcelona" -test_downgrade_arch_flags 3.4 "-march=k8" "-march=btver2 -mtune=generic" test_downgrade_arch_flags 10 "-march=native" "-march=native" test_downgrade_arch_flags 8 "-march=znver1" "-march=znver2" test_downgrade_arch_flags 4.2 "-march=native" "-march=native" -test_downgrade_arch_flags 4.1 "-march=nocona" "-march=native" test_downgrade_arch_flags 9 "-march=znver2" "-march=znver3" test_downgrade_arch_flags 10 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 3f3bfeac6adc6b4e9db50b1204c1a398523c55b1 Author: Sam James gentoo org> AuthorDate: Wed Sep 18 15:49:34 2024 + Commit: Sam James gentoo org> CommitDate: Wed Sep 18 15:49:34 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f3bfeac Revert "eclass/tests/toolchain.sh: declare PYTHON_COMPAT" This reverts commit 992fc2954c2281285bc50156ba12d310a1b434e1. This should no longer be necessary now that tests are opt-in with TOOLCHAIN_HAS_TESTS. Bug: https://bugs.gentoo.org/859157 Signed-off-by: Sam James gentoo.org> eclass/tests/toolchain.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 2e48c3443493..6f8df5b4fc4a 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -11,8 +11,6 @@ PR=r0 source tests-common.sh || exit source version-funcs.sh || exit -PYTHON_COMPAT=( python3_{10..13} ) - EAPI=7 inherit toolchain # Ignore actually running version of gcc and fake new version
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 992fc2954c2281285bc50156ba12d310a1b434e1 Author: Petr Vaněk gentoo org> AuthorDate: Wed Sep 18 11:30:12 2024 + Commit: Sam James gentoo org> CommitDate: Wed Sep 18 15:49:09 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=992fc295 eclass/tests/toolchain.sh: declare PYTHON_COMPAT toolchain.sh test script requires PYTHON_COMPAT array since commit 1d93a491096f ("toolchain.eclass: rework tests more") otherwise it dies with die: PYTHON_COMPAT not declared. error. Bug: https://bugs.gentoo.org/859157 Signed-off-by: Petr Vaněk gentoo.org> Signed-off-by: Sam James gentoo.org> eclass/tests/toolchain.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 6f8df5b4fc4a..2e48c3443493 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -11,6 +11,8 @@ PR=r0 source tests-common.sh || exit source version-funcs.sh || exit +PYTHON_COMPAT=( python3_{10..13} ) + EAPI=7 inherit toolchain # Ignore actually running version of gcc and fake new version
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 91990a04b76e591ffe959f5101645f44cb83c730 Author: Andrew Ammerlaan gentoo org> AuthorDate: Tue Aug 6 09:38:12 2024 + Commit: Andrew Ammerlaan gentoo org> CommitDate: Wed Aug 7 08:58:40 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91990a04 eclass/tests/tests-common.sh: add in_iuse function Signed-off-by: Andrew Ammerlaan gentoo.org> eclass/tests/tests-common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh index 45b1e20b933a..f4e18f38fee9 100644 --- a/eclass/tests/tests-common.sh +++ b/eclass/tests/tests-common.sh @@ -55,6 +55,8 @@ has() { } use() { has "$1" ${IUSE} ; } +in_iuse() { use "$@" ; } + die() { echo "die: $*" 1>&2 exit 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 03e930a67cb99b686188d74e5f2168506b0447aa Author: Andrew Ammerlaan gentoo org> AuthorDate: Tue Aug 6 09:38:34 2024 + Commit: Andrew Ammerlaan gentoo org> CommitDate: Wed Aug 7 08:58:41 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03e930a6 eclass/tests/dist-kernel-utils.sh: add compressed_module_cleanup tests Signed-off-by: Andrew Ammerlaan gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/37985 Signed-off-by: Andrew Ammerlaan gentoo.org> eclass/tests/dist-kernel-utils.sh | 59 +++ 1 file changed, 59 insertions(+) diff --git a/eclass/tests/dist-kernel-utils.sh b/eclass/tests/dist-kernel-utils.sh index 50ba001f8e9c..28c8f7213a53 100755 --- a/eclass/tests/dist-kernel-utils.sh +++ b/eclass/tests/dist-kernel-utils.sh @@ -20,9 +20,68 @@ test_PV_to_KV() { tend $? } +test_compressed_module_cleanup() { + mkdir -p "${tmpdir}/source" || die + pushd "${tmpdir}" >/dev/null || die + + local module option fail=0 + for option in NONE GZIP XZ ZSTD; do + tbegin "CONFIG_MODULE_COMPRESS_${option}" + echo "CONFIG_MODULE_COMPRESS_${option}=y" > source/.config + + touch a.ko b.ko.gz c.ko.xz d.ko.gz e.ko f.ko.xz || die + # ensure some files are older + touch -d "2 hours ago" d.ko e.ko.xz f.ko.gz || die + + IUSE=modules-compress dist-kernel_compressed_module_cleanup . + + local to_keep=( a.ko b.ko.gz c.ko.xz ) + local to_remove=() + + case ${option} in + NONE) + to_keep+=( d.ko e.ko f.ko.xz ) + to_remove+=( d.ko.gz e.ko.xz f.ko.gz ) + ;; + GZIP) + to_keep+=( d.ko.gz e.ko f.ko.gz ) + to_remove+=( d.ko e.ko.xz f.ko.xz ) + ;; + XZ) + to_keep+=( d.ko.gz e.ko.xz f.ko.xz ) + to_remove+=( d.ko e.ko f.ko.gz ) + ;; + ZSTD) + to_keep+=( d.ko.gz e.ko f.ko.xz ) + to_remove+=( d.ko e.ko.xz f.ko.gz ) + ;; + esac + + for module in "${to_keep[@]}"; do + if [[ ! -f ${module} ]]; then + eerror "Module ${module} was removed" + fail=1 + fi + done + + for module in "${to_remove[@]}"; do + if [[ -f ${module} ]]; then + eerror "Module ${module} was not removed" + fail=1 + fi + done + tend ${fail} + done + + popd >/dev/null || die +} + + test_PV_to_KV 6.0_rc1 6.0.0-rc1 test_PV_to_KV 6.0 6.0.0 test_PV_to_KV 6.0.1_rc1 6.0.1-rc1 test_PV_to_KV 6.0.1 6.0.1 +test_compressed_module_cleanup + texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: f14c9139aac5679ad4827e4b69d8bc6a5e3042cc Author: Michał Górny gentoo org> AuthorDate: Mon Aug 5 14:06:43 2024 + Commit: Michał Górny gentoo org> CommitDate: Tue Aug 6 08:28:53 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f14c9139 eclass/tests/toolchain-funcs.sh: Cover tc-is-lto Signed-off-by: Michał Górny gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/37976 Signed-off-by: Michał Górny gentoo.org> eclass/tests/toolchain-funcs.sh | 20 1 file changed, 20 insertions(+) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index ee10ddf50c1e..6bfb00ff6bcb 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -210,6 +210,16 @@ if type -P gcc &>/dev/null; then tbegin "tc-get-c-rtlib (gcc)" [[ $(CC=gcc tc-get-c-rtlib) == libgcc ]] tend $? + + tbegin "tc-is-lto (gcc, -fno-lto)" + CC=gcc CFLAGS=-fno-lto tc-is-lto + [[ $? -eq 1 ]] + tend $? + + tbegin "tc-is-lto (gcc, -flto)" + CC=gcc CFLAGS=-flto tc-is-lto + [[ $? -eq 0 ]] + tend $? fi if type -P clang &>/dev/null; then @@ -232,6 +242,16 @@ if type -P clang &>/dev/null; then [[ $(CC=clang CFLAGS="--rtlib=${rtlib}" tc-get-c-rtlib) == ${rtlib} ]] tend $? done + + tbegin "tc-is-lto (clang, -fno-lto)" + CC=clang CFLAGS=-fno-lto tc-is-lto + [[ $? -eq 1 ]] + tend $? + + tbegin "tc-is-lto (clang, -flto)" + CC=clang CFLAGS=-flto tc-is-lto + [[ $? -eq 0 ]] + tend $? fi texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 69190f6268a2a6942e5a266a45e2b353cf617569 Author: Michał Górny gentoo org> AuthorDate: Tue Aug 6 06:27:14 2024 + Commit: Michał Górny gentoo org> CommitDate: Tue Aug 6 08:29:02 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69190f62 eclass/tests/toolchain-funcs.sh: Cover tc-has-64bit-time_t Signed-off-by: Michał Górny gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/37142 Signed-off-by: Michał Górny gentoo.org> eclass/tests/toolchain-funcs.sh | 20 1 file changed, 20 insertions(+) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 6bfb00ff6bcb..0d6745862148 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -220,6 +220,26 @@ if type -P gcc &>/dev/null; then CC=gcc CFLAGS=-flto tc-is-lto [[ $? -eq 0 ]] tend $? + + case $(gcc -dumpmachine) in + i*86*-gnu*|arm*-gnu*|powerpc-*-gnu) + tbegin "tc-has-64bit-time_t (_TIME_BITS=32)" + CC=gcc CFLAGS="-U_TIME_BITS -D_TIME_BITS=32" tc-has-64bit-time_t + [[ $? -eq 1 ]] + tend $? + + tbegin "tc-has-64bit-time_t (_TIME_BITS=64)" + CC=gcc CFLAGS="-U_FILE_OFFSET_BITS -U_TIME_BITS -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" tc-has-64bit-time_t + [[ $? -eq 0 ]] + tend $? + ;; + *) + tbegin "tc-has-64bit-time_t" + CC=gcc tc-has-64bit-time_t + [[ $? -eq 0 ]] + tend $? + ;; + esac fi if type -P clang &>/dev/null; then
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: ac3849073fc4fc19b4872e7840ff12d66ab54b15 Author: Michał Górny gentoo org> AuthorDate: Mon Jul 29 15:40:10 2024 + Commit: Michał Górny gentoo org> CommitDate: Mon Jul 29 17:02:40 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac384907 llvm-r1.eclass: Update tests for new stable Closes: https://bugs.gentoo.org/936882 Signed-off-by: Michał Górny gentoo.org> eclass/tests/llvm-r1.sh | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/eclass/tests/llvm-r1.sh b/eclass/tests/llvm-r1.sh index 9958f5bba420..8583fd6c799b 100755 --- a/eclass/tests/llvm-r1.sh +++ b/eclass/tests/llvm-r1.sh @@ -121,22 +121,30 @@ test_fix_tool_path() { tend ${?} } +# full range +test_globals '14 15 16 17 18 19' \ + "+llvm_slot_18 llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_19" \ + "^^ ( llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18 llvm_slot_19 )" \ + "llvm_slot_15(-)?,llvm_slot_16(-)?,llvm_slot_17(-)?,llvm_slot_18(-)?,llvm_slot_19(-)?" test_globals '14 15 16 17 18' \ - "+llvm_slot_17 llvm_slot_15 llvm_slot_16 llvm_slot_18" \ + "+llvm_slot_18 llvm_slot_15 llvm_slot_16 llvm_slot_17" \ "^^ ( llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18 )" \ "llvm_slot_15(-)?,llvm_slot_16(-)?,llvm_slot_17(-)?,llvm_slot_18(-)?" +# older than stable test_globals '14 15 16' \ "+llvm_slot_16 llvm_slot_15" \ "^^ ( llvm_slot_15 llvm_slot_16 )" \ "llvm_slot_15(-)?,llvm_slot_16(-)?" -test_globals '15 18' \ - "+llvm_slot_15 llvm_slot_18" \ - "^^ ( llvm_slot_15 llvm_slot_18 )" \ - "llvm_slot_15(-)?,llvm_slot_18(-)?" -test_globals '18' \ - "+llvm_slot_18" \ - "^^ ( llvm_slot_18 )" \ - "llvm_slot_18(-)?" +# old + newer than current stable +test_globals '15 19' \ + "+llvm_slot_15 llvm_slot_19" \ + "^^ ( llvm_slot_15 llvm_slot_19 )" \ + "llvm_slot_15(-)?,llvm_slot_19(-)?" +# newer than current stable +test_globals '19' \ + "+llvm_slot_19" \ + "^^ ( llvm_slot_19 )" \ + "llvm_slot_19(-)?" LLVM_COMPAT=( {14..18} ) inherit llvm-r1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 54aa9f031b6b1eb2af5b45ae9fd7d610d2b97f03 Author: Ulrich Müller gentoo org> AuthorDate: Sun Jul 28 09:23:28 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Sun Jul 28 09:32:32 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54aa9f03 eclass/tests: Include tests in version-funcs.sh itself Previously, tests were in eapi7-ver.sh. Update Makefile. Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/Makefile | 2 +- eclass/tests/eapi7-ver.sh | 174 -- eclass/tests/version-funcs.sh | 174 ++ 3 files changed, 175 insertions(+), 175 deletions(-) diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile index 99e824dea86d..23027aed6b66 100644 --- a/eclass/tests/Makefile +++ b/eclass/tests/Makefile @@ -1,5 +1,5 @@ SH_FILES := $(wildcard *.sh) -TEST_FILES := $(filter-out tests-common.sh version-funcs.sh, $(SH_FILES)) +TEST_FILES := $(filter-out tests-common.sh, $(SH_FILES)) TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES)) # !!! _All_ recipe lines for each target will be provided to a single diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh deleted file mode 100755 index ee7e6d728ef7.. --- a/eclass/tests/eapi7-ver.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -source tests-common.sh || exit -source version-funcs.sh || exit - -teq() { - local expected=${1}; shift - - tbegin "${*} -> ${expected}" - local got=$("${@}") - [[ ${got} == ${expected} ]] - tend ${?} "returned: ${got}" -} - -teqr() { - local expected=$1; shift - tbegin "$* -> ${expected}" - "$@" - local ret=$? - [[ ${ret} -eq ${expected} ]] - tend $? "returned: ${ret}" -} - -txf() { - tbegin "XFAIL: ${*}" - local got=$("${@}" 2>&1) - [[ ${got} == die:* ]] - tend ${?} "function did not die" -} - -teq 1 ver_cut 1 1.2.3 -teq 1 ver_cut 1-1 1.2.3 -teq 1.2 ver_cut 1-2 1.2.3 -teq 2.3 ver_cut 2- 1.2.3 -teq 1.2.3 ver_cut 1- 1.2.3 -teq 3b ver_cut 3-4 1.2.3b_alpha4 -teq alpha ver_cut 5 1.2.3b_alpha4 -teq 1.2 ver_cut 1-2 .1.2.3 -teq .1.2 ver_cut 0-2 .1.2.3 -teq 2.3 ver_cut 2-3 1.2.3. -teq 2.3. ver_cut 2- 1.2.3. -teq 2.3. ver_cut 2-4 1.2.3. - -teq 1-2.3 ver_rs 1 - 1.2.3 -teq 1.2-3 ver_rs 2 - 1.2.3 -teq 1-2-3.4 ver_rs 1-2 - 1.2.3.4 -teq 1.2-3-4 ver_rs 2- - 1.2.3.4 -teq 1.2.3 ver_rs 2 . 1.2-3 -teq 1.2.3.a ver_rs 3 . 1.2.3a -teq 1.2-alpha-4 ver_rs 2-3 - 1.2_alpha4 -teq 1.23-b_alpha4 ver_rs 3 - 2 "" 1.2.3b_alpha4 -teq a1b_2-c-3-d4e5 ver_rs 3-5 _ 4-6 - a1b2c3d4e5 -teq .1-2.3 ver_rs 1 - .1.2.3 -teq -1.2.3 ver_rs 0 - .1.2.3 - -# truncating range -teq 1.2 ver_cut 0-2 1.2.3 -teq 2.3 ver_cut 2-5 1.2.3 -teq "" ver_cut 4 1.2.3 -teq "" ver_cut 0 1.2.3 -teq "" ver_cut 4- 1.2.3 -teq 1.2.3 ver_rs 0 - 1.2.3 -teq 1.2.3 ver_rs 3 . 1.2.3 -teq 1.2.3 ver_rs 3- . 1.2.3 -teq 1.2.3 ver_rs 3-5 . 1.2.3 - -txf ver_cut foo 1.2.3 -txf ver_rs -3 _ a1b2c3d4e5 -txf ver_rs 5-3 _ a1b2c3d4e5 - -# Tests from Portage's test_vercmp.py -teqr 0 ver_test 6.0 -gt 5.0 -teqr 0 ver_test 5.0 -gt 5 -teqr 0 ver_test 1.0-r1 -gt 1.0-r0 -teqr 0 ver_test 99 -gt 98 # 18 digits -teqr 0 ver_test 1.0.0 -gt 1.0 -teqr 0 ver_test 1.0.0 -gt 1.0b -teqr 0 ver_test 1b -gt 1 -teqr 0 ver_test 1b_p1 -gt 1_p1 -teqr 0 ver_test 1.1b -gt 1.1 -teqr 0 ver_test 12.2.5 -gt 12.2b -teqr 0 ver_test 4.0 -lt 5.0 -teqr 0 ver_test 5 -lt 5.0 -teqr 0 ver_test 1.0_pre2 -lt 1.0_p2 -teqr 0 ver_test 1.0_alpha2 -lt 1.0_p2 -teqr 0 ver_test 1.0_alpha1 -lt 1.0_beta1 -teqr 0 ver_test 1.0_beta3 -lt 1.0_rc3 -teqr 0 ver_test 1.001001 -lt 1.001002 -teqr 0 ver_test 1.001 -lt 1.001001 -teqr 0 ver_test 98 -lt 99 -teqr 0 ver_test 1.01 -lt 1.1 -teqr 0 ver_test 1.0-r0 -lt 1.0-r1 -teqr 0 ver_test 1.0 -lt 1.0-r1 -teqr 0 ver_test 1.0 -lt 1.0.0 -teqr 0 ver_test 1.0b -lt 1.0.0 -teqr 0 ver_test 1_p1 -lt 1b_p1 -teqr 0 ver_test 1 -lt 1b -teqr 0 ver_test 1.1 -lt 1.1b -teqr 0 ver_test 12.2b -lt 12.2.5 -teqr 0 ver_test 4.0 -eq 4.0 -teqr 0 ver_test 1.0 -eq 1.0 -teqr 0 ver_test 1.0-r0 -eq 1.0 -teqr 0 ver_test 1.0 -eq 1.0-r0 -teqr 0 ver_test 1.0-r0 -eq 1.0-r0 -teqr 0 ver_test 1.0-r1 -eq 1.0-r1 -teqr 1 ver_test 1 -eq 2 -teqr 1 ver_test 1.0_alpha -eq 1.0_pre -teqr 1 ver_test 1.0_beta -eq 1.0_alpha -teqr 1 ver_test 1 -eq 0.0 -teqr 1 ver_test 1.0-r0 -eq 1.0-r1 -teqr 1 ver_test 1.0-r1 -eq 1.0-r0 -teqr 1 ver_test 1.0 -eq 1.0-r1 -teqr 1 ver_test 1.0-r1 -eq 1.0 -teqr 1 ver_test 1.0 -eq 1.0.0 -teqr 1 ver_test 1_p1 -eq 1b_p1 -teqr 1 ver_test 1b -eq 1 -teqr 1 ver_test 1.1b -eq 1.1 -teqr 1 ver_test 12.2b -eq 12.2 - -# A subset of tests from Paludis -teqr 0 ver_test 1.0_alpha -gt 1_alpha -teqr 0 ver_test 1.0_alpha -gt 1 -teqr 0 ver_test 1.0_alpha -lt 1.0 -teqr 0 ver_test 1.2.0.0_alpha7-r4 -gt 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: ba67b6e7fd84fff922569627003bb3ae326c7f41 Author: Ulrich Müller gentoo org> AuthorDate: Thu Jun 13 18:29:44 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Thu Jun 13 18:35:30 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba67b6e7 eclass/tests: Rename test function in savedconfig.sh Overriding a shell builtin command is generally a very bad idea, especially when that command is used in code that is sourced (in this case, /lib/gentoo/functions.sh). Therefore, rename test() to test_sc(). Also make sure that the directories that are used as targets for rm -rf in cleanup() are actually different from the root directory. Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/savedconfig.sh | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/eclass/tests/savedconfig.sh b/eclass/tests/savedconfig.sh index 16645fc05854..ad03ce2d2d94 100755 --- a/eclass/tests/savedconfig.sh +++ b/eclass/tests/savedconfig.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -18,7 +18,13 @@ quiet() { sc() { EBUILD_PHASE=install quiet save_config "$@" ; } rc() { EBUILD_PHASE=prepare quiet restore_config "$@" ; } -cleanup() { rm -rf "${ED}"/* "${T}"/* "${WORKDIR}"/* ; } +cleanup() { + # make sure that these variables exist + [[ -n ${ED} && -n ${T} && -n ${WORKDIR} ]] \ + || { die "${FUNCNAME[0]}: undefined variable"; exit 1; } + rm -rf "${ED}"/* "${T}"/* "${WORKDIR}"/* +} + test-it() { local ret=0 tbegin "$@" @@ -26,7 +32,7 @@ test-it() { : $(( ret |= $? )) pushd "${WORKDIR}" >/dev/null : $(( ret |= $? )) - test + test_sc : $(( ret |= $? )) popd >/dev/null : $(( ret |= $? )) @@ -34,21 +40,21 @@ test-it() { cleanup } -test() { +test_sc() { touch f || return 1 sc f || return 1 [[ -f ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]] } test-it "simple save_config" -test() { +test_sc() { touch a b c || return 1 sc a b c || return 1 [[ -d ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]] } test-it "multi save_config" -test() { +test_sc() { mkdir dir || return 1 touch dir/{a,b,c} || return 1 sc dir || return 1 @@ -58,14 +64,14 @@ test-it "dir save_config" PORTAGE_CONFIGROOT=${D} -test() { +test_sc() { echo "ggg" > f || return 1 rc f || return 1 [[ $( f || return 1 rc f || return 1 [[ $(
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2d60db117655b37a8c3864f68d30c199a5d3b802 Author: Ulrich Müller gentoo org> AuthorDate: Thu Jun 13 19:40:54 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Thu Jun 13 19:53:15 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d60db11 eclass/tests: Fail the .%.sh.ok Makefile recipe if the test fails With .ONESHELL active, only the return status of the final recipe line will be checked. Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/Makefile | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile index e5d1c3915fe1..99e824dea86d 100644 --- a/eclass/tests/Makefile +++ b/eclass/tests/Makefile @@ -2,18 +2,20 @@ SH_FILES := $(wildcard *.sh) TEST_FILES := $(filter-out tests-common.sh version-funcs.sh, $(SH_FILES)) TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES)) +# !!! _All_ recipe lines for each target will be provided to a single +# !!! invocation of the shell. +.ONESHELL: + # We cache a successful test result if the testfile itself did not # change (%.sh) and the contents of the eclass/ directory did not # change (.eclasssum). .%.sh.ok: %.sh .eclasssum - ./$< - touch $@ + ./$< && touch $@ .PHONY: test test: $(TEST_OK_FILES) .PHONY: force -.ONESHELL: .eclasssum: SHELL = /bin/bash .eclasssum: force set -euo pipefail
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 0fcc9d42818f61e8e094bae67740a656b6d16caa Author: Ulrich Müller gentoo org> AuthorDate: Thu Jun 13 19:39:31 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Thu Jun 13 19:53:14 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0fcc9d42 eclass/tests: Filter version-funcs.sh from the list of tests Fixes: 16b2c5ebb2869f4132536e5eb0a465b534556fb6 Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile index ee4a454912c3..e5d1c3915fe1 100644 --- a/eclass/tests/Makefile +++ b/eclass/tests/Makefile @@ -1,5 +1,5 @@ SH_FILES := $(wildcard *.sh) -TEST_FILES := $(filter-out tests-common.sh, $(SH_FILES)) +TEST_FILES := $(filter-out tests-common.sh version-funcs.sh, $(SH_FILES)) TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES)) # We cache a successful test result if the testfile itself did not
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 8c8239bdffa74b2c12ff9bbb5c25d62947e9a0a2 Author: Ulrich Müller gentoo org> AuthorDate: Wed Jun 12 15:37:07 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Wed Jun 12 16:47:34 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c8239bd eclass/tests: Drop FreeBSD test from toolchain-funcs.sh Prefix targets have been dropped from toolchain-funcs.eclass in commit cab79611b07c9eb. Update tests accordingly. Fixes: cab79611b07c9ebb795c6f65562ef72ba77550b1 Closes: https://bugs.gentoo.org/934150 Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/toolchain-funcs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 08cfd74611aa..ee10ddf50c1e 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -28,7 +28,7 @@ test-tc-arch-kernel() { tbegin "tc-arch-kernel() (KV=2.6.30)" test-tc-arch-kernel 2.6.30 \ i{3..6}86:x86 x86_64:x86 \ - powerpc{,64}:powerpc i{3..6}86-gentoo-freebsd:i386 \ + powerpc{,64}:powerpc \ or1k:openrisc or1k-linux-musl:openrisc tend $?
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2a7763a875ff6f4a74b6c40c0238a50febcfafab Author: Michał Górny gentoo org> AuthorDate: Wed Jun 12 15:34:29 2024 + Commit: Michał Górny gentoo org> CommitDate: Wed Jun 12 15:35:31 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a7763a8 eclass/tests: Remove git-r3.sh Remove base git-r3 tests, they are broken for a long time and I can't figure out how to fix them properly. There is probably no point in testing these functions standalone anyway since they're extensively used by ebuilds. Signed-off-by: Michał Górny gentoo.org> eclass/tests/git-r3.sh | 208 - 1 file changed, 208 deletions(-) diff --git a/eclass/tests/git-r3.sh b/eclass/tests/git-r3.sh deleted file mode 100755 index 02cbcbc59125.. --- a/eclass/tests/git-r3.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/bash -# 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 || exit - -inherit git-r3 - -testdir=${pkg_root}/git -mkdir "${testdir}" || die "unable to mkdir testdir" -cd "${testdir}" || die "unable to cd to testdir" - -EGIT3_STORE_DIR=store -mkdir "${EGIT3_STORE_DIR}" || die "unable to mkdir store" - -test_file() { - local fn=${1} - local expect=${2} - - if [[ ! -f ${fn} ]]; then - eerror "${fn} does not exist (not checked out?)" - else - local got=$(<"${fn}") - - if [[ ${got} != ${expect} ]]; then - eerror "${fn}, expected: ${expect}, got: ${got}" - else - return 0 - fi - fi - return 1 -} - -test_no_file() { - local fn=${1} - - if [[ -f ${fn} ]]; then - eerror "${fn} exists (wtf?!)" - else - return 0 - fi - return 1 -} - -test_repo_clean() { - local P=${P}_${FUNCNAME#test_} - - ( - mkdir repo - cd repo - git init -q - echo test > file - git add file - git commit -m 1 -q - echo other-text > file2 - git add file2 - git commit -m 2 -q - ) || die "unable to prepare repo" - - # we need to use an array to preserve whitespace - local EGIT_REPO_URI=( - "ext::git daemon --export-all --base-path=. --inetd %G/repo" - ) - - tbegin "fetching from a simple repo" - ( - git-r3_src_unpack - test_file "${WORKDIR}/${P}/file" test && \ - test_file "${WORKDIR}/${P}/file2" other-text - ) &>fetch.log - - eend ${?} || cat fetch.log -} - -test_repo_revert() { - local P=${P}_${FUNCNAME#test_} - - ( - cd repo - git revert -n HEAD^ - git commit -m r1 -q - ) || die "unable to prepare repo" - - # we need to use an array to preserve whitespace - local EGIT_REPO_URI=( - "ext::git daemon --export-all --base-path=. --inetd %G/repo" - ) - - tbegin "fetching revert" - ( - git-r3_src_unpack - test_no_file "${WORKDIR}/${P}/file" && \ - test_file "${WORKDIR}/${P}/file2" other-text - ) &>fetch.log - - eend ${?} || cat fetch.log -} - -test_repo_branch() { - local P=${P}_${FUNCNAME#test_} - - ( - cd repo - git branch -q other-branch HEAD^ - git checkout -q other-branch - echo one-more > file3 - git add file3 - git commit -m 3 -q - git checkout -q master - ) || die "unable to prepare repo" - - # we need to use an array to preserve whitespace - local EGIT_REPO_URI=( - "ext::git daemon --export-all --base-path=. --inetd %G/repo" - ) - local EGIT_BRANCH=other-branch - - tbegin "switching branches" - ( - git-r3_src_unpack - test_file "${WORKDIR}/${P}/file" test && \ - test_file "${WORKDIR}/${P}/file2" other-text && \ - test_file "${WORKDIR}/${P}/file3" one-more - ) &>fetch.log - - eend ${?} || cat fetch.log -} - -test_repo_merge() { - local P=${P}_${FUNCNAME#test_} - - ( - cd repo - git branch -q one-more-branch HEAD^ - git checkout -q one-more-branch - echo foobarbaz > file3 - git add file3 - git commit -m 3b -q - git checkout -q master - git merge -m 4 -q one-more-branch - ) || die "unable to prepare repo" - - # we need to use an array to preserve whitespace - local EGIT_REPO_URI=( - "ext::git daemon --export-all --base-path=. --inetd %G/repo" - ) - -
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: dfbc5ab206ba0da4c5fcab2559bb662fb46084a1 Author: Ulrich Müller gentoo org> AuthorDate: Wed Jun 12 15:28:23 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Wed Jun 12 15:31:47 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dfbc5ab2 eclass/tests: Make *-bench.sh work with reference dc dc from sys-devel/bc doesn't support the -S option. Set the precision with the k command instead. Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/cargo-bench.sh| 4 ++-- eclass/tests/pypi-bench.sh | 4 ++-- eclass/tests/python-utils-bench.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eclass/tests/cargo-bench.sh b/eclass/tests/cargo-bench.sh index d30b04569905..9347fe339c12 100755 --- a/eclass/tests/cargo-bench.sh +++ b/eclass/tests/cargo-bench.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2023 Gentoo Authors +# Copyright 2023-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -39,7 +39,7 @@ timeit() { local xr avg for x in real user; do xr="${x}[*]" - avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p") + avg=$(dc -e "3 k ${ITERATIONS} ${RUNS} * ${!xr} + + / p") printf '%s %4.0f it/s\n' "${x}" "${avg}" done diff --git a/eclass/tests/pypi-bench.sh b/eclass/tests/pypi-bench.sh index cce93527b729..02855563db3f 100755 --- a/eclass/tests/pypi-bench.sh +++ b/eclass/tests/pypi-bench.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2023 Gentoo Authors +# Copyright 2023-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -39,7 +39,7 @@ timeit() { local xr avg for x in real user; do xr="${x}[*]" - avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p") + avg=$(dc -e "3 k ${ITERATIONS} ${RUNS} * ${!xr} + + / p") printf '%s %4.0f it/s\n' "${x}" "${avg}" done diff --git a/eclass/tests/python-utils-bench.sh b/eclass/tests/python-utils-bench.sh index 7f27adef5509..f718b9f125cb 100755 --- a/eclass/tests/python-utils-bench.sh +++ b/eclass/tests/python-utils-bench.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2023 Gentoo Authors +# Copyright 2023-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -38,7 +38,7 @@ timeit() { local xr avg for x in real user; do xr="${x}[*]" - avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p") + avg=$(dc -e "3 k ${ITERATIONS} ${RUNS} * ${!xr} + + / p") printf '%s %4.0f it/s\n' "${x}" "${avg}" done
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 8629d5a9fc153679289b85189f385af8348f4f25 Author: Ulrich Müller gentoo org> AuthorDate: Wed Jun 12 09:43:49 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Wed Jun 12 09:46:39 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8629d5a9 eclass/tests: Override use() in linux-info_get_running_version.sh linux-info.eclass checks for the kernel_linux flag since 2018, introduced with commit 9e7c4b6d2daa9a8b1c33154f8dd296a2d1a26e92. Closes: https://bugs.gentoo.org/934130 Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/linux-info_get_running_version.sh | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eclass/tests/linux-info_get_running_version.sh b/eclass/tests/linux-info_get_running_version.sh index 57aaf2fedcd4..b8ae8c4b85ae 100755 --- a/eclass/tests/linux-info_get_running_version.sh +++ b/eclass/tests/linux-info_get_running_version.sh @@ -1,12 +1,20 @@ #!/bin/bash -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=6 +EAPI=8 source tests-common.sh || exit +source version-funcs.sh || exit inherit linux-info +use() { + case $1 in + kernel_linux) return 0 ;; + esac + die "${FUNCNAME[0]}: unknown flag" +} + test_get_running_version() { local test_kv=$1 major=$2 minor=$3 patch=$4 extra=$5 tbegin "get_running_version ${test_kv}"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 16b2c5ebb2869f4132536e5eb0a465b534556fb6 Author: Ulrich Müller gentoo org> AuthorDate: Thu May 9 10:45:26 2024 + Commit: Ulrich Müller gentoo org> CommitDate: Sat May 25 08:22:48 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16b2c5eb eclass/tests: Copy code from eapi7-ver.eclass to version-functions.sh With EAPI 6 banned, eapi7-ver.eclass will be removed in the foreseeable future. Copy its code because it is still needed for tests. Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/dist-kernel-utils.sh | 6 +- eclass/tests/eapi7-ver.sh | 7 +- eclass/tests/eapi7-ver_benchmark.sh | 147 -- eclass/tests/toolchain.sh | 4 +- eclass/tests/version-funcs.sh | 302 5 files changed, 309 insertions(+), 157 deletions(-) diff --git a/eclass/tests/dist-kernel-utils.sh b/eclass/tests/dist-kernel-utils.sh index 7f04f55ce302..50ba001f8e9c 100755 --- a/eclass/tests/dist-kernel-utils.sh +++ b/eclass/tests/dist-kernel-utils.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash -# Copyright 2022 Gentoo Authors +# Copyright 2022-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 source tests-common.sh || exit +# TODO: hack because tests-common don't implement ver_cut +source version-funcs.sh || exit inherit dist-kernel-utils -# TODO: hack because tests-common don't implement ver_cut -EAPI=6 inherit eapi7-ver test_PV_to_KV() { local kv=${1} diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh index 13cd671e7158..ee7e6d728ef7 100755 --- a/eclass/tests/eapi7-ver.sh +++ b/eclass/tests/eapi7-ver.sh @@ -1,12 +1,9 @@ #!/bin/bash -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=6 - source tests-common.sh || exit - -inherit eapi7-ver +source version-funcs.sh || exit teq() { local expected=${1}; shift diff --git a/eclass/tests/eapi7-ver_benchmark.sh b/eclass/tests/eapi7-ver_benchmark.sh deleted file mode 100755 index ab324edb95c9.. --- a/eclass/tests/eapi7-ver_benchmark.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -source tests-common.sh || exit - -inherit eapi7-ver versionator - -cutting() { - local x - for x in {1..1000}; do - ver_cut 1 1.2.3 - ver_cut 1-2 1.2.3 - ver_cut 2- 1.2.3 - ver_cut 1- 1.2.3 - ver_cut 3-4 1.2.3b_alpha4 - ver_cut 5 1.2.3b_alpha4 - ver_cut 1-2 .1.2.3 - ver_cut 0-2 .1.2.3 - ver_cut 2-3 1.2.3. - ver_cut 2- 1.2.3. - ver_cut 2-4 1.2.3. - done >/dev/null -} - -cutting_versionator() { - local x - for x in {1..100}; do - get_version_component_range 1 1.2.3 - get_version_component_range 1-2 1.2.3 - get_version_component_range 2- 1.2.3 - get_version_component_range 1- 1.2.3 - get_version_component_range 3-4 1.2.3b_alpha4 - get_version_component_range 5 1.2.3b_alpha4 - get_version_component_range 1-2 .1.2.3 - get_version_component_range 0-2 .1.2.3 - get_version_component_range 2-3 1.2.3. - get_version_component_range 2- 1.2.3. - get_version_component_range 2-4 1.2.3. - done >/dev/null -} - -replacing() { - local x - for x in {1..1000}; do - ver_rs 1 - 1.2.3 - ver_rs 2 - 1.2.3 - ver_rs 1-2 - 1.2.3.4 - ver_rs 2- - 1.2.3.4 - ver_rs 2 . 1.2-3 - ver_rs 3 . 1.2.3a - ver_rs 2-3 - 1.2_alpha4 - #ver_rs 3 - 2 "" 1.2.3b_alpha4 - #ver_rs 3-5 _ 4-6 - a1b2c3d4e5 - ver_rs 1 - .1.2.3 - ver_rs 0 - .1.2.3 - done >/dev/null -} - -replacing_versionator() { - local x - for x in {1..100}; do - replace_version_separator 1 - 1.2.3 - replace_version_separator 2 - 1.2.3 - replace_version_separator 1-2 - 1.2.3.4 - replace_version_separator 2- - 1.2.3.4 - replace_version_separator 2 . 1.2-3 - replace_version_separator 3 . 1.2.3a - replace_version_separator 2-3 - 1.2_alpha4 - #replace_version_separator 3 - 2 "" 1.2.3b_alpha4 - #replace_version_separator 3-5 _ 4-6 - a1b2c3d4e5 - replace_version_separator 1 - .1.2.3 - replace_version_separator 0 - .1.2.3 - done >/dev/null -} - -comparing() { - local x - for x in {1..1000}; do - ver_test 1b_p1 -le 1_p1 - ver_test 1.1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 5618de75aec49009489efb560a89e014fd060524 Author: Michał Górny gentoo org> AuthorDate: Mon Feb 5 19:29:36 2024 + Commit: Michał Górny gentoo org> CommitDate: Sat Feb 10 10:47:23 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5618de75 llvm-r1.eclass: Initial version Bug: https://bugs.gentoo.org/923228 Bug: https://bugs.gentoo.org/880671 Closes: https://bugs.gentoo.org/821955 Closes: https://bugs.gentoo.org/919150 Signed-off-by: Michał Górny gentoo.org> eclass/llvm-r1.eclass | 250 eclass/tests/llvm-r1.sh | 151 + 2 files changed, 401 insertions(+) diff --git a/eclass/llvm-r1.eclass b/eclass/llvm-r1.eclass new file mode 100644 index ..658946a1ecbd --- /dev/null +++ b/eclass/llvm-r1.eclass @@ -0,0 +1,250 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: llvm-r1.eclass +# @MAINTAINER: +# Michał Górny +# @AUTHOR: +# Michał Górny +# @SUPPORTED_EAPIS: 8 +# @PROVIDES: llvm-utils +# @BLURB: Provide LLVM_SLOT to build against slotted LLVM +# @DESCRIPTION: +# An eclass to reliably depend on a set of LLVM-related packages +# in a matching slot. To use the eclass: +# +# 1. Set LLVM_COMPAT to the list of supported LLVM slots. +# 2. Use llvm_gen_dep and/or LLVM_USEDEP to add appropriate +#dependencies. +# 3. Use llvm-r1_pkg_setup, get_llvm_prefix or LLVM_SLOT. +# +# The eclass sets IUSE and REQUIRED_USE. The flag corresponding +# to the newest supported stable LLVM slot (or the newest testing, +# if no stable slots are supported) is enabled by default. +# +# Example: +# @CODE +# LLVM_COMPAT=( {16..18} ) +# +# inherit llvm-r1 +# +# DEPEND=" +# dev-libs/libfoo[${LLVM_USEDEP}] +# $(llvm_gen_dep ' +# sys-devel/clang:${LLVM_SLOT} +# sys-devel/llvm:${LLVM_SLOT} +# ') +# " +# @CODE + +case ${EAPI} in + 8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ ! ${_LLVM_R1_ECLASS} ]]; then +_LLVM_R1_ECLASS=1 + +inherit llvm-utils + +# == internal control knobs == + +# @ECLASS_VARIABLE: _LLVM_OLDEST_SLOT +# @INTERNAL +# @DESCRIPTION: +# Oldest supported LLVM slot. This is used to automatically filter out +# unsupported LLVM_COMPAT values. +_LLVM_OLDEST_SLOT=15 + +# @ECLASS_VARIABLE: _LLVM_NEWEST_STABLE +# @INTERNAL +# @DESCRIPTION: +# The newest stable LLVM version. Versions newer than that won't +# be automatically enabled via USE defaults. +_LLVM_NEWEST_STABLE=17 + +# == control variables == + +# @ECLASS_VARIABLE: LLVM_COMPAT +# @PRE_INHERIT +# @REQUIRED +# @DESCRIPTION: +# A list of LLVM slots supported by the package, oldest to newest. +# +# Example: +# @CODE +# LLVM_COMPAT=( {15..17} ) +# @CODE + +# @ECLASS_VARIABLE: LLVM_OPTIONAL +# @PRE_INHERIT +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set to a non-empty value, disables setting REQUIRED_USE +# and exporting pkg_setup. You have to add LLVM_REQUIRED_USE and call +# pkg_setup manually, with appropriate USE conditions. + +# == global metadata == + +# @ECLASS_VARIABLE: LLVM_REQUIRED_USE +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# An eclass-generated REQUIRED_USE string that enforces selecting +# exactly one slot. It LLVM_OPTIONAL is set, it needs to be copied +# into REQUIRED_USE, under appropriate USE conditions. Otherwise, +# it is added automatically. + +# @ECLASS_VARIABLE: LLVM_USEDEP +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# An eclass-generated USE dependency string that can be applied to other +# packages using the same eclass, to enforce a LLVM slot match. + +_llvm_set_globals() { + debug-print-function ${FUNCNAME} "${@}" + + if [[ ${LLVM_COMPAT@a} != *a* ]]; then + die "LLVM_COMPAT must be set to an array before inheriting ${ECLASS}" + fi + + local stable=() unstable=() + local x + for x in "${LLVM_COMPAT[@]}"; do + if [[ ${x} -gt ${_LLVM_NEWEST_STABLE} ]]; then + unstable+=( "${x}" ) + elif [[ ${x} -ge ${_LLVM_OLDEST_SLOT} ]]; then + stable+=( "${x}" ) + fi + done + + _LLVM_SLOTS=( "${stable[@]}" "${unstable[@]}" ) + if [[ ! ${_LLVM_SLOTS[@]} ]]; then + die "LLVM_COMPAT does not contain any valid versions (all older than ${_LLVM_OLDEST_SLOT}?)" + fi + + if [[ ${stable[@]} ]]; then + IUSE="+llvm_slot_${stable[-1]}" + unset 'stable[-1]' + else + IUSE="+llvm_slot_${unstable[-1]}" + unset 'unstable[-1]' + fi + local nondefault=( "${stable[@]}" "${unstable[@]}" ) + IUSE+=" ${nondefault[*]/#/llvm_slot_}" + + local flags=( "${_LLVM_SLOTS[@]/#/llvm_slot_}" ) + LLVM_REQUIRED_USE="^^ ( ${flags[*]} )" + local usedep_flags=${flags[*]/%/(-)?} + LLVM_USEDEP=${usedep_flags// /,} + readonly LLVM_REQUIRED_USE LLVM_USEDEP + + i
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 511ce42e90eccd89a8d0d2ccbc239578d6af11ea Author: Michał Górny gentoo org> AuthorDate: Wed Feb 7 16:34:34 2024 + Commit: Michał Górny gentoo org> CommitDate: Sat Feb 10 10:47:20 2024 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=511ce42e llvm-utils.eclass: Introduce an eclass for common helpers Move some reusable functions from llvm.eclass to llvm-utils.eclass. This is with minimal modifications so far (only argument checks were cleaned up). Signed-off-by: Michał Górny gentoo.org> eclass/llvm-utils.eclass | 115 + eclass/llvm.eclass | 92 ++-- eclass/tests/llvm-utils.sh | 82 3 files changed, 200 insertions(+), 89 deletions(-) diff --git a/eclass/llvm-utils.eclass b/eclass/llvm-utils.eclass new file mode 100644 index ..43988f6f88c7 --- /dev/null +++ b/eclass/llvm-utils.eclass @@ -0,0 +1,115 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: llvm-utils.eclass +# @MAINTAINER: +# Michał Górny +# @AUTHOR: +# Michał Górny +# @SUPPORTED_EAPIS: 7 8 +# @BLURB: Common utility functions for building against installed LLVM +# @DESCRIPTION: +# The utility eclass providing shared functions reused between +# llvm.eclass and llvm-r1.eclass. It may also be used directly +# in ebuilds. + +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ ! ${_LLVM_UTILS_ECLASS} ]]; then +_LLVM_UTILS_ECLASS=1 + +# @FUNCTION: llvm_tuple_to_target +# @USAGE: [] +# @DESCRIPTION: +# Translate a tuple into a target suitable for LLVM_TARGETS. +# Defaults to ${CHOST} if not specified. +llvm_tuple_to_target() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -gt 1 ]] && die "Usage: ${FUNCNAME} []" + + case ${1:-${CHOST}} in + aarch64*) echo "AArch64";; + amdgcn*) echo "AMDGPU";; + arc*) echo "ARC";; + arm*) echo "ARM";; + avr*) echo "AVR";; + bpf*) echo "BPF";; + csky*) echo "CSKY";; + loong*) echo "LoongArch";; + m68k*) echo "M68k";; + mips*) echo "Mips";; + msp430*) echo "MSP430";; + nvptx*) echo "NVPTX";; + powerpc*) echo "PowerPC";; + riscv*) echo "RISCV";; + sparc*) echo "Sparc";; + s390*) echo "SystemZ";; + x86_64*|i?86*) echo "X86";; + xtensa*) echo "Xtensa";; + *) die "Unknown LLVM target for tuple ${1:-${CHOST}}" + esac +} + +# @FUNCTION: llvm_fix_clang_version +# @USAGE: ... +# @DESCRIPTION: +# Fix the clang compiler name in specified variables to include +# the major version, to prevent PATH alterations from forcing an older +# clang version being used. +llvm_fix_clang_version() { + debug-print-function ${FUNCNAME} "${@}" + + local shopt_save=$(shopt -p -o noglob) + set -f + local var + for var; do + local split=( ${!var} ) + case ${split[0]} in + *clang|*clang++|*clang-cpp) + local version=() + read -r -a version < <("${split[0]}" --version) + local major=${version[-1]%%.*} + if [[ -n ${major//[0-9]} ]]; then + die "${var}=${!var} produced invalid --version: ${version[*]}" + fi + + split[0]+=-${major} + if ! type -P "${split[0]}" &>/dev/null; then + die "${split[0]} does not seem to exist" + fi + declare -g "${var}=${split[*]}" + ;; + esac + done + ${shopt_save} +} + +# @FUNCTION: llvm_fix_tool_path +# @USAGE: ... +# @DESCRIPTION: +# Fix the LLVM tools referenced in the specified variables to their +# current location, to prevent PATH alterations from forcing older +# versions being used. +llvm_fix_tool_path() { + debug-print-function ${FUNCNAME} "${@}" + + local shopt_save=$(shopt -p -o noglob) + set -f + local var + for var; do + local split=( ${!var} ) + local path=$(type -P ${split[0]} 2>/dev/null) + # if it resides in one of the LLVM prefixes, it's an LLVM tool! + if [[ ${path} == "${BROOT}/usr/lib/llvm"* ]]; then + split[0]=${path} + declare -g "${var}=${split[*]}" + fi + done + ${shopt_save} +} + +fi diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass index 91cc68d966fe..05ffcfd7cc6d 100644 --- a
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: e111329e222787152b6d99ce4b551c8758349aac Author: Michał Górny gentoo org> AuthorDate: Sun Sep 3 13:21:57 2023 + Commit: Michał Górny gentoo org> CommitDate: Thu Sep 14 05:30:10 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e111329e verify-sig.eclass: Support `openssl dgst` format checksums Signed-off-by: Michał Górny gentoo.org> eclass/tests/verify-sig.sh | 18 eclass/verify-sig.eclass | 54 ++ 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/eclass/tests/verify-sig.sh b/eclass/tests/verify-sig.sh index fcd2ee7480a2..fb7f2cdb2a5d 100755 --- a/eclass/tests/verify-sig.sh +++ b/eclass/tests/verify-sig.sh @@ -62,4 +62,22 @@ EOF test_verify_unsigned_checksums sha256 eoutdent +einfo "Testing openssl-dgst format." +eindent + +> "annoying ( filename )= yes ).txt" || die + +cat > checksums.txt <<-EOF || die + junk text that ought to be ignored + + SHA256(empty)=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + SHA256(text)= b47cc0f104b62d4c7c30bcd68fd8e67613e287dc4ad8c310ef10cbadea9c4380 + SHA256(fail)=b47cc0f104b62d4c7c30bcd68fd8e67613e287dc4ad8c310ef10cbadea9c4380 + + SHA256(annoying ( filename )= yes )= e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 +EOF + +test_verify_unsigned_checksums openssl-dgst +eoutdent + texit diff --git a/eclass/verify-sig.eclass b/eclass/verify-sig.eclass index d99dc3461858..815299b419ed 100644 --- a/eclass/verify-sig.eclass +++ b/eclass/verify-sig.eclass @@ -214,12 +214,15 @@ verify-sig_verify_message() { } # @FUNCTION: verify-sig_verify_unsigned_checksums -# @USAGE: +# @USAGE: # @DESCRIPTION: # Verify the checksums for all files listed in the space-separated list -# (akin to ${A}) using a . specifies -# the checksum algorithm (e.g. sha256). can be "-" -# for stdin. +# (akin to ${A}) using a . specifies +# the checksum file format. can be "-" for stdin. +# +# The following formats are supported: +# - sha256 -- sha256sum ( ) +# - openssl-dgst -- openssl dgst (()=) # # The function dies if one of the files does not match checksums or # is missing from the checksum file. @@ -231,35 +234,50 @@ verify-sig_verify_message() { # verify-sig_verify_signed_checksums instead. verify-sig_verify_unsigned_checksums() { local checksum_file=${1} - local algo=${2} + local format=${2} local files=() read -r -d '' -a files <<<"${3}" - local chksum_prog chksum_len + local chksum_prog chksum_len algo=${format} - case ${algo} in + case ${format} in sha256) - chksum_prog=sha256sum chksum_len=64 ;; + openssl-dgst) + ;; *) - die "${FUNCNAME}: unknown checksum algo ${algo}" + die "${FUNCNAME}: unknown checksum format ${format}" ;; esac [[ ${checksum_file} == - ]] && checksum_file=/dev/stdin - local checksum filename junk ret=0 count=0 - while read -r checksum filename junk; do - if [[ ${checksum} == "-BEGIN" ]]; then + local line checksum filename junk ret=0 count=0 + while read -r line; do + if [[ ${line} == "-BEGIN"* ]]; then die "${FUNCNAME}: PGP armor found, use verify-sig_verify_signed_checksums instead" fi - [[ ${#checksum} -eq ${chksum_len} ]] || continue - [[ -z ${checksum//[0-9a-f]} ]] || continue - has "${filename}" "${files[@]}" || continue - [[ -z ${junk} ]] || continue + case ${format} in + sha256) + read -r checksum filename junk <<<"${line}" + [[ ${#checksum} -ne ${chksum_len} ]] && continue + [[ -n ${checksum//[0-9a-f]} ]] && continue + [[ -n ${junk} ]] && continue + ;; + openssl-dgst) + [[ ${line} != *"("*")="* ]] && continue + checksum=${line##*)=} + algo=${line%%(*} + filename=${line#*(} + filename=${filename%)=*} + ;; + esac + + if ! has "${filename}" "${files[@]}"; then + continue + fi - "${chksum_prog}" -c --strict - <<<"${checksum} ${filename}" - if [[ ${?} -eq 0 ]]; then + if "${algo,,}sum" -c --strict - <<<"${checksum} ${filename}"; then (( count++ )) else r
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 4be72bb040d08cae62f9f0ccdd21c307858512a3 Author: Michał Górny gentoo org> AuthorDate: Sun Sep 3 14:45:07 2023 + Commit: Michał Górny gentoo org> CommitDate: Thu Sep 14 05:30:10 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4be72bb0 eclass/tests: Add initial tests for verify-sig Signed-off-by: Michał Górny gentoo.org> eclass/tests/verify-sig.sh | 65 ++ 1 file changed, 65 insertions(+) diff --git a/eclass/tests/verify-sig.sh b/eclass/tests/verify-sig.sh new file mode 100755 index ..fcd2ee7480a2 --- /dev/null +++ b/eclass/tests/verify-sig.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +source tests-common.sh || exit + +inherit verify-sig + +TMP=$(mktemp -d) +trap 'rm -rf "${TMP}"' EXIT +cd "${TMP}" || die +> empty || die +> fail || die +echo "The quick brown fox jumps over the lazy dog." > text || die + +testit() { + local expect=${1} + shift + + tbegin "${*@Q}" + ( "${@}" ) + [[ ${?} -eq ${expect} ]] + tend "${?}" +} + +test_verify_unsigned_checksums() { + local format=${1} + + testit 0 verify-sig_verify_unsigned_checksums checksums.txt "${format}" empty + testit 0 verify-sig_verify_unsigned_checksums checksums.txt "${format}" "empty text" + testit 1 verify-sig_verify_unsigned_checksums checksums.txt "${format}" other + testit 1 verify-sig_verify_unsigned_checksums checksums.txt "${format}" "empty other" + testit 1 verify-sig_verify_unsigned_checksums checksums.txt "${format}" fail + testit 1 verify-sig_verify_unsigned_checksums checksums.txt "${format}" "empty fail" +} + +einfo "Testing coreutils format." +eindent + +cat > checksums.txt <<-EOF || die + # some junk to test junk protection + b47cc0f104b62d4c7c30bcd68fd8e67613e287dc4ad8c310ef10cbadea9c4380 empty junk line + b47cc0f104b62d4c7c30bcd68gd8e67613e287dc4ad8c310ef10cbadea9c4380 empty + + # sha1sums + da39a3ee5e6b4b0d3255bfef95601890afd80709 empty + 9c04cd6372077e9b11f70ca111c9807dc7137e4btext + 9c04cd6372077e9b11f70ca111c9807dc7137e4b fail + + # sha256sums + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 empty + b47cc0f104b62d4c7c30bcd68fd8e67613e287dc4ad8c310ef10cbadea9c4380 text + b47cc0f104b62d4c7c30bcd68fd8e67613e287dc4ad8c310ef10cbadea9c4380 fail + + # sha512sums + cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e empty + 020da0f4d8a4c8bfbc98274027740061d7df52ee07091ed6595a083e0f45327bbe59424312d86f218b74ed2e25507abaf5c7a5fcf4cafcf9538b705808fd55ec text + 020da0f4d8a4c8bfbc98274027740061d7df52ee07091ed6595a083e0f45327bbe59424312d86f218b74ed2e25507abaf5c7a5fcf4cafcf9538b705808fd55ec fail +EOF + +test_verify_unsigned_checksums sha256 +eoutdent + +texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 6d9ca31b20ed4a4d7130602e67aa61385f8511e0 Author: Michał Górny gentoo org> AuthorDate: Fri Jun 23 06:10:46 2023 + Commit: Michał Górny gentoo org> CommitDate: Sun Jul 2 15:06:27 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d9ca31b python-utils-r1.eclass: make pypy3 match Python 3.10 now Signed-off-by: Michał Górny gentoo.org> eclass/python-utils-r1.eclass | 6 +++--- eclass/tests/python-utils-r1.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 7a1be381f596..d2bbe90da049 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -238,12 +238,12 @@ _python_impl_matches() { fi return 0 ;; - 3.9) - # the only unmasked pypy3 version is pypy3.9 atm + 3.9|3.10) + # =7.3.12 is 3.10 [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] && return 0 ;; - 3.8|3.1[0-2]) + 3.8|3.1[1-2]) [[ ${impl} == python${pattern/./_} ]] && return 0 ;; *) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 635d49decbdd..81c459765f0f 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -208,7 +208,7 @@ test_is "_python_impl_matches python3_11 3.12" 1 test_is "_python_impl_matches python3_12 3.10" 1 test_is "_python_impl_matches python3_12 3.11" 1 test_is "_python_impl_matches python3_12 3.12" 0 -test_is "_python_impl_matches pypy3 3.10" 1 +test_is "_python_impl_matches pypy3 3.10" 0 test_is "_python_impl_matches pypy3 3.11" 1 test_is "_python_impl_matches pypy3 3.12" 1 eoutdent
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: ac817be5fd5756bcd017e41321cf5731cd291c54 Author: Michał Górny gentoo org> AuthorDate: Thu Jun 15 15:31:16 2023 + Commit: Michał Górny gentoo org> CommitDate: Sun Jun 18 14:57:46 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac817be5 cargo.eclass: Support separating crate names/versions via `@` Support specifying crate names and versions separated by `@` character rather than `-`. Since `@` are not valid in crate names, this makes splitting the tokens trivial and free of regular expressions. Effectively, the `@` variant is roughly 180% faster: ``` * CRATES with '@' separator real 952 it/s user 952 it/s * CRATES with '-' separator real 339 it/s user 339 it/s ``` Signed-off-by: Michał Górny gentoo.org> eclass/cargo.eclass | 24 +++--- eclass/tests/cargo-bench.sh | 111 +++- 2 files changed, 75 insertions(+), 60 deletions(-) diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index d97bb0df9348..8618c90bd986 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -59,12 +59,16 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo" # Bash string containing all crates that are to be downloaded. # It is used by cargo_crate_uris. # +# Ideally, crate names and versions should be separated by a `@` +# character. A legacy syntax using hyphen is also supported but it is +# much slower. +# # Example: # @CODE # CRATES=" -# metal-1.2.3 -# bar-4.5.6 -# iron_oxide-0.0.1 +# metal@1.2.3 +# bar@4.5.6 +# iron_oxide@0.0.1 # " # inherit cargo # ... @@ -182,10 +186,16 @@ _cargo_set_crate_uris() { CARGO_CRATE_URIS= for crate in ${crates}; do local name version url - [[ $crate =~ $regex ]] || die "Could not parse name and version from crate: $crate" - name="${BASH_REMATCH[1]}" - version="${BASH_REMATCH[2]}" - url="https://crates.io/api/v1/crates/${name}/${version}/download -> ${crate}.crate" + if [[ ${crate} == *@* ]]; then + name=${crate%@*} + version=${crate##*@} + else + [[ ${crate} =~ ${regex} ]] || + die "Could not parse name and version from crate: ${crate}" + name="${BASH_REMATCH[1]}" + version="${BASH_REMATCH[2]}" + fi + url="https://crates.io/api/v1/crates/${name}/${version}/download -> ${name}-${version}.crate" CARGO_CRATE_URIS+="${url} " done diff --git a/eclass/tests/cargo-bench.sh b/eclass/tests/cargo-bench.sh index 11b740f8dfcd..d30b04569905 100755 --- a/eclass/tests/cargo-bench.sh +++ b/eclass/tests/cargo-bench.sh @@ -47,63 +47,68 @@ timeit() { # taken from cryptograpy-41.0.1 CRATES=" - Inflector-0.11.4 - aliasable-0.1.3 - asn1-0.15.2 - asn1_derive-0.15.2 - autocfg-1.1.0 - base64-0.13.1 - bitflags-1.3.2 - cc-1.0.79 - cfg-if-1.0.0 - foreign-types-0.3.2 - foreign-types-shared-0.1.1 - indoc-1.0.9 - libc-0.2.144 - lock_api-0.4.9 - memoffset-0.8.0 - once_cell-1.17.2 - openssl-0.10.54 - openssl-macros-0.1.1 - openssl-sys-0.9.88 - ouroboros-0.15.6 - ouroboros_macro-0.15.6 - parking_lot-0.12.1 - parking_lot_core-0.9.7 - pem-1.1.1 - pkg-config-0.3.27 - proc-macro-error-1.0.4 - proc-macro-error-attr-1.0.4 - proc-macro2-1.0.59 - pyo3-0.18.3 - pyo3-build-config-0.18.3 - pyo3-ffi-0.18.3 - pyo3-macros-0.18.3 - pyo3-macros-backend-0.18.3 - quote-1.0.28 - redox_syscall-0.2.16 - scopeguard-1.1.0 - smallvec-1.10.0 - syn-1.0.109 - syn-2.0.18 - target-lexicon-0.12.7 - unicode-ident-1.0.9 - unindent-0.1.11 - vcpkg-0.2.15 - version_check-0.9.4 - windows-sys-0.45.0 - windows-targets-0.42.2 - windows_aarch64_gnullvm-0.42.2 - windows_aarch64_msvc-0.42.2 - windows_i686_gnu-0.42.2 - windows_i686_msvc-0.42.2 - windows_x86_64_gnu-0.42.2 - windows_x86_64_gnullvm-0.42.2 - windows_x86_64_msvc-0.42.2 + Inflector@0.11.4 + aliasable@0.1.3 + asn1@0.15.2 + asn1_derive@0.15.2 + autocfg@1.1.0 + base64@0.13.1 + bitflags@1.3.2 + cc@1.0.79 + cfg-if@1.0.0 + foreign-types@0.3.2 + foreign-types-shared@0.1.1 + indoc@1.0.9 + libc@0.2.144 + lock_api@0.4.9 + memoffset@0.8.0 + once_cell@1.17.2 + openssl@0.10.54 + openssl-macros@0.1.1 + openssl-sys@0.9.88 + ouroboros@0.15.6 + ouroboros_macro@0.15.6 + parking_lot@0.12.1 + parking_lot_core@0.9.7 + pem@1.1.1 + pkg-config@0.3.27 + proc-macro-error@1.0.4 + proc-macro-error-attr@1.0.4 + proc-macro2@1.0.
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 59dbfb80f748a0fc5741a8f3028f7552af28eecf Author: Michał Górny gentoo org> AuthorDate: Thu Jun 15 15:20:43 2023 + Commit: Michał Górny gentoo org> CommitDate: Sun Jun 18 14:57:44 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59dbfb80 cargo.eclass: Add variable alternative to $(cargo_crate_uris) Add a helper function that sets ${CARGO_CRATE_URIS} variable to make it possible to set SRC_URI without subshells. This gives a slight speedup (~20%): ``` real 300 it/s user 324 it/s ``` Signed-off-by: Michał Górny gentoo.org> eclass/cargo.eclass | 48 +++-- eclass/tests/cargo-bench.sh | 4 +++- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 991e808d453f..4e0cd1e4de70 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -68,7 +68,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo" # " # inherit cargo # ... -# SRC_URI="$(cargo_crate_uris)" +# SRC_URI="${CARGO_CRATE_URIS}" # @CODE # @ECLASS_VARIABLE: GIT_CRATES @@ -162,31 +162,31 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo" # group, and then switch over to building with FEATURES=userpriv. # Or vice-versa. -# @FUNCTION: cargo_crate_uris +# @ECLASS_VARIABLE: CARGO_CRATE_URIS +# @OUTPUT_VARIABLE +# @DESCRIPTION: +# List of URIs to put in SRC_URI created from CRATES variable. + +# @FUNCTION: _cargo_set_crate_uris +# @USAGE: # @DESCRIPTION: # Generates the URIs to put in SRC_URI to help fetch dependencies. # Constructs a list of crates from its arguments. # If no arguments are provided, it uses the CRATES variable. -cargo_crate_uris() { +# The value is set as CARGO_CRATE_URIS. +_cargo_set_crate_uris() { local -r regex='^([a-zA-Z0-9_\-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$' - local crate crates - - if [[ -n ${@} ]]; then - crates="$@" - elif [[ -n ${CRATES} ]]; then - crates="${CRATES}" - else - eerror "CRATES variable is not defined and nothing passed as argument" - die "Can't generate SRC_URI from empty input" - fi + local crates=${1} + local crate + CARGO_CRATE_URIS= for crate in ${crates}; do local name version url [[ $crate =~ $regex ]] || die "Could not parse name and version from crate: $crate" name="${BASH_REMATCH[1]}" version="${BASH_REMATCH[2]}" url="https://crates.io/api/v1/crates/${name}/${version}/download -> ${crate}.crate" - echo "${url}" + CARGO_CRATE_URIS+="${url} " done local git_crates_type @@ -214,12 +214,30 @@ cargo_crate_uris() { ;; esac - printf -- '%s -> %s\n' "${crate_uri//%commit%/${commit}}" "${repo_name}-${commit}${repo_ext}.tar.gz" + CARGO_CRATE_URIS+="${crate_uri//%commit%/${commit}} -> ${repo_name}-${commit}${repo_ext}.tar.gz " done elif [[ -n ${git_crates_type} ]]; then die "GIT_CRATE must be declared as an associative array" fi } +_cargo_set_crate_uris "${CRATES}" + +# @FUNCTION: cargo_crate_uris +# @USAGE: [...] +# @DESCRIPTION: +# Generates the URIs to put in SRC_URI to help fetch dependencies. +# Constructs a list of crates from its arguments. +# If no arguments are provided, it uses the CRATES variable. +cargo_crate_uris() { + local crates=${*-${CRATES}} + if [[ -z ${crates} ]]; then + eerror "CRATES variable is not defined and nothing passed as argument" + die "Can't generate SRC_URI from empty input" + fi + + _cargo_set_crate_uris "${crates}" + echo "${CARGO_CRATE_URIS}" +} # @FUNCTION: cargo_gen_config # @DESCRIPTION: diff --git a/eclass/tests/cargo-bench.sh b/eclass/tests/cargo-bench.sh index cdc5e4431c14..11b740f8dfcd 100755 --- a/eclass/tests/cargo-bench.sh +++ b/eclass/tests/cargo-bench.sh @@ -12,8 +12,9 @@ RUNS=3 doit() { for (( i = 0; i < ITERATIONS; i++ )); do + _cargo_set_crate_uris "${CRATES}" SRC_URI=" - $(cargo_crate_uris) + ${CARGO_CRATE_URIS} " done } @@ -102,6 +103,7 @@ CRATES=" " inherit cargo + timeit texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: a9d3b1f7d35f9b226a8d8bf35d9e83b1244aa016 Author: Michał Górny gentoo org> AuthorDate: Thu Jun 15 04:32:10 2023 + Commit: Michał Górny gentoo org> CommitDate: Sun Jun 18 14:57:43 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9d3b1f7 eclass/tests: Add a minimal benchmark for cargo.eclass The initial results on my machine are: ``` real 252 it/s user 289 it/s ``` Signed-off-by: Michał Górny gentoo.org> eclass/tests/cargo-bench.sh | 107 1 file changed, 107 insertions(+) diff --git a/eclass/tests/cargo-bench.sh b/eclass/tests/cargo-bench.sh new file mode 100755 index ..cdc5e4431c14 --- /dev/null +++ b/eclass/tests/cargo-bench.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +source tests-common.sh || exit + +export LC_ALL=C + +ITERATIONS=1000 +RUNS=3 + +doit() { + for (( i = 0; i < ITERATIONS; i++ )); do + SRC_URI=" + $(cargo_crate_uris) + " + done +} + +timeit() { + local real=() + local user=() + local x vr avg + + for (( x = 0; x < RUNS; x++ )); do + while read tt tv; do + case ${tt} in + real) real+=( ${tv} );; + user) user+=( ${tv} );; + esac + done < <( ( time -p doit ) 2>&1 ) + done + + [[ ${#real[@]} == ${RUNS} ]] || die "Did not get ${RUNS} real times" + [[ ${#user[@]} == ${RUNS} ]] || die "Did not get ${RUNS} user times" + + local xr avg + for x in real user; do + xr="${x}[*]" + avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p") + + printf '%s %4.0f it/s\n' "${x}" "${avg}" + done +} + +# taken from cryptograpy-41.0.1 +CRATES=" + Inflector-0.11.4 + aliasable-0.1.3 + asn1-0.15.2 + asn1_derive-0.15.2 + autocfg-1.1.0 + base64-0.13.1 + bitflags-1.3.2 + cc-1.0.79 + cfg-if-1.0.0 + foreign-types-0.3.2 + foreign-types-shared-0.1.1 + indoc-1.0.9 + libc-0.2.144 + lock_api-0.4.9 + memoffset-0.8.0 + once_cell-1.17.2 + openssl-0.10.54 + openssl-macros-0.1.1 + openssl-sys-0.9.88 + ouroboros-0.15.6 + ouroboros_macro-0.15.6 + parking_lot-0.12.1 + parking_lot_core-0.9.7 + pem-1.1.1 + pkg-config-0.3.27 + proc-macro-error-1.0.4 + proc-macro-error-attr-1.0.4 + proc-macro2-1.0.59 + pyo3-0.18.3 + pyo3-build-config-0.18.3 + pyo3-ffi-0.18.3 + pyo3-macros-0.18.3 + pyo3-macros-backend-0.18.3 + quote-1.0.28 + redox_syscall-0.2.16 + scopeguard-1.1.0 + smallvec-1.10.0 + syn-1.0.109 + syn-2.0.18 + target-lexicon-0.12.7 + unicode-ident-1.0.9 + unindent-0.1.11 + vcpkg-0.2.15 + version_check-0.9.4 + windows-sys-0.45.0 + windows-targets-0.42.2 + windows_aarch64_gnullvm-0.42.2 + windows_aarch64_msvc-0.42.2 + windows_i686_gnu-0.42.2 + windows_i686_msvc-0.42.2 + windows_x86_64_gnu-0.42.2 + windows_x86_64_gnullvm-0.42.2 + windows_x86_64_msvc-0.42.2 +" + +inherit cargo +timeit + +texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 746642aec3f9380f44bff3c5e8b79acfb105af6b Author: Michał Górny gentoo org> AuthorDate: Thu Jun 15 12:24:43 2023 + Commit: Michał Górny gentoo org> CommitDate: Sat Jun 17 10:10:14 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=746642ae eclass/tests: Add a benchmark for python-utils-r1 Initial timings on my system: ``` * Timing _python_set_impls real 1463 it/s user 1886 it/s ``` Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-bench.sh | 53 ++ 1 file changed, 53 insertions(+) diff --git a/eclass/tests/python-utils-bench.sh b/eclass/tests/python-utils-bench.sh new file mode 100755 index ..7f27adef5509 --- /dev/null +++ b/eclass/tests/python-utils-bench.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +source tests-common.sh || exit + +export LC_ALL=C + +ITERATIONS=1 +RUNS=3 + +doit() { + local i + for (( i = 0; i < ITERATIONS; i++ )); do + "${@}" + done +} + +timeit() { + local real=() + local user=() + local x vr avg + + einfo "Timing ${*}" + for (( x = 0; x < RUNS; x++ )); do + while read tt tv; do + case ${tt} in + real) real+=( ${tv} );; + user) user+=( ${tv} );; + esac + done < <( ( time -p doit "${@}" ) 2>&1 ) + done + + [[ ${#real[@]} == ${RUNS} ]] || die "Did not get ${RUNS} real times" + [[ ${#user[@]} == ${RUNS} ]] || die "Did not get ${RUNS} user times" + + local xr avg + for x in real user; do + xr="${x}[*]" + avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p") + + printf '%s %4.0f it/s\n' "${x}" "${avg}" + done +} + +PYTHON_COMPAT=( python3_{10..12} pypy3 ) + +inherit python-utils-r1 + +timeit _python_set_impls + +texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: d72660faea4dcba0d261fbc80d9c6d62066842bd Author: Michał Górny gentoo org> AuthorDate: Mon Jun 12 19:44:03 2023 + Commit: Michał Górny gentoo org> CommitDate: Thu Jun 15 12:19:22 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d72660fa eclass/tests: Add pypi-bench.sh for global scope logic The benchmark yield roughly 327 ops / s on my machine. Signed-off-by: Michał Górny gentoo.org> eclass/tests/pypi-bench.sh | 69 ++ 1 file changed, 69 insertions(+) diff --git a/eclass/tests/pypi-bench.sh b/eclass/tests/pypi-bench.sh new file mode 100755 index ..cce93527b729 --- /dev/null +++ b/eclass/tests/pypi-bench.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# Copyright 2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +source tests-common.sh || exit + +export LC_ALL=C + +ITERATIONS=1000 +RUNS=3 + +doit() { + local i + for (( i = 0; i < ITERATIONS; i++ )); do + _pypi_set_globals + done +} + +timeit() { + einfo "Timing PYPI_PN=\"${PYPI_PN}\" PV=\"${PV}\" PYPI_NO_NORMALIZE=${PYPI_NO_NORMALIZE}" + + local real=() + local user=() + local x vr avg + + for (( x = 0; x < RUNS; x++ )); do + while read tt tv; do + case ${tt} in + real) real+=( ${tv} );; + user) user+=( ${tv} );; + esac + done < <( ( time -p doit ) 2>&1 ) + done + + [[ ${#real[@]} == ${RUNS} ]] || die "Did not get ${RUNS} real times" + [[ ${#user[@]} == ${RUNS} ]] || die "Did not get ${RUNS} user times" + + local xr avg + for x in real user; do + xr="${x}[*]" + avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p") + + printf '%s %4.0f it/s\n' "${x}" "${avg}" + done +} + +PN=foo-bar +PYPI_PN=Foo.Bar +PV=1.2.3_beta2 +WORKDIR='' + +inherit pypi +timeit + +PV=1.2.3 +timeit +PYPI_NO_NORMALIZE=1 timeit + +PN=foobar +PYPI_PN=FooBar +timeit +PYPI_NO_NORMALIZE=1 timeit + +PYPI_PN=foobar +timeit +PYPI_NO_NORMALIZE=1 timeit + +texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 610b01ff117232fde9068a9e97e7355d6e53f2e4 Author: Ulrich Müller gentoo org> AuthorDate: Wed Jun 7 08:42:07 2023 + Commit: Ulrich Müller gentoo org> CommitDate: Wed Jun 7 08:56:25 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=610b01ff eapi8-dosym.eclass: Fix another corner case of strange input Signed-off-by: Ulrich Müller gentoo.org> eclass/eapi8-dosym.eclass | 4 ++-- eclass/tests/eapi8-dosym.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eclass/eapi8-dosym.eclass b/eclass/eapi8-dosym.eclass index e139b74cfea0..866c98c78d91 100644 --- a/eclass/eapi8-dosym.eclass +++ b/eclass/eapi8-dosym.eclass @@ -31,7 +31,7 @@ esac _dosym8_canonicalize() { local path slash i prev out IFS=/ - read -r -d '' -a path < <(echo -n "$1") + read -r -d '' -a path < <(printf '%s\0' "$1") [[ $1 == /* ]] && slash=/ while true; do @@ -56,7 +56,7 @@ _dosym8_canonicalize() { done out="${slash}${path[*]}" - echo "${out:-.}" + printf "%s\n" "${out:-.}" } # @FUNCTION: dosym8 diff --git a/eclass/tests/eapi8-dosym.sh b/eclass/tests/eapi8-dosym.sh index cae66e3bb2ee..a0f8961d4d96 100755 --- a/eclass/tests/eapi8-dosym.sh +++ b/eclass/tests/eapi8-dosym.sh @@ -54,6 +54,7 @@ teq foo _dosym8_canonicalize foo/. teq ../foo _dosym8_canonicalize ../foo teq ../baz _dosym8_canonicalize foo/bar/../../../baz teq '*' _dosym8_canonicalize '*' +teq '-e' _dosym8_canonicalize '-e' for f in ref_dosym_r "dosym8 -r"; do teq ../../bin/foo ${f} /bin/foo /usr/bin/foo
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 8ef986658021d85a990d1049039614a29054cc43 Author: Michał Górny gentoo org> AuthorDate: Tue May 23 04:01:45 2023 + Commit: Michał Górny gentoo org> CommitDate: Tue May 23 04:36:33 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ef98665 eclass/tests/python-utils-r1.sh: Fix patterns for pypy3.10 Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index ee09ae2c877c..635d49decbdd 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -123,8 +123,8 @@ eindent 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/include/pypy3.?" + test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3.*/site-packages" + test_var PYTHON_INCLUDEDIR pypy3 "/usr/include/pypy3.*" fi test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0=' test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, /
commit: 94694a5c3710fe264e3726bc2dad379600f4ef2e Author: Florian Schmaus gentoo org> AuthorDate: Sat Apr 15 13:42:59 2023 + Commit: Florian Schmaus gentoo org> CommitDate: Mon May 15 07:58:08 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94694a5c eclass/tests: add Makefile to run eclass tests Thanks to robbat2 for providing feedback. Closes: https://github.com/gentoo/gentoo/pull/30603 Signed-off-by: Florian Schmaus gentoo.org> .gitignore| 2 ++ eclass/tests/Makefile | 27 +++ 2 files changed, 29 insertions(+) diff --git a/.gitignore b/.gitignore index fbf45aff6770..d79ada5b1b40 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ /.ebuild.x /distfiles/ /eclass/*.5 +/eclass/tests/*.sh.ok +/eclass/tests/.eclasssum /local/ /packages/ /profiles/use.local.desc diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile new file mode 100644 index ..ee4a454912c3 --- /dev/null +++ b/eclass/tests/Makefile @@ -0,0 +1,27 @@ +SH_FILES := $(wildcard *.sh) +TEST_FILES := $(filter-out tests-common.sh, $(SH_FILES)) +TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES)) + +# We cache a successful test result if the testfile itself did not +# change (%.sh) and the contents of the eclass/ directory did not +# change (.eclasssum). +.%.sh.ok: %.sh .eclasssum + ./$< + touch $@ + +.PHONY: test +test: $(TEST_OK_FILES) + +.PHONY: force +.ONESHELL: +.eclasssum: SHELL = /bin/bash +.eclasssum: force + set -euo pipefail + find .. -maxdepth 1 -type f -name "*.eclass" \ + -exec stat --format="%n %y" \{} \+ |\ + sort |\ + cksum - > $@.cur + trap "rm -f $@.cur" EXIT + if ! cmp --silent $@.cur $@; then + mv $@.cur $@ + fi
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: cc939b81c322279e65f82c8c222dcb54015c65df Author: Michał Górny gentoo org> AuthorDate: Mon May 1 11:55:22 2023 + Commit: Sam James gentoo org> CommitDate: Mon May 1 13:43:27 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc939b81 eclass/tests/python-utils-r1.sh: Stop testing python3_9 Signed-off-by: Michał Górny gentoo.org> Signed-off-by: Sam James gentoo.org> eclass/tests/python-utils-r1.sh | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 9d37bf0b24d0..d8b414219704 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -64,7 +64,7 @@ tmpfile=$(mktemp) inherit python-utils-r1 -for minor in 9 10 11; do +for minor in 10 11; do ebegin "Testing python3.${minor}" eindent test_var EPYTHON "python3_${minor}" "python3.${minor}" @@ -199,16 +199,10 @@ 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_9 3.9" 0 -test_is "_python_impl_matches python3_9 3.10" 1 -test_is "_python_impl_matches python3_9 3.11" 1 -test_is "_python_impl_matches python3_10 3.9" 1 test_is "_python_impl_matches python3_10 3.10" 0 test_is "_python_impl_matches python3_10 3.11" 1 -test_is "_python_impl_matches python3_11 3.9" 1 test_is "_python_impl_matches python3_11 3.10" 1 test_is "_python_impl_matches python3_11 3.11" 0 -test_is "_python_impl_matches pypy3 3.9" 0 test_is "_python_impl_matches pypy3 3.10" 1 test_is "_python_impl_matches pypy3 3.11" 1 eoutdent
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 55074a1c37442d3dedf5e65dcb93c8e6d20c6af8 Author: Sam James gentoo org> AuthorDate: Thu Apr 20 23:12:51 2023 + Commit: Sam James gentoo org> CommitDate: Thu Apr 20 23:12:51 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55074a1c eclass/tests: partially fix toolchain.eclass tests - Use the same hack as in crossdev for now wrt EAPI. - Fix up the version tests. We still need to investigate the issues with -march downgrading though. Bug: https://bugs.gentoo.org/859157 Signed-off-by: Sam James gentoo.org> eclass/tests/toolchain.sh | 41 + 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index c012448a1478..1f21e7d842b1 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -1,16 +1,17 @@ #!/bin/bash -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=5 +EAPI=8 -# apply exlass globals to test version parsing -TOOLCHAIN_GCC_PV=7.3.0 +# apply eclass globals to test version parsing +TOOLCHAIN_GCC_PV=11.3.0 PR=r0 source tests-common.sh || exit -inherit toolchain +EAPI=6 inherit eapi7-ver +EAPI=7 inherit toolchain # Ignore actually running version of gcc and fake new version # to force downgrade test on all conditions below. @@ -120,12 +121,12 @@ test_tc_version_is_at_least() { } # wantmine expect -test_tc_version_is_at_least 8 '' 1 -test_tc_version_is_at_least 8.0 '' 1 -test_tc_version_is_at_least 7 '' 0 -test_tc_version_is_at_least 7.0 '' 0 +test_tc_version_is_at_least 12 '' 1 +test_tc_version_is_at_least 11.4'' 1 +test_tc_version_is_at_least 10 '' 0 +test_tc_version_is_at_least 10 '' 0 test_tc_version_is_at_least ${TOOLCHAIN_GCC_PV} '' 0 -test_tc_version_is_at_least 5.0 6.0 0 +test_tc_version_is_at_least 10 11 0 test_tc_version_is_between() { local exp msg ret=0 lo hi res @@ -149,11 +150,11 @@ test_tc_version_is_between() { # lo hi expect test_tc_version_is_between 1 0 1 test_tc_version_is_between 1 2 1 -test_tc_version_is_between 7 8 0 -test_tc_version_is_between ${TOOLCHAIN_GCC_PV} 8 0 +test_tc_version_is_between 11 12 0 +test_tc_version_is_between ${TOOLCHAIN_GCC_PV} 12 0 test_tc_version_is_between ${TOOLCHAIN_GCC_PV} ${TOOLCHAIN_GCC_PV} 1 -test_tc_version_is_between 7 ${TOOLCHAIN_GCC_PV} 1 -test_tc_version_is_between 8 9 1 +test_tc_version_is_between 10 ${TOOLCHAIN_GCC_PV} 1 +test_tc_version_is_between 12 13 1 # eclass has a few critical global variables worth not breaking test_var_assert() { @@ -173,14 +174,14 @@ test_var_assert() { # TODO: convert these globals to helpers to ease testing against multiple # ${TOOLCHAIN_GCC_PV} vaues. -test_var_assert GCC_PV 7.3.0 -test_var_assert GCC_PVR 7.3.0 -test_var_assert GCC_RELEASE_VER 7.3.0 -test_var_assert GCC_BRANCH_VER 7.3 -test_var_assert GCCMAJOR7 +test_var_assert GCC_PV 11.3.0 +test_var_assert GCC_PVR 11.3.0 +test_var_assert GCC_RELEASE_VER 11.3.0 +test_var_assert GCC_BRANCH_VER 11.3 +test_var_assert GCCMAJOR11 test_var_assert GCCMINOR3 test_var_assert GCCMICRO0 -test_var_assert GCC_CONFIG_VER 7.3.0 +test_var_assert GCC_CONFIG_VER 11.3.0 test_var_assert PREFIX /usr texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/, profiles/base/, app-portage/gpyutils/files/, ...
commit: 69b674e49e70369b4a5da3a958f4e1556d6b01f7 Author: David Seifert gentoo org> AuthorDate: Sat Jan 14 11:16:16 2023 + Commit: David Seifert gentoo org> CommitDate: Sat Jan 14 11:16:16 2023 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69b674e4 python-utils-r1.eclass: remove py3.8 Signed-off-by: David Seifert gentoo.org> app-portage/gpyutils/files/implementations.txt | 2 +- eclass/python-utils-r1.eclass | 10 -- eclass/tests/python-utils-r1.sh| 17 ++--- profiles/base/package.use.force| 3 +-- profiles/desc/python_single_target.desc| 3 +-- profiles/desc/python_targets.desc | 3 +-- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/app-portage/gpyutils/files/implementations.txt b/app-portage/gpyutils/files/implementations.txt index 88202c6748a3..ab471bfc7b49 100644 --- a/app-portage/gpyutils/files/implementations.txt +++ b/app-portage/gpyutils/files/implementations.txt @@ -17,7 +17,7 @@ python3_4 dead3.4 python3_5 dead3.5 python3_6 dead3.6 python3_7 dead3.7 -python3_8 old 3.8 +python3_8 dead3.8 python3_9 old 3.9 python3_10 current 3.10 python3_11 supported 3.11 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 83bf5d035c4a..43472bd1fae0 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -40,7 +40,7 @@ inherit multiprocessing toolchain-funcs # All supported Python implementations, most preferred last. _PYTHON_ALL_IMPLS=( pypy3 - python3_{8..11} + python3_{9..11} ) readonly _PYTHON_ALL_IMPLS @@ -52,7 +52,7 @@ _PYTHON_HISTORICAL_IMPLS=( jython2_7 pypy pypy1_{8,9} pypy2_0 python2_{5..7} - python3_{1..7} + python3_{1..8} ) readonly _PYTHON_HISTORICAL_IMPLS @@ -129,9 +129,9 @@ _python_set_impls() { # please keep them in sync with _PYTHON_ALL_IMPLS # and _PYTHON_HISTORICAL_IMPLS case ${i} in - pypy3|python3_[89]|python3_1[01]) + pypy3|python3_9|python3_1[01]) ;; - jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-7]) + jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-8]) obsolete+=( "${i}" ) ;; *) @@ -440,8 +440,6 @@ _python_export() { PYTHON_PKG_DEP) local d case ${impl} in - python3.8) - PYTHON_PKG_DEP=">=dev-lang/python-3.8.16:3.8";; python3.9) PYTHON_PKG_DEP=">=dev-lang/python-3.9.16:3.9";; python3.10) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 6a1d2f98cbf9..9d37bf0b24d0 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -64,7 +64,7 @@ tmpfile=$(mktemp) inherit python-utils-r1 -for minor in 8 9 10 11; do +for minor in 9 10 11; do ebegin "Testing python3.${minor}" eindent test_var EPYTHON "python3_${minor}" "python3.${minor}" @@ -199,15 +199,18 @@ 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 python3_9 3.11" 1 +test_is "_python_impl_matches python3_10 3.9" 1 +test_is "_python_impl_matches python3_10 3.10" 0 +test_is "_python_impl_matches python3_10 3.11" 1 +test_is "_python_impl_matches python3_11 3.9" 1 +test_is "_python_impl_matches python3_11 3.10" 1 +test_is "_python_impl_matches python3_11 3.11" 0 test_is "_python_impl_matches pypy3 3.9" 0 test_is "_python_impl_matches pypy3 3.10" 1 +test_is "_python_impl_matches pypy3 3.11" 1 eoutdent rm "${tmpfile}" diff --git a/profiles/base/package.use.force b/profiles/base/package.use.force index fbce620680a2..7521
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 0cc7b234854bc82ebf2d20bfe161848a9fe3e6ee Author: Michał Górny gentoo org> AuthorDate: Mon Dec 12 05:48:37 2022 + Commit: Michał Górny gentoo org> CommitDate: Wed Dec 14 10:16:15 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0cc7b234 eclass/tests/python-utils-r1.sh: Remove old impls Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 18 +- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 6abf10cadabd..6a1d2f98cbf9 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -64,23 +64,7 @@ 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 - test_var PYTHON_SITEDIR python2_7 "/usr/lib*/python2.7/site-packages" - test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7 - test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)" - test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config - test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*" - test_var PYTHON_LIBS python2_7 "*-lpython2.7*" -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 - -for minor in 6 7 8 9 10 11; do +for minor in 8 9 10 11; do ebegin "Testing python3.${minor}" eindent test_var EPYTHON "python3_${minor}" "python3.${minor}"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 95a6dff78a57dde2133dba050d16cae2c5113b23 Author: Michał Górny gentoo org> AuthorDate: Fri Oct 28 09:59:52 2022 + Commit: Michał Górny gentoo org> CommitDate: Tue Nov 15 16:34:06 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95a6dff7 scons-utils.eclass: Reuse makeopts_jobs Closes: https://github.com/gentoo/gentoo/pull/27999 Signed-off-by: Michał Górny gentoo.org> eclass/scons-utils.eclass | 102 ++-- eclass/tests/scons-utils.sh | 64 --- 2 files changed, 4 insertions(+), 162 deletions(-) diff --git a/eclass/scons-utils.eclass b/eclass/scons-utils.eclass index cbe92f6fc385..acb51300f348 100644 --- a/eclass/scons-utils.eclass +++ b/eclass/scons-utils.eclass @@ -71,8 +71,8 @@ # @DEFAULT_UNSET # @DESCRIPTION: # The default set of options to pass to scons. Similar to MAKEOPTS, -# supposed to be set in make.conf. If unset, escons() will use cleaned -# up MAKEOPTS instead. +# supposed to be set in make.conf. If unset, escons() will set -j +# based on MAKEOPTS. # @ECLASS_VARIABLE: EXTRA_ESCONS # @USER_VARIABLE @@ -148,11 +148,8 @@ escons() { die "EPYTHON unset in escons" fi - # if SCONSOPTS are _unset_, use cleaned MAKEOPTS - if [[ ! ${SCONSOPTS+set} ]]; then - local SCONSOPTS - _scons_clean_makeopts - fi + # if SCONSOPTS are unset, grab -j from MAKEOPTS + : "${SCONSOPTS:=-j$(makeopts_jobs)}" # pass ebuild environment variables through! local -x GENTOO_SCONS_ENV_PASSTHROUGH=1 @@ -161,94 +158,3 @@ escons() { echo "${@}" >&2 "${@}" || die -n "escons failed." } - -# @FUNCTION: _scons_clean_makeopts -# @USAGE: [makeflags] [...] -# @INTERNAL -# @DESCRIPTION: -# Strip the supplied makeflags (or ${MAKEOPTS} if called without -# an argument) of options not supported by SCons and make sure --jobs -# gets an argument. Output the resulting flag list (suitable -# for an assignment to SCONSOPTS). -_scons_clean_makeopts() { - local new_makeopts=() - - debug-print-function ${FUNCNAME} "${@}" - - if [[ ${#} -eq 0 ]]; then - debug-print "Using MAKEOPTS: [${MAKEOPTS}]" - set -- ${MAKEOPTS} - else - # unquote if necessary - set -- ${*} - fi - - # empty MAKEOPTS give out empty SCONSOPTS - # thus, we do need to worry about the initial setup - if [[ ${*} = ${_SCONS_CACHE_MAKEOPTS} ]]; then - SCONSOPTS=${_SCONS_CACHE_SCONSOPTS} - debug-print "Cache hit: [${SCONSOPTS}]" - return - fi - _SCONS_CACHE_MAKEOPTS=${*} - - while [[ ${#} -gt 0 ]]; do - case ${1} in - # clean, simple to check -- we like that - --jobs=*|--keep-going) - new_makeopts+=( ${1} ) - ;; - # need to take a look at the next arg and guess - --jobs) - if [[ ${#} -gt 1 && ${2} =~ ^[0-9]+$ ]]; then - new_makeopts+=( ${1} ${2} ) - shift - else - # no value means no limit, let's pass a default instead - new_makeopts+=( ${1}=$(( $(get_nproc) + 1 )) ) - fi - ;; - # strip other long options - --*) - ;; - # short option hell - -*) - local str new_optstr - new_optstr= - str=${1#-} - - while [[ -n ${str} ]]; do - case ${str} in - k*) - new_optstr+=k - ;; - # -j needs to come last - j) - if [[ ${#} -gt 1 && ${2} =~ ^[0-9]+$ ]]; then - new_optstr+="j ${2}" - shift - else - new_optstr+="j $(( $(get_nproc) + 1 ))" - fi - ;; - # otherwise, everything after -j is treated as an arg -
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2ec095a0bca10ded3361ff2d7494a42ac9f51cfb Author: Michał Górny gentoo org> AuthorDate: Fri Oct 28 08:24:00 2022 + Commit: Michał Górny gentoo org> CommitDate: Fri Oct 28 08:24:00 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ec095a0 eclass/tests/scons-utils.sh: Fake python-r1 to fix failure Signed-off-by: Michał Górny gentoo.org> eclass/tests/scons-utils.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh index 32a0a944706e..5f1cd2036047 100755 --- a/eclass/tests/scons-utils.sh +++ b/eclass/tests/scons-utils.sh @@ -3,6 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 +_PYTHON_R1=1 source tests-common.sh || exit inherit scons-utils
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 37219aee42de9387e83eb2e2454b4c7b74e5ebbe Author: Mike Gilbert gentoo org> AuthorDate: Sun Oct 9 21:16:51 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Sat Oct 15 17:33:50 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37219aee eclass/tests: add systemd tests Signed-off-by: Mike Gilbert gentoo.org> eclass/tests/systemd.sh | 50 + 1 file changed, 50 insertions(+) diff --git a/eclass/tests/systemd.sh b/eclass/tests/systemd.sh new file mode 100755 index ..f870df4b7a12 --- /dev/null +++ b/eclass/tests/systemd.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +source tests-common.sh || exit + +inherit systemd + +test_system_dir() { + local exp1="${EPREFIX}$1" + local exp2="${EPREFIX}/usr$1" + shift + tbegin "$@" + local act=$("$@") + [[ ${act} == ${exp1} || ${act} == ${exp2} ]] + tend $? +} + +test_user_dir() { + local exp="${EPREFIX}$1" + shift + tbegin "$@" + local act=$("$@") + [[ ${act} == ${exp} ]] + tend $? +} + +test_systemd_unprefix() { + local exp=$1 + local EPREFIX=$2 + shift 2 + tbegin "EPREFIX=${EPREFIX} _systemd_unprefix $@" + [[ "$(_systemd_unprefix "$@")" == "${exp}" ]] + tend $? +} + +test_system_dir /lib/systemd/system systemd_get_systemunitdir +test_system_dir /lib/systemd systemd_get_utildir +test_system_dir /lib/systemd/system-generators systemd_get_systemgeneratordir +test_system_dir /lib/systemd/system-preset systemd_get_systempresetdir +test_system_dir /lib/systemd/system-sleep systemd_get_sleepdir + +test_user_dir /usr/lib/systemd/user systemd_get_userunitdir + +test_systemd_unprefix /lib/systemd /prefix echo /prefix/lib/systemd +test_systemd_unprefix /lib/systemd '' echo /lib/systemd +test_systemd_unprefix /lib/systemd '/*' echo '/*/lib/systemd' + +texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 96ddadb40ddba1bfdba68ff8f2fd889cfd004f03 Author: Michał Górny gentoo org> AuthorDate: Fri Oct 7 15:22:01 2022 + Commit: Michał Górny gentoo org> CommitDate: Mon Oct 10 20:52:35 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=96ddadb4 toolchain-funcs.eclass: Add tc-get-c-rtlib() to get CC runtime Add a new tc-get-c-rtlib() that attempts to get the runtime used by the current C compiler. Currently it supports compiler-rt and libgcc. Signed-off-by: Michał Górny gentoo.org> eclass/tests/toolchain-funcs.sh | 10 ++ eclass/toolchain-funcs.eclass | 28 2 files changed, 38 insertions(+) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 5a35a44ce018..d8a357fb24fe 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -202,6 +202,10 @@ if type -P gcc &>/dev/null; then tbegin "tc-get-cxx-stdlib (gcc)" [[ $(CXX=g++ tc-get-cxx-stdlib) == libstdc++ ]] tend $? + + tbegin "tc-get-c-rtlib (gcc)" + [[ $(CC=gcc tc-get-c-rtlib) == libgcc ]] + tend $? fi if type -P clang &>/dev/null; then @@ -218,6 +222,12 @@ if type -P clang &>/dev/null; then tbegin "tc-get-cxx-stdlib (clang, invalid)" ! CXX=clang++ CXXFLAGS="-stdlib=invalid" tc-get-cxx-stdlib tend $? + + for rtlib in compiler-rt libgcc; do + tbegin "tc-get-c-rtlib (clang, ${rtlib})" + [[ $(CC=clang CFLAGS="--rtlib=${rtlib}" tc-get-c-rtlib) == ${rtlib} ]] + tend $? + done fi texit diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 92494158201e..32e446cb2368 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -1209,4 +1209,32 @@ tc-get-cxx-stdlib() { return 0 } +# @FUNCTION: tc-get-c-rtlib +# @DESCRIPTION: +# Attempt to identify the runtime used by the C/C++ compiler. +# If the runtime is identifed, the function returns 0 and prints one +# of the following: +# +# - ``compiler-rt`` for ``sys-libs/compiler-rt`` +# - ``libgcc`` for ``sys-devel/gcc``'s libgcc +# +# If the runtime is not recognized, the function returns 1. +tc-get-c-rtlib() { + local res=$( + $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} \ + -print-libgcc-file-name 2>/dev/null + ) + + case ${res} in + *libclang_rt*) + echo compiler-rt;; + *libgcc*) + echo libgcc;; + *) + return 1;; + esac + + return 0 +} + fi
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: bcce21e5e6b31aca6b2f8edb15328edc8f078d52 Author: Michał Górny gentoo org> AuthorDate: Sat Oct 8 09:41:05 2022 + Commit: Michał Górny gentoo org> CommitDate: Mon Oct 10 20:52:36 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcce21e5 eclass/tests/toolchain-funcs.sh: Handle missing ld.gold gracefully Signed-off-by: Michał Górny gentoo.org> eclass/tests/toolchain-funcs.sh | 64 ++--- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index d8a357fb24fe..08cfd74611aa 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -60,20 +60,22 @@ 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 (ld=gold cc=default)" -LD=ld.gold tc-ld-is-gold -ret=$? -tend ${ret} - -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 (ld=bfd cc=gold)" -LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold -ret=$? -tend ${ret} +if type -P ld.gold &>/dev/null; then + tbegin "tc-ld-is-gold (ld=gold cc=default)" + LD=ld.gold tc-ld-is-gold + ret=$? + tend ${ret} + + 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 (ld=bfd cc=gold)" + LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold + ret=$? + tend ${ret} +fi # # TEST: tc-ld-disable-gold @@ -87,23 +89,25 @@ tc-ld-disable-gold ) tend $? -tbegin "tc-ld-disable-gold (ld=gold)" -( -export LD=ld.gold LDFLAGS= -ewarn() { :; } -tc-ld-disable-gold -[[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]] -) -tend $? +if type -P ld.gold &>/dev/null; then + tbegin "tc-ld-disable-gold (ld=gold)" + ( + export LD=ld.gold LDFLAGS= + ewarn() { :; } + tc-ld-disable-gold + [[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]] + ) + tend $? -tbegin "tc-ld-disable-gold (cc=gold)" -( -export LD= LDFLAGS="-fuse-ld=gold" -ewarn() { :; } -tc-ld-disable-gold -[[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]] -) -tend $? + tbegin "tc-ld-disable-gold (cc=gold)" + ( + export LD= LDFLAGS="-fuse-ld=gold" + ewarn() { :; } + tc-ld-disable-gold + [[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]] + ) + tend $? +fi unset CPP
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 8554f11f4bf46147609c710ffb8fac2eef8ccc94 Author: Michał Górny gentoo org> AuthorDate: Thu Sep 29 06:54:44 2022 + Commit: Michał Górny gentoo org> CommitDate: Sat Oct 1 17:19:36 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8554f11f eclass/tests/unpacker.sh: Add online tests for makeself Closes: https://github.com/gentoo/gentoo/pull/27507 Signed-off-by: Michał Górny gentoo.org> eclass/tests/unpacker.sh | 105 +++ 1 file changed, 105 insertions(+) diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh index ea9e64d0a4c7..ef17e724a851 100755 --- a/eclass/tests/unpacker.sh +++ b/eclass/tests/unpacker.sh @@ -223,6 +223,67 @@ test_reject_junk() { rm -f "${archive}" || die } +test_online() { + local url=${1} + local b2sum=${2} + local unpacked=${3} + local unp_b2sum=${4} + + local filename=${url##*/} + local archive=${DISTDIR}/${filename} + + if [[ ! -f ${archive} ]]; then + if [[ ${UNPACKER_TESTS_ONLINE} != 1 ]]; then + ewarn "Skipping ${filename} test, distfile not found" + return + fi + + if ! wget -O "${archive}" "${url}"; then + die "Fetching ${archive} failed" + fi + fi + + local real_sum=$(b2sum "${archive}" | cut -d' ' -f1) + if [[ ${real_sum} != ${b2sum} ]]; then + eerror "Incorrect b2sum on ${filename}" + eerror " expected: ${b2sum}" + eerror " found: ${real_sum}" + die "Incorrect b2sum on ${filename}" + fi + + rm -rf testdir || die + mkdir -p testdir || die + + tbegin "unpacking ${filename}" + cd testdir || die + + ln -s "${archive}" "${filename}" || die + + local out + out=$( + _unpacker "${archive}" 2>&1 + ) + ret=$? + if [[ ${ret} -eq 0 ]]; then + if [[ ! -f ${unpacked} ]]; then + eerror "${unpacked} not found after unpacking" + ret=1 + else + real_sum=$(b2sum "${unpacked}" | cut -d' ' -f1) + if [[ ${real_sum} != ${unp_b2sum} ]]; then + eerror "Incorrect b2sum on unpacked file ${unpacked}" + eerror " expected: ${unp_b2sum}" + eerror " found: ${real_sum}" + ret=1 + fi + fi + fi + [[ ${ret} -ne 0 ]] && echo "${out}" >&2 + tend ${ret} + + cd .. || die +} + test_compressed_file .bz2 bzip2 test_compressed_file .Z compress test_compressed_file .gz gzip @@ -322,4 +383,48 @@ test_reject_junk .rar test_reject_junk .lha test_reject_junk .lzh +DISTDIR=$(portageq envvar DISTDIR) +if [[ -n ${DISTDIR} ]]; then + einfo "Using DISTDIR: ${DISTDIR}" + if [[ ${UNPACKER_TESTS_ONLINE} != 1 ]]; then + ewarn "Online tests will be skipped if distfiles are not found already." + ewarn "Set UNPACKER_TESTS_ONLINE=1 to enable fetching." + fi + + # NB: a good idea to list the last file in the archive (to avoid + # passing on partial unpack) + + # TODO: find test cases for makeself 2.0/2.0.1, 2.1.1, 2.1.2, 2.1.3 + + # makeself 1.5.4, gzip + test_online \ + http://updates.lokigames.com/sof/sof-1.06a-cdrom-x86.run \ + f76f605af08a19b77548455c0101e03aca7cae69462914e47911da2fadd6d4f3b766e1069556ead0d06c757b179ae2e8105e76ea37852f17796b47b4712aec87 \ + update.sh \ + ba7a3f8fa79bbed8ca3a34ead957aeaa308c6e6d6aedd603098aa9867ca745983ff98c83d65572e507f2c3c4e0778ae4984f8b69d2b8279741b06064253c5788 + + # makeself 1.6.0-nv*, xz + test_online \ + https://download.nvidia.com/XFree86/Linux-x86/390.154/NVIDIA-Linux-x86-390.154.run \ + 083d9dd234a37ec39a703ef7e0eb6ec165c24d2fcb5e92ca987c33df643d0604319eb65ef152c861acacd5a41858ab6b82c45c2c8ff270efc62b07727666daae \ + libEGL_nvidia.so.390.154 \ + 6665804947e71fb583dc7d5cc3a6f4514f612503000b0a9dbd8da5c362d3c2dcb2895d8cbbf5700a6f0e24cca9b0dd9c2cf5763d6fbb037f55257ac5af7d6084 + + # makeself 2.3.0, gzip + test_online \ + http://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.07.1.run \ + 059d9a5fbd14c0e7ecb969cd3e5afe8e3f42896175b443bdaa9f9108302a1c9ef5ad9769e62f824465611d74f67191fff71cc6dbe297e399e5b2f6824c650112 \ + i686/sdrplay_apiService \ + 806393c310d7e60dca7b8afee225bcc50c0d5771bdd04c3fa575eda2e687dc5c888279a7404316438b633fb91565a49899cf634194d43981151a12c6c284a162 + + # makeself 2.4.0, gzip + test_online \ + http://www.sdrplay.com/software/SDRpl
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 467e21cbdab04a21e006825a17fd9344f7dcd688 Author: Michał Górny gentoo org> AuthorDate: Wed Sep 28 08:56:16 2022 + Commit: Michał Górny gentoo org> CommitDate: Sat Oct 1 17:19:34 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=467e21cb eclass/tests/unpacker.sh: Add tests for makeself Signed-off-by: Michał Górny gentoo.org> eclass/tests/unpacker.sh | 29 + 1 file changed, 29 insertions(+) diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh index 105f28fd4858..ea9e64d0a4c7 100755 --- a/eclass/tests/unpacker.sh +++ b/eclass/tests/unpacker.sh @@ -182,6 +182,25 @@ test_gpkg() { "create_gpkg '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}" } +create_makeself() { + local comp_opt=${1} + local archive=${2} + local infile=${3} + + mkdir test || die + cp "${infile}" test/ || die + makeself --quiet "${comp_opt}" test "${archive}" test : || die + rm -rf test || die +} + +test_makeself() { + local comp_opt=${1} + local tool=${2} + + test_unpack "makeself-${tool}.sh" test.in "makeself ${tool}" \ + "create_makeself '${comp_opt}' \${archive} \${TESTFILE}" +} + test_reject_junk() { local suffix=${1} local archive=test${1} @@ -265,6 +284,16 @@ test_gpkg .lzo lzop test_gpkg .xz xz test_gpkg .zst zstd +test_makeself --gzip gzip +test_makeself --zstd zstd +test_makeself --bzip2 bzip2 +test_makeself --xz xz +test_makeself --lzo lzop +test_makeself --lz4 lz4 +test_makeself --compress compress +test_makeself --base64 base64 +test_makeself --nocomp tar + test_unpack test.zip test.in zip 'zip -q ${archive} ${TESTFILE}' # test handling non-adjusted zip with junk prepended test_unpack test.zip test.in zip \
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 725aa5a066e69f5611e40c3cc84660eee07f940c Author: Michał Górny gentoo org> AuthorDate: Wed Sep 28 20:44:47 2022 + Commit: Michał Górny gentoo org> CommitDate: Wed Sep 28 20:55:24 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=725aa5a0 unpacker.eclass: Workaround zstd refusing to process symlinks Closes: https://bugs.gentoo.org/873352 Signed-off-by: Michał Górny gentoo.org> eclass/tests/unpacker.sh | 7 ++- eclass/unpacker.eclass | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh index b15953966f65..105f28fd4858 100755 --- a/eclass/tests/unpacker.sh +++ b/eclass/tests/unpacker.sh @@ -42,9 +42,14 @@ test_unpack() { eval "${packcmd}" assert "packing ${archive} failed" cd testdir || die + + # create a symlink to flush out compressor issues and resemble distdir more + # https://bugs.gentoo.org/873352 + ln -s "../${archive}" "${archive}" || die + local out out=$( - _unpacker "../${archive}" 2>&1 + _unpacker "${archive}" 2>&1 ) ret=$? if [[ ${ret} -eq 0 ]]; then diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass index 3d23151b636e..6c9bcbdd7a7b 100644 --- a/eclass/unpacker.eclass +++ b/eclass/unpacker.eclass @@ -523,11 +523,11 @@ _unpacker() { if [[ -z ${arch} ]] ; then # Need to decompress the file into $PWD #408801 local _a=${a%.*} - ${comp} "${a}" > "${_a##*/}" + ${comp} < "${a}" > "${_a##*/}" elif [[ -z ${comp} ]] ; then ${arch} "${a}" else - ${comp} "${a}" | ${arch} - + ${comp} < "${a}" | ${arch} - fi assert "unpacking ${a} failed (comp=${comp} arch=${arch})"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 9f8718d9175ede151365ae0472bfc25e0e7e451f Author: Michał Górny gentoo org> AuthorDate: Sat Sep 24 13:43:43 2022 + Commit: Michał Górny gentoo org> CommitDate: Tue Sep 27 20:27:55 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f8718d9 eclass/tests: Add tests for unpacker.eclass Signed-off-by: Michał Górny gentoo.org> eclass/tests/tests-common.sh | 7 ++ eclass/tests/unpacker.sh | 233 +++ 2 files changed, 240 insertions(+) diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh index a677842b6ac5..45b1e20b933a 100644 --- a/eclass/tests/tests-common.sh +++ b/eclass/tests/tests-common.sh @@ -60,6 +60,13 @@ die() { exit 1 } +assert() { + local x pipestatus=${PIPESTATUS[*]} + for x in ${pipestatus} ; do + [[ ${x} -eq 0 ]] || die "$@" + done +} + has_version() { while [[ $1 == -* ]]; do shift diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh new file mode 100755 index ..7a297d61babd --- /dev/null +++ b/eclass/tests/unpacker.sh @@ -0,0 +1,233 @@ +#!/usr/bin/env bash +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +source tests-common.sh || exit + +inherit unpacker + +# silence the output +unpack_banner() { :; } + +TESTFILE=test.in +TESTDIR=$(mktemp -d || die) +trap 'cd - >/dev/null && rm -r "${TESTDIR}"' EXIT + +# prepare some test data +# NB: we need something "compressible", as compress(1) will return +# an error if the file "is larger than before compression" +cp ../unpacker.eclass "${TESTDIR}/${TESTFILE}" || die +cd "${TESTDIR}" || die + +test_unpack() { + local archive=${1} + local unpacked=${2} + local deps=${3} + local packcmd=${4} + + local x + for x in ${deps}; do + if ! type "${x}" &>/dev/null; then + ewarn "Skipping ${archive}, tool ${x} not found" + return + fi + done + + rm -rf testdir || die + mkdir -p testdir || die + + tbegin "unpacking ${archive}" + eval "${packcmd}" + assert "packing ${archive} failed" + cd testdir || die + local out + out=$( + _unpacker "../${archive}" 2>&1 + ) + ret=$? + if [[ ${ret} -eq 0 ]]; then + if [[ ! -f ${unpacked} ]]; then + eerror "${unpacked} not found after unpacking" + ret=1 + elif ! diff -u "${unpacked}" "../${TESTFILE}"; then + eerror "${unpacked} different than input" + ret=1 + fi + fi + [[ ${ret} -ne 0 ]] && echo "${out}" >&2 + tend ${ret} + + cd .. || die + rm -f "${archive}" || die +} + +test_compressed_file() { + local suffix=${1} + local tool=${2} + + test_unpack "test${suffix}" test "${tool}" \ + "${tool} -c \${TESTFILE} > \${archive}" +} + +test_compressed_file_multistream() { + local suffix=${1} + local tool=${2} + + test_unpack "test+multistream${suffix}" "test+multistream" "${tool}" \ + "head -n 300 \${TESTFILE} | ${tool} -c > \${archive} && + tail -n +301 \${TESTFILE} | ${tool} -c >> \${archive}" +} + +test_compressed_file_with_junk() { + local suffix=${1} + local tool=${2} + local flag=${3} + + test_unpack "test+junk${suffix}" "test+junk" "${tool}" \ + "${tool} -c \${TESTFILE} > \${archive} && cat test.in >> \${archive}" +} + +test_compressed_tar() { + local suffix=${1} + local tool=${2} + + test_unpack "test${suffix}" test.in "tar ${tool}" \ + "tar -c \${TESTFILE} | ${tool} -c > \${archive}" +} + +test_compressed_cpio() { + local suffix=${1} + local tool=${2} + + test_unpack "test${suffix}" test.in "cpio ${tool}" \ + "cpio -o --quiet <<<\${TESTFILE} | ${tool} -c > \${archive}" +} + +create_deb() { + local suffix=${1} + local tool=${2} + local archive=${3} + local infile=${4} + + echo 2.0 > debian-binary || die + : > control || die + tar -cf control.tar control || die + tar -c "${infile}" | ${tool} > "data.tar${suffix}" + assert "packing data.tar${suffix} failed" + ar r "${archive}" debian-binary control.tar "data.tar${suffix}" \ + 2>/dev/null || die + rm -f control control.tar "data.tar${suffix}" debian-binary || die +} + +test_deb() { + local suffix=${1} + local tool=${2} + local tool_cmd + + if [[ -n ${tool} ]]; then + tool_cmd="${tool} -c" + else + tool_cmd=cat + fi + + test_unpack "test-${tool}_1.2.3_noarch.deb" test.in "ar tar ${tool}" \ + "create_deb '${suffix}' '${tool_cmd}'
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 3f4aa7b89404ad751b7d4da2e272ee61b1554010 Author: Michał Górny gentoo org> AuthorDate: Sun May 8 10:20:59 2022 + Commit: Michał Górny gentoo org> CommitDate: Mon May 9 20:31:46 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f4aa7b8 eclass/tests/python-utils-r1.sh: Streamline the tests Streamline the python-utils-r1.eclass tests to use a for loop instead of copying the same tests over and over again. While at it, group tests by purpose. Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 112 ++-- 1 file changed, 28 insertions(+), 84 deletions(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index e0fc0aab3c03..d971c524b373 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,91 +78,29 @@ 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: f77482477e16fb380a1fe29bbbf88ba9d343a1ac Author: Michał Górny gentoo org> AuthorDate: Sun May 8 10:37:57 2022 + Commit: Michał Górny gentoo org> CommitDate: Mon May 9 20:31:47 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7748247 eclass/tests/python-utils-r1.eclass: Add tests for adding new impls Add tests that verify that new Python implementations are added to all the places that need them. Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 35 +++ 1 file changed, 35 insertions(+) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index d971c524b373..6abf10cadabd 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -96,6 +96,41 @@ for minor in 6 7 8 9 10 11; do 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: a00223eb88742885325b8863ba080e7d94202d8f Author: Michał Górny gentoo org> AuthorDate: Thu Apr 28 10:44:02 2022 + Commit: Michał Górny gentoo org> CommitDate: Sun May 1 07:30:36 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a00223eb multiprocessing.eclass: Default makeopts_jobs to inf=nproc+1 Change the default value for 'inf' argument to makeopts_jobs from 999 to $(get_nproc) + 1. This means that if MAKEOPTS specifies a `-j` argument without a specific value, nproc will be used rather than infinity-ish number of jobs. The old default made sense for ebuilds using both makeopts_jobs and makeopts_loadavg. However, these are very rare — only 4 packages and 3 eclass at this time. For the remaining ebuilds, they meant uncontrollably using up to 999 jobs. The new default is both safer and more correct for the vast majority of Gentoo packages, removing the necessity of repeating: $(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") The ebuilds and eclasses using makeopts_loadavg have been updated to pass the old default. Signed-off-by: Michał Górny gentoo.org> eclass/multiprocessing.eclass | 11 +-- eclass/tests/multiprocessing_makeopts_jobs.sh | 15 ++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass index c32bfaac2e6b..e55be636a02c 100644 --- a/eclass/multiprocessing.eclass +++ b/eclass/multiprocessing.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: multiprocessing.eclass @@ -65,22 +65,21 @@ get_nproc() { } # @FUNCTION: makeopts_jobs -# @USAGE: [${MAKEOPTS}] [${inf:-999}] +# @USAGE: [${MAKEOPTS}] [${inf:-$(( $(get_nproc) + 1 ))}] # @DESCRIPTION: # Searches the arguments (defaults to ${MAKEOPTS}) and extracts the jobs number # specified therein. Useful for running non-make tools in parallel too. # i.e. if the user has MAKEOPTS=-j9, this will echo "9" -- we can't return the # number as bash normalizes it to [0, 255]. If the flags haven't specified a -# -j flag, then "1" is shown as that is the default `make` uses. Since there's -# no way to represent infinity, we return ${inf} (defaults to 999) if the user -# has -j without a number. +# -j flag, then "1" is shown as that is the default `make` uses. If the flags +# specify -j without a number, ${inf} is returned (defaults to nproc). makeopts_jobs() { [[ $# -eq 0 ]] && set -- "${MAKEOPTS}" # This assumes the first .* will be more greedy than the second .* # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). local jobs=$(echo " $* " | sed -r -n \ -e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ - -e "s:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:${2:-999}:p") + -e "s:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:${2:-$(( $(get_nproc) + 1 ))}:p") echo ${jobs:-1} } 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" )
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 5ebae81ccb112276cf260007c99f18069063c0be Author: Michał Górny gentoo org> AuthorDate: Thu Apr 21 08:41:06 2022 + Commit: Michał Górny gentoo org> CommitDate: Thu Apr 21 15:19:40 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ebae81c eclass/tests/python-utils-r1.sh: Add tests for stdlib ver matching Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 9 + 1 file changed, 9 insertions(+) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index ef7687b8a9cf..9c41798c4727 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -223,6 +223,15 @@ 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 rm "${tmpfile}"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 74780679b37fc00aa39804d8cc3a90abf6e2c745 Author: Mike Gilbert gentoo org> AuthorDate: Tue Apr 19 21:31:52 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Tue Apr 19 21:31:52 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74780679 eclass/tests/qmail.sh: eend and return should be separate statements Closes: https://bugs.gentoo.org/839189 Signed-off-by: Mike Gilbert gentoo.org> eclass/tests/qmail.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: c1f9ddbdceb036b79881625403917aaeeb608190 Author: Mike Gilbert gentoo org> AuthorDate: Mon Feb 14 21:12:31 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Mon Feb 14 21:12:31 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1f9ddbd eclass/tests: source tests-common.sh || exit Signed-off-by: Mike Gilbert gentoo.org> eclass/tests/autotools_eaclocal_amflags.sh | 2 +- eclass/tests/distutils-r1.sh | 2 +- eclass/tests/distutils-r1_single.sh | 2 +- eclass/tests/eapi7-ver.sh| 2 +- eclass/tests/eapi7-ver_benchmark.sh | 2 +- eclass/tests/eapi8-dosym.sh | 2 +- eclass/tests/estack_eshopts.sh | 2 +- eclass/tests/estack_estack.sh| 2 +- eclass/tests/estack_evar.sh | 2 +- eclass/tests/flag-o-matic.sh | 2 +- eclass/tests/git-r3.sh | 2 +- eclass/tests/git-r3_GIT_DIR.sh | 2 +- eclass/tests/git-r3_subrepos.sh | 2 +- eclass/tests/linux-info_get_running_version.sh | 2 +- eclass/tests/llvm.sh | 2 +- eclass/tests/multilib.sh | 2 +- eclass/tests/multiprocessing_makeopts_jobs.sh| 2 +- eclass/tests/multiprocessing_makeopts_loadavg.sh | 2 +- eclass/tests/python-utils-r1.sh | 2 +- eclass/tests/qmail.sh| 2 +- eclass/tests/rebar_fix_include_path.sh | 2 +- eclass/tests/rebar_remove_deps.sh| 2 +- eclass/tests/rebar_set_vsn.sh| 2 +- eclass/tests/scons-utils.sh | 2 +- eclass/tests/toolchain-funcs.sh | 2 +- eclass/tests/toolchain.sh| 2 +- eclass/tests/versionator_version_compare.sh | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) diff --git a/eclass/tests/autotools_eaclocal_amflags.sh b/eclass/tests/autotools_eaclocal_amflags.sh index f9f02bb77893..b64f857ec102 100755 --- a/eclass/tests/autotools_eaclocal_amflags.sh +++ b/eclass/tests/autotools_eaclocal_amflags.sh @@ -2,7 +2,7 @@ # Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -source tests-common.sh +source tests-common.sh || exit EAPI=7 diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index cd768066bf37..a42d4cc4641a 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -4,7 +4,7 @@ EAPI=7 PYTHON_COMPAT=( python3_8 ) -source tests-common.sh +source tests-common.sh || exit test-phase_name_free() { local ph=${1} diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh index fdeba2e2b9b2..0a671e2b739b 100755 --- a/eclass/tests/distutils-r1_single.sh +++ b/eclass/tests/distutils-r1_single.sh @@ -4,7 +4,7 @@ EAPI=7 PYTHON_COMPAT=( python3_8 ) -source tests-common.sh +source tests-common.sh || exit test-distutils_enable_tests() { local runner=${1} diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh index d4aa4fdbd289..13cd671e7158 100755 --- a/eclass/tests/eapi7-ver.sh +++ b/eclass/tests/eapi7-ver.sh @@ -4,7 +4,7 @@ EAPI=6 -source tests-common.sh +source tests-common.sh || exit inherit eapi7-ver diff --git a/eclass/tests/eapi7-ver_benchmark.sh b/eclass/tests/eapi7-ver_benchmark.sh index c46713713368..ab324edb95c9 100755 --- a/eclass/tests/eapi7-ver_benchmark.sh +++ b/eclass/tests/eapi7-ver_benchmark.sh @@ -4,7 +4,7 @@ EAPI=6 -source tests-common.sh +source tests-common.sh || exit inherit eapi7-ver versionator diff --git a/eclass/tests/eapi8-dosym.sh b/eclass/tests/eapi8-dosym.sh index e1160c42d875..9290026a26de 100755 --- a/eclass/tests/eapi8-dosym.sh +++ b/eclass/tests/eapi8-dosym.sh @@ -4,7 +4,7 @@ EAPI=7 -source tests-common.sh +source tests-common.sh || exit inherit eapi8-dosym diff --git a/eclass/tests/estack_eshopts.sh b/eclass/tests/estack_eshopts.sh index 28346c65ec13..c070e99b6569 100755 --- a/eclass/tests/estack_eshopts.sh +++ b/eclass/tests/estack_eshopts.sh @@ -2,7 +2,7 @@ # Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source tests-common.sh +source tests-common.sh || exit inherit estack diff --git a/eclass/tests/estack_estack.sh b/eclass/tests/estack_estack.sh index 4845243d3ae4..18d337ec1f0c 100755 --- a/eclass/tests/estack_estack.sh +++ b/eclass/tests/estack_estack.sh @@ -2,7 +2,7 @@ # Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source tests-common.sh +source tests-common.sh || exit inherit estack diff --git a/eclass/tests/estack_evar.sh b/eclass/tests/estack_evar.sh index 29badba0079e..1bf35f2d6e0e 100755 --- a/eclass/tests/estack_evar.sh +++ b/eclass/tests/estack_evar.s
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 318f4a2e9b59083194ac34389a1ca29fce3c969b Author: Mike Gilbert gentoo org> AuthorDate: Mon Feb 14 17:20:39 2022 + Commit: Mike Gilbert gentoo org> CommitDate: Mon Feb 14 17:24:57 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=318f4a2e eclass/tests/savedconfig.sh: abort when source tests-common.sh fails Closes: https://bugs.gentoo.org/833342 Signed-off-by: Mike Gilbert gentoo.org> eclass/tests/savedconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/tests/savedconfig.sh b/eclass/tests/savedconfig.sh index 7643cf4cc823..16645fc05854 100755 --- a/eclass/tests/savedconfig.sh +++ b/eclass/tests/savedconfig.sh @@ -4,7 +4,7 @@ EAPI=7 -source tests-common.sh +source tests-common.sh || exit inherit savedconfig
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: beda1fe93abc87691239919653283ab0c299e00b Author: Michał Górny gentoo org> AuthorDate: Fri Feb 4 18:47:20 2022 + Commit: Michał Górny gentoo org> CommitDate: Wed Feb 9 08:43:51 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=beda1fe9 python-utils-r1.eclass: Remove python_is_python3 Signed-off-by: Michał Górny gentoo.org> eclass/distutils-r1.eclass | 8 +++- eclass/python-utils-r1.eclass | 17 - eclass/tests/python-utils-r1.sh | 5 - 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 0507551897b9..b4bbb7d67e04 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -333,11 +333,9 @@ unset -f _distutils_set_globals # (allowing any implementation). If multiple values are specified, # implementations matching any of the patterns will be accepted. # -# The patterns can be either fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate -# appropriately all enabled Python 2/3 implementations (alike -# python_is_python3). Remember to escape or quote the fnmatch patterns -# to prevent accidental shell filename expansion. +# The patterns are fnmatch-style patterns (matched via bash == operator +# against PYTHON_COMPAT values). Remember to escape or quote the fnmatch +# patterns to prevent accidental shell filename expansion. # # If the restriction needs to apply conditionally to a USE flag, # the variable should be set conditionally as well (e.g. in an early diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 395e3e6420f4..29ff04d2892c 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -945,23 +945,6 @@ _python_wrapper_setup() { export PATH PKG_CONFIG_PATH } -# @FUNCTION: python_is_python3 -# @USAGE: [] -# @DESCRIPTION: -# Check whether (or ${EPYTHON}) is a Python3k variant -# (i.e. uses syntax and stdlib of Python 3.*). -# -# Returns 0 (true) if it is, 1 (false) otherwise. -python_is_python3() { - eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported anymore" - [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" - - local impl=${1:-${EPYTHON}} - [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON" - - [[ ${impl} == python3* || ${impl} == pypy3 ]] -} - # @FUNCTION: python_fix_shebang # @USAGE: [-f|--force] [-q|--quiet] ... # @DESCRIPTION: diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 7ba4a864ff10..0244ce26ad0f 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -156,11 +156,6 @@ fi test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0=' 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 pypy" 1 -test_is "python_is_python3 pypy3" 0 - # generic shebangs test_fix_shebang '#!/usr/bin/python' python3.6 '#!/usr/bin/python3.6' test_fix_shebang '#!/usr/bin/python' pypy3 '#!/usr/bin/pypy3'
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 61d3e4f58783d613521c9cd9d2877c932212e460 Author: Michał Górny gentoo org> AuthorDate: Fri Dec 31 08:59:17 2021 + Commit: Michał Górny gentoo org> CommitDate: Sun Jan 9 08:09:06 2022 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61d3e4f5 python-utils-r1.eclass: Bump minimal Python versions Bump minimal Python package versions to ensure that the python-exec deps are inside. Signed-off-by: Michał Górny gentoo.org> eclass/python-utils-r1.eclass | 10 -- eclass/tests/distutils-r1.sh| 2 +- eclass/tests/distutils-r1_single.sh | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 22e00c56815d..ff5b350cd469 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: python-utils-r1.eclass @@ -416,12 +416,18 @@ _python_export() { case ${impl} in python2.7) PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';; + python3.8) + PYTHON_PKG_DEP=">=dev-lang/python-3.8.12_p1-r1:3.8";; + python3.9) + PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";; + python3.10) + PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";; python*) PYTHON_PKG_DEP="dev-lang/python:${impl#python}";; pypy) PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';; pypy3) - PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.7:0=';; + PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.7-r1:0=';; *) die "Invalid implementation: ${impl}" esac diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 1ccb1dfbc523..a582bd9bbee7 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -97,7 +97,7 @@ tend einfo distutils_enable_tests eindent BASE_IUSE="python_targets_python3_8" -BASE_DEPS="python_targets_python3_8? ( dev-lang/python:3.8 ) >=dev-lang/python-exec-2:=[python_targets_python3_8(-)?]" +BASE_DEPS="python_targets_python3_8? ( >=dev-lang/python-3.8.12_p1-r1:3.8 ) >=dev-lang/python-exec-2:=[python_targets_python3_8(-)?]" TEST_RESTRICT="!test? ( test )" einfo "empty RDEPEND" diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh index 56b62ca0e90f..8d07eebb133f 100755 --- a/eclass/tests/distutils-r1_single.sh +++ b/eclass/tests/distutils-r1_single.sh @@ -77,7 +77,7 @@ inherit distutils-r1 einfo distutils_enable_tests eindent BASE_IUSE="+python_single_target_python3_8" -BASE_DEPS="python_single_target_python3_8? ( dev-lang/python:3.8 >=dev-lang/python-exec-2:=[python_targets_python3_8] )" +BASE_DEPS="python_single_target_python3_8? ( >=dev-lang/python-3.8.12_p1-r1:3.8 >=dev-lang/python-exec-2:=[python_targets_python3_8] )" TEST_RESTRICT="!test? ( test )" einfo "empty RDEPEND"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2faf25df671629e393ccae66c98683bd3521cbb2 Author: Michał Górny gentoo org> AuthorDate: Fri Dec 31 09:04:58 2021 + Commit: Michał Górny gentoo org> CommitDate: Fri Dec 31 09:04:58 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2faf25df eclass/tests: Update expected deps in distutils-r1 tests Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh| 6 +++--- eclass/tests/distutils-r1_single.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 163a509b3068..1ccb1dfbc523 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -97,7 +97,7 @@ tend einfo distutils_enable_tests eindent BASE_IUSE="python_targets_python3_8" -BASE_DEPS="python_targets_python3_8? ( dev-lang/python:3.8 ) >=dev-lang/python-exec-2:=[python_targets_python3_8(-)?,-python_single_target_python3_8(-)]" +BASE_DEPS="python_targets_python3_8? ( dev-lang/python:3.8 ) >=dev-lang/python-exec-2:=[python_targets_python3_8(-)?]" TEST_RESTRICT="!test? ( test )" einfo "empty RDEPEND" @@ -131,11 +131,11 @@ eoutdent einfo DISTUTILS_USE_SETUPTOOLS eindent -SETUPTOOLS_DEP=">=dev-python/setuptools-42.0.2[python_targets_python3_8(-)?,-python_single_target_python3_8(-)]" +SETUPTOOLS_DEP=">=dev-python/setuptools-42.0.2[python_targets_python3_8(-)?]" test-DISTUTILS_USE_SETUPTOOLS no "${BASE_DEPS}" "${BASE_DEPS}" test-DISTUTILS_USE_SETUPTOOLS bdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS}" test-DISTUTILS_USE_SETUPTOOLS rdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS} ${SETUPTOOLS_DEP}" -test-DISTUTILS_USE_SETUPTOOLS pyproject.toml "${BASE_DEPS} dev-python/pyproject2setuppy[python_targets_python3_8(-)?,-python_single_target_python3_8(-)]" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS pyproject.toml "${BASE_DEPS} >=dev-python/pyproject2setuppy-22[python_targets_python3_8(-)?]" "${BASE_DEPS}" test-DISTUTILS_USE_SETUPTOOLS manual "${BASE_DEPS}" "${BASE_DEPS}" eoutdent diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh index fb177261d0a0..56b62ca0e90f 100755 --- a/eclass/tests/distutils-r1_single.sh +++ b/eclass/tests/distutils-r1_single.sh @@ -115,7 +115,7 @@ SETUPTOOLS_DEP="python_single_target_python3_8? ( >=dev-python/setuptools-42.0.2 test-DISTUTILS_USE_SETUPTOOLS no "${BASE_DEPS}" "${BASE_DEPS}" test-DISTUTILS_USE_SETUPTOOLS bdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS}" test-DISTUTILS_USE_SETUPTOOLS rdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS} ${SETUPTOOLS_DEP}" -test-DISTUTILS_USE_SETUPTOOLS pyproject.toml "${BASE_DEPS} python_single_target_python3_8? ( dev-python/pyproject2setuppy[python_targets_python3_8(-)] )" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS pyproject.toml "${BASE_DEPS} python_single_target_python3_8? ( >=dev-python/pyproject2setuppy-22[python_targets_python3_8(-)] )" "${BASE_DEPS}" test-DISTUTILS_USE_SETUPTOOLS manual "${BASE_DEPS}" "${BASE_DEPS}" eoutdent
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 85ad470eafdfe9971bb57bbdfed33aad0df964d4 Author: Michał Górny gentoo org> AuthorDate: Fri Dec 31 09:06:01 2021 + Commit: Michał Górny gentoo org> CommitDate: Fri Dec 31 09:06:01 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85ad470e eclass/tests/python-utils-r1.sh: Update expected pypy3 includedir Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 63a94c90b715..1cd5cdbf6c0a 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -151,7 +151,7 @@ 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_INCLUDEDIR pypy3 "/usr/include/pypy3.?" fi test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0=' test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 7d07fee32109260cfa3018c29a3a45d589a82d60 Author: Michał Górny gentoo org> AuthorDate: Fri Dec 31 09:09:34 2021 + Commit: Michał Górny gentoo org> CommitDate: Fri Dec 31 09:09:34 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d07fee3 eclass/tests/python-utils-r1.sh: Remove obsoletep py2 usage Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 46 ++--- 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 1cd5cdbf6c0a..7ba4a864ff10 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -162,68 +162,44 @@ 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' pypy3 '#!/usr/bin/pypy3' # python2/python3 matching -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.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' test_fix_shebang '#!/usr/bin/python2.7' python3.2 FAIL 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' python2.7 FAIL -test_fix_shebang '#!/usr/bin/pypy' python2.7 '#!/usr/bin/python2.7' --force # fancy path handling 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 \ - '#!/mnt/python2/usr/bin/env python2.7' -test_fix_shebang '#!/mnt/python2/usr/bin/python2 python2' python2.7 \ - '#!/mnt/python2/usr/bin/python2.7 python2' -test_fix_shebang '#!/mnt/python2/usr/bin/python3 python2' python2.7 FAIL -test_fix_shebang '#!/mnt/python2/usr/bin/python3 python2' python2.7 \ - '#!/mnt/python2/usr/bin/python2.7 python2' --force -test_fix_shebang '#!/usr/bin/foo' python2.7 FAIL +test_fix_shebang '#!/mnt/python2/usr/bin/python3' python3.8 \ + '#!/mnt/python2/usr/bin/python3.8' +test_fix_shebang '#!/mnt/python2/usr/bin/env python' python3.8 \ + '#!/mnt/python2/usr/bin/env python3.8' +test_fix_shebang '#!/mnt/python2/usr/bin/python3 python3' python3.8 \ + '#!/mnt/python2/usr/bin/python3.8 python3' +test_fix_shebang '#!/mnt/python2/usr/bin/python2 python3' python3.8 FAIL +test_fix_shebang '#!/mnt/python2/usr/bin/python2 python3' python3.8 \ + '#!/mnt/python2/usr/bin/python3.8 python3' --force +test_fix_shebang '#!/usr/bin/foo' python3.8 FAIL # regression test for bug #522080 -test_fix_shebang '#!/usr/bin/python ' python2.7 '#!/usr/bin/python2.7 ' +test_fix_shebang '#!/usr/bin/python ' python3.8 '#!/usr/bin/python3.8 ' # 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 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 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 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 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 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 pypy3 python*" 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: a0eb5847674c9d295fbc80e2b7c53855cfca5a66 Author: Michał Górny gentoo org> AuthorDate: Sun Jun 20 07:14:32 2021 + Commit: Michał Górny gentoo org> CommitDate: Wed Jun 23 21:44:08 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0eb5847 python-utils-r1.eclass: Deprecated and EAPI8-ban python_is_python3 There is no use for python_is_python3 anymore, as Python 2 is no longer supported at runtime and the remaining any-r1 uses are pure-2. Signed-off-by: Michał Górny gentoo.org> eclass/python-utils-r1.eclass | 3 +++ eclass/tests/python-utils-r1.sh | 4 2 files changed, 7 insertions(+) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 1a20a3cae99..b435ebaa7ad 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1010,6 +1010,9 @@ _python_wrapper_setup() { # # Returns 0 (true) if it is, 1 (false) otherwise. python_is_python3() { + eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported anymore" + [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" + local impl=${1:-${EPYTHON}} [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON" diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 85a6a53654d..63a94c90b71 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -5,6 +5,10 @@ EAPI=7 source tests-common.sh +eqawarn() { + : # stub +} + test_var() { local var=${1} local impl=${2}
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: e60eb42c4e5bd3e9cf0d023e87f4925de66556e2 Author: David Seifert gentoo org> AuthorDate: Tue Jun 22 20:43:32 2021 + Commit: David Seifert gentoo org> CommitDate: Tue Jun 22 20:43:32 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e60eb42c eclass/tests: Add EAPI decls to fix running tests Signed-off-by: David Seifert gentoo.org> eclass/tests/linux-info_get_running_version.sh | 3 ++- eclass/tests/multilib.sh | 3 ++- eclass/tests/multiprocessing_makeopts_jobs.sh| 3 ++- eclass/tests/multiprocessing_makeopts_loadavg.sh | 3 ++- eclass/tests/scons-utils.sh | 3 ++- eclass/tests/toolchain-funcs.sh | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/eclass/tests/linux-info_get_running_version.sh b/eclass/tests/linux-info_get_running_version.sh index fbb5c827a45..ce65ae51fee 100755 --- a/eclass/tests/linux-info_get_running_version.sh +++ b/eclass/tests/linux-info_get_running_version.sh @@ -1,7 +1,8 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +EAPI=6 source tests-common.sh inherit linux-info diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh index a483d4bef36..ce2b4c2a583 100755 --- a/eclass/tests/multilib.sh +++ b/eclass/tests/multilib.sh @@ -1,7 +1,8 @@ #!/bin/bash -# Copyright 2020 Gentoo Authors +# Copyright 2020-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +EAPI=7 source tests-common.sh inherit multilib diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh index 689313a397b..b045121cfa1 100755 --- a/eclass/tests/multiprocessing_makeopts_jobs.sh +++ b/eclass/tests/multiprocessing_makeopts_jobs.sh @@ -1,7 +1,8 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +EAPI=7 source tests-common.sh inherit multiprocessing diff --git a/eclass/tests/multiprocessing_makeopts_loadavg.sh b/eclass/tests/multiprocessing_makeopts_loadavg.sh index d17d7734b9f..28e5e557601 100755 --- a/eclass/tests/multiprocessing_makeopts_loadavg.sh +++ b/eclass/tests/multiprocessing_makeopts_loadavg.sh @@ -1,7 +1,8 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +EAPI=7 source tests-common.sh inherit multiprocessing diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh index 873312f67d0..c329cf1bcbd 100755 --- a/eclass/tests/scons-utils.sh +++ b/eclass/tests/scons-utils.sh @@ -1,7 +1,8 @@ #!/bin/bash -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +EAPI=7 source tests-common.sh inherit scons-utils diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 23ac568c4a5..f78ecc4ebaa 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -1,7 +1,8 @@ #!/bin/bash -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +EAPI=7 source tests-common.sh inherit toolchain-funcs
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: b13d8ea802f395645a7364088a1a74738e7aecda Author: Mike Gilbert gentoo org> AuthorDate: Wed May 12 20:12:03 2021 + Commit: Mike Gilbert gentoo org> CommitDate: Wed May 12 20:54:56 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b13d8ea8 eclass/tests: eat optional arguments passed to has_version portageq has_version does not understand arguments like -b or --host-root. This fixes tests for autotools.eclass. Signed-off-by: Mike Gilbert gentoo.org> eclass/tests/tests-common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh index 2fc849cb69a..a677842b6ac 100644 --- a/eclass/tests/tests-common.sh +++ b/eclass/tests/tests-common.sh @@ -61,6 +61,9 @@ die() { } has_version() { + while [[ $1 == -* ]]; do + shift + done portageq has_version / "$@" }
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 66cf9baaae38c512f6cfe7166610cb47a9944016 Author: Michał Górny gentoo org> AuthorDate: Wed May 12 19:38:26 2021 + Commit: Michał Górny gentoo org> CommitDate: Wed May 12 19:39:03 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66cf9baa eclass/tests: Add EAPI decls to fix running tests Signed-off-by: Michał Górny gentoo.org> eclass/tests/autotools_eaclocal_amflags.sh | 4 +++- eclass/tests/flag-o-matic.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eclass/tests/autotools_eaclocal_amflags.sh b/eclass/tests/autotools_eaclocal_amflags.sh index b39f5420c31..f9f02bb7789 100755 --- a/eclass/tests/autotools_eaclocal_amflags.sh +++ b/eclass/tests/autotools_eaclocal_amflags.sh @@ -1,9 +1,11 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 source tests-common.sh +EAPI=7 + inherit autotools test-it() { diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh index 676cc690c75..dc8cfd375c1 100755 --- a/eclass/tests/flag-o-matic.sh +++ b/eclass/tests/flag-o-matic.sh @@ -1,9 +1,11 @@ #!/bin/bash -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 source tests-common.sh +EAPI=7 + inherit flag-o-matic CFLAGS="-a -b -c=1 --param l1-cache-size=32"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 582746d036443f3965028d564e05fd12ca4f10cf Author: Michał Górny gentoo org> AuthorDate: Wed May 5 18:00:53 2021 + Commit: Michał Górny gentoo org> CommitDate: Wed May 5 18:01:08 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=582746d0 eclass/tests/python-utils-r1.sh: Cover py3.10 Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 14 ++ 1 file changed, 14 insertions(+) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index eb8223ec6ac..85a6a53654d 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -129,6 +129,20 @@ 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 + test_var EPYTHON pypy3 pypy3 test_var PYTHON pypy3 /usr/bin/pypy3 if [[ -x /usr/bin/pypy3 ]]; then
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: e7474dec0dcc7c6dd20f4e0feaeda380f4bacd47 Author: Michał Górny gentoo org> AuthorDate: Sun Mar 28 11:48:13 2021 + Commit: Michał Górny gentoo org> CommitDate: Sun Mar 28 11:48:41 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7474dec eclass/tests: Update distutils-r1 expected values Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh| 4 ++-- eclass/tests/distutils-r1_single.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 93496f9ac00..163a509b306 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -108,7 +108,7 @@ test-distutils_enable_tests pytest \ test-distutils_enable_tests nose \ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( >=dev-python/nose-1.3.7-r4[${PYTHON_USEDEP}] )" test-distutils_enable_tests unittest \ - "${BASE_IUSE}" "" "${BASE_DEPS}" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/unittest-or-fail[${PYTHON_USEDEP}] )" test-distutils_enable_tests setup.py \ "${BASE_IUSE}" "" "${BASE_DEPS}" eoutdent @@ -122,7 +122,7 @@ test-distutils_enable_tests pytest \ test-distutils_enable_tests nose \ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} >=dev-python/nose-1.3.7-r4[${PYTHON_USEDEP}] )" test-distutils_enable_tests unittest \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} dev-python/unittest-or-fail[${PYTHON_USEDEP}] )" test-distutils_enable_tests setup.py \ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )" eoutdent diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh index 80c152b6ee0..fb177261d0a 100755 --- a/eclass/tests/distutils-r1_single.sh +++ b/eclass/tests/distutils-r1_single.sh @@ -88,7 +88,7 @@ test-distutils_enable_tests pytest \ test-distutils_enable_tests nose \ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( python_single_target_python3_8? ( >=dev-python/nose-1.3.7-r4[python_targets_python3_8(-)] ) )" test-distutils_enable_tests unittest \ - "${BASE_IUSE}" "" "${BASE_DEPS}" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( python_single_target_python3_8? ( dev-python/unittest-or-fail[python_targets_python3_8(-)] ) )" test-distutils_enable_tests setup.py \ "${BASE_IUSE}" "" "${BASE_DEPS}" eoutdent @@ -102,7 +102,7 @@ test-distutils_enable_tests pytest \ test-distutils_enable_tests nose \ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} python_single_target_python3_8? ( >=dev-python/nose-1.3.7-r4[python_targets_python3_8(-)] ) )" test-distutils_enable_tests unittest \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} python_single_target_python3_8? ( dev-python/unittest-or-fail[python_targets_python3_8(-)] ) )" test-distutils_enable_tests setup.py \ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )" eoutdent
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 10da6fd3ccd3ba547cb855371b670db909cb165c Author: Michał Górny gentoo org> AuthorDate: Thu Dec 31 11:18:04 2020 + Commit: Michał Górny gentoo org> CommitDate: Fri Jan 15 17:05:53 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10da6fd3 python-utils-r1.eclass: Inline _python_impl_supported() The _python_impl_supported() function is not used anymore in its original function. It is called only once, in order to die on incorrect targets in PYTHON_COMPAT. Let's inline the corresponding logic in _python_set_impls() and remove the function. While at it, add an extra check for outdated patterns. This also renders the relevant tests obsolete. Signed-off-by: Michał Górny gentoo.org> eclass/python-utils-r1.eclass | 56 +++-- eclass/tests/python-utils-r1.sh | 18 - 2 files changed, 20 insertions(+), 54 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 9c8b6a14d2a..2aa953213b6 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -69,38 +69,6 @@ readonly _PYTHON_HISTORICAL_IMPLS # which can involve revisions of this eclass that support a different # set of Python implementations. -# @FUNCTION: _python_impl_supported -# @USAGE: -# @INTERNAL -# @DESCRIPTION: -# Check whether the implementation (PYTHON_COMPAT-form) -# is still supported. -# -# Returns 0 if the implementation is valid and supported. If it is -# unsupported, returns 1 -- and the caller should ignore the entry. -# If it is invalid, dies with an appopriate error messages. -_python_impl_supported() { - debug-print-function ${FUNCNAME} "${@}" - - [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl)." - - local impl=${1} - - # keep in sync with _PYTHON_ALL_IMPLS! - # (not using that list because inline patterns shall be faster) - case "${impl}" in - python2_7|python3_[6789]|pypy3) - return 0 - ;; - jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345]) - return 1 - ;; - *) - [[ ${PYTHON_COMPAT_NO_STRICT} ]] && return 1 - die "Invalid implementation in PYTHON_COMPAT: ${impl}" - esac -} - # @FUNCTION: _python_verify_patterns # @USAGE: ... # @INTERNAL @@ -149,10 +117,26 @@ _python_set_impls() { if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then die 'PYTHON_COMPAT must be an array.' fi - for i in "${PYTHON_COMPAT[@]}"; do - # trigger validity checks - _python_impl_supported "${i}" - done + if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then + for i in "${PYTHON_COMPAT[@]}"; do + # check for incorrect implementations + # we're using pattern matching as an optimization + # please keep them in sync with _PYTHON_ALL_IMPLS + # and _PYTHON_HISTORICAL_IMPLS + case ${i} in + jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]) + ;; + *) + if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \ + "${_PYTHON_HISTORICAL_IMPLS[@]}" + then + die "Mis-synced patterns in _python_set_impls: missing ${i}" + else + die "Invalid implementation in PYTHON_COMPAT: ${i}" + fi + esac + done + fi local supp=() unsupp=() diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 86b87ec173d..eb8223ec6ac 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -183,24 +183,6 @@ test_fix_shebang '#!/usr/bin/foo' python2.7 FAIL # regression test for bug #522080 test_fix_shebang '#!/usr/bin/python ' python2.7 '#!/usr/bin/python2.7 ' -# make sure we don't break pattern matching -test_is "_python_impl_supported python2_5" 1 -test_is "_python_impl_supported python2_6" 1 -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" 1 -test_is "_python_impl_supported python3_5" 1 -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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: f8ed334c4a1f2a9802f898663b3facac5ec15e01 Author: Sergei Trofimovich gentoo org> AuthorDate: Tue Jan 5 22:40:59 2021 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Jan 5 23:01:37 2021 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8ed334c toolchain-funcs.eclass: fix or1k* tuple detection Before the change the only recognised CHOST was 'or1k'. After the change CHOSTs like 'or1k-linux-musl' are also recognised as 'openrisc'. Reported-by: adam pimentel.space Bug: https://bugs.gentoo.org/763606 Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/toolchain-funcs.sh | 3 ++- eclass/toolchain-funcs.eclass | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index a0a56fd9e5d..23ac568c4a5 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -27,7 +27,8 @@ test-tc-arch-kernel() { tbegin "tc-arch-kernel() (KV=2.6.30)" test-tc-arch-kernel 2.6.30 \ i{3..6}86:x86 x86_64:x86 \ - powerpc{,64}:powerpc i{3..6}86-gentoo-freebsd:i386 + powerpc{,64}:powerpc i{3..6}86-gentoo-freebsd:i386 \ + or1k:openrisc or1k-linux-musl:openrisc tend $? # diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index ec7b920bcfa..4a4bb27fc08 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -665,7 +665,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } mips*) echo mips;; nios2*) echo nios2;; nios*) echo nios;; - or1k|or32*) echo openrisc;; + or1k*|or32*)echo openrisc;; powerpc*) # Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees # have been unified into simply 'powerpc', but until 2.6.16,
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 754aa946555ccc3f6657922d91a1d2c34b419053 Author: Ulrich Müller gentoo org> AuthorDate: Tue Nov 17 20:13:14 2020 + Commit: Ulrich Müller gentoo org> CommitDate: Mon Nov 23 18:01:12 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=754aa946 eclass/tests: Initial test cases for eapi8-dosym.eclass. Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/eapi8-dosym.sh | 78 + 1 file changed, 78 insertions(+) diff --git a/eclass/tests/eapi8-dosym.sh b/eclass/tests/eapi8-dosym.sh new file mode 100755 index 000..e1160c42d87 --- /dev/null +++ b/eclass/tests/eapi8-dosym.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +source tests-common.sh + +inherit eapi8-dosym + +dosym() { + echo "$1" +} + +# reference implementation using GNU realpath +ref_canonicalize() { + realpath -m -s "$1" +} + +ref_dosym_r() { + local link=$(realpath -m -s "/${2#/}") + realpath -m -s --relative-to="$(dirname "${link}")" "$1" +} + +randompath() { + dd if=/dev/urandom bs=128 count=1 2>/dev/null | LC_ALL=C sed \ + -e 's/[^a-zA-M]//g;s/[A-E]/\/.\//g;s/[F-J]/\/..\//g;s/[K-M]/\//g' \ + -e 's/^/\//;q' +} + +teq() { + local expected=$1; shift + tbegin "$* -> ${expected}" + local got=$("$@") + [[ ${got} == "${expected}" ]] + tend $? "returned: ${got}" +} + +for f in ref_canonicalize "_dosym8_canonicalize"; do + # canonicalize absolute paths + teq / ${f} / + teq /foo/baz/quux ${f} /foo/bar/../baz/quux + teq /foo ${f} /../../../foo + teq /bar ${f} /foo//./..///bar + teq /baz ${f} /foo/bar/../../../baz + teq /a/d/f/g ${f} /a/b/c/../../d/e/../f/g +done + +# canonicalize relative paths (not actually used) +teq . _dosym8_canonicalize . +teq foo _dosym8_canonicalize foo +teq foo _dosym8_canonicalize ./foo +teq ../foo _dosym8_canonicalize ../foo +teq ../baz _dosym8_canonicalize foo/bar/../../../baz + +for f in ref_dosym_r "dosym8 -r"; do + teq ../../bin/foo ${f} /bin/foo /usr/bin/foo + teq ../../../doc/foo-1 \ + ${f} /usr/share/doc/foo-1 /usr/share/texmf-site/doc/fonts/foo + teq ../../opt/bar/foo ${f} /opt/bar/foo /usr/bin/foo + teq ../c/d/e ${f} /a/b/c/d/e a/b/f/g + teq b/f ${f} /a/b///./c/d/../e/..//../f /a/./.g/../h + teq ../h ${f} /a/./.g/../h /a/b///./c/d/../e/..//../f + teq . ${f} /foo /foo/bar + teq .. ${f} /foo /foo/bar/baz + teq '../../fo . o/b ar' ${f} '/fo . o/b ar' '/baz / qu .. ux/qu x' + teq '../../f"o\o/b$a[]r' ${f} '/f"o\o/b$a[]r' '/ba\z/qu$u"x/qux' +done + +# set RANDOMTESTS to a positive number to enable random tests +for (( i = 0; i < RANDOMTESTS; i++ )); do + targ=$(randompath) + link=$(randompath) + out=$(ref_dosym_r "${targ}" "${link}") + teq "${out}" dosym8 -r "${targ}" "${link}" +done + +texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2917508e1ac399d73e4714468ee95a3a28cb979f Author: Michał Górny gentoo org> AuthorDate: Thu Jul 2 08:09:02 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu Jul 2 08:29:18 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2917508e eclass/tests/distutils-r1*.sh: Cover DISTUTILS_USE_SETUPTOOLS Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh| 43 - eclass/tests/distutils-r1_single.sh | 41 +++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 237fc1eebae..93496f9ac00 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -35,7 +35,38 @@ test-distutils_enable_tests() { for var in IUSE RESTRICT BDEPEND; do local exp_var=exp_${var} # (this normalizes whitespace) - read -a val <<<"${!var}" + read -d $'\0' -r -a val <<<"${!var}" + val=${val[*]} + if [[ ${val} != "${!exp_var}" ]]; then + eindent + eerror "${var} expected: ${!exp_var}" + eerror "${var} actual: ${val}" + eoutdent + ret=1 + tret=1 + fi + done + + tend ${ret} +} + +test-DISTUTILS_USE_SETUPTOOLS() { + local DISTUTILS_USE_SETUPTOOLS=${1} + local exp_BDEPEND=${2} + local exp_RDEPEND=${3} + + tbegin "${1}" + + local BDEPEND= + local RDEPEND= + unset _DISTUTILS_R1 + inherit distutils-r1 + + local ret var val + for var in BDEPEND RDEPEND; do + local exp_var=exp_${var} + # (this normalizes whitespace) + read -d $'\0' -r -a val <<<"${!var}" val=${val[*]} if [[ ${val} != "${!exp_var}" ]]; then eindent @@ -98,4 +129,14 @@ eoutdent eoutdent +einfo DISTUTILS_USE_SETUPTOOLS +eindent +SETUPTOOLS_DEP=">=dev-python/setuptools-42.0.2[python_targets_python3_8(-)?,-python_single_target_python3_8(-)]" +test-DISTUTILS_USE_SETUPTOOLS no "${BASE_DEPS}" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS bdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS rdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS} ${SETUPTOOLS_DEP}" +test-DISTUTILS_USE_SETUPTOOLS pyproject.toml "${BASE_DEPS} dev-python/pyproject2setuppy[python_targets_python3_8(-)?,-python_single_target_python3_8(-)]" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS manual "${BASE_DEPS}" "${BASE_DEPS}" +eoutdent + texit diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh index 6c79e36881b..80c152b6ee0 100755 --- a/eclass/tests/distutils-r1_single.sh +++ b/eclass/tests/distutils-r1_single.sh @@ -39,6 +39,37 @@ test-distutils_enable_tests() { tend ${ret} } +test-DISTUTILS_USE_SETUPTOOLS() { + local DISTUTILS_USE_SETUPTOOLS=${1} + local exp_BDEPEND=${2} + local exp_RDEPEND=${3} + + tbegin "${1}" + + local BDEPEND= + local RDEPEND= + unset _DISTUTILS_R1 + inherit distutils-r1 + + local ret var val + for var in BDEPEND RDEPEND; do + local exp_var=exp_${var} + # (this normalizes whitespace) + read -d $'\0' -r -a val <<<"${!var}" + val=${val[*]} + if [[ ${val} != "${!exp_var}" ]]; then + eindent + eerror "${var} expected: ${!exp_var}" + eerror "${var} actual: ${val}" + eoutdent + ret=1 + tret=1 + fi + done + + tend ${ret} +} + DISTUTILS_USE_SETUPTOOLS=no DISTUTILS_SINGLE_IMPL=1 inherit distutils-r1 @@ -78,4 +109,14 @@ eoutdent eoutdent +einfo DISTUTILS_USE_SETUPTOOLS +eindent +SETUPTOOLS_DEP="python_single_target_python3_8? ( >=dev-python/setuptools-42.0.2[python_targets_python3_8(-)] )" +test-DISTUTILS_USE_SETUPTOOLS no "${BASE_DEPS}" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS bdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS rdepend "${BASE_DEPS} ${SETUPTOOLS_DEP}" "${BASE_DEPS} ${SETUPTOOLS_DEP}" +test-DISTUTILS_USE_SETUPTOOLS pyproject.toml "${BASE_DEPS} python_single_target_python3_8? ( dev-python/pyproject2setuppy[python_targets_python3_8(-)] )" "${BASE_DEPS}" +test-DISTUTILS_USE_SETUPTOOLS manual "${BASE_DEPS}" "${BASE_DEPS}" +eoutdent + texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 16c2e7ec5b7b6da9dd8f23d3fe86bbe8b32be3f8 Author: Michał Górny gentoo org> AuthorDate: Thu Jul 2 06:29:07 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu Jul 2 08:29:14 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16c2e7ec eclass/tests/distutils-r1.sh: update for EAPI=7 / py3.8 Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 4c8e37b2617..b511e19d9e7 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -1,9 +1,9 @@ #!/bin/bash -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=5 -PYTHON_COMPAT=( python2_7 ) +EAPI=7 +PYTHON_COMPAT=( python3_8 ) source tests-common.sh test-phase_name_free() { @@ -21,18 +21,18 @@ test-distutils_enable_tests() { local runner=${1} local exp_IUSE=${2} local exp_RESTRICT=${3} - local exp_DEPEND=${4} + local exp_BDEPEND=${4} local IUSE=${IUSE} local RESTRICT=${RESTRICT} - local DEPEND=${DEPEND} + local BDEPEND=${BDEPEND} tbegin "${runner}" distutils_enable_tests "${runner}" local ret var - for var in IUSE RESTRICT DEPEND; do + for var in IUSE RESTRICT BDEPEND; do local exp_var=exp_${var} if [[ ${!var} != "${!exp_var}" ]]; then eindent @@ -62,8 +62,8 @@ 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_IUSE="python_targets_python3_8" +BASE_DEPS="python_targets_python3_8? ( dev-lang/python:3.8 ) >=dev-lang/python-exec-2:=[python_targets_python3_8(-)?,-python_single_target_python3_8(-)]" TEST_RESTRICT=" !test? ( test )" einfo "empty RDEPEND"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: edbad14a5a79e4972092707475ee3cf00e3b07ca Author: Michał Górny gentoo org> AuthorDate: Thu Jul 2 07:28:04 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu Jul 2 08:29:16 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=edbad14a eclass/tests/distutils-r1:single.sh: Tests for d-r1 single impl mode Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1_single.sh | 81 + 1 file changed, 81 insertions(+) diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh new file mode 100755 index 000..6c79e36881b --- /dev/null +++ b/eclass/tests/distutils-r1_single.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python3_8 ) +source tests-common.sh + +test-distutils_enable_tests() { + local runner=${1} + local exp_IUSE=${2} + local exp_RESTRICT=${3} + local exp_BDEPEND=${4} + + local IUSE=${IUSE} + local RESTRICT=${RESTRICT} + local BDEPEND=${BDEPEND} + + tbegin "${runner}" + + distutils_enable_tests "${runner}" + + local ret var + for var in IUSE RESTRICT BDEPEND; do + local exp_var=exp_${var} + # (this normalizes whitespace) + read -d $'\0' -r -a val <<<"${!var}" + val=${val[*]} + if [[ ${val} != "${!exp_var}" ]]; then + eindent + eerror "${var} expected: ${!exp_var}" + eerror "${var} actual: ${val}" + eoutdent + ret=1 + tret=1 + fi + done + + tend ${ret} +} + +DISTUTILS_USE_SETUPTOOLS=no +DISTUTILS_SINGLE_IMPL=1 +inherit distutils-r1 + +einfo distutils_enable_tests +eindent +BASE_IUSE="+python_single_target_python3_8" +BASE_DEPS="python_single_target_python3_8? ( dev-lang/python:3.8 >=dev-lang/python-exec-2:=[python_targets_python3_8] )" +TEST_RESTRICT="!test? ( test )" + +einfo "empty RDEPEND" +eindent +RDEPEND="" +test-distutils_enable_tests pytest \ + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( python_single_target_python3_8? ( >=dev-python/pytest-4.5.0[python_targets_python3_8(-)] ) )" +test-distutils_enable_tests nose \ + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( python_single_target_python3_8? ( >=dev-python/nose-1.3.7-r4[python_targets_python3_8(-)] ) )" +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_SINGLE_USEDEP}]" +RDEPEND=${BASE_RDEPEND} +test-distutils_enable_tests pytest \ + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} python_single_target_python3_8? ( >=dev-python/pytest-4.5.0[python_targets_python3_8(-)] ) )" +test-distutils_enable_tests nose \ + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} python_single_target_python3_8? ( >=dev-python/nose-1.3.7-r4[python_targets_python3_8(-)] ) )" +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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: f60282d584bf9456f4a2ec2a1ebdf87f33b82ea2 Author: Michał Górny gentoo org> AuthorDate: Thu Jul 2 07:08:33 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu Jul 2 08:29:15 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f60282d5 eclass/tests/distutils-r1.sh: Normalize whitespace Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index b511e19d9e7..237fc1eebae 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -31,13 +31,16 @@ test-distutils_enable_tests() { distutils_enable_tests "${runner}" - local ret var + local ret var val for var in IUSE RESTRICT BDEPEND; do local exp_var=exp_${var} - if [[ ${!var} != "${!exp_var}" ]]; then + # (this normalizes whitespace) + read -a val <<<"${!var}" + val=${val[*]} + if [[ ${val} != "${!exp_var}" ]]; then eindent eerror "${var} expected: ${!exp_var}" - eerror "${var} actual: ${!var}" + eerror "${var} actual: ${val}" eoutdent ret=1 tret=1 @@ -64,15 +67,15 @@ einfo distutils_enable_tests eindent BASE_IUSE="python_targets_python3_8" BASE_DEPS="python_targets_python3_8? ( dev-lang/python:3.8 ) >=dev-lang/python-exec-2:=[python_targets_python3_8(-)?,-python_single_target_python3_8(-)]" -TEST_RESTRICT=" !test? ( test )" +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-4.5.0[${PYTHON_USEDEP}] )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( >=dev-python/pytest-4.5.0[${PYTHON_USEDEP}] )" test-distutils_enable_tests nose \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( >=dev-python/nose-1.3.7-r4[${PYTHON_USEDEP}] )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( >=dev-python/nose-1.3.7-r4[${PYTHON_USEDEP}] )" test-distutils_enable_tests unittest \ "${BASE_IUSE}" "" "${BASE_DEPS}" test-distutils_enable_tests setup.py \
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: ded0ce319d6cb29d2eb7568fec55c7db7a601371 Author: Michał Górny gentoo org> AuthorDate: Fri Jun 19 11:52:06 2020 + Commit: Michał Górny gentoo org> CommitDate: Fri Jun 19 11:52:06 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ded0ce31 eclass/tests/distutils-r1.sh: update dep values Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 9ef4562edf1..4c8e37b2617 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -70,9 +70,9 @@ einfo "empty RDEPEND" eindent RDEPEND="" test-distutils_enable_tests pytest \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( >=dev-python/pytest-4.5.0[${PYTHON_USEDEP}] )" test-distutils_enable_tests nose \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( >=dev-python/nose-1.3.7-r4[${PYTHON_USEDEP}] )" test-distutils_enable_tests unittest \ "${BASE_IUSE}" "" "${BASE_DEPS}" test-distutils_enable_tests setup.py \ @@ -84,9 +84,9 @@ eindent BASE_RDEPEND="dev-python/foo[${PYTHON_USEDEP}]" RDEPEND=${BASE_RDEPEND} test-distutils_enable_tests pytest \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} dev-python/pytest[${PYTHON_USEDEP}] )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} >=dev-python/pytest-4.5.0[${PYTHON_USEDEP}] )" test-distutils_enable_tests nose \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} dev-python/nose[${PYTHON_USEDEP}] )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} >=dev-python/nose-1.3.7-r4[${PYTHON_USEDEP}] )" test-distutils_enable_tests unittest \ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )" test-distutils_enable_tests setup.py \
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: dba4f2113f6cfa539246acdad25459a479d7f434 Author: Michał Górny gentoo org> AuthorDate: Tue May 26 07:25:56 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu May 28 11:41:20 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dba4f211 llvm.eclass: Add initial tests Signed-off-by: Michał Górny gentoo.org> eclass/tests/llvm.sh | 138 +++ 1 file changed, 138 insertions(+) diff --git a/eclass/tests/llvm.sh b/eclass/tests/llvm.sh new file mode 100755 index 000..bb8d5fc998e --- /dev/null +++ b/eclass/tests/llvm.sh @@ -0,0 +1,138 @@ +#!/bin/bash +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +source tests-common.sh + +inherit llvm + +# llvm_check_deps override to disable has_version use. +# in: ${LLVM_SLOT} +# returns 0 if installed (i.e. == LLVM_INSTALLED_SLOT), 1 otherwise +llvm_check_deps() { + [[ ${LLVM_SLOT} == ${LLVM_INSTALLED_SLOT} ]] +} + +# check_prefix [...] +# Check output of `get_llvm_prefix ...`. +check_prefix() { + local expected=${1} + shift + + tbegin "get_llvm_prefix ${*}; inst=${LLVM_INSTALLED_SLOT} -> ${expected}" + prefix=$(get_llvm_prefix "${@}") + [[ ${prefix} == ${expected} ]] || + eerror "got: ${prefix} != exp: ${expected}" + tend ${?} +} + +# check_setup_path +# Check PATH after pkg_setup. +check_setup_path() { + local expected=${1} + shift + + tbegin "pkg_setup; max=${LLVM_MAX_SLOT}; inst=${LLVM_INSTALLED_SLOT} -> PATH=${expected}" + path=$(llvm_pkg_setup; echo "${PATH}") + [[ ${path} == ${expected} ]] || + eerror "got: ${path} != exp: ${expected}" + tend ${?} +} + + +EAPI=7 +BROOT=/broot +SYSROOT=/sysroot +ESYSROOT=/sysroot/eprefix +ROOT=/root +EROOT=/root/eprefix + +ebegin "Testing check_setup_path without max slot" +eindent + LLVM_INSTALLED_SLOT=11 \ + check_prefix /sysroot/eprefix/usr/lib/llvm/11 + LLVM_INSTALLED_SLOT=10 \ + check_prefix /sysroot/eprefix/usr/lib/llvm/10 +eoutdent + +ebegin "Testing check_setup_path with max slot" +eindent + LLVM_INSTALLED_SLOT=1* \ + check_prefix /sysroot/eprefix/usr/lib/llvm/11 11 + LLVM_INSTALLED_SLOT=1* \ + check_prefix /sysroot/eprefix/usr/lib/llvm/10 10 + LLVM_INSTALLED_SLOT=10 \ + check_prefix /sysroot/eprefix/usr/lib/llvm/10 11 +eoutdent + +ebegin "Testing check_setup_path option switches" +eindent + LLVM_INSTALLED_SLOT=11 \ + check_prefix /broot/usr/lib/llvm/11 -b + LLVM_INSTALLED_SLOT=11 \ + check_prefix /sysroot/eprefix/usr/lib/llvm/11 -d +eoutdent + +ebegin "Testing check_setup_path EAPI 6 API" +eindent + EAPI=6 \ + LLVM_INSTALLED_SLOT=11 \ + check_prefix /usr/lib/llvm/11 -d +eoutdent + +BASEPATH=/usr/lib/ccache/bin:/usr/bin:/usr/sbin:/bin:/sbin + +# TODO: cross support? +ESYSROOT= + +ebegin "Testing pkg_setup with all installed LLVM versions in PATH" +eindent + LLVM_MAX_SLOT=11 \ + LLVM_INSTALLED_SLOT=1* \ + PATH=${BASEPATH}:/usr/lib/llvm/11/bin \ + check_setup_path "/usr/lib/llvm/11/bin:${BASEPATH}:/usr/lib/llvm/11/bin" + + LLVM_MAX_SLOT=10 \ + LLVM_INSTALLED_SLOT=1* \ + PATH=${BASEPATH}:/usr/lib/llvm/11/bin:/usr/lib/llvm/10/bin \ + check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}:/usr/lib/llvm/11/bin:/usr/lib/llvm/10/bin" + + LLVM_MAX_SLOT=11 \ + LLVM_INSTALLED_SLOT=10 \ + PATH=${BASEPATH}:/usr/lib/llvm/10/bin \ + check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}:/usr/lib/llvm/10/bin" +eoutdent + +ebegin "Testing pkg_setup with the other LLVM version in PATH" +eindent + LLVM_MAX_SLOT=11 \ + LLVM_INSTALLED_SLOT=1* \ + PATH=${BASEPATH}:/usr/lib/llvm/10/bin \ + check_setup_path "/usr/lib/llvm/11/bin:${BASEPATH}:/usr/lib/llvm/10/bin" + + LLVM_MAX_SLOT=10 \ + LLVM_INSTALLED_SLOT=1* \ + PATH=${BASEPATH}:/usr/lib/llvm/11/bin \ + check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}:/usr/lib/llvm/11/bin" +eoutdent + +ebegin "Testing pkg_setup with LLVM missing from PATH" +eindent + LLVM_MAX_SLOT=11 \ + LLVM_INSTALLED_SLOT=1* \ + PATH=${BASEPATH} \ + check_setup_path "/usr/lib/llvm/11/bin:${BASEPATH}" + + LLVM_MAX_SLOT=10 \ + LLVM_INSTALLED_SLOT=1* \ + PATH=${BASEPATH} \ + check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}" + + LLVM_MAX_SLOT=11 \ + LLVM_INSTALLED_SLOT=10 \ + PATH=${BASEPATH} \ + check_setup_path "/usr/lib/llvm/10/bin:${BASEPATH}" +eoutdent + +texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: e563ed3af0dad1d3eaa165f5eb89b6f7ed0a1c9c Author: Michał Górny gentoo org> AuthorDate: Mon May 25 06:04:34 2020 + Commit: Michał Górny gentoo org> CommitDate: Mon May 25 06:07:18 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e563ed3a python-utils-r1.eclass: Enable python3_9 Signed-off-by: Michał Górny gentoo.org> eclass/python-utils-r1.eclass | 4 ++-- eclass/tests/python-utils-r1.sh | 16 +++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 4af710da363..1067d2367ab 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -41,7 +41,7 @@ inherit toolchain-funcs _PYTHON_ALL_IMPLS=( pypy3 python2_7 - python3_6 python3_7 python3_8 + python3_6 python3_7 python3_8 python3_9 ) readonly _PYTHON_ALL_IMPLS @@ -77,7 +77,7 @@ _python_impl_supported() { # keep in sync with _PYTHON_ALL_IMPLS! # (not using that list because inline patterns shall be faster) case "${impl}" in - python2_7|python3_[678]|pypy3) + python2_7|python3_[6789]|pypy3) return 0 ;; jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345]) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 192c1183e80..86b87ec173d 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 @@ -115,6 +115,20 @@ 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 pypy3 pypy3 test_var PYTHON pypy3 /usr/bin/pypy3 if [[ -x /usr/bin/pypy3 ]]; then
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: e0f8418663dff3c4e51899b8ccb172363478591a Author: Sergei Trofimovich gentoo org> AuthorDate: Sun May 10 01:02:07 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun May 10 01:02:07 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e0f84186 eclass/tests/toolchain.sh: add znver2 downgrade test Bug: https://bugs.gentoo.org/721690 Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/toolchain.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 1d05f6c126b..e69e0c8f1dd 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -83,6 +83,7 @@ test_downgrade_arch_flags 3.3 "-march=k6-2" "-march=geode -mtune=barcelona test_downgrade_arch_flags 3.4 "-march=k8" "-march=btver2 -mtune=generic" test_downgrade_arch_flags 10 "-march=native" "-march=native" +test_downgrade_arch_flags 8 "-march=znver1" "-march=znver2" test_downgrade_arch_flags 4.2 "-march=native" "-march=native" test_downgrade_arch_flags 4.1 "-march=nocona" "-march=native"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: a80411e43523cf60fb40120045a66d331eba7f2d Author: Michał Górny gentoo org> AuthorDate: Thu Apr 30 09:40:00 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu Apr 30 09:45:22 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a80411e4 eclass/tests/distutils-r1.sh: Revert "Update Python versions" Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 10f57b59edf..9ef4562edf1 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.17-r1: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.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"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 73c127b0891aae921d60478fe377bf6c4ee50f13 Author: Michał Górny gentoo org> AuthorDate: Thu Feb 27 18:00:10 2020 + Commit: Michał Górny gentoo org> CommitDate: Sun Apr 19 16:47:08 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73c127b0 eclass/tests/python-utils-r1.sh: Add tests for py3.8 Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 14 ++ 1 file changed, 14 insertions(+) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 377bb474a3a..192c1183e80 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -101,6 +101,20 @@ 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 pypy3 pypy3 test_var PYTHON pypy3 /usr/bin/pypy3 if [[ -x /usr/bin/pypy3 ]]; then
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 38b8184d18a7c43559f6578e9974703350cc3ed1 Author: Michał Górny gentoo org> AuthorDate: Mon Mar 30 13:10:11 2020 + Commit: Michał Górny gentoo org> CommitDate: Mon Mar 30 13:11:06 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38b8184d eclass/tests/python-utils-r1.sh: Remove tests for jython & pypy Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 31 --- 1 file changed, 31 deletions(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 2ce425be15e..377bb474a3a 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 9e1d480c2fdd9906aaa4bfe6e20be8ceb0c9af7c Author: Michał Górny gentoo org> AuthorDate: Mon Mar 30 11:56:34 2020 + Commit: Michał Górny gentoo org> CommitDate: Mon Mar 30 11:57:33 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e1d480c eclass/tests/distutils-r1.sh: Update Python versions Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index 9ef4562edf1..10f57b59edf 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"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 1a687fd280c3d33cbf7ef99cd6f96fda95039c75 Author: Sergei Trofimovich gentoo org> AuthorDate: Sat Mar 28 19:53:49 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sat Mar 28 19:54:47 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a687fd2 eclass/multilib.eclass: update copyright and fix typos Reported-by: Mike Gilbert Signed-off-by: Sergei Trofimovich gentoo.org> eclass/multilib.eclass | 2 +- eclass/tests/multilib.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass index 8b4a7dacaa3..bbaab709b4f 100644 --- a/eclass/multilib.eclass +++ b/eclass/multilib.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: multilib.eclass diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh index 68c0dd6e142..a483d4bef36 100755 --- a/eclass/tests/multilib.sh +++ b/eclass/tests/multilib.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2020 Gentoo Foundation +# Copyright 2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 source tests-common.sh @@ -46,7 +46,7 @@ test-multilib_env() { fi } -# Pick a few interesting gargets from: +# Pick a few interesting targets from: # $ grep -h -o -R 'CHOST=.*' ../../profiles/ | sort -u test-multilib_env \
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: ba0d4bc94f655ff82d69276d79f9d85e8e8e01eb Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Mar 27 23:42:03 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Mar 27 23:54:40 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba0d4bc9 eclass/tests: add basic tests for multilib_env() expansion Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/multilib.sh | 61 1 file changed, 61 insertions(+) diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh new file mode 100755 index 000..308c456b98d --- /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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: a5003d48705fa9b501022d4e6326c8f516a2eec0 Author: Sergei Trofimovich gentoo org> AuthorDate: Thu Mar 26 07:49:07 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Thu Mar 26 07:50:41 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5003d48 flag-o-matic.eclass: revert "don't use -Werror in test-flag-PROG(), bug #712488" This reverts commit ab8fe14ae2e9110faa85ca1c4528b470c0be1535. Triggers build failures on sys-libs/compiler-rt-sanitizers. Reported-by: Craig Andrews Bug: https://bugs.gentoo.org/714742 Bug: https://bugs.gentoo.org/712488 Signed-off-by: Sergei Trofimovich gentoo.org> eclass/flag-o-matic.eclass | 19 +++ eclass/tests/flag-o-matic.sh | 10 -- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index d8111fb9e38..9ef9ac3685e 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -487,15 +487,11 @@ test-flag-PROG() { printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'" - # Don't set -Werror as there are cases when benign - # always-on warnings filter out all flags like bug #712488. - # We'll have to live with potential '-Wunused-command-line-argument'. - # flags. - # - # We can add more selective detection of no-op flags via - # '-Werror=ignored-optimization-argument' and similar error options. local cmdline=( "${comp[@]}" + # Clang will warn about unknown gcc flags but exit 0. + # Need -Werror to force it to exit non-zero. + -Werror "$@" # -x options need to go before first source file "${cmdline_extra[@]}" @@ -503,7 +499,14 @@ test-flag-PROG() { "${test_in}" -o "${test_out}" ) - "${cmdline[@]}" &>/dev/null + if ! "${cmdline[@]}" &>/dev/null; then + # -Werror makes clang bail out on unused arguments as well; + # try to add -Qunused-arguments to work-around that + # other compilers don't support it but then, it's failure like + # any other + cmdline+=( -Qunused-arguments ) + "${cmdline[@]}" &>/dev/null + fi } # @FUNCTION: test-flag-CC diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh index 6dfacb04c07..229dff52af9 100755 --- a/eclass/tests/flag-o-matic.sh +++ b/eclass/tests/flag-o-matic.sh @@ -161,12 +161,10 @@ out=$(CC=clang test-flags-CC -finvalid-flag) [[ $? -ne 0 && -z ${out} ]] ftend -### '-finline-limit=1200' is 'ignored' flag, not invalid. -### We don't filter out ignored flags currently, bug #712488 -#tbegin "test-flags-CC (gcc-valid but clang-invalid flags)" -#out=$(CC=clang test-flags-CC -finline-limit=1200) -#[[ $? -ne 0 && -z ${out} ]] -#ftend +tbegin "test-flags-CC (gcc-valid but clang-invalid flags)" +out=$(CC=clang test-flags-CC -finline-limit=1200) +[[ $? -ne 0 && -z ${out} ]] +ftend tbegin "test-flags-CC (unused flags w/clang)" out=$(CC=clang test-flags-CC -Wl,-O1)
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: cd46eb3f8d5cc1bdbcf3277efa32d918285fc27e Author: Michał Górny gentoo org> AuthorDate: Thu Feb 27 16:29:12 2020 + Commit: Michał Górny gentoo org> CommitDate: Thu Feb 27 16:29:12 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd46eb3f eclass/tests/python-utils-r1.sh: Cover PYTHON_{CFLAGS,LIBS} Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 6 ++ 1 file changed, 6 insertions(+) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 279324e163b..4367890a08a 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -67,6 +67,8 @@ if [[ -x /usr/bin/python2.7 ]]; then test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7 test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)" test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config + test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*" + test_var PYTHON_LIBS python2_7 "*-lpython2.7*" 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 @@ -79,6 +81,8 @@ if [[ -x /usr/bin/python3.6 ]]; then 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 @@ -91,6 +95,8 @@ if [[ -x /usr/bin/python3.7 ]]; then 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: d3c570fb9e6fc1b4e5ec131c73843f0ebe8dbd12 Author: Michał Górny gentoo org> AuthorDate: Sun Feb 9 18:09:36 2020 + Commit: Michał Górny gentoo org> CommitDate: Sun Feb 9 18:09:36 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d3c570fb eclass/tests/distutils-r1.sh: Update post eclass changes Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index d251f85a5eb..9ef4562edf1 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -70,9 +70,9 @@ einfo "empty RDEPEND" eindent RDEPEND="" test-distutils_enable_tests pytest \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] )" + "${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}] )" + "${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 \ @@ -84,13 +84,13 @@ 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} )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} dev-python/pytest[${PYTHON_USEDEP}] )" test-distutils_enable_tests nose \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] ${BASE_RDEPEND} )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} dev-python/nose[${PYTHON_USEDEP}] )" test-distutils_enable_tests unittest \ - "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )" + "${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} )" + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )" eoutdent eoutdent
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 12bfa1e4f9595dbbcbe0a442c6a63bc3ef890cc2 Author: Sergei Trofimovich gentoo org> AuthorDate: Sat Jan 11 23:11:13 2020 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sat Jan 11 23:53:08 2020 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=12bfa1e4 toolchain.eclass: fix arch downgrade for gcc-10 The bug is in lexical comparison instead of version compare. Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/toolchain.sh | 12 +++- eclass/toolchain.eclass | 17 + 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 56609aa180e..1d05f6c126b 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -12,6 +12,12 @@ source tests-common.sh inherit toolchain +# Ignore actually running version of gcc and fake new version +# to force downgrade test on all conditions below. +gcc-version() { + echo "99.99" +} + test_downgrade_arch_flags() { local exp msg ret=0 ver @@ -26,13 +32,14 @@ test_downgrade_arch_flags() { downgrade_arch_flags ${ver} if [[ ${CFLAGS} != ${exp} ]]; then - msg="Failure - Expected: \"${exp}\" Got: \"${CFLAGS}\"" + msg="Failure - Expected: \"${exp}\" Got: \"${CFLAGS}\" Ver: ${ver}" ret=1 fi tend ${ret} ${msg} } # ver expectedgiven +test_downgrade_arch_flags 10 "-march=haswell""-march=haswell" test_downgrade_arch_flags 4.9 "-march=haswell""-march=haswell" test_downgrade_arch_flags 4.8 "-march=core-avx2" "-march=haswell" test_downgrade_arch_flags 4.7 "-march=core-avx2" "-march=haswell" @@ -64,6 +71,7 @@ test_downgrade_arch_flags 3.3 "-march=c3" "-march=c3-2" test_downgrade_arch_flags 4.5 "-march=garbage""-march=garbage" +test_downgrade_arch_flags 10 "-mtune=intel" "-mtune=intel" test_downgrade_arch_flags 4.9 "-mtune=intel" "-mtune=intel" test_downgrade_arch_flags 4.8 "-mtune=generic""-mtune=intel" test_downgrade_arch_flags 3.4 "" "-mtune=generic" @@ -74,9 +82,11 @@ test_downgrade_arch_flags 4.5 "-march=amdfam10 -mtune=generic" "-march=btver2 -m test_downgrade_arch_flags 3.3 "-march=k6-2" "-march=geode -mtune=barcelona" test_downgrade_arch_flags 3.4 "-march=k8" "-march=btver2 -mtune=generic" +test_downgrade_arch_flags 10 "-march=native" "-march=native" test_downgrade_arch_flags 4.2 "-march=native" "-march=native" test_downgrade_arch_flags 4.1 "-march=nocona" "-march=native" +test_downgrade_arch_flags 10 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" test_downgrade_arch_flags 4.9 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" test_downgrade_arch_flags 4.8 "-march=foo -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" test_downgrade_arch_flags 4.7 "-march=foo -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 5f9bd7750dd..bd3d024f989 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1406,7 +1406,8 @@ downgrade_arch_flags() { local arch bver i isa myarch mytune rep ver bver=${1:-${GCC_BRANCH_VER}} - [[ $(gcc-version) < ${bver} ]] && return 0 + # Don't perform downgrade if running gcc is older than ebuild's. + tc_version_is_at_least ${bver} $(gcc-version) || return 0 [[ $(tc-arch) != amd64 && $(tc-arch) != x86 ]] && return 0 myarch=$(get-flag march) @@ -1414,7 +1415,7 @@ downgrade_arch_flags() { # If -march=native isn't supported we have to tease out the actual arch if [[ ${myarch} == native || ${mytune} == native ]] ; then - if [[ ${bver} < 4.2 ]] ; then + if ! tc_version_is_at_least 4.2 ${bver}; then arch=$($(tc-getCC) -march=native -v -E -P - &1 \ | sed -rn "/cc1.*-march/s:.*-march=([^ ']*).*:\1:p") replace-cpu-flags native ${arch} @@ -1422,10 +1423,10 @@ downgrade_arch_flags() { fi # Handle special -mtune flags - [[ ${mytune} == intel && ${bver} < 4.9 ]] && replace-cpu-flags intel generic - [[ ${mytune} == generic && ${bver} < 4.2 ]] && filter-flags '-mtune=*' + [[ ${mytune} == intel ]] && ! tc_version_is_at_least 4.9 ${bver} && replace-cpu-flags intel generic + [[ ${mytune} == generic ]] && ! tc_version_is_at_least 4.2 ${bver} && filter-flags '-mtune=*' [[ ${mytune} == x86-64 ]] && filter-flags '-mtune=*' - [[ ${bver} < 3.4 ]] && filter-flags '-mtune=*' + tc_version_is_at_least 3.4 ${bver} || filter-
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 8844b4c200dc82d7d09547b3d913f011f05cf592 Author: David Seifert gentoo org> AuthorDate: Mon Dec 30 00:48:32 2019 + Commit: Michał Górny gentoo org> CommitDate: Mon Dec 30 12:58:51 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8844b4c2 python-utils-r1.eclass: Remove PYTHON_TARGETS="pypy" * With the EOL of CPython 2, we also want to remove support for PyPy (i.e. PyPy for Python 2). This change does not affect PyPy3, i.e. Pypy for Python 3. Signed-off-by: David Seifert gentoo.org> Signed-off-by: Michał Górny gentoo.org> eclass/python-utils-r1.eclass | 6 +++--- eclass/tests/python-utils-r1.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 370898bcea0..09b501a4ad2 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -40,7 +40,7 @@ inherit toolchain-funcs # All supported Python implementations, most preferred last. _PYTHON_ALL_IMPLS=( jython2_7 - pypy pypy3 + pypy3 python2_7 python3_6 python3_7 python3_8 ) @@ -78,10 +78,10 @@ _python_impl_supported() { # keep in sync with _PYTHON_ALL_IMPLS! # (not using that list because inline patterns shall be faster) case "${impl}" in - python2_7|python3_[678]|jython2_7|pypy|pypy3) + python2_7|python3_[678]|jython2_7|pypy3) return 0 ;; - pypy1_[89]|pypy2_0|python2_[56]|python3_[12345]) + pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345]) return 1 ;; *) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index df77a3fcf6e..f8d4858da7c 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -188,7 +188,7 @@ 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 -test_is "_python_impl_supported pypy" 0 +test_is "_python_impl_supported pypy" 1 test_is "_python_impl_supported pypy3" 0 test_is "_python_impl_supported jython2_7" 0
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: f0f388d6e7b7990006384bd024ec5bf2d7f66737 Author: David Seifert gentoo org> AuthorDate: Mon Dec 30 00:48:32 2019 + Commit: Michał Górny gentoo org> CommitDate: Mon Dec 30 12:58:50 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f0f388d6 python-utils-r1.eclass: Remove PYTHON_TARGETS="python3_5" * Python 3.5 will go EOL on 2020-09-13 and in order to reduce testing and maintenance burden, we want to keep the number of active Py3 impls below four. https://devguide.python.org/#status-of-python-branches Signed-off-by: David Seifert gentoo.org> Signed-off-by: Michał Górny gentoo.org> eclass/python-utils-r1.eclass | 6 +++--- eclass/tests/python-utils-r1.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index e0711a35e3a..370898bcea0 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -42,7 +42,7 @@ _PYTHON_ALL_IMPLS=( jython2_7 pypy pypy3 python2_7 - python3_5 python3_6 python3_7 python3_8 + python3_6 python3_7 python3_8 ) readonly _PYTHON_ALL_IMPLS @@ -78,10 +78,10 @@ _python_impl_supported() { # keep in sync with _PYTHON_ALL_IMPLS! # (not using that list because inline patterns shall be faster) case "${impl}" in - python2_7|python3_[5678]|jython2_7|pypy|pypy3) + python2_7|python3_[678]|jython2_7|pypy|pypy3) return 0 ;; - pypy1_[89]|pypy2_0|python2_[56]|python3_[1234]) + pypy1_[89]|pypy2_0|python2_[56]|python3_[12345]) return 1 ;; *) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index e883da38cea..df77a3fcf6e 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -181,7 +181,7 @@ 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" 1 -test_is "_python_impl_supported python3_5" 0 +test_is "_python_impl_supported python3_5" 1 test_is "_python_impl_supported python3_6" 0 test_is "_python_impl_supported python3_7" 0 test_is "_python_impl_supported python3_8" 0
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 28d6437fc7009002f98f28e8900e994109927726 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Dec 23 11:41:20 2019 + Commit: Sergei Trofimovich gentoo org> CommitDate: Tue Dec 24 11:01:01 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28d6437f flag-o-matic.eclass: add LDFLAGS testing against linker Before the change we tested only compiler driver (gcc flag parser) for LDFLAGS. This does not cover cases when we would really like to filter out unsupported linker flags like -Wl,--hash-style=gnu passed to non-ELF targets. The change adds test-flag-CCLD() helper to perform all of assembly, compilation and linking steps. Helper is used to filter LDFLAGS variable in strip-unsupported-flags(). Closes: https://bugs.gentoo.org/333763 Signed-off-by: Sergei Trofimovich gentoo.org> eclass/flag-o-matic.eclass | 72 +++- eclass/tests/flag-o-matic.sh | 2 +- 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index f882b09d621..0aec22c83f2 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -441,29 +441,63 @@ test-flag-PROG() { # 'type' needs a binary name type -p ${comp[0]} >/dev/null || return 1 + # Set up test file. + local in_src in_ext cmdline_extra=() + case "${lang}" in + # compiler/assembler only + c) + in_ext='.c' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc -c) + ;; + c++) + in_ext='.cc' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc++ -c) + ;; + f77) + in_ext='.f' + # fixed source form + in_src=' end' + cmdline_extra+=(-xf77 -c) + ;; + f95) + in_ext='.f90' + in_src='end' + cmdline_extra+=(-xf95 -c) + ;; + + # C compiler/assembler/linker + c+ld) + in_ext='.c' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc) + ;; + esac + local test_in=${T}/test-flag-${comp}.${lang} + local test_out=${T}/test-flag-${comp}.exe + + printf "%s\n" "${in_src}" > "${test_in}" || return 1 + local cmdline=( "${comp[@]}" # Clang will warn about unknown gcc flags but exit 0. # Need -Werror to force it to exit non-zero. -Werror - # Use -c so we can test the assembler as well. - -c -o /dev/null + "$@" + # -x options need to go before first source file + "${cmdline_extra[@]}" + + "${test_in}" -o "${test_out}" ) - if "${cmdline[@]}" -x${lang} - /dev/null ; then - cmdline+=( "$@" -x${lang} - ) - else - # XXX: what's the purpose of this? does it even work with - # any compiler? - cmdline+=( "$@" -c -o /dev/null /dev/null ) - fi - if ! "${cmdline[@]}" /dev/null; then + if ! "${cmdline[@]}" &>/dev/null; then # -Werror makes clang bail out on unused arguments as well; # try to add -Qunused-arguments to work-around that # other compilers don't support it but then, it's failure like # any other cmdline+=( -Qunused-arguments ) - "${cmdline[@]}" /dev/null + "${cmdline[@]}" &>/dev/null fi } @@ -491,6 +525,12 @@ test-flag-F77() { test-flag-PROG "F77" f77 "$@"; } # Returns shell true if is supported by the Fortran 90 compiler, else returns shell false. test-flag-FC() { test-flag-PROG "FC" f95 "$@"; } +# @FUNCTION: test-flag-CCLD +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is supported by the C compiler and linker, else returns shell false. +test-flag-CCLD() { test-flag-PROG "CC" c+ld "$@"; } + test-flags-PROG() { local comp=$1 local flags=() @@ -548,6 +588,12 @@ test-flags-F77() { test-flags-PROG "F77" "$@"; } # Returns shell true if are supported by the Fortran 90 compiler, else returns shell false. test-flags-FC() { test-flags-PROG "FC" "$@"; } +# @FUNCTION: test-flags-CCLD +# @USAGE: +# @DESCRIPTION: +# Returns shell true if are supported by the C compiler and default linker, else returns shell false. +test-flags-CCLD() { test-flags-PROG "CCLD" "$@"; } + # @FUNCTION: test-flags # @USAGE: # @DESCRIPTION: @@ -576,9 +622,7 @@ strip-unsupported-flags() { export CXXFLAGS=$(test-fla
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 36613f4c0fb5eae1f99165156b85c348d38ecf24 Author: Sergei Trofimovich gentoo org> AuthorDate: Mon Dec 23 11:32:39 2019 + Commit: Sergei Trofimovich gentoo org> CommitDate: Mon Dec 23 11:47:02 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36613f4c eclass/tests/flag-o-matic.sh: clarify the filter Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/flag-o-matic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh index b0b97ea0bc1..7c078499d70 100755 --- a/eclass/tests/flag-o-matic.sh +++ b/eclass/tests/flag-o-matic.sh @@ -53,7 +53,7 @@ done <<<" 1 -n " -tbegin "strip-unsupported-flags" +tbegin "strip-unsupported-flags for -z=2" strip-unsupported-flags [[ ${CFLAGS} == "--param l1-cache-size=32" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]] ftend
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 063d79790a2c0ee4542552f76334f511aaced319 Author: Sergei Trofimovich gentoo org> AuthorDate: Fri Dec 13 22:22:11 2019 + Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Dec 13 22:37:12 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=063d7979 eclass/tests/toolchain-funcs.sh: fix gold tests, bug #700812 As written tests assumed that $CC always called ld.bfd as a linker. The assumption fails when default linker is not ld.bfd, (for example sys-devel/binutils[default-gold]). The change uses LDFLAGS=-fuse-ld=bfd explicitly. Fixes the following tests: * Testing tc-ld-is-gold (bfd selected) ... [ !! ] * Testing tc-ld-disable-gold (bfd selected) ... [ !! ] Reported-by: Michał Górny Closes: https://bugs.gentoo.org/700812 Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/toolchain-funcs.sh | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 4cd4213c2de..1cf124520c3 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() { :; }
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: cfdfd8c30a9aec68b34a958cc7e28cf823489f64 Author: Michał Górny gentoo org> AuthorDate: Sat Dec 7 16:58:09 2019 + Commit: Michał Górny gentoo org> CommitDate: Sat Dec 7 16:58:54 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfdfd8c3 eclass/tests/distutils-r1.sh: Disable setuptools dep Signed-off-by: Michał Górny gentoo.org> eclass/tests/distutils-r1.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh index d5f3e2812ca..d251f85a5eb 100755 --- a/eclass/tests/distutils-r1.sh +++ b/eclass/tests/distutils-r1.sh @@ -47,6 +47,7 @@ test-distutils_enable_tests() { tend ${ret} } +DISTUTILS_USE_SETUPTOOLS=no inherit distutils-r1 tbegin "sane function names"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: ddcb3bf30c3dbdd42f1306ea4f0e8611b25ca81c Author: Sergei Trofimovich gentoo org> AuthorDate: Sun Dec 1 11:29:02 2019 + Commit: Sergei Trofimovich gentoo org> CommitDate: Sun Dec 1 11:29:37 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddcb3bf3 eclass/tests/toolchain.sh: fix 's/asserv/assert' typo Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/toolchain.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 2c09f2238d7..56609aa180e 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}\""
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: c32cd67056099a178b5928ea6b2d0958b8ef45c8 Author: Michał Górny gentoo org> AuthorDate: Sun Nov 24 14:39:47 2019 + Commit: Michał Górny gentoo org> CommitDate: Sun Nov 24 15:09:14 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c32cd670 eclass/tests/python-utils-r1.sh: Add tests for _python_impl_matches Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 34 ++ 1 file changed, 34 insertions(+) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index e7c533d5f33..e883da38cea 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -192,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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 7b7b4fe856baecfbe4b36831a88dac298e6bb2b9 Author: Sergei Trofimovich gentoo org> AuthorDate: Wed Nov 20 20:28:40 2019 + Commit: Sergei Trofimovich gentoo org> CommitDate: Wed Nov 20 20:30:19 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b7b4fe8 eclass/tests/toolchain-funcs.sh: fix tc-cpp-is-true tests The test was failing on systems without clang because presence of compiler was tested incorrectly (${compielr} typo). Reported-by: Michał Górny Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/toolchain-funcs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 79ba6fa407b..4cd4213c2de 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -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}
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 3b75b027410fa2f5aca262794173086ec6b19d90 Author: Sergei Trofimovich gentoo org> AuthorDate: Wed Nov 20 19:49:35 2019 + Commit: Sergei Trofimovich gentoo org> CommitDate: Wed Nov 20 19:51:36 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b75b027 eclass/tests/flag-o-matic.sh: fix strip-unsupported-flags -B* set of tests Don't know how I tested previous state, it certainly could not work. The fix itself is fine though. The change updates expected output. Reported-by: Michał Górny Bug: https://bugs.gentoo.org/687198 Signed-off-by: Sergei Trofimovich gentoo.org> eclass/tests/flag-o-matic.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh index 691b052c3d4..b0b97ea0bc1 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: f50c714df53bcc38a09c1cfbd6b25506dd449eb7 Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 09:23:32 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 09:23:32 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f50c714d eclass/tests/git-r3_GIT_DIR.sh: stub out git calls Signed-off-by: Michał Górny gentoo.org> eclass/tests/git-r3_GIT_DIR.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eclass/tests/git-r3_GIT_DIR.sh b/eclass/tests/git-r3_GIT_DIR.sh index 42bebd99782..c17ae7bb43c 100755 --- a/eclass/tests/git-r3_GIT_DIR.sh +++ b/eclass/tests/git-r3_GIT_DIR.sh @@ -15,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}
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 7d3e32ce11e4f9137c5f26776ccf1f1258a025a8 Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 09:15:48 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 09:15:48 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d3e32ce eclass/tests/savedconfig.sh: Use a supported EAPI Signed-off-by: Michał Górny gentoo.org> eclass/tests/savedconfig.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eclass/tests/savedconfig.sh b/eclass/tests/savedconfig.sh index 19da181d840..7643cf4cc82 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: e2992167ca894f82afa2fcdb23ff21ad4807ad37 Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 09:14:28 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 09:15:03 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2992167 eclass/tests/scons-utils.sh: Fix getting default job count Signed-off-by: Michał Górny gentoo.org> eclass/tests/scons-utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh index 7a588863c6a..873312f67d0 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: e4c472f744ab75e15056aa2a4dcfe3c6edb2caa9 Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 08:58:24 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 08:58:54 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4c472f7 eclass/tests/git-r3_subrepos.sh: Use a supported EAPI Signed-off-by: Michał Górny gentoo.org> eclass/tests/git-r3_subrepos.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eclass/tests/git-r3_subrepos.sh b/eclass/tests/git-r3_subrepos.sh index 5b814328a49..0fcf1cd0808 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: b60ffd4286d874cc61b892ac14c76ea2b14dc6cb Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 08:57:42 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 08:57:42 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b60ffd42 eclass/tests/git-r3.sh: Partially fix and disable The tests rely on ext: remote support which apparently no longer works. Signed-off-by: Michał Górny gentoo.org> eclass/tests/git-r3.sh | 7 ++- eclass/tests/tests-common.sh | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/eclass/tests/git-r3.sh b/eclass/tests/git-r3.sh index 6ff6226c0aa..2f452bfd68a 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/tests-common.sh b/eclass/tests/tests-common.sh index d52cf3a2687..674eaa02cdc 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() { :; }
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: edd5b81e2adc156b3a9545faefcb9397c0ca63a4 Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 08:59:36 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 08:59:49 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=edd5b81e eclass/tests/git-r3_GIT_DIR.sh: Use a supported EAPI Signed-off-by: Michał Górny gentoo.org> eclass/tests/git-r3_GIT_DIR.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eclass/tests/git-r3_GIT_DIR.sh b/eclass/tests/git-r3_GIT_DIR.sh index 06c4094ceb9..42bebd99782 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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 6104a28be358ced4ab9bab9f11cede409de532a6 Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 08:46:00 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 08:46:35 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6104a28b eclass/tests/python-utils-r1.sh: Add tests for py3.7 Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 12 1 file changed, 12 insertions(+) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 226eba9370e..e7c533d5f33 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -83,6 +83,18 @@ 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" +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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: e1fe382b21691a0731b7fe1d3d13a08b1275f241 Author: Michał Górny gentoo org> AuthorDate: Wed Nov 20 08:44:55 2019 + Commit: Michał Górny gentoo org> CommitDate: Wed Nov 20 08:46:34 2019 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1fe382b eclass/tests/python-utils-r1.sh: Update PyPy paths Signed-off-by: Michał Górny gentoo.org> eclass/tests/python-utils-r1.sh | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 3f60112a153..226eba9370e 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -94,8 +94,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 +103,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