From 27c814666fa25210c3f6c603c8da836189272eb0 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 1 Feb 2023 13:54:21 +0100 Subject: [PATCH 1/2] test: disable pipefail when testing interactive firstboot Otherwise we might get unexpected test fails due to SIGPIPE: ``` [ 14.334917] testsuite-74.sh[565]: + grep -q '^root:.*:0:0:.*:/bin/fooshell$' test-root/etc/passwd [ 14.335670] testsuite-74.sh[681]: + systemd-firstboot --root=test-root --prompt-root-shell [ 14.336382] testsuite-74.sh[680]: + echo -ne '\n/bin/barshell\n' [ 14.336980] testsuite-74.sh[680]: .//usr/lib/systemd/tests/testdata/units/testsuite-74.firstboot.sh: line 166: echo: write error: Broken pipe ``` --- test/units/testsuite-74.firstboot.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/units/testsuite-74.firstboot.sh b/test/units/testsuite-74.firstboot.sh index c3be8f1cf6..92a607501b 100755 --- a/test/units/testsuite-74.firstboot.sh +++ b/test/units/testsuite-74.firstboot.sh @@ -143,6 +143,8 @@ diff <(awk -F: '/^root/ { print $2; }' /etc/shadow) <(awk -F: '/^root/ { print $ rm -fr "$ROOT" mkdir -p "$ROOT/bin" touch "$ROOT/bin/fooshell" "$ROOT/bin/barshell" +# Temporarily disable pipefail to avoid `echo: write error: Broken pipe +set +o pipefail # We can do only limited testing here, since it's all an interactive stuff, # so --prompt and --prompt-root-password are skipped on purpose echo -ne "\nfoo\nbar\n" | systemd-firstboot --root="$ROOT" --prompt-locale @@ -168,6 +170,8 @@ grep -q "^root:.*:0:0:.*:/bin/fooshell$" "$ROOT/etc/passwd" # Now without the welcome screen but with force echo -ne "/bin/barshell\n" | systemd-firstboot --root="$ROOT" --force --prompt-root-shell --welcome=no grep -q "^root:.*:0:0:.*:/bin/barshell$" "$ROOT/etc/passwd" +# Re-enable pipefail +set -o pipefail # Assorted tests rm -fr "$ROOT" From 85cce734c975e40e180ae471b61be5a4cc328c58 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 20 Feb 2023 10:50:06 +0100 Subject: [PATCH 2/2] test: ignore missing coverage in TEST-78 gcov is incompatible with DynamicUser=true without additional tweaks, so let's ignore its complaints in this test, as working around it is not worth it (in this case). --- test/TEST-78-SIGQUEUE/test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/TEST-78-SIGQUEUE/test.sh b/test/TEST-78-SIGQUEUE/test.sh index 61e8e7d1c4..80ce7926ab 100755 --- a/test/TEST-78-SIGQUEUE/test.sh +++ b/test/TEST-78-SIGQUEUE/test.sh @@ -3,6 +3,8 @@ set -e TEST_DESCRIPTION="Test queue signal logic" +# Ignore gcov complaints caused by DynamicUser=true +IGNORE_MISSING_COVERAGE=yes # shellcheck source=test/test-functions . "$TEST_BASE_DIR/test-functions"