fmf: Plumb through $TEST_* variables for unexpected messages

This will allow us to control the value from test plans, in particular
for disabling at least some unexpected message checks for reverse
dependency testing. We don't want to disable unexpected messages
in general for fmf, as we are looking for exactly these in e.g.
selinux-policy reverse dependency tests.

Move from `su` to `runtest`, as with the former it's impossible to plumb
through variables with non-trivial characters, as they cannot be quoted.

Taken from c38692fa4c
This commit is contained in:
Martin Pitt 2023-08-26 07:44:51 +02:00 committed by Martin Pitt
parent 139d73a03b
commit 9544f57220
4 changed files with 17 additions and 6 deletions

View file

@ -172,10 +172,10 @@ print-vm:
# without actually running them # without actually running them
prepare-check: $(NODE_MODULES_TEST) $(VM_IMAGE) test/common prepare-check: $(NODE_MODULES_TEST) $(VM_IMAGE) test/common
# run the browser integration tests; skip check for SELinux denials # run the browser integration tests
# this will run all tests/check-* and format them as TAP # this will run all tests/check-* and format them as TAP
check: prepare-check check: prepare-check
TEST_AUDIT_NO_SELINUX=1 test/common/run-tests ${RUN_TESTS_OPTIONS} test/common/run-tests ${RUN_TESTS_OPTIONS}
# checkout Cockpit's bots for standard test VM images and API to launch them # checkout Cockpit's bots for standard test VM images and API to launch them
bots: $(COCKPIT_REPO_STAMP) bots: $(COCKPIT_REPO_STAMP)

View file

@ -4,3 +4,7 @@ discover:
how: fmf how: fmf
execute: execute:
how: tmt how: tmt
# Let's handle them upstream only, don't break Fedora/RHEL reverse dependency gating
environment:
TEST_AUDIT_NO_SELINUX: 1

View file

@ -1,9 +1,11 @@
#!/bin/sh #!/bin/sh
set -eux set -eux
export TEST_BROWSER=${TEST_BROWSER:-firefox}
TESTS="$(realpath $(dirname "$0"))" TESTS="$(realpath $(dirname "$0"))"
SOURCE="$(realpath $TESTS/../..)" export SOURCE="$(realpath $TESTS/../..)"
LOGS="$(pwd)/logs" export LOGS="$(pwd)/logs"
mkdir -p "$LOGS" mkdir -p "$LOGS"
chmod a+w "$LOGS" chmod a+w "$LOGS"
@ -47,7 +49,9 @@ echo core > /proc/sys/kernel/core_pattern
systemctl enable --now cockpit.socket systemctl enable --now cockpit.socket
# Run tests as unprivileged user # Run tests as unprivileged user
su - -c "env TEST_BROWSER=firefox SOURCE=$SOURCE LOGS=$LOGS $TESTS/run-test.sh" runtest # once we drop support for RHEL 8, use this:
# runuser -u runtest --whitelist-environment=TEST_BROWSER,TEST_ALLOW_JOURNAL_MESSAGES,TEST_AUDIT_NO_SELINUX,SOURCE,LOGS $TESTS/run-test.sh
runuser -u runtest --preserve-environment env USER=runtest HOME=$(getent passwd runtest | cut -f6 -d:) $TESTS/run-test.sh
RC=$(cat $LOGS/exitcode) RC=$(cat $LOGS/exitcode)
exit ${RC:-1} exit ${RC:-1}

View file

@ -22,7 +22,6 @@ mv .git dot-git
. /etc/os-release . /etc/os-release
export TEST_OS="${ID}-${VERSION_ID/./-}" export TEST_OS="${ID}-${VERSION_ID/./-}"
export TEST_AUDIT_NO_SELINUX=1
if [ "${TEST_OS#centos-}" != "$TEST_OS" ]; then if [ "${TEST_OS#centos-}" != "$TEST_OS" ]; then
TEST_OS="${TEST_OS}-stream" TEST_OS="${TEST_OS}-stream"
@ -30,6 +29,10 @@ fi
EXCLUDES="" EXCLUDES=""
# make it easy to check in logs
echo "TEST_ALLOW_JOURNAL_MESSAGES: ${TEST_ALLOW_JOURNAL_MESSAGES:-}"
echo "TEST_AUDIT_NO_SELINUX: ${TEST_AUDIT_NO_SELINUX:-}"
RC=0 RC=0
test/common/run-tests --nondestructive --machine 127.0.0.1:22 --browser 127.0.0.1:9090 $EXCLUDES || RC=$? test/common/run-tests --nondestructive --machine 127.0.0.1:22 --browser 127.0.0.1:9090 $EXCLUDES || RC=$?