summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-11-09 15:33:31 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2023-11-09 17:31:12 +0100
commit4f3d8def186bf22013723416701cc8b9bc76fc26 (patch)
treee1364c141983ef833b7cbb624bc0290b97999e79 /test
parentMerge pull request #29954 from DaanDeMeyer/fix (diff)
downloadsystemd-4f3d8def186bf22013723416701cc8b9bc76fc26.tar.xz
systemd-4f3d8def186bf22013723416701cc8b9bc76fc26.zip
test: don't pre-process $KERNEL_APPEND
Let's just rely on the word splitting done by bash instead of messing with that ourselves, as it's just adding extra complexity to appease one ShellCheck check. Also, this apparently never worked for the nspawn stuff anyway, since I forgot to set $IFS to an appropriate value, so it always put all arguments from $KERNEL_APPEND into a single array item with an extra newline, which then made systemd sad: ~# readarray arr <<< "foo bar baz"; for i in "${arr[@]}"; do echo "'$i'"; done 'foo bar baz ' ~# make -C test/TEST-45-TIMEDATE/ clean setup run BUILD_DIR=$PWD/build TEST_NO_QEMU=1 KERNEL_APPEND="systemd.log_level=console" ... ~# journalctl -o short-monotonic --no-hostname --file /var/tmp/systemd-tests/systemd-test.XaDX67/system.journal --grep "Failed to parse" -p info --no-pager [551138.986882] systemd-tmpfiles[21]: Failed to parse log level 'console [551138.987179] systemd-remount-fs[20]: Failed to parse log level 'console [551138.993125] systemd-sysusers[23]: Failed to parse log level 'console [551138.998685] journalctl[29]: Failed to parse log level 'console Resolves: #29945
Diffstat (limited to '')
-rw-r--r--test/test-functions18
1 files changed, 4 insertions, 14 deletions
diff --git a/test/test-functions b/test/test-functions
index 8663f902d8..3cb08fb47a 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -594,12 +594,6 @@ run_qemu() {
fi
qemu_options+=(${QEMU_OPTIONS_ARRAY:+"${QEMU_OPTIONS_ARRAY[@]}"})
- if [[ -n "${KERNEL_APPEND:=}" ]]; then
- local user_kernel_append
- readarray user_kernel_append <<< "$KERNEL_APPEND"
- kernel_params+=("${user_kernel_append[@]}")
- fi
-
if [[ -n "$INITRD" ]]; then
if [[ -n "$INITRD_EXTRA" ]]; then
# An addition initrd has been specified, let's combine it with the main one.
@@ -634,7 +628,7 @@ run_qemu() {
qemu_cmd=(timeout --foreground "$QEMU_TIMEOUT" "$QEMU_BIN")
fi
- (set -x; "${qemu_cmd[@]}" "${qemu_options[@]}" -append "${kernel_params[*]}" |& tee "${TESTDIR:?}/console.log")
+ (set -x; "${qemu_cmd[@]}" "${qemu_options[@]}" -append "${kernel_params[*]} ${KERNEL_APPEND:-}" |& tee "${TESTDIR:?}/console.log")
rc=$?
if [ "$rc" -eq 124 ] && [ "$QEMU_TIMEOUT" != "infinity" ]; then
derror "Test timed out after ${QEMU_TIMEOUT}s"
@@ -679,12 +673,6 @@ run_nspawn() {
nspawn_options+=("${user_nspawn_arguments[@]}")
fi
- if [[ -n "${KERNEL_APPEND:=}" ]]; then
- local user_kernel_append
- readarray user_kernel_append <<< "$KERNEL_APPEND"
- kernel_params+=("${user_kernel_append[@]}")
- fi
-
if [[ "$UNIFIED_CGROUP_HIERARCHY" = "hybrid" ]]; then
dwarn "nspawn doesn't support SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=hybrid, skipping"
exit
@@ -703,7 +691,9 @@ run_nspawn() {
nspawn_cmd+=("$SYSTEMD_NSPAWN")
fi
- (set -x; "${nspawn_cmd[@]}" "${nspawn_options[@]}" "${kernel_params[@]}" |& tee "${TESTDIR:?}/console.log")
+ # Word splitting here is intentional
+ # shellcheck disable=SC2086
+ (set -x; "${nspawn_cmd[@]}" "${nspawn_options[@]}" "${kernel_params[@]}" ${KERNEL_APPEND:-} |& tee "${TESTDIR:?}/console.log")
rc=$?
if [ "$rc" -eq 124 ] && [ "$NSPAWN_TIMEOUT" != "infinity" ]; then
derror "Test timed out after ${NSPAWN_TIMEOUT}s"