From deeb9ae769dea1a95e6f4000b4249cf9fa8bb234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Rossillol=E2=80=91=E2=80=91Laruelle?= Date: Fri, 30 May 2025 15:21:12 +0200 Subject: [PATCH] dev-util/kcov: fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: https://github.com/gentoo/gentoo/pull/42350 Signed-off-by: Sam James --- 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 014165152149d..66b5b306e3007 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 32f6b0358b923..66b5b306e3007 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}" \