public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Matus Marhefka <mmarhefk@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/openscap] main: Sanity/smoke-test: run C unit tests skipped under CUSTOM_OSCAP
Date: Mon, 02 Nov 2026 11:31:44 GMT [thread overview]
Message-ID: <179361910446.1.1681510062308450520.tests-openscap-4256f349fb8a@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : tests/openscap
Branch : main
Commit : 4256f349fb8a7cb1b0492bfaea84ec2389a566b7
Author : Matus Marhefka <mmarhefk@redhat.com>
Date : 2026-11-02T11:23:32+01:00
Stats : +26/-0 in 2 file(s)
URL : https://src.fedoraproject.org/tests/openscap/c/4256f349fb8a7cb1b0492bfaea84ec2389a566b7?branch=main
Log:
Sanity/smoke-test: run C unit tests skipped under CUSTOM_OSCAP
Upstream C unit tests guard their test binary with
`if [ -z ${CUSTOM_OSCAP+x} ]`, so when the suite runs against the
installed oscap (CUSTOM_OSCAP exported) the binary is skipped, all.sh
exits 0 and CTest reports Passed. As a result, tests such as
DS/ds_sds_path_traversal (SDS decomposition path traversal fix,
OpenSCAP/openscap#2459, PSIRTSUPT-15968) passed without running.
Add a second CTest pass that:
- finds the guarded tests by grepping tests/ in the source tree for
CUSTOM_OSCAP+x, so the selection follows each release and backport
- runs them with `env -u CUSTOM_OSCAP` (an empty value would still
count as set)
- submits its LastTest.log as unit_test_verbose_output.log, since the
first pass writes the same file
- asserts that the path traversal test actually ran (if present)
The unit tests run against the library rebuilt from the installed
package's SRPM, effectively the %check stage the RHEL spec does not
run. The second pass adds about 50 s.
Verified on RHEL 10.3 (openscap-1.4.6-1.el10_3): 26 tests passed and
58 inner checks ran, including path_traversal (it ran 0 before).
---
diff --git a/Sanity/smoke-test/main.fmf b/Sanity/smoke-test/main.fmf
index a35cee4..2d18a06 100644
--- a/Sanity/smoke-test/main.fmf
+++ b/Sanity/smoke-test/main.fmf
@@ -2,6 +2,8 @@ summary: Test runs upstream test suite.
description: |
Runs upstream test suite against installed openscap. Test suite is built from
the openscap source RPM by running %prep and %build stages from the spec file.
+ C unit tests which are skipped when CUSTOM_OSCAP is set are then run in
+ a second CTest pass with CUSTOM_OSCAP unset.
contact: Matus Marhefka <mmarhefk@redhat.com>
component:
- openscap
diff --git a/Sanity/smoke-test/runtest.sh b/Sanity/smoke-test/runtest.sh
index 13cf0d9..818559b 100755
--- a/Sanity/smoke-test/runtest.sh
+++ b/Sanity/smoke-test/runtest.sh
@@ -153,6 +153,30 @@ rlJournalStart
fi
rlPhaseEnd
+ if ! rlIsRHEL "<=7"; then
+ # C unit tests guarded by ${CUSTOM_OSCAP+x} skip their binary (and report
+ # Passed) when CUSTOM_OSCAP is set, so run them again with it unset.
+ rlPhaseStartTest "Run upstream C unit tests"
+ SRC_DIR=$(sed -n 's/^CMAKE_HOME_DIRECTORY:INTERNAL=//p' "$BUILD_DIR_PATH/CMakeCache.txt")
+ rlRun "test -d '$SRC_DIR/tests'" 0 "Source tests directory found: $SRC_DIR/tests"
+ UNIT_TESTS=$(cd "$SRC_DIR/tests" && grep -rlE 'CUSTOM_OSCAP\+x' --include='*.sh' . | sed 's|^\./||' | sort)
+ if [ -z "$UNIT_TESTS" ]; then
+ rlLogInfo "No CUSTOM_OSCAP-guarded unit tests found, skipping"
+ else
+ rlLogInfo "Guarded unit tests: $(echo "$UNIT_TESTS" | paste -sd' ')"
+ UNIT_TESTS_ESCAPED=${UNIT_TESTS//./\\.}
+ REGEX="^(${UNIT_TESTS_ESCAPED//$'\n'/|})\$"
+ rlRun -s "env -u CUSTOM_OSCAP ctest --test-dir $BUILD_DIR_PATH --output-on-failure -R '$REGEX'"
+ rv=$?
+ FILE="${BUILD_DIR_PATH}/Testing/Temporary/LastTest.log"
+ rlFileSubmit "$(readlink -f "$FILE")" unit_test_verbose_output.log
+ if [ $rv -ne 0 ]; then
+ rlBundleLogs unit_test_outputs_all "$(readlink -f "${BUILD_DIR_PATH}/tests")"
+ fi
+ fi
+ rlPhaseEnd
+ fi
+
rlPhaseStartCleanup
CleanupDo
rlPhaseEnd
reply other threads:[~2026-11-02 11:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179361910446.1.1681510062308450520.tests-openscap-4256f349fb8a@fedoraproject.org \
--to=mmarhefk@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox