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

@ -1,9 +1,11 @@
#!/bin/sh
set -eux
export TEST_BROWSER=${TEST_BROWSER:-firefox}
TESTS="$(realpath $(dirname "$0"))"
SOURCE="$(realpath $TESTS/../..)"
LOGS="$(pwd)/logs"
export SOURCE="$(realpath $TESTS/../..)"
export LOGS="$(pwd)/logs"
mkdir -p "$LOGS"
chmod a+w "$LOGS"
@ -47,7 +49,9 @@ echo core > /proc/sys/kernel/core_pattern
systemctl enable --now cockpit.socket
# 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)
exit ${RC:-1}

View file

@ -22,7 +22,6 @@ mv .git dot-git
. /etc/os-release
export TEST_OS="${ID}-${VERSION_ID/./-}"
export TEST_AUDIT_NO_SELINUX=1
if [ "${TEST_OS#centos-}" != "$TEST_OS" ]; then
TEST_OS="${TEST_OS}-stream"
@ -30,6 +29,10 @@ fi
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
test/common/run-tests --nondestructive --machine 127.0.0.1:22 --browser 127.0.0.1:9090 $EXCLUDES || RC=$?