commit: deeb9ae769dea1a95e6f4000b4249cf9fa8bb234
Author: Mattéo Rossillol‑‑Laruelle <beatussum <AT> protonmail <DOT> com>
AuthorDate: Fri May 30 13:21:12 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 14:50:22 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=deeb9ae7
dev-util/kcov: fix tests
Some files generated by kcov are stored in `KCOV_SYSTEM_PIPE`,
`KCOV_SYSTEM_DESTINATION_DIR` or `TMPDIR`. By default, these variables are set
to /tmp; however, file creation here is not allowed. These variables are now set
to "${T}".
Full system instrumentation tests force using /tmp and are therefore disabled.
Closes: https://bugs.gentoo.org/938668
Signed-off-by: Mattéo Rossillol‑‑Laruelle <beatussum <AT> protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42350
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-util/kcov/kcov-43.ebuild | 14 +++++++++++++-
dev-util/kcov/kcov-9999.ebuild | 18 +++++++++++++++---
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/dev-util/kcov/kcov-43.ebuild b/dev-util/kcov/kcov-43.ebuild
index 014165152149..66b5b306e300 100644
--- a/dev-util/kcov/kcov-43.ebuild
+++ b/dev-util/kcov/kcov-43.ebuild
@@ -56,6 +56,13 @@ pkg_setup() {
src_prepare() {
if use test; then
+ find tests \( -name "*.cc" -or -name "*.py" -or -name "*.sh" \)
\
+ -exec sed -Ei "s%/tmp([^-])%${T}\1%g" {} + \
+ || die "Cannot fixing the temporary directory"
+
+ sed -i "s/[a-z].*test_system_mode.*/pass/"
tests/tools/libkcov/main.py \
+ || die "Cannot remove full system instrumentation tests"
+
sed -Ei "/skip_python2/ s/= .+/= True/"
tests/tools/test_python.py \
|| die "Cannot disable Python 2 tests"
@@ -74,7 +81,12 @@ src_configure() {
}
src_test() {
- PYTHONPATH="${S}/tests/tools" edo "${PYTHON}" -m libkcov \
+ PYTHONPATH="${S}/tests/tools" \
+ KCOV_SYSTEM_PIPE="${T}/kcov-system.pipe" \
+ KCOV_SYSTEM_DESTINATION_DIR="${T}/kcov-data" \
+ TMPDIR="${T}" \
+ edo \
+ "${PYTHON}" -m libkcov \
-v \
"${BUILD_DIR}/src/kcov" \
"${T}" \
diff --git a/dev-util/kcov/kcov-9999.ebuild b/dev-util/kcov/kcov-9999.ebuild
index 32f6b0358b92..66b5b306e300 100644
--- a/dev-util/kcov/kcov-9999.ebuild
+++ b/dev-util/kcov/kcov-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -15,7 +15,7 @@ if [[ "${PV}" = 9999 ]]; then
EGIT_REPO_URI="https://github.com/SimonKagstrom/kcov.git"
else
SRC_URI="https://github.com/SimonKagstrom/kcov/archive/v${PV}.tar.gz ->
${P}.tar.gz"
- KEYWORDS="~amd64 ~x86"
+ KEYWORDS="amd64 ~x86"
fi
LICENSE="GPL-2 MIT"
@@ -56,6 +56,13 @@ pkg_setup() {
src_prepare() {
if use test; then
+ find tests \( -name "*.cc" -or -name "*.py" -or -name "*.sh" \)
\
+ -exec sed -Ei "s%/tmp([^-])%${T}\1%g" {} + \
+ || die "Cannot fixing the temporary directory"
+
+ sed -i "s/[a-z].*test_system_mode.*/pass/"
tests/tools/libkcov/main.py \
+ || die "Cannot remove full system instrumentation tests"
+
sed -Ei "/skip_python2/ s/= .+/= True/"
tests/tools/test_python.py \
|| die "Cannot disable Python 2 tests"
@@ -74,7 +81,12 @@ src_configure() {
}
src_test() {
- PYTHONPATH="${S}/tests/tools" edo "${PYTHON}" -m libkcov \
+ PYTHONPATH="${S}/tests/tools" \
+ KCOV_SYSTEM_PIPE="${T}/kcov-system.pipe" \
+ KCOV_SYSTEM_DESTINATION_DIR="${T}/kcov-data" \
+ TMPDIR="${T}" \
+ edo \
+ "${PYTHON}" -m libkcov \
-v \
"${BUILD_DIR}/src/kcov" \
"${T}" \