[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2faf4a38f838781e56696dcca483ebe3acccb094
Author: Sam James gentoo org>
AuthorDate: Tue Feb 3 23:49:24 2026 +
Commit: Sam James gentoo org>
CommitDate: Tue Feb 3 23:51:32 2026 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2faf4a38
eclass/tests: dot-a: adapt to binutils trunk changes
GNU Binutils 2.46 will let us corrupt archives in some special cases
because GCC's compare-lto needs that (PR33801).
I think it actually worked okay for both our case and GCC's before
Alan's 9adb8ba865f2aebc6f4d7cc74df64ea200959b3a but I can't find a fault
with that either, so adapt to the new reality which hopefully works
for everybody now.
Bug: https://sourceware.org/PR33801
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 14 --
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index cfd79112472a..4e55c40f0712 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -479,9 +479,10 @@ test_strip_lto() {
cp foo.a foo.a.bak || return 1
$(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
- # They should NOT differ after stripping because it
- # can't be safely stripped without special arguments.
- cmp -s foo.a foo.a.bak || return 1
+ # The file may differ slightly with newer GNU Binutils (PR33801)
+ # so just make sure it's not totally corrupted.
+ $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c foo.a -o main || return
1
+ ./main &>/dev/null || return 1
return 0
) || ret=1
@@ -669,9 +670,10 @@ test_strip_index() {
cp foo.a foo.a.bak || return 1
$(tc-getSTRIP) --enable-deterministic-archives -p
--strip-unneeded foo.a || return 1
- # They should NOT differ after stripping because it
- # can't be safely stripped without special arguments.
- cmp -s foo.a foo.a.bak || return 1
+ # The file may differ slightly with newer GNU Binutils (PR33801)
+ # so just make sure it's not totally corrupted.
+ $(tc-getCC) ${CFLAGS} ${LDFLAGS} main.c foo.a -o main || return
1
+ ./main &>/dev/null || return 1
return 0
) || ret=1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 72a4afc1514c41c157665166526fb36257eed860
Author: Sam James gentoo org>
AuthorDate: Wed Nov 12 06:31:30 2025 +
Commit: Sam James gentoo org>
CommitDate: Wed Nov 12 06:33:03 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72a4afc1
eclass/tests: fix flag-o-matic tests w/ clang
The eclass behaviour was fixed in ddba1d149e82dba88b72f992729ad4158f640e32.
Bug: https://bugs.gentoo.org/627474
Bug: https://bugs.gentoo.org/712488
Bug: https://bugs.gentoo.org/714742
Bug: https://bugs.gentoo.org/862798
Closes: https://bugs.gentoo.org/934129
Signed-off-by: Sam James gentoo.org>
eclass/tests/flag-o-matic.sh | 33 -
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
index 1e4bfdb2fcfe..4dc133776038 100755
--- a/eclass/tests/flag-o-matic.sh
+++ b/eclass/tests/flag-o-matic.sh
@@ -1,7 +1,6 @@
#!/bin/bash
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-
source tests-common.sh || exit
EAPI=7
@@ -153,25 +152,25 @@ out=$(test-flags-CC -finvalid-flag)
ftend
if type -P clang >/dev/null ; then
-tbegin "test-flags-CC (valid flags w/clang)"
-out=$(CC=clang test-flags-CC -O3)
-[[ $? -eq 0 && ${out} == "-O3" ]]
-ftend
+ tbegin "test-flags-CC (valid flags w/clang)"
+ out=$(CC=clang test-flags-CC -O3)
+ [[ $? -eq 0 && ${out} == "-O3" ]]
+ ftend
-tbegin "test-flags-CC (invalid flags w/clang)"
-out=$(CC=clang test-flags-CC -finvalid-flag)
-[[ $? -ne 0 && -z ${out} ]]
-ftend
+ tbegin "test-flags-CC (invalid flags w/clang)"
+ out=$(CC=clang test-flags-CC -finvalid-flag)
+ [[ $? -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 (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)
-[[ $? -eq 0 && ${out} == "-Wl,-O1" ]]
-ftend
+ tbegin "test-flags-CC (unused flags w/clang)"
+ out=$(CC=clang test-flags-CC -Wl,-O1)
+ [[ $? -ne 0 && -z ${out} ]]
+ ftend
fi
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 7952fbcf81b0ebd8e24e87b1a45165a172aede13 Author: Sam James gentoo org> AuthorDate: Wed Nov 12 06:23:15 2025 + Commit: Sam James gentoo org> CommitDate: Wed Nov 12 06:33:03 2025 + URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7952fbcf eclass/tests: fix toolchain.sh tests Followup to e9e6d8c367fdf02b14f9cb2a59489833975d1445. Signed-off-by: Sam James 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 162ff27e17c4..3621c93e3841 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -11,7 +11,7 @@ PR=r0 source tests-common.sh || exit source version-funcs.sh || exit -EAPI=7 inherit toolchain +EAPI=8 inherit toolchain # Ignore actually running version of gcc and fake new version # to force downgrade test on all conditions below.
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 77a958258afc72077128e86afc04c277f2dab655
Author: Sam James gentoo org>
AuthorDate: Fri Aug 15 05:14:16 2025 +
Commit: Sam James gentoo org>
CommitDate: Fri Aug 15 05:17:05 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77a95825
Revert "eclass/tests: tweak dot-a.sh tests for binutils"
This reverts commit 89468b4dc0cf1ac417a1f3fb499693dc0c86e2fa. This is
now needed after 9b383903e73cd01f2fbe9728d0c31fea765ba8d6 in binutils,
which is great news, as strip Does The Right Thing in even more cases now.
Tweaked the versions accordingly.
Bug: https://sourceware.org/PR33271
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 47 +++
1 file changed, 47 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 07416494441d..cfd79112472a 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -9,6 +9,45 @@ source version-funcs.sh || exit
inherit dot-a
+_strip_is_gnu() {
+ local name=$($(tc-getSTRIP) --version 2>&1 | head -n 1)
+
+ if ! [[ ${name} =~ ^GNU.*strip ]] ; then
+ return 1
+ fi
+
+ return 0
+}
+
+_check_binutils_version() {
+ local tool=$1
+ # Convert this:
+ # ```
+ # GNU ld (Gentoo 2.38 p4) 2.38
+ # Copyright (C) 2022 Free Software Foundation, Inc.
+ # This program is free software; you may redistribute it under the
terms of
+ # the GNU General Public License version 3 or (at your option) a later
version.
+ # This program has absolutely no warranty.
+ # ```
+ #
+ # into...
+ # ```
+ # 2.38
+ # ```
+ local ver=$(${tool} --version 2>&1 | head -n 1 | rev | cut -d' ' -f1 |
rev)
+
+ if ! [[ ${ver} =~ [0-9].[0-9][0-9](.[0-9]?) ]] ; then
+ # Skip if unrecognised format so we don't pass something
+ # odd into ver_cut.
+ return
+ fi
+
+ ver_major=$(ver_cut 1 "${ver}")
+ ver_minor=$(ver_cut 2 "${ver}")
+ ver_extra=$(ver_cut 3 "${ver}")
+ echo ${ver_major}.${ver_minor}${ver_extra:+.${ver_extra}}
+}
+
_create_test_progs() {
cat <<-EOF > a.c
int foo();
@@ -115,6 +154,10 @@ test_strip_lto_bytecode() {
# strip-lto-bytecode will error out early with LLVM,
# so stop the test here.
tc-is-clang && return 0
+ # strip with >= GNU Binutils 2.46 won't corrupt the archive:
+ # https://sourceware.org/PR21479
+ # https://sourceware.org/PR33271
+ _strip_is_gnu && ver_test $(_check_binutils_version
$(tc-getSTRIP)) -gt 2.45 && return 0
$(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
@@ -153,6 +196,10 @@ test_strip_lto_bytecode() {
# strip-lto-bytecode will error out early with LLVM,
# so stop the test here.
tc-is-clang && return 0
+ # strip with >= GNU Binutils 2.46 won't corrupt the archive:
+ # https://sourceware.org/PR21479
+ # https://sourceware.org/PR33271
+ _strip_is_gnu && ver_test $(_check_binutils_version
$(tc-getSTRIP)) -gt 2.45 && return 0
$(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
$(tc-getAR) qD test.a a.o 2>/dev/null || return 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 26475f8373c26cd537cbe26ad884db9c1fa6fcd4
Author: Sam James gentoo org>
AuthorDate: Fri Aug 8 13:19:15 2025 +
Commit: Sam James gentoo org>
CommitDate: Fri Aug 8 17:39:18 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26475f83
eclass/tests: dot-a: add another strip vs index testcase
This is in addition to 44699664fa7aba134c327acb38c40851e0813ff4 and
1b826e95ac66bf54e532bb155261f4a39419efa9. It's an explicit, simple version
of the original testcase Markus gave on the bug (just with --strip-unneeded
instead of --strip-debug/-d).
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 26 ++
1 file changed, 26 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 96b8c3a130a7..07416494441d 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -419,6 +419,8 @@ test_strip_lto() {
# one needs -ffat-lto-objects for our purposes in dot-a.eclass,
# but still, strip shouldn't break a non-fat object, and we want
# to know if that regresses.
+ #
+ # See test_strip_index as well.
tbegin "whether strip ignores LTO static archives"
ret=0
(
@@ -606,6 +608,29 @@ test_strip_cross() {
tend ${ret} "strip broke binary for a foreign architecture"
}
+test_strip_index() {
+ # Check specifically for whether we mangle the index in an archive
+ # which was the original testcase given in
https://sourceware.org/PR21479.
+ tbegin "whether strip breaks index on LTO static archive"
+ ret=0
+ (
+ rm foo.a foo.a.bak 2>/dev/null
+ _create_test_progs
+
+ $(tc-getCC) a.c -o a.o -c -flto -ggdb3 || return 1
+ $(tc-getAR) qD foo.a a.o 2>/dev/null || return 1
+ cp foo.a foo.a.bak || return 1
+ $(tc-getSTRIP) --enable-deterministic-archives -p
--strip-unneeded foo.a || return 1
+
+ # They should NOT differ after stripping because it
+ # can't be safely stripped without special arguments.
+ cmp -s foo.a foo.a.bak || return 1
+
+ return 0
+ ) || ret=1
+ tend ${ret} "strip broke index on LTO static archive"
+}
+
_repeat_tests_with_compilers() {
# Call test_lto_guarantee_fat and test_strip_lto_bytecode with
# various compilers and linkers.
@@ -666,4 +691,5 @@ test_strip_lto
test_strip_lto_mixed
test_strip_nolto
test_strip_cross
+test_strip_index
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: a6d64cf6d851ea48b45f6b4914a5a2930d0cedce
Author: Sam James gentoo org>
AuthorDate: Mon Aug 4 21:20:57 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Aug 4 21:20:57 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6d64cf6
eclass/tests: dot-a: pass --enable-deterministic-archives to strip
See 3c6009e3d48bcc80cfc714e4365ae24856114c5f.
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index e747965af80f..2ee526d2ba3e 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -428,7 +428,7 @@ test_strip_lto() {
$(tc-getCC) a.c -o a.o -c -flto -ggdb3 || return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -p -d foo.a || return 1
+ $(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
# They should NOT differ after stripping because it
# can't be safely stripped without special arguments.
@@ -447,7 +447,7 @@ test_strip_lto() {
$(tc-getCC) a.c -o a.o -c -flto -ffat-lto-objects -ggdb3 ||
return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -p -d foo.a || return 1
+ $(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
# They should differ after stripping because binutils
# (these days) can safely strip it without special arguments
@@ -526,7 +526,7 @@ test_strip_nolto() {
$(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -p -d foo.a || return 1
+ $(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
# They should differ after stripping.
cmp -s foo.a foo.a.bak && return 1
@@ -550,7 +550,7 @@ test_strip_nolto() {
$(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -p -d foo.a || return 1
+ $(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
# They should differ after stripping.
cmp -s foo.a foo.a.bak && return 1
@@ -577,7 +577,7 @@ test_strip_cross() {
# The test only makes sense with binutils[-multitarget], otherwise
# binutils will iterate over all available targets and just pick one
# rather than not-figuring-it-out and setting EM_NONE.
- if $(tc-getSTRIP) |& grep -q aarch ; then
+ if $(tc-getSTRIP) --enable-deterministic-archives |& grep -q aarch ;
then
return
fi
@@ -591,7 +591,7 @@ test_strip_cross() {
cp a.o a.o.bak || return 1
# We want this to error out with binutils[-multitarget]
# and we skip the test earlier on if binutils[multitarget].
- $(tc-getSTRIP) -p a.o &>/dev/null || return 0
+ $(tc-getSTRIP) --enable-deterministic-archives -p a.o
&>/dev/null || return 0
if file a.o |& grep "no machine" ; then
return 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2c76b49f5755837d01023486052d9651be0daabd
Author: Sam James gentoo org>
AuthorDate: Mon Aug 4 21:22:07 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Aug 4 21:22:41 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c76b49f
eclass/tests: dot-a: pass D to ar
... for deterministic archives.
See 3c6009e3d48bcc80cfc714e4365ae24856114c5f and
a6d64cf6d851ea48b45f6b4914a5a2930d0cedce.
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 22 +++---
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 2ee526d2ba3e..96b8c3a130a7 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -155,7 +155,7 @@ test_strip_lto_bytecode() {
tc-is-clang && return 0
$(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
- $(tc-getAR) q test.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD test.a a.o 2>/dev/null || return 1
# This should corrupt a.o and make linking below fail.
strip-lto-bytecode test.a
@@ -176,7 +176,7 @@ test_strip_lto_bytecode() {
lto-guarantee-fat
$(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
- $(tc-getAR) q test.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD test.a a.o 2>/dev/null || return 1
# This should NOT corrupt a.o, so linking below should succeed.
strip-lto-bytecode test.a
@@ -347,7 +347,7 @@ test_search_recursion() {
_create_test_progs
lto-guarantee-fat
$(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
- $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD foo.a a.o 2>/dev/null || return 1
_check_if_lto_object "${tmpdir}/lto/foo.a" || return 1
# It should search ${ED} if no arguments are passed, find
@@ -397,8 +397,8 @@ test_search_recursion() {
_create_test_progs
lto-guarantee-fat
$(tc-getCC) ${CFLAGS} "${tmpdir}"/lto/a.c -o
"${tmpdir}"/lto/a.o -c 2>/dev/null || return 1
- $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
- $(tc-getAR) q "${tmpdir}"/lto2/foo.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD foo.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD "${tmpdir}"/lto2/foo.a a.o 2>/dev/null || return
1
_check_if_lto_object "${tmpdir}/lto/foo.a" || return 1
_check_if_lto_object "${tmpdir}/lto2/foo.a" || return 1
@@ -426,7 +426,7 @@ test_strip_lto() {
_create_test_progs
$(tc-getCC) a.c -o a.o -c -flto -ggdb3 || return 1
- $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
$(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
@@ -445,7 +445,7 @@ test_strip_lto() {
_create_test_progs
$(tc-getCC) a.c -o a.o -c -flto -ffat-lto-objects -ggdb3 ||
return 1
- $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
$(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
@@ -479,7 +479,7 @@ test_strip_lto_mixed() {
rm test.a 2>/dev/null
clang ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
- $(tc-getAR) q test.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD test.a a.o 2>/dev/null || return 1
# Pretend that gcc built a.o/test.a so that we use
# GNU Binutils strip to trigger the bug.
@@ -503,7 +503,7 @@ test_strip_lto_mixed() {
rm test.a 2>/dev/null
clang ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
- $(tc-getAR) q test.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD test.a a.o 2>/dev/null || return 1
# Pretend that gcc built a.o/test.a so that we use
# GNU Binutils strip to trigger the bug.
@@ -524,7 +524,7 @@ test_strip_nolto() {
_create_test_progs
$(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
- $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
$(tc-getSTRIP) --enable-deterministic-archives -p -d foo.a ||
return 1
@@ -548,7 +548,7 @@ test_strip_nolto() {
_create_test_progs
$(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
- $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ $(tc-getAR) qD
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: d613538e385a78aed00f80f9e40f0fceb82dc936
Author: Sam James gentoo org>
AuthorDate: Mon Aug 4 20:04:26 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Aug 4 20:04:26 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d613538e
eclass/tests: dot-a: fix test fail description
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index a70ea20e632a..e747965af80f 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -603,7 +603,7 @@ test_strip_cross() {
return 0
) || ret=1
- tend ${ret} ""
+ tend ${ret} "strip broke binary for a foreign architecture"
}
_repeat_tests_with_compilers() {
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 5285c15383388b9a46ee39eeebcf2a1e5b8c01d1
Author: Sam James gentoo org>
AuthorDate: Mon Aug 4 19:27:43 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Aug 4 20:02:41 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5285c153
eclass/tests: dot-a: tweak test description
Bit clearer maybe.
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 5d0b0541e3e4..bb17e62b5afc 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -493,7 +493,7 @@ test_strip_lto_mixed() {
# against the stripped archive?
# Note that this can only happen in a mixed build because
strip-lto-bytecode
# checks for the toolchain type before deciding which strip to use.
- tbegin "whether strip corrupts a Clang fat IR archive"
+ tbegin "whether strip can process (not corrupt) a Clang fat IR archive"
ret=0
(
export CFLAGS="-O2 -flto"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: ee83b41b824cc10dd263e34ca42644acf037e360
Author: Sam James gentoo org>
AuthorDate: Mon Aug 4 20:01:56 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Aug 4 20:02:42 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee83b41b
eclass/tests: dot-a: test strip doesn't break foreign architectures
... with binutils[-multitarget].
Make sure that strip doesn't break binaries for another architecture
and instead bails out (bug #960493, https://sourceware.org/PR33230).
Bug: https://bugs.gentoo.org/960493
Bug: ttps://sourceware.org/PR33230
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 43 +++
1 file changed, 43 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index bb17e62b5afc..a70ea20e632a 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -564,6 +564,48 @@ test_strip_nolto() {
tend ${ret} "strip -d ignored an archive when it shouldn't"
}
+test_strip_cross() {
+ # Make sure that strip doesn't break binaries for another architecture
+ # and instead bails out (bug #960493, https://sourceware.org/PR33230).
+ local machine=$($(tc-getCC) -dumpmachine)
+ # Just assume we're on x86_64-pc-linux-gnu and have a
+ # aarch64-unknown-linux-gnu toolchain available for testing.
+ if [[ ${machine} != x86_64-pc-linux-gnu ]] || ! type -P
aarch64-unknown-linux-gnu-gcc &> /dev/null ; then
+ # TODO: Iterate over cross toolchains available?
+ return
+ fi
+ # The test only makes sense with binutils[-multitarget], otherwise
+ # binutils will iterate over all available targets and just pick one
+ # rather than not-figuring-it-out and setting EM_NONE.
+ if $(tc-getSTRIP) |& grep -q aarch ; then
+ return
+ fi
+
+ tbegin "whether strip breaks binaries for a foreign architecture"
+ ret=0
+ (
+ rm foo.a foo.a.bak 2>/dev/null
+ _create_test_progs
+
+ aarch64-unknown-linux-gnu-gcc a.c -o a.o -c -ggdb3 || return 1
+ cp a.o a.o.bak || return 1
+ # We want this to error out with binutils[-multitarget]
+ # and we skip the test earlier on if binutils[multitarget].
+ $(tc-getSTRIP) -p a.o &>/dev/null || return 0
+
+ if file a.o |& grep "no machine" ; then
+ return 1
+ fi
+
+ # They should not differ because it's unsafe to touch
+ # for a foreign architecture.
+ cmp -s a.a a.a.bak || return 1
+
+ return 0
+ ) || ret=1
+ tend ${ret} ""
+}
+
_repeat_tests_with_compilers() {
# Call test_lto_guarantee_fat and test_strip_lto_bytecode with
# various compilers and linkers.
@@ -623,4 +665,5 @@ test_search_recursion
test_strip_lto
test_strip_lto_mixed
test_strip_nolto
+test_strip_cross
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2db7a007b9b5a988cd8f6783bacc5317be39b9af
Author: Sam James gentoo org>
AuthorDate: Mon Aug 4 19:18:28 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Aug 4 19:19:10 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2db7a007
eclass/tests: dot-a: allow some differences with strip
With the fix for the linked binutils bug, we actually want a difference
for fat archives (only) where debug information gets stripped out with
-d.
Bug: https://sourceware.org/PR33246
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 11 ++-
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 982e02c28e62..5d0b0541e3e4 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -438,7 +438,7 @@ test_strip_lto() {
) || ret=1
tend ${ret} "strip operated on an LTO archive when it shouldn't"
- tbegin "whether strip ignores fat LTO static archives"
+ tbegin "whether strip modifies fat LTO static archives"
ret=0
(
rm foo.a foo.a.bak 2>/dev/null
@@ -449,13 +449,14 @@ test_strip_lto() {
cp foo.a foo.a.bak || return 1
$(tc-getSTRIP) -p -d foo.a || return 1
- # They should NOT differ after stripping because it
- # can't be safely stripped without special arguments.
- cmp -s foo.a foo.a.bak || return 1
+ # They should differ after stripping because binutils
+ # (these days) can safely strip it without special arguments
+ # via plugin support.
+ cmp -s foo.a foo.a.bak && return 1
return 0
) || ret=1
- tend ${ret} "strip operated on a fat LTO archive when it shouldn't"
+ tend ${ret} "strip failed to operate on a fat LTO archive when it
should"
}
test_strip_lto_mixed() {
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 3c6009e3d48bcc80cfc714e4365ae24856114c5f
Author: Sam James gentoo org>
AuthorDate: Mon Aug 4 19:17:59 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Aug 4 19:19:09 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c6009e3
eclass/tests: dot-a: use strip -p to avoid spurious differences within archive
Like in https://sourceware.org/bugzilla/show_bug.cgi?id=33246#c21, but it
showed up in our tests too.
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index dd68bc00eeaf..982e02c28e62 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -428,7 +428,7 @@ test_strip_lto() {
$(tc-getCC) a.c -o a.o -c -flto -ggdb3 || return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -d foo.a || return 1
+ $(tc-getSTRIP) -p -d foo.a || return 1
# They should NOT differ after stripping because it
# can't be safely stripped without special arguments.
@@ -447,7 +447,7 @@ test_strip_lto() {
$(tc-getCC) a.c -o a.o -c -flto -ffat-lto-objects -ggdb3 ||
return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -d foo.a || return 1
+ $(tc-getSTRIP) -p -d foo.a || return 1
# They should NOT differ after stripping because it
# can't be safely stripped without special arguments.
@@ -525,7 +525,7 @@ test_strip_nolto() {
$(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -d foo.a || return 1
+ $(tc-getSTRIP) -p -d foo.a || return 1
# They should differ after stripping.
cmp -s foo.a foo.a.bak && return 1
@@ -549,7 +549,7 @@ test_strip_nolto() {
$(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
$(tc-getAR) q foo.a a.o 2>/dev/null || return 1
cp foo.a foo.a.bak || return 1
- $(tc-getSTRIP) -d foo.a || return 1
+ $(tc-getSTRIP) -p -d foo.a || return 1
# They should differ after stripping.
cmp -s foo.a foo.a.bak && return 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: a09c4b76b75d4a3d34a60bc6030220563b838743
Author: Sam James gentoo org>
AuthorDate: Wed Jul 23 21:31:44 2025 +
Commit: Sam James gentoo org>
CommitDate: Wed Jul 23 22:35:55 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a09c4b76
eclass/tests: dot-a: add missing `local`
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 33c1573385ef..8a5e4739b1fa 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -511,12 +511,14 @@ test_strip_nolto() {
_repeat_tests_with_compilers() {
# Call test_lto_guarantee_fat and test_strip_lto_bytecode with
# various compilers and linkers.
+ local toolchain
for toolchain in gcc:ar clang:llvm-ar ; do
CC=${toolchain%:*}
AR=${toolchain#*:}
type -P ${CC} &>/dev/null || continue
type -P ${AR} &>/dev/null || continue
+ local linker
for linker in gold bfd lld mold gold ; do
# lld doesn't support GCC LTO:
https://github.com/llvm/llvm-project/issues/41791
[[ ${CC} == gcc && ${linker} == lld ]] && continue
@@ -535,6 +537,7 @@ _repeat_mixed_tests_with_linkers() {
#
# Needs both GCC and Clang to test mixing their outputs.
if type -P gcc &>/dev/null && type -P clang &>/dev/null ; then
+ local linker
for linker in bfd lld mold gold ; do
# lld doesn't support GCC LTO:
https://github.com/llvm/llvm-project/issues/41791
[[ ${CC} == gcc && ${linker} == lld ]] && continue
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: d04a78e0813974c43508a20c0d2b9ea687ef162d
Author: Sam James gentoo org>
AuthorDate: Wed Jul 23 22:31:54 2025 +
Commit: Sam James gentoo org>
CommitDate: Wed Jul 23 22:35:56 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d04a78e0
eclass/tests: dot-a: check if strip dies on LLVM LTO archives
Bug: https://sourceware.org/PR33198
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 56 +++
1 file changed, 56 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 8a5e4739b1fa..dd68bc00eeaf 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -458,6 +458,61 @@ test_strip_lto() {
tend ${ret} "strip operated on a fat LTO archive when it shouldn't"
}
+test_strip_lto_mixed() {
+ # This is more of a test for https://sourceware.org/PR33198.
+ # It'll only happen in a Gentoo packaging context if a package
+ # uses Clang for some parts of the build or similar.
+ if ! type -P gcc &>/dev/null || ! type -P clang &>/dev/null ; then
+ return
+ fi
+
+ # If we have a static archive with Clang LTO members, does strip
+ # error out wrongly, or does it work? Note that this can only
+ # happen in a mixed build because strip-lto-bytecode checks for
+ # the toolchain type before deciding which strip to use.
+ tbegin "whether strip accepts a Clang IR archive"
+ ret=0
+ (
+ export CFLAGS="-O2 -flto"
+
+ rm test.a 2>/dev/null
+
+ clang ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
+ $(tc-getAR) q test.a a.o 2>/dev/null || return 1
+
+ # Pretend that gcc built a.o/test.a so that we use
+ # GNU Binutils strip to trigger the bug.
+ CC=gcc strip-lto-bytecode test.a || return 1
+
+ return 0
+ ) || ret=1
+ tend ${ret} "strip did not accept a Clang IR archive"
+
+ # If we have a static archive with Clang fat LTO members, can we link
+ # against the stripped archive?
+ # Note that this can only happen in a mixed build because
strip-lto-bytecode
+ # checks for the toolchain type before deciding which strip to use.
+ tbegin "whether strip corrupts a Clang fat IR archive"
+ ret=0
+ (
+ export CFLAGS="-O2 -flto"
+
+ lto-guarantee-fat
+
+ rm test.a 2>/dev/null
+
+ clang ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
+ $(tc-getAR) q test.a a.o 2>/dev/null || return 1
+
+ # Pretend that gcc built a.o/test.a so that we use
+ # GNU Binutils strip to trigger the bug.
+ CC=gcc strip-lto-bytecode test.a || return 1
+
+ clang ${CFLAGS} ${LDFLAGS} -fno-lto main.c test.a -o main ||
return 1
+ ) || ret=1
+ tend ${ret} "strip corrupted a Clang IR archive, couldn't link against
the result"
+}
+
test_strip_nolto() {
# Check whether regular (non-LTO'd) static libraries are stripped
# and not ignored (bug #957882, https://sourceware.org/PR33078).
@@ -565,5 +620,6 @@ CC=${CC_orig}
AR=${AR_orig}
test_search_recursion
test_strip_lto
+test_strip_lto_mixed
test_strip_nolto
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 1b826e95ac66bf54e532bb155261f4a39419efa9
Author: Sam James gentoo org>
AuthorDate: Fri Jun 13 09:21:07 2025 +
Commit: Sam James gentoo org>
CommitDate: Fri Jun 13 09:21:46 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b826e95
eclass/tests: dot-a: add commentary for strip test
This is more of a test for https://sourceware.org/PR21479 given
one needs -ffat-lto-objects for our purposes in dot-a.eclass,
but still, strip shouldn't break a non-fat object, and we want
to know if that regresses.
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 4
1 file changed, 4 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index d32d73229026..33c1573385ef 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -415,6 +415,10 @@ test_search_recursion() {
}
test_strip_lto() {
+ # This is more of a test for https://sourceware.org/PR21479 given
+ # one needs -ffat-lto-objects for our purposes in dot-a.eclass,
+ # but still, strip shouldn't break a non-fat object, and we want
+ # to know if that regresses.
tbegin "whether strip ignores LTO static archives"
ret=0
(
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 44699664fa7aba134c327acb38c40851e0813ff4
Author: Sam James gentoo org>
AuthorDate: Fri Jun 13 08:48:42 2025 +
Commit: Sam James gentoo org>
CommitDate: Fri Jun 13 08:50:38 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44699664
eclass/tests: dot-a: add simple strip tests
This makes clear what the expected behaviour is outside of our eclass
machinery (even though it is tested via that with special strip args).
It's useful because the original issue necessitating dot-a.eclass meant we
only test the ranlib case rather than the regular archive one before this.
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 41 +
1 file changed, 41 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 7f757a5789ed..d32d73229026 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -414,6 +414,46 @@ test_search_recursion() {
tend ${ret} "Unexpected LTO object found"
}
+test_strip_lto() {
+ tbegin "whether strip ignores LTO static archives"
+ ret=0
+ (
+ rm foo.a foo.a.bak 2>/dev/null
+ _create_test_progs
+
+ $(tc-getCC) a.c -o a.o -c -flto -ggdb3 || return 1
+ $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ cp foo.a foo.a.bak || return 1
+ $(tc-getSTRIP) -d foo.a || return 1
+
+ # They should NOT differ after stripping because it
+ # can't be safely stripped without special arguments.
+ cmp -s foo.a foo.a.bak || return 1
+
+ return 0
+ ) || ret=1
+ tend ${ret} "strip operated on an LTO archive when it shouldn't"
+
+ tbegin "whether strip ignores fat LTO static archives"
+ ret=0
+ (
+ rm foo.a foo.a.bak 2>/dev/null
+ _create_test_progs
+
+ $(tc-getCC) a.c -o a.o -c -flto -ffat-lto-objects -ggdb3 ||
return 1
+ $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ cp foo.a foo.a.bak || return 1
+ $(tc-getSTRIP) -d foo.a || return 1
+
+ # They should NOT differ after stripping because it
+ # can't be safely stripped without special arguments.
+ cmp -s foo.a foo.a.bak || return 1
+
+ return 0
+ ) || ret=1
+ tend ${ret} "strip operated on a fat LTO archive when it shouldn't"
+}
+
test_strip_nolto() {
# Check whether regular (non-LTO'd) static libraries are stripped
# and not ignored (bug #957882, https://sourceware.org/PR33078).
@@ -517,5 +557,6 @@ _repeat_mixed_tests_with_linkers
CC=${CC_orig}
AR=${AR_orig}
test_search_recursion
+test_strip_lto
test_strip_nolto
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: c4695b465b2736b418c784146cc21ec6f4dcc31e
Author: Sam James gentoo org>
AuthorDate: Fri Jun 13 08:28:17 2025 +
Commit: Sam James gentoo org>
CommitDate: Fri Jun 13 08:32:01 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4695b46
eclass/tests: add more strip tests to dot-a for non-LTO bug
Add tests that would've found the issue w/ non-LTO static libraries
not being stripped.
Bug: https://bugs.gentoo.org/957882
Bug: https://sourceware.org/PR33078
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 51 +++
1 file changed, 51 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 6a01ce5798b8..30f1ae1292bf 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -414,6 +414,56 @@ test_search_recursion() {
tend ${ret} "Unexpected LTO object found"
}
+test_strip_nolto() {
+ # Check whether regular (non-LTO'd) static libraries are stripped
+ # and not ignored (bug #957882, https://sourceware.org/PR33078).
+ tbegin "whether strip ignores non-LTO static archives"
+ ret=0
+ (
+ rm foo.a foo.a.bak 2>/dev/null
+ _create_test_progs
+
+ $(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
+ $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ cp foo.a foo.a.bak || return 1
+ $(tc-getSTRIP) -d foo.a || return 1
+
+ # They should differ after stripping.
+ cmp -s foo.a foo.a.bak && return 1
+ # The stripped version should be smaller.
+ orig_size=$(stat -c %s foo.a.bak)
+ stripped_size=$(stat -c %s foo.a)
+ (( ${stripped_size} < ${orig_size} )) || return 1
+
+ return 0
+ ) || ret=1
+ tend ${ret} "strip ignored an archive when it shouldn't"
+
+ # Check whether regular (non-LTO'd) static libraries are stripped
+ # and not ignored (bug #957882, https://sourceware.org/PR33078).
+ tbegin "whether strip -d ignores non-LTO static archives"
+ ret=0
+ (
+ rm foo.a foo.a.bak 2>/dev/null
+ _create_test_progs
+
+ $(tc-getCC) a.c -o a.o -c -ggdb3 || return 1
+ $(tc-getAR) q foo.a a.o 2>/dev/null || return 1
+ cp foo.a foo.a.bak || return 1
+ $(tc-getSTRIP) -d foo.a || return 1
+
+ # They should differ after stripping.
+ cmp -s foo.a foo.a.bak && return 1
+ # The stripped version should be smaller.
+ orig_size=$(stat -c %s foo.a.bak)
+ stripped_size=$(stat -c %s foo.a)
+ (( ${stripped_size} < ${orig_size} )) || return 1
+
+ return 0
+ ) || ret=1
+ tend ${ret} "strip -d ignored an archive when it shouldn't"
+}
+
_repeat_tests_with_compilers() {
# Call test_lto_guarantee_fat and test_strip_lto_bytecode with
# various compilers and linkers.
@@ -463,4 +513,5 @@ _create_test_progs
_repeat_tests_with_compilers
_repeat_mixed_tests_with_linkers
test_search_recursion
+test_strip_nolto
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 2e6afd611a1f8c8e54669bf3a349d4c0d3448501
Author: Sam James gentoo org>
AuthorDate: Fri Jun 13 08:31:35 2025 +
Commit: Sam James gentoo org>
CommitDate: Fri Jun 13 08:32:02 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e6afd61
eclass/tests: restore old CC/AR in dot-a
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 4
1 file changed, 4 insertions(+)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index 30f1ae1292bf..7f757a5789ed 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -509,9 +509,13 @@ _repeat_mixed_tests_with_linkers() {
# TODO: maybe test several files
mkdir -p "${tmpdir}/lto" || die
pushd "${tmpdir}/lto" >/dev/null || die
+CC_orig=${CC}
+AR_orig=${AR}
_create_test_progs
_repeat_tests_with_compilers
_repeat_mixed_tests_with_linkers
+CC=${CC_orig}
+AR=${AR_orig}
test_search_recursion
test_strip_nolto
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 78aadb7e0ca924cf3a7f6fec8b3118c7c23c
Author: Sam James gentoo org>
AuthorDate: Tue Jun 10 06:39:44 2025 +
Commit: Sam James gentoo org>
CommitDate: Tue Jun 10 06:39:44 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78aadb7e
eclass/tests: fix typo in toolchain.sh
Signed-off-by: Sam James 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 1ba2e6b1f29d..162ff27e17c4 100755
--- a/eclass/tests/toolchain.sh
+++ b/eclass/tests/toolchain.sh
@@ -156,7 +156,7 @@ test_var_assert() {
}
# TODO: convert these globals to helpers to ease testing against multiple
-# ${TOOLCHAIN_GCC_PV} vaues.
+# ${TOOLCHAIN_GCC_PV} values.
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
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: ebb5251f0eef8843d6c2dd78f4c2f71069420bfe
Author: Michał Górny gentoo org>
AuthorDate: Thu May 22 17:48:00 2025 +
Commit: Michał Górny gentoo org>
CommitDate: Fri May 23 18:59:05 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ebb5251f
llvm-utils.eclass: Fix llvm_prepend_path w/ no '-d' and slot arg
Closes: https://bugs.gentoo.org/951975
Signed-off-by: Michał Górny gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/42214
Closes: https://github.com/gentoo/gentoo/pull/42214
Signed-off-by: Michał Górny gentoo.org>
eclass/llvm-utils.eclass | 5 ++---
eclass/tests/llvm-utils.sh | 21 +
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/eclass/llvm-utils.eclass b/eclass/llvm-utils.eclass
index abe8bb7d7d0f..98fc81408415 100644
--- a/eclass/llvm-utils.eclass
+++ b/eclass/llvm-utils.eclass
@@ -126,10 +126,9 @@ llvm_fix_tool_path() {
llvm_prepend_path() {
debug-print-function ${FUNCNAME} "$@"
- local prefix
- case ${1--d} in
+ local prefix=${ESYSROOT}
+ case ${1} in
-d)
- prefix=${ESYSROOT}
shift
;;
-b)
diff --git a/eclass/tests/llvm-utils.sh b/eclass/tests/llvm-utils.sh
index 4ba767a442f2..a3219d23b491 100755
--- a/eclass/tests/llvm-utils.sh
+++ b/eclass/tests/llvm-utils.sh
@@ -104,6 +104,8 @@ test_fix_tool_path AR ar 1
test_fix_tool_path AR ar 0
ESYSROOT=
+einfo "Testing with ESYSROOT=${ESYSROOT}"
+eindent
test_prepend_path 17 /usr/bin /usr/bin:/usr/lib/llvm/17/bin
test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin
/usr/lib/llvm/17/bin:/usr/bin
test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin
/usr/bin:/usr/lib/llvm/17/bin
@@ -123,5 +125,24 @@ test_prepend_path 18
/usr/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin \
/usr/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/lib/llvm/16/bin
test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin:/usr/lib/llvm/16/bin \
/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin:/usr/lib/llvm/16/bin
+eoutdent
+
+ESYSROOT=/foo
+einfo "Testing with ESYSROOT=${ESYSROOT}"
+eindent
+test_prepend_path 17 /usr/bin /usr/bin:/foo/usr/lib/llvm/17/bin
+test_prepend_path 17 /usr/lib/llvm/17/bin:/usr/bin \
+ /foo/usr/lib/llvm/17/bin:/usr/lib/llvm/17/bin:/usr/bin
+test_prepend_path 17 /usr/bin:/usr/lib/llvm/17/bin: \
+ /usr/bin:/foo/usr/lib/llvm/17/bin:/usr/lib/llvm/17/bin
+test_prepend_path 17 /foo/usr/lib/llvm/17/bin:/usr/bin \
+ /foo/usr/lib/llvm/17/bin:/usr/bin
+test_prepend_path 17 /usr/bin:/foo/usr/lib/llvm/17/bin: \
+ /usr/bin:/foo/usr/lib/llvm/17/bin
+test_prepend_path 18 /usr/lib/llvm/17/bin:/usr/bin \
+ /foo/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin:/usr/bin
+test_prepend_path 18 /foo/usr/lib/llvm/17/bin:/usr/bin \
+ /foo/usr/lib/llvm/18/bin:/foo/usr/lib/llvm/17/bin:/usr/bin
+eoutdent
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 0cd5afe4bd2b823721c0a7d7a5750fd15b6edf5c
Author: Michał Górny gentoo org>
AuthorDate: Thu May 22 17:42:56 2025 +
Commit: Michał Górny gentoo org>
CommitDate: Fri May 23 18:59:04 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0cd5afe4
eclass/tests/llvm-utils.sh: Fix testing without old clang
Signed-off-by: Michał Górny gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/42214
Signed-off-by: Michał Górny gentoo.org>
eclass/tests/llvm-utils.sh | 9 +
1 file changed, 9 insertions(+)
diff --git a/eclass/tests/llvm-utils.sh b/eclass/tests/llvm-utils.sh
index 6fe3da3eda13..4ba767a442f2 100755
--- a/eclass/tests/llvm-utils.sh
+++ b/eclass/tests/llvm-utils.sh
@@ -81,6 +81,15 @@ test_prepend_path() {
tend ${?}
}
+TMPDIR=$(mktemp -d)
+trap 'rm -r "${TMPDIR}"' EXIT
+
+for x in clang-19 clang-17 clang++-17 x86_64-pc-linux-gnu-clang-17; do
+ > "${TMPDIR}/${x}" || die
+done
+chmod +x "${TMPDIR}"/* || die
+export PATH=${TMPDIR}:${PATH}
+
test_fix_clang_version CC clang 19.0.0git78b4e7c5 clang-19
test_fix_clang_version CC clang 17.0.6 clang-17
test_fix_clang_version CXX clang++ 17.0.6 clang++-17
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 4225e61a4368f275d1f77f71f06cc082be4d
Author: Michał Górny gentoo org>
AuthorDate: Wed May 7 17:59:13 2025 +
Commit: Michał Górny gentoo org>
CommitDate: Thu May 8 12:32:52 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4225e61a
python-utils-r1.eclass: Add python3.14 targets
Signed-off-by: Michał Górny gentoo.org>
eclass/python-utils-r1.eclass | 10 +-
eclass/tests/python-utils-r1.sh | 10 +-
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 4fedd2b8a790..a1ca388ab730 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -40,8 +40,8 @@ inherit multiprocessing toolchain-funcs
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3_11
- python3_13t
- python3_{11..13}
+ python3_{13..14}t
+ python3_{11..14}
)
readonly _PYTHON_ALL_IMPLS
@@ -81,7 +81,7 @@ _python_verify_patterns() {
local impl pattern
for pattern; do
case ${pattern} in
- -[23]|3.[89]|3.1[0-3])
+ -[23]|3.[89]|3.1[0-4])
continue
;;
esac
@@ -137,7 +137,7 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- pypy3_11|python3_9|python3_1[1-3]|python3_13t)
+
pypy3_11|python3_9|python3_1[1-4]|python3_1[3-4]t)
;;
jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10)
obsolete+=( "${i}" )
@@ -230,7 +230,7 @@ _python_impl_matches() {
fi
return 0
;;
- 3.[89]|3.1[0-3])
+ 3.[89]|3.1[0-4])
[[ ${impl%t} == python${pattern/./_} || ${impl}
== pypy${pattern/./_} ]] &&
return 0
;;
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 6a647c3a9622..17fd4bc24de7 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -64,7 +64,7 @@ tmpfile=$(mktemp)
inherit multilib python-utils-r1
-for minor in {11..13} 13t; do
+for minor in {11..14} {13..14}t; do
ebegin "Testing python3.${minor}"
eindent
test_var EPYTHON "python3_${minor}" "python3.${minor}"
@@ -209,6 +209,14 @@ 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 python3_13 3.13" 0
+test_is "_python_impl_matches python3_13t 3.13" 0
+test_is "_python_impl_matches python3_13 3.14" 1
+test_is "_python_impl_matches python3_13t 3.14" 1
+test_is "_python_impl_matches python3_14 3.13" 1
+test_is "_python_impl_matches python3_14t 3.13" 1
+test_is "_python_impl_matches python3_14 3.14" 0
+test_is "_python_impl_matches python3_14t 3.14" 0
test_is "_python_impl_matches pypy3_11 3.10" 1
test_is "_python_impl_matches pypy3_11 3.11" 0
test_is "_python_impl_matches pypy3_11 3.12" 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 89468b4dc0cf1ac417a1f3fb499693dc0c86e2fa
Author: Sam James gentoo org>
AuthorDate: Tue May 6 07:22:07 2025 +
Commit: Sam James gentoo org>
CommitDate: Tue May 6 08:45:09 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89468b4d
eclass/tests: tweak dot-a.sh tests for binutils
I'm not sure if I made a mistake when testing this before or if it changed
when the strip patch did, but the new behaviour is fine too with the
latest patch for Binutils.
I think what happened is that the patch changed to only mangle with -R ...
where ... is for LTO sections, which is fine for us. But doing this in a
separate commit so I can revert it easily if needed.
See https://sourceware.org/bugzilla/show_bug.cgi?id=21479#c13.
Signed-off-by: Sam James gentoo.org>
eclass/tests/dot-a.sh | 45 -
1 file changed, 45 deletions(-)
diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh
index de60c4dc7605..6a01ce5798b8 100755
--- a/eclass/tests/dot-a.sh
+++ b/eclass/tests/dot-a.sh
@@ -9,45 +9,6 @@ source version-funcs.sh || exit
inherit dot-a
-_strip_is_gnu() {
- local name=$($(tc-getSTRIP) --version 2>&1 | head -n 1)
-
- if ! [[ ${name} =~ ^GNU.*strip ]] ; then
- return 1
- fi
-
- return 0
-}
-
-_check_binutils_version() {
- local tool=$1
- # Convert this:
- # ```
- # GNU ld (Gentoo 2.38 p4) 2.38
- # Copyright (C) 2022 Free Software Foundation, Inc.
- # This program is free software; you may redistribute it under the
terms of
- # the GNU General Public License version 3 or (at your option) a later
version.
- # This program has absolutely no warranty.
- # ```
- #
- # into...
- # ```
- # 2.38
- # ```
- local ver=$(${tool} --version 2>&1 | head -n 1 | rev | cut -d' ' -f1 |
rev)
-
- if ! [[ ${ver} =~ [0-9].[0-9][0-9](.[0-9]?) ]] ; then
- # Skip if unrecognised format so we don't pass something
- # odd into ver_cut.
- return
- fi
-
- ver_major=$(ver_cut 1 "${ver}")
- ver_minor=$(ver_cut 2 "${ver}")
- ver_extra=$(ver_cut 3 "${ver}")
- echo ${ver_major}.${ver_minor}${ver_extra:+.${ver_extra}}
-}
-
_create_test_progs() {
cat <<-EOF > a.c
int foo();
@@ -154,9 +115,6 @@ test_strip_lto_bytecode() {
# strip-lto-bytecode will error out early with LLVM,
# so stop the test here.
tc-is-clang && return 0
- # strip with >= GNU Binutils 2.45 won't corrupt the archive:
- # https://sourceware.org/PR21479
- _strip_is_gnu && ver_test $(_check_binutils_version
$(tc-getSTRIP)) -gt 2.44 && return 0
$(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
@@ -195,9 +153,6 @@ test_strip_lto_bytecode() {
# strip-lto-bytecode will error out early with LLVM,
# so stop the test here.
tc-is-clang && return 0
- # strip with >= GNU Binutils 2.45 won't corrupt the archive:
- # https://sourceware.org/PR21479
- _strip_is_gnu && ver_test $(_check_binutils_version
$(tc-getSTRIP)) -gt 2.44 && return 0
$(tc-getCC) ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1
$(tc-getAR) q test.a a.o 2>/dev/null || return 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 8394e261f92828c50db41f257c8294acfb9ea533
Author: Michał Górny gentoo org>
AuthorDate: Fri May 2 18:25:11 2025 +
Commit: Michał Górny gentoo org>
CommitDate: Fri May 2 18:25:11 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8394e261
python-utils-r1.eclass: Add more tests for impl match corner cases
Signed-off-by: Michał Górny gentoo.org>
eclass/tests/python-utils-r1.sh | 8
1 file changed, 8 insertions(+)
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index ccb599ca8400..6a647c3a9622 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -221,6 +221,14 @@ test_is "_python_impl_matches python3_12 3.10 3.11" 1
test_is "_python_impl_matches python3_12 3.11 3.12" 0
test_is "_python_impl_matches python3_12 3.10 3.12" 0
test_is "_python_impl_matches python3_12 3.10 3.11 3.12" 0
+test_is "_python_impl_matches python3_11 python3_10 python3_11" 0
+test_is "_python_impl_matches python3_11 python3_11 python3_12" 0
+test_is "_python_impl_matches python3_11 python3_10 python3_12" 1
+test_is "_python_impl_matches python3_11 python3_10 python3_11 python3_12" 0
+test_is "_python_impl_matches python3_12 python3_10 python3_11" 1
+test_is "_python_impl_matches python3_12 python3_11 python3_12" 0
+test_is "_python_impl_matches python3_12 python3_10 python3_12" 0
+test_is "_python_impl_matches python3_12 python3_10 python3_11 python3_12" 0
eoutdent
rm "${tmpfile}"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 18accbc44e76533dfc42c1bd4666156972e53c50
Author: Petr Vaněk gentoo org>
AuthorDate: Fri May 2 08:02:52 2025 +
Commit: Petr Vaněk gentoo org>
CommitDate: Fri May 2 08:02:52 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18accbc4
eclass/tests: fix typo in bgo number
The last digit was missing in bgo link.
Fixes: d133f3d0eb16 ("python-utils-r1.eclass: Fix matching pattern list
starting with 3.10")
Bug: https://bugs.gentoo.org/955213
Signed-off-by: Petr Vaněk 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 09de934e703d..ccb599ca8400 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -212,7 +212,7 @@ test_is "_python_impl_matches python3_12 3.12" 0
test_is "_python_impl_matches pypy3_11 3.10" 1
test_is "_python_impl_matches pypy3_11 3.11" 0
test_is "_python_impl_matches pypy3_11 3.12" 1
-# https://bugs.gentoo.org/95521
+# https://bugs.gentoo.org/955213
test_is "_python_impl_matches python3_11 3.10 3.11" 0
test_is "_python_impl_matches python3_11 3.11 3.12" 0
test_is "_python_impl_matches python3_11 3.10 3.12" 1
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: d133f3d0eb162f6d6e1385f9c96f9814315cd9c9
Author: Michał Górny gentoo org>
AuthorDate: Fri May 2 04:10:01 2025 +
Commit: Michał Górny gentoo org>
CommitDate: Fri May 2 04:10:01 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d133f3d0
python-utils-r1.eclass: Fix matching pattern list starting with 3.10
Closes: https://bugs.gentoo.org/955213
Fixes: 92cf8fae5081 (Disable Python 3.10 / PyPy 3.10 targets)
Signed-off-by: Michał Górny gentoo.org>
eclass/python-utils-r1.eclass | 3 ++-
eclass/tests/python-utils-r1.sh | 9 +
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 860250cbe1eb..ef05a58e1b13 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -208,6 +208,8 @@ _python_impl_matches() {
local impl=${1/./_} pattern
shift
+ # note: do not add "return 1" below, the function is supposed
+ # to iterate until it matches something
for pattern; do
case ${pattern} in
-2|python2*|pypy)
@@ -229,7 +231,6 @@ _python_impl_matches() {
return 0
;;
3.10)
- return 1
;;
3.8|3.9|3.1[1-3])
[[ ${impl%t} == python${pattern/./_} || ${impl}
== pypy${pattern/./_} ]] &&
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index eb5201bf413c..09de934e703d 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -212,6 +212,15 @@ test_is "_python_impl_matches python3_12 3.12" 0
test_is "_python_impl_matches pypy3_11 3.10" 1
test_is "_python_impl_matches pypy3_11 3.11" 0
test_is "_python_impl_matches pypy3_11 3.12" 1
+# https://bugs.gentoo.org/95521
+test_is "_python_impl_matches python3_11 3.10 3.11" 0
+test_is "_python_impl_matches python3_11 3.11 3.12" 0
+test_is "_python_impl_matches python3_11 3.10 3.12" 1
+test_is "_python_impl_matches python3_11 3.10 3.11 3.12" 0
+test_is "_python_impl_matches python3_12 3.10 3.11" 1
+test_is "_python_impl_matches python3_12 3.11 3.12" 0
+test_is "_python_impl_matches python3_12 3.10 3.12" 0
+test_is "_python_impl_matches python3_12 3.10 3.11 3.12" 0
eoutdent
rm "${tmpfile}"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 5ba9cc09aa8dc79f4a837eac28ae874e27791378
Author: Michał Górny gentoo org>
AuthorDate: Tue Apr 22 10:43:37 2025 +
Commit: Michał Górny gentoo org>
CommitDate: Thu May 1 11:36:15 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ba9cc09
eclass/tests/python-utils-r1.sh: Add missing multilib inherit
Signed-off-by: Michał Górny gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/41697
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 c08c224cfdbd..eb5201bf413c 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -62,7 +62,7 @@ test_fix_shebang() {
tmpfile=$(mktemp)
-inherit python-utils-r1
+inherit multilib python-utils-r1
for minor in {11..13} 13t; do
ebegin "Testing python3.${minor}"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 31153db1f45836c37cda3d0c12643c67e1eaca85
Author: Eli Schwartz gentoo org>
AuthorDate: Wed Apr 23 14:53:58 2025 +
Commit: Sam James gentoo org>
CommitDate: Wed Apr 23 15:17:40 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31153db1
systemd.eclass: make all fallback paths use /usr/lib
Back in 2018, the eclass was changed to ensure that the canonical path
used for results was in /lib, since that works for split-usr systems
running systemd while also supporting merged-usr systems due to portage
following symlinks at install time. It even works for binpkgs.
But here and now in 2025, systemd doesn't support split-usr at all.
There is no point in having unit files install conservatively in
/lib/systemd. Update the path to accommodate the new reality.
This mostly has no effect. On openrc profiles, or for packages that use
systemd_dounit without pulling in pkgconfig, binpkgs will be created
with a different, but still working path, which then triggers iwdevtools
warnings when you reinstall a former binpkg from source, as it thinks
the file has "moved". e.g.
```
* CMP: =net-misc/radvd-2.19-r7 with net-misc/radvd-2.20/image
* FILES:-lib/systemd/system/radvd.service
* FILES:+usr/lib/systemd/system/radvd.service
* --> FILES(+1,-1)
```
Signed-off-by: Eli Schwartz gentoo.org>
Signed-off-by: Sam James gentoo.org>
eclass/systemd.eclass | 12 ++--
eclass/tests/systemd.sh | 10 +-
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index f908ad688d9d..f0b4b79d9c32 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -1,4 +1,4 @@
-# Copyright 2011-2024 Gentoo Authors
+# Copyright 2011-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: systemd.eclass
@@ -77,7 +77,7 @@ _systemd_unprefix() {
systemd_get_systemunitdir() {
debug-print-function ${FUNCNAME} "$@"
- _systemd_get_dir systemdsystemunitdir /lib/systemd/system
+ _systemd_get_dir systemdsystemunitdir /usr/lib/systemd/system
}
# @FUNCTION: systemd_get_userunitdir
@@ -99,7 +99,7 @@ systemd_get_userunitdir() {
systemd_get_utildir() {
debug-print-function ${FUNCNAME} "$@"
- _systemd_get_dir systemdutildir /lib/systemd
+ _systemd_get_dir systemdutildir /usr/lib/systemd
}
# @FUNCTION: systemd_get_systemgeneratordir
@@ -109,7 +109,7 @@ systemd_get_utildir() {
systemd_get_systemgeneratordir() {
debug-print-function ${FUNCNAME} "$@"
- _systemd_get_dir systemdsystemgeneratordir
/lib/systemd/system-generators
+ _systemd_get_dir systemdsystemgeneratordir
/usr/lib/systemd/system-generators
}
# @FUNCTION: systemd_get_systempresetdir
@@ -119,7 +119,7 @@ systemd_get_systemgeneratordir() {
systemd_get_systempresetdir() {
debug-print-function ${FUNCNAME} "$@"
- _systemd_get_dir systemdsystempresetdir /lib/systemd/system-preset
+ _systemd_get_dir systemdsystempresetdir /usr/lib/systemd/system-preset
}
# @FUNCTION: systemd_get_sleepdir
@@ -127,7 +127,7 @@ systemd_get_systempresetdir() {
# Output the path for the system sleep directory.
systemd_get_sleepdir() {
debug-print-function ${FUNCNAME} "$@"
- _systemd_get_dir systemdsleepdir /lib/systemd/system-sleep
+ _systemd_get_dir systemdsleepdir /usr/lib/systemd/system-sleep
}
# @FUNCTION: systemd_dounit
diff --git a/eclass/tests/systemd.sh b/eclass/tests/systemd.sh
index f870df4b7a12..3b735c95bf6a 100755
--- a/eclass/tests/systemd.sh
+++ b/eclass/tests/systemd.sh
@@ -35,11 +35,11 @@ test_systemd_unprefix() {
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_system_dir /usr/lib/systemd/system systemd_get_systemunitdir
+test_system_dir /usr/lib/systemd systemd_get_utildir
+test_system_dir /usr/lib/systemd/system-generators
systemd_get_systemgeneratordir
+test_system_dir /usr/lib/systemd/system-preset systemd_get_systempresetdir
+test_system_dir /usr/lib/systemd/system-sleep systemd_get_sleepdir
test_user_dir /usr/lib/systemd/user systemd_get_userunitdir
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: e54a05e27512a039417cbaf448a998dbf700585d
Author: Eric Joldasov landless-city net>
AuthorDate: Sat Jan 18 17:19:16 2025 +
Commit: Sam James gentoo org>
CommitDate: Mon Mar 3 19:26:27 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e54a05e2
zig-utils.eclass: fix translating `-march=unset` and `-march=native` on ARM
Reported on IRC.
Reported-by: sin-ack protonmail.com>
Signed-off-by: Eric Joldasov landless-city.net>
Signed-off-by: Sam James gentoo.org>
eclass/tests/zig-utils.sh | 8 +++-
eclass/zig-utils.eclass | 18 +-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/eclass/tests/zig-utils.sh b/eclass/tests/zig-utils.sh
index 14af1d2105e3..3c98134b9006 100755
--- a/eclass/tests/zig-utils.sh
+++ b/eclass/tests/zig-utils.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2024 Gentoo Authors
+# Copyright 2024-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -197,6 +197,8 @@ c_to_zig_map=(
# https://bugs.gentoo.org/924920
["-march=armv7-a -mfpu=vfpv3-d16
-mfloat-abi=hard"]=generic+v7a+vfp3d16-soft_float
+
+ ["-march=armv7-a -march=unset"]="generic-soft_float"
)
test-convert_c_env_to_zig_cpu c_to_zig_map "${CHOST}"
tend ${?}
@@ -210,6 +212,10 @@ c_to_zig_map=(
["-march=armv8.3-a"]="generic+v8_3a"
["-mcpu=cortex-a78 -march=armv8.3-a"]="cortex_a78+v8_3a"
+
+ ["-march=native"]="native"
+ ["-march=native -mtune=native"]="generic"
+ ["-mcpu=cortex-a78 -march=native"]="cortex_a78"
)
test-convert_c_env_to_zig_cpu c_to_zig_map "${CHOST}"
tend ${?}
diff --git a/eclass/zig-utils.eclass b/eclass/zig-utils.eclass
index d92fd0724b17..e9d91b8f5f52 100644
--- a/eclass/zig-utils.eclass
+++ b/eclass/zig-utils.eclass
@@ -313,6 +313,7 @@ zig-utils_c_env_to_zig_cpu() {
local c_flags_march="$(_get-c-option march)"
local c_flags_mcpu="$(_get-c-option mcpu)"
local c_flags_mfpu="$(_get-c-option mfpu)"
+ local c_flags_mtune="$(_get-c-option mtune)"
local base_cpu features=""
@@ -332,13 +333,28 @@ zig-utils_c_env_to_zig_cpu() {
esac
case "${c_flags_march}" in
- "") ;;
+ "" | unset) ;;
armv*)
local
c_arm_family="${c_flags_march##arm}"
c_arm_family="${c_arm_family//./_}"
c_arm_family="${c_arm_family//-/}"
features+="+${c_arm_family}"
;;
+ native)
+ # GCC docs: This option has no effect if
+ # the compiler is unable to recognize
the
+ # architecture of the host system.
+ #
+ # When -march=native is given and no
other
+ # -mcpu or -mtune is given then ...
-march=native
+ # is treated as -mcpu=native.
+ if [[ -z
"${c_flags_mcpu}${c_flags_mtune}" ]]; then
+ base_cpu=native
+ else
+ : # Zig can not detect CPU
features (architecture
+ # in our case) separately from
model, so we ignore it.
+ fi
+ ;;
*) features+="+${c_flags_march}";;
esac
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 732340d13de61dd50e53c6f6b01b0303265c2e2c
Author: Michał Górny gentoo org>
AuthorDate: Fri Dec 20 20:55:50 2024 +
Commit: Michał Górny gentoo org>
CommitDate: Mon Dec 30 11:32:34 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=732340d1
eclass/tests/llvm-r2.sh: Add tests for llvm-config
Signed-off-by: Michał Górny gentoo.org>
eclass/tests/llvm-r2.sh | 87 +
1 file changed, 87 insertions(+)
diff --git a/eclass/tests/llvm-r2.sh b/eclass/tests/llvm-r2.sh
index e715f7e34e82..fde76d2d682e 100755
--- a/eclass/tests/llvm-r2.sh
+++ b/eclass/tests/llvm-r2.sh
@@ -63,6 +63,80 @@ test_gen_dep() {
tend ${?}
}
+LLVM_CONFIG_OPTIONS=(
+ --assertion-mode
+ --bindir
+ --build-mode
+ --build-system
+ --cflags
+ --cmakedir
+ --components
+ --cppflags
+ --cxxflags
+ --has-rtti
+ --host-target
+ --ignore-libllvm
+ --includedir
+ --ldflags
+ --libdir
+ --libfiles
+ --libnames
+ --libs
+ --link-shared
+ --link-static
+ --obj-root
+ --prefix
+ --shared-mode
+ --system-libs
+ --targets-built
+ --version
+)
+
+normalize_list() {
+ "${@}" |
+ sed -e 's:\s\+:\n:g' |
+ sed -e '/^$/d' |
+ sort
+ local ps=${PIPESTATUS[*]}
+ [[ ${ps} == '0 0 0 0' ]] || die "normalize_list pipe failed: ${ps}"
+}
+
+test_llvm_config() {
+ einfo "llvm-config for slot ${LLVM_SLOT}, libdir ${LLVM_LIBDIR}"
+ eindent
+
+ generate_llvm_config > "${TMP}/llvm-config" || die
+ local triple=$(sh "${TMP}/llvm-config" --host-target || die)
+ local llvm_config=/usr/lib/llvm/${LLVM_SLOT}/bin/${triple}-llvm-config
+
+ local option res
+ for option in "${LLVM_CONFIG_OPTIONS[@]}"; do
+ tbegin "${option}"
+
+ normalize_list sh "${TMP}/llvm-config" "${option}" >
"${TMP}/our"
+ normalize_list "${llvm_config}" "${option}" > "${TMP}/upstream"
+ case ${option} in
+ --components)
+ # our components are a superset of what
llvm-config yields
+ res=$(comm -13 "${TMP}/our" "${TMP}/upstream")
+ ;;
+ *)
+ # expect all elements to match
+ res=$(comm -3 "${TMP}/our" "${TMP}/upstream")
+ ;;
+ esac
+
+ if [[ -z ${res} ]]; then
+ tend 0
+ else
+ eerror "$(diff -u "${TMP}/our" "${TMP}/upstream")"
+ tend 1
+ fi
+ done
+
+ eoutdent
+}
+
# full range
test_globals '14 15 16 17 18 19' \
"+llvm_slot_19 llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18" \
@@ -98,4 +172,17 @@ test_gen_dep 'llvm-core/llvm:${LLVM_SLOT}
llvm-core/clang:${LLVM_SLOT}' <<-EOF
llvm_slot_18? ( llvm-core/llvm:18 llvm-core/clang:18 )
EOF
+TMP=$(mktemp -d || die)
+trap 'rm -rf \"${TMP}\"' EXIT
+get_libdir() { echo "${LLVM_LIBDIR}"; }
+
+for installed_llvm_cmake in /usr/lib/llvm/*/lib*/cmake; do
+ installed_llvm_libdir=${installed_llvm_cmake%/*}
+ LLVM_LIBDIR=${installed_llvm_libdir##*/}
+ installed_llvm=${installed_llvm_libdir%/*}
+ LLVM_SLOT=${installed_llvm##*/}
+
+ test_llvm_config
+done
+
texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 23bf4f998ffe1448f122403d23f084ce29207101
Author: Michał Górny gentoo org>
AuthorDate: Fri Dec 20 20:39:53 2024 +
Commit: Michał Górny gentoo org>
CommitDate: Mon Dec 30 11:32:33 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23bf4f99
eclass/tests: Copy llvm-r1 tests to llvm-r2.sh
Signed-off-by: Michał Górny gentoo.org>
eclass/tests/llvm-r2.sh | 101
1 file changed, 101 insertions(+)
diff --git a/eclass/tests/llvm-r2.sh b/eclass/tests/llvm-r2.sh
new file mode 100755
index ..e715f7e34e82
--- /dev/null
+++ b/eclass/tests/llvm-r2.sh
@@ -0,0 +1,101 @@
+#!/bin/bash
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+source tests-common.sh || exit
+
+EAPI=8
+
+test_globals() {
+ local compat=${1}
+ local expected_iuse=${2}
+ local expected_required_use=${3}
+ local expected_usedep=${4}
+ local x
+
+ tbegin "LLVM_COMPAT=( ${compat} )"
+
+ (
+ local fail=0
+ local LLVM_COMPAT=( ${compat} )
+
+ inherit llvm-r2
+
+ if [[ ${IUSE%% } != ${expected_iuse} ]]; then
+ eerror " IUSE: ${IUSE%% }"
+ eerror "does not match: ${expected_iuse}"
+ fail=1
+ fi
+
+ if [[ ${REQUIRED_USE} != ${expected_required_use} ]]; then
+ eerror " REQUIRED_USE: ${REQUIRED_USE}"
+ eerror "does not match: ${expected_required_use}"
+ fail=1
+ fi
+
+ if [[ ${LLVM_USEDEP} != ${expected_usedep} ]]; then
+ eerror " LLVM_USEDEP: ${LLVM_USEDEP}"
+ eerror "does not match: ${expected_usedep}"
+ fail=1
+ fi
+
+ exit "${fail}"
+ )
+
+ tend "${?}"
+}
+
+test_gen_dep() {
+ local arg=${1}
+ local expected
+ read -r -d '' expected
+
+ tbegin "llvm_gen_dep ${arg}"
+ local value=$(llvm_gen_dep "${arg}")
+
+ if [[ ${value} != ${expected} ]]; then
+ eerror "llvm_gen_dep ${arg}"
+ eerror "gave:"
+ eerror " ${value}"
+ eerror "expected:"
+ eerror " ${expected}"
+ fi
+ tend ${?}
+}
+
+# full range
+test_globals '14 15 16 17 18 19' \
+ "+llvm_slot_19 llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18" \
+ "^^ ( 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_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(-)?"
+# old + newer than current stable
+test_globals '15 20' \
+ "+llvm_slot_15 llvm_slot_20" \
+ "^^ ( llvm_slot_15 llvm_slot_20 )" \
+ "llvm_slot_15(-)?,llvm_slot_20(-)?"
+# newer than current stable
+test_globals '19' \
+ "+llvm_slot_19" \
+ "^^ ( llvm_slot_19 )" \
+ "llvm_slot_19(-)?"
+
+LLVM_COMPAT=( {14..18} )
+inherit llvm-r2
+
+test_gen_dep 'llvm-core/llvm:${LLVM_SLOT} llvm-core/clang:${LLVM_SLOT}' <<-EOF
+ llvm_slot_15? ( llvm-core/llvm:15 llvm-core/clang:15 )
+ llvm_slot_16? ( llvm-core/llvm:16 llvm-core/clang:16 )
+ llvm_slot_17? ( llvm-core/llvm:17 llvm-core/clang:17 )
+ llvm_slot_18? ( llvm-core/llvm:18 llvm-core/clang:18 )
+EOF
+
+texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: ceccc6c5c824f3bbe5c01e372a45f60051804727
Author: Michał Górny gentoo org>
AuthorDate: Sat Dec 21 06:52:53 2024 +
Commit: Michał Górny gentoo org>
CommitDate: Sat Dec 21 08:10:59 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ceccc6c5
eclass/tests/llvm-r1.sh: Fix function name in error message
Thanks to Sam for noticing.
Signed-off-by: Michał Górny gentoo.org>
eclass/tests/llvm-r1.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/tests/llvm-r1.sh b/eclass/tests/llvm-r1.sh
index 730b0a6db653..d4657815465d 100755
--- a/eclass/tests/llvm-r1.sh
+++ b/eclass/tests/llvm-r1.sh
@@ -54,7 +54,7 @@ test_gen_dep() {
local value=$(llvm_gen_dep "${arg}")
if [[ ${value} != ${expected} ]]; then
- eerror "python_get_usedep ${arg}"
+ eerror "llvm_gen_dep ${arg}"
eerror "gave:"
eerror " ${value}"
eerror "expected:"
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: b1f63a99ae33a215b1ae2f4f7c048bc3bc199ab2
Author: Michał Górny gentoo org>
AuthorDate: Fri Dec 20 20:39:09 2024 +
Commit: Michał Górny gentoo org>
CommitDate: Fri Dec 20 20:39:09 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1f63a99
eclass/tests/llvm-r1.sh: Remove unused functions
Signed-off-by: Michał Górny gentoo.org>
eclass/tests/llvm-r1.sh | 58 -
1 file changed, 58 deletions(-)
diff --git a/eclass/tests/llvm-r1.sh b/eclass/tests/llvm-r1.sh
index 892b773a08c9..ad6c51dfb0c0 100755
--- a/eclass/tests/llvm-r1.sh
+++ b/eclass/tests/llvm-r1.sh
@@ -63,64 +63,6 @@ test_gen_dep() {
tend ${?}
}
-test_fix_clang_version() {
- local var=${1}
- local tool=${2}
- local version=${3}
- local expected=${4}
-
- eval "${tool}() {
- cat <<-EOF
- clang version ${version}
- Target: x86_64-pc-linux-gnu
- Thread model: posix
- InstalledDir: /usr/lib/llvm/17/bin
- Configuration file:
/etc/clang/x86_64-pc-linux-gnu-clang.cfg
- EOF
- }"
-
- declare -g ${var}=${tool}
- tbegin "llvm_fix_clang_version ${var}=${tool} for ${version}"
- llvm_fix_clang_version "${var}"
- if [[ ${!var} != ${expected} ]]; then
- eerror "llvm_fix_clang_version ${var}"
- eerror "gave: ${!var}"
- eerror "expected: ${expected}"
- fi
- tend ${?}
-}
-
-test_fix_tool_path() {
- local var=${1}
- local tool=${2}
- local expected_subst=${3}
- local expected=${tool}
-
- tbegin "llvm_fix_tool_path ${1}=${2} (from llvm? ${expected_subst})"
-
- local matches=( "${BROOT}"/usr/lib/llvm/*/bin/"${tool}" )
- if [[ ${expected_subst} == 1 ]]; then
- if [[ ! -x ${matches[0]} ]]; then
- ewarn "- skipping, test requires ${tool}"
- return
- fi
-
- expected=${matches[0]}
- local -x PATH=${matches[0]%/*}
- else
- local -x PATH=
- fi
-
- declare -g ${var}=${tool}
- llvm_fix_tool_path "${var}"
- if [[ ${!var} != ${expected} ]]; then
- eerror "llvm_fix_tool_path ${var}"
- eerror "gave: ${!var}"
- eerror "expected: ${expected}"
- fi
- 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" \
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: f542439843842365f02f353619669838508b08f3
Author: Michał Górny gentoo org>
AuthorDate: Fri Dec 20 20:39:20 2024 +
Commit: Michał Górny gentoo org>
CommitDate: Fri Dec 20 20:39:20 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5424398
eclass/tests/llvm-r1.sh: Update for LLVM 19 stable
Signed-off-by: Michał Górny gentoo.org>
eclass/tests/llvm-r1.sh | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/eclass/tests/llvm-r1.sh b/eclass/tests/llvm-r1.sh
index ad6c51dfb0c0..730b0a6db653 100755
--- a/eclass/tests/llvm-r1.sh
+++ b/eclass/tests/llvm-r1.sh
@@ -65,7 +65,7 @@ test_gen_dep() {
# 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_19 llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18" \
"^^ ( 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' \
@@ -78,10 +78,10 @@ test_globals '14 15 16' \
"^^ ( llvm_slot_15 llvm_slot_16 )" \
"llvm_slot_15(-)?,llvm_slot_16(-)?"
# 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(-)?"
+test_globals '15 20' \
+ "+llvm_slot_15 llvm_slot_20" \
+ "^^ ( llvm_slot_15 llvm_slot_20 )" \
+ "llvm_slot_15(-)?,llvm_slot_20(-)?"
# newer than current stable
test_globals '19' \
"+llvm_slot_19" \
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/
commit: 15b4410cd8b6c90b3a614ecde3a5a719b0a8350c
Author: Ulrich Müller gentoo org>
AuthorDate: Sun Dec 8 21:59:57 2024 +
Commit: Ulrich Müller gentoo org>
CommitDate: Mon Dec 9 18:48:11 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15b4410c
eclass/tests: New test for eapi9-pipestatus.eclass
Signed-off-by: Ulrich Müller gentoo.org>
eclass/tests/eapi9-pipestatus.sh | 57
1 file changed, 57 insertions(+)
diff --git a/eclass/tests/eapi9-pipestatus.sh b/eclass/tests/eapi9-pipestatus.sh
new file mode 100755
index ..6264b63d9440
--- /dev/null
+++ b/eclass/tests/eapi9-pipestatus.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+source tests-common.sh || exit
+
+inherit eapi9-pipestatus
+
+tps() {
+ local exp_ret=${1} cmd=${2}
+ local have_ret
+ tbegin "${cmd} -> ret: ${exp_ret}"
+ eval "${cmd}; pipestatus"
+ have_ret=$?
+ [[ ${have_ret} -eq ${exp_ret} ]]
+ tend $? "returned: ${have_ret}"
+}
+
+tpsv() {
+ local exp_ret=${1} exp_out=${2} cmd=${3}
+ local have_ret have_out
+ tbegin "${cmd} -> ret: ${exp_ret}, out: ${exp_out}"
+ have_out=$(eval "${cmd}; pipestatus -v")
+ have_ret=$?
+ [[ ${have_ret} -eq ${exp_ret} && ${have_out} == "${exp_out}" ]]
+ tend $? "returned: ${have_ret}, output: ${have_out}"
+}
+
+txf() {
+ local out
+ tbegin "XFAIL: $*"
+ out=$("$@" 2>&1)
+ [[ ${out} == die:* ]]
+ tend $? "function did not die"
+}
+
+ret() {
+ return ${1}
+}
+
+tps 0 "true"
+tps 1 "false"
+tps 0 "true | true"
+tps 1 "false | true"
+tps 2 "ret 2 | true"
+tps 1 "true | false | true"
+tps 5 "true | false | ret 5 | true"
+tpsv 0 "0 0 0" "true | true | true"
+tpsv 1 "1 0""false | true"
+tpsv 2 "3 2 0" "ret 3 | ret 2 | true"
+
+txf pipestatus bad_arg
+txf pipestatus -v extra_arg
+
+texit
[gentoo-commits] repo/gentoo:master commit in: eclass/tests/, eclass/
commit: 6e088d1b7647178279d58973de2c4906513b3a3e
Author: Ulrich Müller gentoo org>
AuthorDate: Tue Aug 20 18:02:38 2024 +
Commit: Ulrich Müller gentoo org>
CommitDate: Tue Oct 8 15:22:35 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e088d1b
versionator.eclass: Remove dead eclass
Signed-off-by: Ulrich Müller gentoo.org>
eclass/tests/versionator_version_compare.sh | 199 ---
eclass/versionator.eclass | 519
2 files changed, 718 deletions(-)
diff --git a/eclass/tests/versionator_version_compare.sh
b/eclass/tests/versionator_version_compare.sh
deleted file mode 100755
index 2875c0f693da..
--- a/eclass/tests/versionator_version_compare.sh
+++ /dev/null
@@ -1,199 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-source tests-common.sh || exit
-
-inherit versionator
-
-eshopts_push -s extglob
-ver=( "" "lt" "eq" "gt" )
-lt=1 eq=2 gt=3
-
-test_version_compare() {
- tbegin "version_compare ${1} -${ver[${2}]} ${3}"
- version_compare "${1}" "${3}"
- local r=$?
- [[ ${r} -eq ${2} ]]
- tend $? "FAIL: ${@} (got ${r} exp ${2})"
-}
-
-echo "
- 0 $lt 1
- 1 $lt 2
- 2 $gt 1
- 2 $eq 2
- 0 $eq 0
- 10$lt 20
- 68$eq 068
- 068 $gt 67
- 068 $lt 69
-
- 1.0 $lt 2.0
- 2.0 $eq 2.0
- 2.0 $gt 1.0
-
- 1.0 $gt 0.0
- 0.0 $eq 0.0
- 0.0 $lt 1.0
-
- 0.1 $lt 0.2
- 0.2 $eq 0.2
- 0.3 $gt 0.2
-
- 1.2 $lt 2.1
- 2.1 $gt 1.2
-
- 1.2.3 $lt 1.2.4
- 1.2.4 $gt 1.2.3
-
- 1.2.0 $gt 1.2
- 1.2.1 $gt 1.2
- 1.2 $lt 1.2.1
-
- 1.2b $eq 1.2b
- 1.2b $lt 1.2c
- 1.2b $gt 1.2a
- 1.2b $gt 1.2
- 1.2 $lt 1.2a
-
- 1.3 $gt 1.2a
- 1.3 $lt 1.3a
-
- 1.0_alpha7$lt 1.0_beta7
- 1.0_beta $lt 1.0_pre
- 1.0_pre5 $lt 1.0_rc2
- 1.0_rc2 $lt 1.0
-
- 1.0_p1$gt 1.0
- 1.0_p1-r1 $gt 1.0_p1
-
- 1.0_alpha6-r1 $gt 1.0_alpha6
- 1.0_beta6-r1 $gt 1.0_alpha6-r2
-
- 1.0_pre1 $lt 1.0_p1
-
- 1.0p $gt 1.0_p1
- 1.0r $gt 1.0-r1
- 1.6.15$gt 1.6.10-r2
- 1.6.10-r2 $lt 1.6.15
-
-" | while read a b c ; do
- [[ -z "${a}${b}${c}" ]] && continue
- test_version_compare "${a}" "${b}" "${c}"
-done
-
-
-for q in "alpha beta pre rc=${lt};${gt}" "p=${gt};${lt}" ; do
- for p in ${q%%=*} ; do
- c=${q##*=}
- alt=${c%%;*} agt=${c##*;}
- test_version_compare "1.0" $agt "1.0_${p}"
- test_version_compare "1.0" $agt "1.0_${p}1"
- test_version_compare "1.0" $agt "1.0_${p}068"
-
- test_version_compare "2.0_${p}"$alt "2.0"
- test_version_compare "2.0_${p}1" $alt "2.0"
- test_version_compare "2.0_${p}068" $alt "2.0"
-
- test_version_compare "1.0_${p}" $eq "1.0_${p}"
- test_version_compare "0.0_${p}" $lt "0.0_${p}1"
- test_version_compare "666_${p}3" $gt "666_${p}"
-
- test_version_compare "1_${p}7" $lt "1_${p}8"
- test_version_compare "1_${p}7" $eq "1_${p}7"
- test_version_compare "1_${p}7" $gt "1_${p}6"
- test_version_compare "1_${p}09" $eq "1_${p}9"
-
- test_version_compare "1_${p}7-r0" $eq "1_${p}7"
- test_version_compare "1_${p}7-r0" $lt "1_${p}7-r1"
- test_version_compare "1_${p}7-r0" $lt "1_${p}7-r01"
- test_version_compare "1_${p}7-r01" $eq "1_${p}7-r1"
- test_version_compare "1_${p}8-r1" $gt "1_${p}7-r100"
-
- test_version_compare "1_${p}_alpha" $lt "1_${p}_beta"
- done
-done
-
-for p in "-r" "_p" ; do
- test_version_compare "7.2${p}1" $lt "7.2${p}2"
- test_version_compare "7.2${p}2" $gt "7.2${p}1"
- test_version_compare "7.2${p}3" $gt "7.2${p}2"
- test_version_compare "7.2${p}2" $lt "7.2${p}3"
-done
-
-# The following tests all come from portage's test cases:
-test_version_compare "6.0" $gt "5.0"
-test_version_compare "5.0" $gt "5"
-test_version_compare "1.0-r1" $gt "1.0-r0"
-test_version_compare "1.0-r1" $gt "1.0"
-test_version_compare "99" $gt
"98"
-test_version_compare "1.0.0" $gt "1.0"
-test_version_compare "1.0.0" $gt "1.0b"
-test_version_compare "1b" $gt "1"
-test_version_compare "1b_p1" $gt "1_p1"
-test_version_compare "1.
[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
+# [email protected]
+# [email protected]
+# [email protected]
# "
# 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
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected].
[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 - > [email protected]
+ trap "rm -f [email protected]" EXIT
+ if ! cmp --silent [email protected] $@; then
+ mv [email protected] $@
+ 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
