]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
ci: allow the execution of arbitrary commands within the test container
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 28 Sep 2025 12:43:02 +0000 (08:43 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Sun, 28 Sep 2025 13:17:02 +0000 (09:17 -0400)
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
test/test-container.sh
test/test.sh

index 09d14f819bad829d5ee08cdf0080478a20ce2a45..06e619d0bce3ddf50bce73c3270b583123a40f6f 100644 (file)
@@ -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
index c27927e1cf97243a510af04373d975323821bc52..a64723286b26fd294e9662dc56598ecbe288bbce 100755 (executable)
@@ -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}
index 1d7258f62fd818a8e149262938eb3e435148f372..69343080f8355206a0d5e4e713864df3385985cc 100755 (executable)
@@ -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