test: Stop using grep -q in integration test

When a TTY is attached to the test unit, grep -q will generate SIGPIPE
for the previous command in the pipeline which in combo with `pipefail`
will cause the command to fail with exit status 141 which will fail the
test.

Replace with >/dev/null to avoid this from happening.

See also https://www.gnu.org/software/grep/manual/html_node/Usage.html
> There is a related problem with Bash’s set -e -o pipefail. Since grep
> does not always read all its input, a command outputting to a pipe read
> by grep can fail when grep exits before reading all its input, and the
> command’s failure can cause Bash to exit.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
This commit is contained in:
Daan De Meyer
2025-12-10 12:09:10 +01:00
committed by Zbigniew Jędrzejewski-Szmek
co-authored by Yu Watanabe
parent d065fdd337
commit ee6b3d1aa2
43 changed files with 281 additions and 277 deletions
+9 -9
View File
@@ -149,17 +149,17 @@ EOF
test -f "$uki"
if [ -x "$bootctl" ]; then
"$bootctl" kernel-inspect "$uki" | grep -qE 'Kernel Type: +uki$'
"$bootctl" kernel-inspect "$uki" | grep -qE 'Version: +1\.1\.3$'
"$bootctl" kernel-inspect "$uki" | grep -qE 'Cmdline: +opt1 opt2$'
"$bootctl" kernel-inspect "$uki" | grep -E 'Kernel Type: +uki$' >/dev/null
"$bootctl" kernel-inspect "$uki" | grep -E 'Version: +1\.1\.3$' >/dev/null
"$bootctl" kernel-inspect "$uki" | grep -E 'Cmdline: +opt1 opt2$' >/dev/null
fi
"$ukify" inspect "$uki" | grep -qE '^.sbat'
"$ukify" inspect "$uki" | grep -qE '^.cmdline'
"$ukify" inspect "$uki" | grep -qE '^.uname'
"$ukify" inspect "$uki" | grep -qE '^.initrd'
"$ukify" inspect "$uki" | grep -qE '^.linux'
"$ukify" inspect "$uki" | grep -qE '^.dtb'
"$ukify" inspect "$uki" | grep -E '^.sbat' >/dev/null
"$ukify" inspect "$uki" | grep -E '^.cmdline' >/dev/null
"$ukify" inspect "$uki" | grep -E '^.uname' >/dev/null
"$ukify" inspect "$uki" | grep -E '^.initrd' >/dev/null
"$ukify" inspect "$uki" | grep -E '^.linux' >/dev/null
"$ukify" inspect "$uki" | grep -E '^.dtb' >/dev/null
rm "$D/sources/install.conf.d/override.conf"
fi