dev-util/kcov: fix test failures

These changes do not affect the installed program.

Closes: https://bugs.gentoo.org/937314
Closes: https://bugs.gentoo.org/937315
Signed-off-by: Mattéo Rossillol‑‑Laruelle <beatussum@protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/38185
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Mattéo Rossillol‑‑Laruelle
2024-08-18 15:40:13 +02:00
committed by Sam James
parent 115f92066a
commit a44c00576d
3 changed files with 75 additions and 12 deletions

View File

@@ -0,0 +1,51 @@
From c3c89cfca876b9c56586afc374ea92a7b25998c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matt=C3=A9o=20Rossillol=E2=80=91=E2=80=91Laruelle?=
<beatussum@protonmail.com>
Date: Sun, 18 Aug 2024 15:18:19 +0200
Subject: [PATCH] remove failing test conflicting with sandbox
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
sys-apps/sandbox is based on `LD_PRELOAD`; however,
`--bash-handle-sh-invocation` uses it too. This option seems to conflict with
the sandbox environment and the associated test fails fails.
Indeed, according to the Kcov man page, this option handles "invocations of
/bin/sh scripts via using a LD_PRELOADed library that replaces execve (i.e.,
/bin/sh is executed as /bin/bash)".
Signed-off-by: Mattéo RossillolLaruelle <beatussum@protonmail.com>
---
tests/tools/test_bash_linux_only.py | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/tests/tools/test_bash_linux_only.py b/tests/tools/test_bash_linux_only.py
index d0a46bb..87022e0 100644
--- a/tests/tools/test_bash_linux_only.py
+++ b/tests/tools/test_bash_linux_only.py
@@ -2,21 +2,6 @@ import libkcov
from libkcov import cobertura
-class bash_sh_shebang(libkcov.TestCase):
- def runTest(self):
- rv, o = self.do(
- self.kcov
- + " --bash-handle-sh-invocation "
- + self.outbase
- + "/kcov "
- + self.sources
- + "/tests/bash/shell-main"
- )
-
- dom = cobertura.parseFile(self.outbase + "/kcov/shell-main/cobertura.xml")
- assert cobertura.hitsPerLine(dom, "sh-shebang.sh", 4) == 1
-
-
class bash_exit_before_child(libkcov.TestCase):
def runTest(self):
# kcovKcov shouldn't wait for the background process, so call it with kcovKcov = False
--
2.44.2

View File

@@ -39,6 +39,10 @@ DEPEND="
BDEPEND="test? ( ${PYTHON_DEPS} )"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/${PN}-remove-failing-test-conflicting-with-sandbox.patch"
)
DOCS=(
doc/
CONTRIBUTING.md
@@ -51,24 +55,26 @@ pkg_setup() {
}
src_prepare() {
cmake_src_prepare
if use test; then
sed -Ei "/skip_python2/ s/= .+/= True/" tests/tools/test_python.py \
|| die
|| die "Cannot disable Python 2 tests"
echo "add_subdirectory (tests)" >> CMakeLists.txt || die
cat <<- EOF >> CMakeLists.txt || die "Cannot enable test building"
add_compile_options (-g)
add_subdirectory (tests)
EOF
fi
cmake_src_prepare
}
src_configure() {
local mycmakeargs=( -DKCOV_INSTALL_DOCDIR:PATH="share/doc/${PF}" )
cmake_src_configure
}
src_test() {
PYTHONPATH="${S}/tests/tools" edo python3 -m libkcov \
PYTHONPATH="${S}/tests/tools" edo "${PYTHON}" -m libkcov \
-v \
"${BUILD_DIR}/src/kcov" \
"${T}" \

View File

@@ -39,6 +39,10 @@ DEPEND="
BDEPEND="test? ( ${PYTHON_DEPS} )"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/${PN}-remove-failing-test-conflicting-with-sandbox.patch"
)
DOCS=(
doc/
CONTRIBUTING.md
@@ -51,24 +55,26 @@ pkg_setup() {
}
src_prepare() {
cmake_src_prepare
if use test; then
sed -Ei "/skip_python2/ s/= .+/= True/" tests/tools/test_python.py \
|| die
|| die "Cannot disable Python 2 tests"
echo "add_subdirectory (tests)" >> CMakeLists.txt || die
cat <<- EOF >> CMakeLists.txt || die "Cannot enable test building"
add_compile_options (-g)
add_subdirectory (tests)
EOF
fi
cmake_src_prepare
}
src_configure() {
local mycmakeargs=( -DKCOV_INSTALL_DOCDIR:PATH="share/doc/${PF}" )
cmake_src_configure
}
src_test() {
PYTHONPATH="${S}/tests/tools" edo python3 -m libkcov \
PYTHONPATH="${S}/tests/tools" edo "${PYTHON}" -m libkcov \
-v \
"${BUILD_DIR}/src/kcov" \
"${T}" \