From: Frantisek Sumsal Date: Fri, 19 Aug 2022 14:30:24 +0000 (+0200) Subject: test: correctly process multiline strings in $KERNEL_APPEND X-Git-Tag: v252-rc1~398 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bea9d62bdb499b7b2a49a478cac51d46416808d4;p=thirdparty%2Fsystemd.git test: correctly process multiline strings in $KERNEL_APPEND Some tests (like TEST-02) set a multiline string to $KERNEL_APPEND (which is a valid thing to do), unfortunately we'd use only the first line of it and throw the rest away, e.g: ``` $ printf "%s" "$x" hello this is a multiline kernel command line $ read -ra out <<< "$x" $ printf "%s" "${out[@]}" hello ``` Let's use readarray/mapfile instead to avoid this: ``` $ readarray out <<< "$x" $ printf "%s" "${out[@]}" hello this is a multiline kernel command line ``` --- diff --git a/test/test-functions b/test/test-functions index 5dec5e28dec..3cdfd800f08 100644 --- a/test/test-functions +++ b/test/test-functions @@ -498,7 +498,7 @@ run_qemu() { if [[ -n "${KERNEL_APPEND:=}" ]]; then local user_kernel_append - read -ra user_kernel_append <<< "$KERNEL_APPEND" + readarray user_kernel_append <<< "$KERNEL_APPEND" kernel_params+=("${user_kernel_append[@]}") fi @@ -557,7 +557,7 @@ run_nspawn() { if [[ -n "${KERNEL_APPEND:=}" ]]; then local user_kernel_append - read -ra user_kernel_append <<< "$KERNEL_APPEND" + readarray user_kernel_append <<< "$KERNEL_APPEND" kernel_params+=("${user_kernel_append[@]}") fi