From db18959435e8414146a7bd4404e9d01b1250a922 Mon Sep 17 00:00:00 2001 From: Jo Zzsi Date: Sun, 28 Sep 2025 08:43:02 -0400 Subject: [PATCH] ci: allow the execution of arbitrary commands within the test container Evaluate the TEST_CONTAINER_COMMAND right before the test run inside the test container to facilitate additional testing that is not provided by the test CI containers by default. --- doc_site/modules/ROOT/pages/developer/hacking.adoc | 6 ++++++ test/test-container.sh | 3 +++ test/test.sh | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc_site/modules/ROOT/pages/developer/hacking.adoc b/doc_site/modules/ROOT/pages/developer/hacking.adoc index 09d14f819..06e619d0b 100644 --- a/doc_site/modules/ROOT/pages/developer/hacking.adoc +++ b/doc_site/modules/ROOT/pages/developer/hacking.adoc @@ -144,6 +144,12 @@ Run test 20 with `btrfs` omitting `systemd` dracut module on `debian` :: {empty} $ TESTS="20" TEST_FSTYPE=btrfs TEST_DRACUT_ARGS="--omit systemd" test/test.sh debian ---- +Run test 10 with `rdma` package installed on `fedora` :: {empty} ++ +[,console] +---- +$ TESTS="10" TEST_CONTAINER_COMMAND="dnf -y install rdma" test/test.sh fedora + === On bare metal For the testsuite to pass, you will have to install at least the software packages diff --git a/test/test-container.sh b/test/test-container.sh index c27927e1c..a64723286 100755 --- a/test/test-container.sh +++ b/test/test-container.sh @@ -27,6 +27,9 @@ if [ "${V-}" = "2" ]; then set -x; fi # shellcheck disable=SC2086 ./configure --enable-test ${CONFIGURE_ARG-} +# allow the execution of arbitrary commands within the test container +[[ -n ${TEST_CONTAINER_COMMAND-} ]] && eval "$TEST_CONTAINER_COMMAND" + # treat warnings as error # shellcheck disable=SC2086 CFLAGS="-Wextra -Werror" make TEST_RUN_ID="${TEST_RUN_ID:=${1-}}" TESTS="${TESTS:=${2-}}" V="${V:=1}" ${MAKEFLAGS-} ${TARGETS:=all install check} diff --git a/test/test.sh b/test/test.sh index 1d7258f62..69343080f 100755 --- a/test/test.sh +++ b/test/test.sh @@ -49,7 +49,7 @@ fi # clear previous test run TARGETS='clean all install check' "$PODMAN" run --rm -it \ --device=/dev/kvm --privileged \ - -e V -e TESTS -e TEST_RUN_ID -e TARGETS -e MAKEFLAGS -e TEST_DRACUT_ARGS ${TEST_FSTYPE:+-e TEST_FSTYPE} \ + -e V -e TESTS -e TEST_RUN_ID -e TARGETS -e MAKEFLAGS -e TEST_DRACUT_ARGS ${TEST_FSTYPE:+-e TEST_FSTYPE} -e TEST_CONTAINER_COMMAND \ -v "$PWD"/:/z \ "$CONTAINER" \ /z/test/test-container.sh -- 2.47.3