]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Stop using grep -q in integration test
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 3 Dec 2025 12:36:52 +0000 (13:36 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Dec 2025 11:09:10 +0000 (12:09 +0100)
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>
43 files changed:
docs/CODING_STYLE.md
src/kernel-install/test-kernel-install.sh
test/units/TEST-04-JOURNAL.SYSTEMD_JOURNAL_COMPRESS.sh
test/units/TEST-04-JOURNAL.fss.sh
test/units/TEST-04-JOURNAL.journal.sh
test/units/TEST-07-PID1.exec-context.sh
test/units/TEST-07-PID1.private-bpf.sh
test/units/TEST-10-MOUNT.sh
test/units/TEST-13-NSPAWN.machined.sh
test/units/TEST-17-UDEV.IMPORT.sh
test/units/TEST-17-UDEV.SYSTEMD_WANTS.sh
test/units/TEST-17-UDEV.TAG.sh
test/units/TEST-17-UDEV.rename-netif.sh
test/units/TEST-22-TMPFILES.12.sh
test/units/TEST-26-SYSTEMCTL.sh
test/units/TEST-29-PORTABLE.directory.sh
test/units/TEST-29-PORTABLE.image.sh
test/units/TEST-29-PORTABLE.sh
test/units/TEST-35-LOGIN.sh
test/units/TEST-36-NUMAPOLICY.sh
test/units/TEST-43-PRIVATEUSER-UNPRIV.sh
test/units/TEST-46-HOMED.sh
test/units/TEST-50-DISSECT.dissect.sh
test/units/TEST-50-DISSECT.mountfsd.sh
test/units/TEST-54-CREDS.sh
test/units/TEST-55-OOMD.sh
test/units/TEST-58-REPART.sh
test/units/TEST-59-RELOADING-RESTART.sh
test/units/TEST-60-MOUNT-RATELIMIT.sh
test/units/TEST-62-RESTRICT-IFACES.sh
test/units/TEST-65-ANALYZE.sh
test/units/TEST-70-TPM2.cryptsetup.sh
test/units/TEST-72-SYSUPDATE.sh
test/units/TEST-74-AUX-UTILS.busctl.sh
test/units/TEST-74-AUX-UTILS.firstboot.sh
test/units/TEST-74-AUX-UTILS.userdbctl.sh
test/units/TEST-74-AUX-UTILS.varlinkctl.sh
test/units/TEST-75-RESOLVED.sh
test/units/TEST-80-NOTIFYACCESS.sh
test/units/TEST-87-AUX-UTILS-VM.bootctl.sh
test/units/TEST-87-AUX-UTILS-VM.mount.sh
test/units/TEST-87-AUX-UTILS-VM.validatefs.sh
test/units/util.sh

index a890bd25ecd8e02db12070fadde923664aec552d..02a776e54462f707cee84a02dd462345f749f6c4 100644 (file)
@@ -999,3 +999,9 @@ SPDX-License-Identifier: LGPL-2.1-or-later
 
 - When modifying existing tests, please convert the test to use the new assertion
   macros from `tests.h` if it is not already using those.
+
+## Integration Tests
+
+- Never use `grep -q` in a pipeline, use `grep >/dev/null` instead. The former
+  will generate `SIGPIPE` for the previous command in the pipeline when it finds
+  a match which will cause the test to fail unexpectedly.
index e6979727298f35a6c4d5fabdf4f737028d782564..e2add8ba80b5c21e03cd0a78b9891e572b5b2477 100755 (executable)
@@ -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
index 1561ed971ebe09fa26524b86b7d1f5bec245c06c..13ca3751cb35d6a7847262728b46309d4c4074e2 100755 (executable)
@@ -28,15 +28,15 @@ EOF
     ID="$(systemd-id128 new)"
     systemd-cat -t "$ID" bash -c "for ((i=0;i<100;i++)); do echo -n hoge with ${c}; done; echo"
     journalctl --sync
-    timeout 10 bash -c "until SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /var/log/journal/$MACHINE_ID/system.journal 2>&1 | grep -q -F 'compress=${c}'; do sleep .5; done"
+    timeout 10 bash -c "until SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /var/log/journal/$MACHINE_ID/system.journal 2>&1 | grep -F 'compress=${c}' >/dev/null; do sleep .5; done"
 
     # $SYSTEMD_JOURNAL_COMPRESS= also works for journal-remote
     if [[ -x /usr/lib/systemd/systemd-journal-remote ]]; then
         for cc in NONE XZ LZ4 ZSTD; do
             rm -f /tmp/foo.journal
             SYSTEMD_JOURNAL_COMPRESS="${cc}" /usr/lib/systemd/systemd-journal-remote --split-mode=none -o /tmp/foo.journal --getter="journalctl -b -o export -t $ID"
-            SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /tmp/foo.journal 2>&1 | grep -q -F "compress=${cc}"
-            journalctl -t "$ID" -o cat --file /tmp/foo.journal | grep -q -F "hoge with ${c}"
+            SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /tmp/foo.journal 2>&1 | grep -F "compress=${cc}" >/dev/null
+            journalctl -t "$ID" -o cat --file /tmp/foo.journal | grep -F "hoge with ${c}" >/dev/null
         done
     fi
 done
index 7edcbf95b09033c95e3294a7ae2f5378a9e8e400..50f0608280e37f38e3ac1de8dbfa20e905121c82 100755 (executable)
@@ -5,7 +5,7 @@ set -o pipefail
 
 # Forward Secure Sealing
 
-if ! journalctl --version | grep -qF +GCRYPT; then
+if ! journalctl --version | grep -F +GCRYPT >/dev/null; then
     echo "Built without gcrypt, skipping the FSS tests"
     exit 0
 fi
index 5d2ee3a0492e9a97dfb68db9b702828e937975ad..de3b45eaee5bb0533a6de565b0727fdaecd9761b 100755 (executable)
@@ -60,10 +60,10 @@ grep -q '^PRIORITY=6$' /tmp/output
 ID="$(systemd-id128 new)"
 echo -e 'HEAD\nTAIL\nTAIL' | systemd-cat -t "$ID"
 journalctl --sync
-journalctl -b -t "$ID" | grep -q HEAD
-journalctl -b -t "$ID" | grep -q TAIL
-journalctl -b -t "$ID" --truncate-newline | grep -q HEAD
-journalctl -b -t "$ID" --truncate-newline | grep -q -v TAIL
+journalctl -b -t "$ID" | grep HEAD >/dev/null
+journalctl -b -t "$ID" | grep TAIL >/dev/null
+journalctl -b -t "$ID" --truncate-newline | grep HEAD >/dev/null
+journalctl -b -t "$ID" --truncate-newline | grep -v TAIL >/dev/null
 
 # '-b all' negates earlier use of -b (-b and -m are otherwise exclusive)
 journalctl -b -1 -b all -m >/dev/null
index d6255e21cdf84a21818612ae85f662cfece9e4ad..e770e917934ebda4c6695b3c26753d6c753f559d 100755 (executable)
@@ -175,7 +175,7 @@ if ! systemd-detect-virt -cq; then
     systemd-run --wait --pipe --unit "$SERVICE_NAME" "${ARGUMENTS[@]}" \
         bash -xec "test -r /dev/null; test ! -w /dev/null; test ! -r $LODEV; test -w $LODEV; test ! -r /dev/tty; test ! -w /dev/tty"
 
-    if ! systemctl --version | grep -qF -- "-BPF_FRAMEWORK"; then
+    if ! systemctl --version | grep -F -- "-BPF_FRAMEWORK" >/dev/null; then
         # SocketBind*=
         ARGUMENTS=(
             -p SocketBindAllow=
index d9c0218055129d6c76ecb2952b73e75bb31acf16..9908934260dd4e4c5a9cead97c4684c79ad89804 100755 (executable)
@@ -52,7 +52,7 @@ check_mount_opts 'BPFDelegatePrograms=BPFProgTypeTracepoint,BPFProgTypeXdp,BPFPr
 check_mount_opts 'BPFDelegateAttachments=BPFFlowDissector,BPFCgroupSysctl,BPFNetfilter' 'delegate_attachs=flow_dissector:cgroup_sysctl:netfilter'
 
 # Building test-bpf-token requires BPF support
-if systemctl --version | grep -q -- -BPF_FRAMEWORK; then
+if systemctl --version | grep -- -BPF_FRAMEWORK >/dev/null; then
         exit 0
 fi
 
index 72c2ccfba25cf97d48bb8416d7cdca355cd67ce4..c57989403bacc1f58e184cfddf16c7ec923ebee1 100755 (executable)
@@ -89,7 +89,7 @@ check_dependencies() {
     # again with the userspace options. Typically, the window between the two calls is very short, but when
     # the mount event source is ratelimited after the first event, processing the second event may be delayed
     # about 1 second. Hence, here we need to wait for a while.
-    timeout 10 bash -c 'until systemctl show --property=After --value tmp-deptest.mount | grep -q -F remote-fs-pre.target; do sleep .1; done'
+    timeout 10 bash -c 'until systemctl show --property=After --value tmp-deptest.mount | grep -F remote-fs-pre.target >/dev/null; do sleep .1; done'
     after=$(systemctl show --property=After --value tmp-deptest.mount)
     assert_not_in "local-fs-pre.target" "$after"
     assert_in "remote-fs-pre.target" "$after"
index 50a8c142dbf092c36e26abbcf7c8f76fbec010b8..dbf126f1fcf3e0c8f4601e05296ea1a1e797a97a 100755 (executable)
@@ -308,8 +308,8 @@ timeout 30 bash -c "while varlinkctl call /run/systemd/machine/io.systemd.Machin
 # test io.systemd.Machine.List with sshAddress and sshPrivateKeyPath fields
 varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Register '{"name": "registered-container", "class": "container", "sshAddress": "localhost", "sshPrivateKeyPath": "/non-existent"}'
 timeout 30 bash -c "until varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{\"name\":\"registered-container\"}'; do sleep 0.5; done"
-varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name":"registered-container"}' | jq '.sshAddress' | grep -q 'localhost'
-varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name":"registered-container"}' | jq '.sshPrivateKeyPath' | grep -q 'non-existent'
+varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name":"registered-container"}' | jq '.sshAddress' | grep 'localhost' >/dev/null
+varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name":"registered-container"}' | jq '.sshPrivateKeyPath' | grep 'non-existent' >/dev/null
 varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Unregister '{"name": "registered-container"}'
 
 # test io.systemd.Machine.List with addresses, OSRelease, and UIDShift fields
@@ -369,7 +369,7 @@ journalctl --sync
 (! journalctl -u systemd-machined.service --since="$TS" --grep 'Connection busy')
 machinectl terminate container-without-os-release
 
-(ip addr show lo | grep -q 192.168.1.100) || ip address add 192.168.1.100/24 dev lo
+(ip addr show lo | grep 192.168.1.100 >/dev/null) || ip address add 192.168.1.100/24 dev lo
 (! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name": ".host"}' | grep 'addresses')
 varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name": ".host", "acquireMetadata": "yes"}' | grep 'addresses'
 (! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List '{"name": ".host"}' | grep 'OSRelease')
index d960ddd98112101aeda275169ae1227aa953f534..f09b171066187e1016a0709b193e970ff6d12a56 100755 (executable)
@@ -14,8 +14,8 @@ udevadm control --reload
 SYSTEMD_LOG_LEVEL=debug udevadm trigger --verbose --settle --action add /dev/null
 
 test -f /run/udev/data/c1:3
-udevadm info /dev/null | grep -q 'E: HOGE=aa\\x20\\x20\\x20bb'
-udevadm info /dev/null | grep -q 'E: FOO=\\x20aaa\\x20'
+udevadm info /dev/null | grep 'E: HOGE=aa\\x20\\x20\\x20bb' >/dev/null
+udevadm info /dev/null | grep 'E: FOO=\\x20aaa\\x20' >/dev/null
 
 rm /run/udev/rules.d/50-testsuite.rules
 udevadm control --reload
index 41f8c6ae0e7451e033c1e4b1b44a31e5e38ade41..175d2570c58c63eb77cbd9579b3b992baf39c486 100755 (executable)
@@ -13,10 +13,10 @@ udevadm trigger --settle "$ROOTDEV"
 
 while : ; do
     (
-        udevadm info "$ROOTDEV" | grep -q -v SYSTEMD_WANTS=foobar.service
-        udevadm info "$ROOTDEV" | grep -q -v SYSTEMD_WANTS=waldo.service
-        systemctl show -p WantedBy foobar.service | grep -q -v "${ROOTDEV#/dev/}"
-        systemctl show -p WantedBy waldo.service | grep -q -v "${ROOTDEV#/dev/}"
+        udevadm info "$ROOTDEV" | grep -v SYSTEMD_WANTS=foobar.service >/dev/null
+        udevadm info "$ROOTDEV" | grep -v SYSTEMD_WANTS=waldo.service >/dev/null
+        systemctl show -p WantedBy foobar.service | grep -v "${ROOTDEV#/dev/}" >/dev/null
+        systemctl show -p WantedBy waldo.service | grep -v "${ROOTDEV#/dev/}" >/dev/null
     ) && break
 
     sleep .5
@@ -31,10 +31,10 @@ udevadm trigger --settle "$ROOTDEV"
 
 while : ; do
     (
-        udevadm info "$ROOTDEV" | grep -q SYSTEMD_WANTS=foobar.service
-        udevadm info "$ROOTDEV" | grep -q -v SYSTEMD_WANTS=waldo.service
-        systemctl show -p WantedBy foobar.service | grep -q "${ROOTDEV#/dev/}"
-        systemctl show -p WantedBy waldo.service | grep -q -v "${ROOTDEV#/dev/}"
+        udevadm info "$ROOTDEV" | grep SYSTEMD_WANTS=foobar.service >/dev/null
+        udevadm info "$ROOTDEV" | grep -v SYSTEMD_WANTS=waldo.service >/dev/null
+        systemctl show -p WantedBy foobar.service | grep "${ROOTDEV#/dev/}" >/dev/null
+        systemctl show -p WantedBy waldo.service | grep -v "${ROOTDEV#/dev/}" >/dev/null
     ) && break
 
     sleep .5
@@ -49,10 +49,10 @@ udevadm trigger --settle "$ROOTDEV"
 
 while : ; do
     (
-        udevadm info "$ROOTDEV" | grep -q -v SYSTEMD_WANTS=foobar.service
-        udevadm info "$ROOTDEV" | grep -q SYSTEMD_WANTS=waldo.service
-        systemctl show -p WantedBy foobar.service | grep -q -v "${ROOTDEV#/dev/}"
-        systemctl show -p WantedBy waldo.service | grep -q "${ROOTDEV#/dev/}"
+        udevadm info "$ROOTDEV" | grep -v SYSTEMD_WANTS=foobar.service >/dev/null
+        udevadm info "$ROOTDEV" | grep SYSTEMD_WANTS=waldo.service >/dev/null
+        systemctl show -p WantedBy foobar.service | grep -v "${ROOTDEV#/dev/}" >/dev/null
+        systemctl show -p WantedBy waldo.service | grep "${ROOTDEV#/dev/}" >/dev/null
     ) && break
 
     sleep .5
@@ -65,10 +65,10 @@ udevadm trigger --settle "$ROOTDEV"
 
 while : ; do
     (
-        udevadm info "$ROOTDEV" | grep -q -v SYSTEMD_WANTS=foobar.service
-        udevadm info "$ROOTDEV" | grep -q -v SYSTEMD_WANTS=waldo.service
-        systemctl show -p WantedBy foobar.service | grep -q -v "${ROOTDEV#/dev/}"
-        systemctl show -p WantedBy waldo.service | grep -q -v "${ROOTDEV#/dev/}"
+        udevadm info "$ROOTDEV" | grep -v SYSTEMD_WANTS=foobar.service >/dev/null
+        udevadm info "$ROOTDEV" | grep -v SYSTEMD_WANTS=waldo.service >/dev/null
+        systemctl show -p WantedBy foobar.service | grep -v "${ROOTDEV#/dev/}" >/dev/null
+        systemctl show -p WantedBy waldo.service | grep -v "${ROOTDEV#/dev/}" >/dev/null
     ) && break
 
     sleep .5
index 81790d03eec6fd576247db96832fb144bac302c1..bca6aedd05a3f90876a0d9a38a9c2b4527e6c77d 100755 (executable)
@@ -20,28 +20,28 @@ SYSTEMD_LOG_LEVEL=debug udevadm trigger --verbose --settle --action add /dev/nul
 
 test -f /run/udev/tags/added/c1:3
 test ! -f /run/udev/tags/changed/c1:3
-udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*'
-udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*'
-udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' && { echo 'unexpected TAGS='; exit 1; }
-udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*' && { echo 'unexpected CURRENT_TAGS='; exit 1; }
+udevadm info /dev/null | grep 'E: TAGS=.*:added:.*' >/dev/null
+udevadm info /dev/null | grep 'E: CURRENT_TAGS=.*:added:.*' >/dev/null
+udevadm info /dev/null | grep 'E: TAGS=.*:changed:.*' >/dev/null && { echo 'unexpected TAGS='; exit 1; }
+udevadm info /dev/null | grep 'E: CURRENT_TAGS=.*:changed:.*' >/dev/null && { echo 'unexpected CURRENT_TAGS='; exit 1; }
 
 SYSTEMD_LOG_LEVEL=debug udevadm trigger --verbose --settle --action change /dev/null
 
 test -f /run/udev/tags/added/c1:3
 test -f /run/udev/tags/changed/c1:3
-udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*'
-udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' && { echo 'unexpected CURRENT_TAGS='; exit 1; }
-udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*'
-udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
+udevadm info /dev/null | grep 'E: TAGS=.*:added:.*' >/dev/null
+udevadm info /dev/null | grep 'E: CURRENT_TAGS=.*:added:.*' >/dev/null && { echo 'unexpected CURRENT_TAGS='; exit 1; }
+udevadm info /dev/null | grep 'E: TAGS=.*:changed:.*' >/dev/null
+udevadm info /dev/null | grep 'E: CURRENT_TAGS=.*:changed:.*' >/dev/null
 
 SYSTEMD_LOG_LEVEL=debug udevadm trigger --verbose --settle --action add /dev/null
 
 test -f /run/udev/tags/added/c1:3
 test -f /run/udev/tags/changed/c1:3
-udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*'
-udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*'
-udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*'
-udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*' && { echo 'unexpected CURRENT_TAGS='; exit 1; }
+udevadm info /dev/null | grep 'E: TAGS=.*:added:.*' >/dev/null
+udevadm info /dev/null | grep 'E: CURRENT_TAGS=.*:added:.*' >/dev/null
+udevadm info /dev/null | grep 'E: TAGS=.*:changed:.*' >/dev/null
+udevadm info /dev/null | grep 'E: CURRENT_TAGS=.*:changed:.*' >/dev/null && { echo 'unexpected CURRENT_TAGS='; exit 1; }
 
 rm /run/udev/rules.d/50-testsuite.rules
 udevadm control --reload
index a9fcf28bfb05815bb0a87a08fa472c00d60d3855..0abfe24bcd82ba18e806a990ff6990ab233077f4 100755 (executable)
@@ -174,7 +174,7 @@ EOF
     test -n "$found"
 
     journalctl --sync
-    timeout -v 30 journalctl _PID=1 _COMM=systemd --since "$since" -n all --follow | grep -m 1 -q -F 'foobar: systemd-udevd failed to process the device, ignoring: File exists'
+    timeout -v 30 bash -c "journalctl _PID=1 _COMM=systemd --since '$since' -n all --follow | grep -m 1 -q -F 'foobar: systemd-udevd failed to process the device, ignoring: File exists'"
     # check if the invalid SYSTEMD_ALIAS property for the interface foobar is ignored by PID1
     assert_eq "$(systemctl show --property=SysFSPath --value /sys/subsystem/net/devices/hoge)" "/sys/devices/virtual/net/hoge"
 }
index 57788da906c4f62d7b2edfda780eff15309f076b..44bb9498254a9d6aa51dec1f3956f097a6de82f1 100755 (executable)
@@ -29,7 +29,7 @@ mkdir -p /tmp/ageby/d{1..4}
 # timestamp. But, if the timestamp is visible in "stat" it is a
 # good indicator that the test can be run.
 TEST_TMPFILES_AGEBY_BTIME=${TEST_TMPFILES_AGEBY_BTIME:-0}
-if stat --format "%w" /tmp/ageby 2>/dev/null | grep -qv '^[\?\-]$'; then
+if stat --format "%w" /tmp/ageby 2>/dev/null | grep -v '^[\?\-]$' >/dev/null; then
     TEST_TMPFILES_AGEBY_BTIME=1
 fi
 
@@ -85,7 +85,7 @@ fi
 
 # Check for an invalid "age" and "age-by" arguments.
 for a in ':' ':1s' '2:1h' 'nope:42h' '"  :7m"' 'm:' '::' '"+r^w-x:2/h"' 'b ar::64'; do
-    systemd-tmpfiles --clean - <<EOF 2>&1 | grep -q -F 'Invalid age'
+    systemd-tmpfiles --clean - <<EOF 2>&1 | grep -F 'Invalid age' >/dev/null
 d /tmp/ageby - - - ${a} -
 EOF
 done
index 5b580625abb1e3410218dda22ce173c6a53760e9..88e37fd4eb035096e2e2724fdd6ac55c9da5cb8d 100755 (executable)
@@ -421,24 +421,24 @@ systemctl disable "$UNIT_NAME"
 
 # show/set-environment
 # Make sure PATH is set
-systemctl show-environment | grep -q '^PATH='
+systemctl show-environment | grep '^PATH=' >/dev/null
 # Let's add an entry and override a built-in one
 systemctl set-environment PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/testaddition FOO=BAR
 # Check that both are set
-systemctl show-environment | grep -q '^PATH=.*testaddition$'
-systemctl show-environment | grep -q '^FOO=BAR$'
+systemctl show-environment | grep '^PATH=.*testaddition$' >/dev/null
+systemctl show-environment | grep '^FOO=BAR$' >/dev/null
 systemctl daemon-reload
 # Check again after the reload
-systemctl show-environment | grep -q '^PATH=.*testaddition$'
-systemctl show-environment | grep -q '^FOO=BAR$'
+systemctl show-environment | grep '^PATH=.*testaddition$' >/dev/null
+systemctl show-environment | grep '^FOO=BAR$' >/dev/null
 # Check that JSON output is supported
-systemctl show-environment --output=json | grep -q '^{.*"FOO":"BAR".*}$'
+systemctl show-environment --output=json | grep '^{.*"FOO":"BAR".*}$' >/dev/null
 # Drop both
 systemctl unset-environment FOO PATH
 # Check that one is gone and the other reverted to the built-in
 systemctl show-environment | grep '^FOO=$' && exit 1
 systemctl show-environment | grep '^PATH=.*testaddition$' && exit 1
-systemctl show-environment | grep -q '^PATH='
+systemctl show-environment | grep '^PATH=' >/dev/null
 # Check import-environment
 export IMPORT_THIS=hello
 export IMPORT_THIS_TOO=world
@@ -590,7 +590,7 @@ EOF
 test -f "/run/systemd/user/$GLOBAL_UNIT_NAME"
 
 # Test 2: Read the global unit with systemctl cat --global
-systemctl cat --global "$GLOBAL_UNIT_NAME" | grep -q "ExecStart=/bin/true"
+systemctl cat --global "$GLOBAL_UNIT_NAME" | grep "ExecStart=/bin/true" >/dev/null
 
 # Test 3: Edit existing global unit (add a drop-in)
 systemctl edit --global --runtime --stdin "$GLOBAL_UNIT_NAME" <<EOF
@@ -600,17 +600,17 @@ EOF
 
 # Verify drop-in was created
 test -f "/run/systemd/user/$GLOBAL_UNIT_NAME.d/override.conf"
-systemctl cat --global "$GLOBAL_UNIT_NAME" | grep -q "Environment=TEST=value"
+systemctl cat --global "$GLOBAL_UNIT_NAME" | grep "Environment=TEST=value" >/dev/null
 
 # Test 4: Create a masked global unit in /run/
 mkdir -p /run/systemd/user
 ln -sf /dev/null "/run/systemd/user/$GLOBAL_MASKED_UNIT"
 
 # Test 5: Verify cat shows it's masked
-systemctl cat --global "$GLOBAL_MASKED_UNIT" 2>&1 | grep -q "masked"
+systemctl cat --global "$GLOBAL_MASKED_UNIT" 2>&1 | grep "masked" >/dev/null
 
 # Test 6: Verify edit refuses to edit masked unit
-(! systemctl edit --global --runtime --stdin --full "$GLOBAL_MASKED_UNIT" </dev/null 2>&1) | grep -q "masked"
+(! systemctl edit --global --runtime --stdin --full "$GLOBAL_MASKED_UNIT" </dev/null 2>&1) | grep "masked" >/dev/null
 
 # Cleanup global test units
 rm -f "/run/systemd/user/$GLOBAL_UNIT_NAME"
index 57fed2d4a55bb9f018d20d01d9aaf5f0ccfb9fc5..81aae08a3d6d6586f85b8f1d36ee38ff57fc6b9e 100755 (executable)
@@ -32,13 +32,13 @@ systemctl is-active minimal-app0.service
 systemctl is-active minimal-app0-bar.service
 systemctl is-active minimal-app0-foo.service && exit 1
 
-portablectl list | grep -q -F "minimal_1"
-busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1'
+portablectl list | grep -F "minimal_1" >/dev/null
+busctl tree org.freedesktop.portable1 --no-pager | grep -F '/org/freedesktop/portable1/image/minimal_5f1' >/dev/null
 
 portablectl detach --now --enable --runtime /tmp/minimal_1 minimal-app0
 
-portablectl list | grep -q -F "No images."
-busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1' && exit 1
+portablectl list | grep -F "No images." >/dev/null
+busctl tree org.freedesktop.portable1 --no-pager | grep -F '/org/freedesktop/portable1/image/minimal_5f1' && exit 1 >/dev/null
 
 mkdir /tmp/rootdir /tmp/app0 /tmp/app1 /tmp/overlay /tmp/os-release-fix /tmp/os-release-fix/etc
 mount /tmp/app0.raw /tmp/app0
@@ -90,11 +90,11 @@ portablectl "${ARGS[@]}" attach --copy=symlink --now --runtime --extension /tmp/
 systemctl is-active app0.service
 systemctl is-active app1.service
 
-portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -q -f /tmp/rootdir/usr/lib/os-release
-portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -q -f /tmp/app0/usr/lib/extension-release.d/extension-release.app0
-portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -q -f /tmp/app1/usr/lib/extension-release.d/extension-release.app2
-portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -q -f /tmp/app1/usr/lib/systemd/system/app1.service
-portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -q -f /tmp/app0/usr/lib/systemd/system/app0.service
+portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -f /tmp/rootdir/usr/lib/os-release >/dev/null
+portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -f /tmp/app0/usr/lib/extension-release.d/extension-release.app0 >/dev/null
+portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -f /tmp/app1/usr/lib/extension-release.d/extension-release.app2 >/dev/null
+portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -f /tmp/app1/usr/lib/systemd/system/app1.service >/dev/null
+portablectl inspect --cat --extension app0 --extension app1 rootdir app0 app1 | grep -f /tmp/app0/usr/lib/systemd/system/app0.service >/dev/null
 
 grep -q -F "LogExtraFields=PORTABLE=app0" /run/systemd/system.attached/app0.service.d/20-portable.conf
 grep -q -F "LogExtraFields=PORTABLE_ROOT=rootdir" /run/systemd/system.attached/app0.service.d/20-portable.conf
index 376d94c28331a30bad8ddad06fd67cab2c18d443..d034e2c48c5a4ddad8180a41815cbac162ab9e7b 100755 (executable)
@@ -33,13 +33,13 @@ systemctl is-active minimal-app0.service
 systemctl is-active minimal-app0-bar.service
 systemctl is-active minimal-app0-foo.service && exit 1
 
-portablectl list | grep -q -F "minimal_1"
-busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1'
+portablectl list | grep -F "minimal_1" >/dev/null
+busctl tree org.freedesktop.portable1 --no-pager | grep -F '/org/freedesktop/portable1/image/minimal_5f1' >/dev/null
 
 portablectl detach --now --runtime /usr/share/minimal_1.raw minimal-app0
 
-portablectl list | grep -q -F "No images."
-busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1' && exit 1
+portablectl list | grep -F "No images." >/dev/null
+busctl tree org.freedesktop.portable1 --no-pager | grep -F '/org/freedesktop/portable1/image/minimal_5f1' && exit 1 >/dev/null
 
 # Ensure we don't regress (again) when using --force
 
@@ -74,13 +74,13 @@ systemctl is-active minimal-app0.service
 systemctl is-active minimal-app0-bar.service
 systemctl is-active minimal-app0-foo.service && exit 1
 
-portablectl list | grep -q -F "minimal_1"
-busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1'
+portablectl list | grep -F "minimal_1" >/dev/null
+busctl tree org.freedesktop.portable1 --no-pager | grep -F '/org/freedesktop/portable1/image/minimal_5f1' >/dev/null
 
 portablectl detach --force --now --runtime /usr/share/minimal_1.raw minimal-app0
 
-portablectl list | grep -q -F "No images."
-busctl tree org.freedesktop.portable1 --no-pager | grep -q -F '/org/freedesktop/portable1/image/minimal_5f1' && exit 1
+portablectl list | grep -F "No images." >/dev/null
+busctl tree org.freedesktop.portable1 --no-pager | grep -F '/org/freedesktop/portable1/image/minimal_5f1' >/dev/null && exit 1
 
 portablectl "${ARGS[@]}" attach --now --runtime --extension /tmp/app0.raw /usr/share/minimal_0.raw app0
 
@@ -182,7 +182,7 @@ systemctl is-active app0.service
 status="$(portablectl is-attached --extension /tmp/app10.raw /usr/share/minimal_0.raw)"
 [[ "${status}" == "running-runtime" ]]
 
-portablectl inspect --force --cat --extension /tmp/app10.raw /usr/share/minimal_0.raw app0 | grep -q -F "Extension Release: /tmp/app10.raw"
+portablectl inspect --force --cat --extension /tmp/app10.raw /usr/share/minimal_0.raw app0 | grep -F "Extension Release: /tmp/app10.raw" >/dev/null
 
 # Ensure that we can detach even when an image has been deleted already (stop the unit manually as
 # portablectl won't find it)
@@ -197,7 +197,7 @@ systemctl is-active app0.service
 status="$(portablectl is-attached --extension /tmp/app0.raw --extension /tmp/conf0.raw /usr/share/minimal_0.raw)"
 [[ "${status}" == "running-runtime" ]]
 
-portablectl inspect --force --cat --extension /tmp/app0.raw --extension /tmp/conf0.raw /usr/share/minimal_0.raw app0 | grep -q -F "Extension Release: /tmp/conf0.raw"
+portablectl inspect --force --cat --extension /tmp/app0.raw --extension /tmp/conf0.raw /usr/share/minimal_0.raw app0 | grep -F "Extension Release: /tmp/conf0.raw" >/dev/null
 
 portablectl detach --now --runtime --extension /tmp/app0.raw --extension /tmp/conf0.raw /usr/share/minimal_0.raw app0
 
@@ -228,9 +228,9 @@ status="$(portablectl is-attached --extension app1 minimal_0)"
 
 # Ensure 'portablectl list' shows the correct status for both images
 portablectl list
-portablectl list | grep -F "minimal_0" | grep -q -F "attached-runtime"
-portablectl list | grep -F "app0" | grep -q -F "attached-runtime"
-portablectl list | grep -F "app1" | grep -q -F "attached-runtime"
+portablectl list | grep -F "minimal_0" | grep -F "attached-runtime" >/dev/null
+portablectl list | grep -F "app0" | grep -F "attached-runtime" >/dev/null
+portablectl list | grep -F "app1" | grep -F "attached-runtime" >/dev/null
 
 portablectl detach --runtime --extension /tmp/app0.raw /usr/share/minimal_0.raw app
 
index 7e0ba7e38a68a7758f5cff1a81b3b462a7450cf3..82b12d538083d61be73bd4ceac2f95adfa3fb887 100755 (executable)
@@ -47,11 +47,11 @@ export SYSTEMD_DISSECT_VERITY_TIMEOUT_SEC=30
 
 # Quick smoke tests
 
-systemd-dissect --no-pager /usr/share/minimal_0.raw | grep -q '✓ portable service'
-systemd-dissect --no-pager /usr/share/minimal_1.raw | grep -q '✓ portable service'
-systemd-dissect --no-pager /tmp/app0.raw | grep -q '✓ sysext for portable service'
-systemd-dissect --no-pager /tmp/app1.raw | grep -q '✓ sysext for portable service'
-systemd-dissect --no-pager /tmp/conf0.raw | grep -q '✓ confext for portable service'
+systemd-dissect --no-pager /usr/share/minimal_0.raw | grep '✓ portable service' >/dev/null
+systemd-dissect --no-pager /usr/share/minimal_1.raw | grep '✓ portable service' >/dev/null
+systemd-dissect --no-pager /tmp/app0.raw | grep '✓ sysext for portable service' >/dev/null
+systemd-dissect --no-pager /tmp/app1.raw | grep '✓ sysext for portable service' >/dev/null
+systemd-dissect --no-pager /tmp/conf0.raw | grep '✓ confext for portable service' >/dev/null
 
 # Lack of ID field in os-release should be rejected, but it caused a crash in the past instead
 mkdir -p /tmp/emptyroot/usr/lib
index c3dd11afa6c139579f8624ea9972589c9608105b..58b3bcca07888b090ab74ceda128585daa1ed9f3 100755 (executable)
@@ -278,7 +278,7 @@ cleanup_session() (
 
     loginctl terminate-user logind-test-user
 
-    if ! timeout 30 bash -c "while loginctl --no-legend | grep -q logind-test-user; do sleep 1; done"; then
+    if ! timeout 30 bash -c "while loginctl --no-legend | grep logind-test-user >/dev/null; do sleep 1; done"; then
         loginctl
         echo "WARNING: session for logind-test-user still active, ignoring."
     fi
@@ -339,7 +339,7 @@ check_session() (
         return 1
     fi
 
-    if ! loginctl session-status "$session" | grep -q "Unit: session-${session}\.scope"; then
+    if ! loginctl session-status "$session" | grep "Unit: session-${session}\.scope" >/dev/null; then
         echo "cannot find scope unit for session $session" >&2
         return 1
     fi
@@ -516,7 +516,7 @@ testcase_lock_idle_action() {
         return
     fi
 
-    if loginctl --no-legend | grep -v manager | grep -q logind-test-user; then
+    if loginctl --no-legend | grep -v manager | grep logind-test-user >/dev/null; then
         echo >&2 "Session of the 'logind-test-user' is already present."
         exit 1
     fi
@@ -542,7 +542,7 @@ EOF
     # become idle again. 'Lock' signal is sent out for each session, we have at
     # least one session, so minimum of 2 "Lock" signals must have been sent.
     journalctl --sync
-    timeout -v 35 journalctl -b -u systemd-logind.service --since="$ts" -n all --follow | grep -m 1 -q 'Sent message type=signal .* member=Lock'
+    timeout -v 35 bash -c "journalctl -b -u systemd-logind.service --since='$ts' -n all --follow | grep -m 1 -q 'Sent message type=signal .* member=Lock'"
 
     # We need to know that a new message was sent after waking up,
     # so we must track how many happened before sleeping to check we have extra.
@@ -553,8 +553,8 @@ EOF
 
     # Wait again
     journalctl --sync
-    timeout -v 35 journalctl -b -u systemd-logind.service --since="$ts" -n all --follow | grep -m "$((locks + 1))" -q 'Sent message type=signal .* member=Lock'
-    timeout -v 35 journalctl -b -u systemd-logind.service --since="$ts" -n all --follow | grep -m 2 -q -F 'System idle. Will be locked now.'
+    timeout -v 35 bash -c "journalctl -b -u systemd-logind.service --since='$ts' -n all --follow | grep -m '$((locks + 1))' -q 'Sent message type=signal .* member=Lock'"
+    timeout -v 35 bash -c "journalctl -b -u systemd-logind.service --since='$ts' -n all --follow | grep -m 2 -q -F 'System idle. Will be locked now.'"
 }
 
 testcase_session_properties() {
@@ -597,7 +597,7 @@ testcase_list_users_sessions_seats() {
     assert_eq "$(loginctl list-sessions --no-legend | grep -v manager | awk '$3 == "logind-test-user" { print $8 }')" no
     assert_eq "$(loginctl list-sessions --no-legend | grep -v manager | awk '$3 == "logind-test-user" { print $9 }')" '-'
 
-    loginctl list-seats --no-legend | grep -Fwq "${seat?}"
+    loginctl list-seats --no-legend | grep -Fw "${seat?}" >/dev/null
 
     assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $1 }')" "$(id -ru logind-test-user)"
     assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $3 }')" no
@@ -606,13 +606,13 @@ testcase_list_users_sessions_seats() {
     systemd-run --quiet --service-type=notify --unit=test-linger-signal-wait --pty \
                 -p Environment=SYSTEMD_LOG_LEVEL=debug \
                 -p ExecStartPost="loginctl enable-linger logind-test-user" \
-                busctl --timeout=30 wait "/org/freedesktop/login1/user/_$(id -ru logind-test-user)" org.freedesktop.DBus.Properties PropertiesChanged | grep -qF '"Linger" b true'
+                busctl --timeout=30 wait "/org/freedesktop/login1/user/_$(id -ru logind-test-user)" org.freedesktop.DBus.Properties PropertiesChanged | grep -F '"Linger" b true' >/dev/null
     assert_eq "$(loginctl list-users --no-legend | awk '$2 == "logind-test-user" { print $3 }')" yes
 
     for s in $(loginctl list-sessions --no-legend | grep tty | awk '$3 == "logind-test-user" { print $1 }'); do
         loginctl terminate-session "$s"
     done
-    if ! timeout 30 bash -c "while loginctl --no-legend | grep tty | grep -q logind-test-user; do sleep 1; done"; then
+    if ! timeout 30 bash -c "while loginctl --no-legend | grep tty | grep logind-test-user >/dev/null; do sleep 1; done"; then
         echo "WARNING: session for logind-test-user still active, ignoring."
         return
     fi
@@ -772,28 +772,28 @@ EOF
     systemd-sysusers --inline "u lightuser"
 
     systemd-run -u "$TRANSIENTUNIT3" -p PAMName="$PAMSERVICE" -p "Environment=XDG_SESSION_TYPE=unspecified" -p Type=exec -p User=lightuser sleep infinity
-    loginctl | grep lightuser | grep -q background-light
+    loginctl | grep lightuser | grep -w background-light >/dev/null
     systemctl stop "$TRANSIENTUNIT3"
 
     systemd-run -u "$TRANSIENTUNIT4" -p PAMName="$PAMSERVICE" -p "Environment=XDG_SESSION_TYPE=tty" -p Type=exec -p User=lightuser sleep infinity
-    loginctl | grep lightuser | grep -q user-light
+    loginctl | grep lightuser | grep -w user-light >/dev/null
     systemctl stop "$TRANSIENTUNIT4"
 
     # Now check that run0's session class control works
     systemd-run --service-type=notify run0 -u lightuser --unit="$RUN0UNIT0" sleep infinity
-    loginctl | grep lightuser | grep -qw background-light
+    loginctl | grep lightuser | grep -w background-light >/dev/null
     systemctl stop "$RUN0UNIT0"
 
     systemd-run --service-type=notify run0 -u lightuser --unit="$RUN0UNIT1" --lightweight=yes sleep infinity
-    loginctl | grep lightuser | grep -qw background-light
+    loginctl | grep lightuser | grep -w background-light >/dev/null
     systemctl stop "$RUN0UNIT1"
 
     systemd-run --service-type=notify run0 -u lightuser --unit="$RUN0UNIT2" --lightweight=no sleep infinity
-    loginctl | grep lightuser | grep -qw background
+    loginctl | grep lightuser | grep -w background >/dev/null
     systemctl stop "$RUN0UNIT2"
 
     systemd-run --service-type=notify run0 -u root --unit="$RUN0UNIT3" sleep infinity
-    loginctl | grep root | grep -qw background-light
+    loginctl | grep root | grep -w background-light >/dev/null
     systemctl stop "$RUN0UNIT3"
 }
 
@@ -816,7 +816,7 @@ testcase_restart() {
     for c in $classes; do
         unit="user-sleeper-$c.service"
         systemctl --quiet is-active "$unit"
-        loginctl | grep logind-test-user | grep -qw "$c"
+        loginctl | grep logind-test-user | grep -w "$c" >/dev/null
         systemctl kill "$unit"
     done
 }
index 7e48b4739efb34aef29679d0d8d278b51f436c48..71fcdb45248705aa703b31d4ea327b3846c8ccae 100755 (executable)
@@ -341,7 +341,7 @@ else
 
     systemd-run -p NUMAPolicy=local -p NUMAMask=0 -p CPUAffinity=numa --unit "$runUnit" sleep 1000
     systemctlCheckNUMAProperties "$runUnit" "local" ""
-    systemctl cat "$runUnit" | grep -q 'CPUAffinity=numa'
+    systemctl cat "$runUnit" | grep 'CPUAffinity=numa' >/dev/null
     pid1StopUnit "$runUnit"
 fi
 
index fa3a090b055f1b11c6b1d90b55b64090b8016b65..7dec078580b12810c80a8de3d17bf4656ee3a28e 100755 (executable)
@@ -84,7 +84,7 @@ runas testuser systemd-run --wait --user --unit=test-caps \
 
 runas testuser systemd-run --wait --user --unit=test-devices \
     -p PrivateDevices=yes -p PrivateIPC=yes \
-    bash -c "ls -1 /dev/ | wc -l | grep -q -F 18"
+    bash -c "ls -1 /dev/ | wc -l | grep -F 18 >/dev/null"
 
 # Same check as test/test-execute/exec-privatenetwork-yes.service
 runas testuser systemd-run --wait --user --unit=test-network \
index d7d29e08936db177da76e1b42681109b0bd59441..6de15789669f3c66871ccb649a169b5d7e44ead4 100755 (executable)
@@ -37,7 +37,7 @@ wait_for_exist() {
 }
 
 wait_for_state() {
-    timeout 2m bash -c "until homectl inspect '${1:?}' | grep -qF 'State: $2'; do sleep 2; done"
+    timeout 2m bash -c "until homectl inspect '${1:?}' | grep -F 'State: $2' >/dev/null; do sleep 2; done"
 }
 
 FSTYPE="$(stat --file-system --format "%T" /)"
@@ -721,7 +721,7 @@ testcase_quota() {
 
     NEWPASSWORD=quux homectl create tmpfsquota --storage=subvolume --dev-shm-limit=50K --tmp-limit=50K -P
     for p in /dev/shm /tmp; do
-        if findmnt -n -o options "$p" | grep -q usrquota; then
+        if findmnt -n -o options "$p" | grep usrquota >/dev/null; then
             # Check if we can display the quotas. If we cannot, than it's likely
             # that PID1 was also not able to set the limits and we should not fail
             # in the tests below.
@@ -808,8 +808,8 @@ EOF
 
 testcase_sign() {
     # Test signing key logic
-    homectl list-signing-keys | grep -q local.public
-    (! (homectl list-signing-keys | grep -q signtest.public))
+    homectl list-signing-keys | grep local.public >/dev/null
+    (! (homectl list-signing-keys | grep signtest.public >/dev/null))
 
     if built_with_musl; then
         # FIXME: musl does not support yescrypt. Use SHA512 and update signature.
@@ -864,8 +864,8 @@ EOF
     # Let's now add the signing key
     print_public_key | homectl add-signing-key --key-name=signtest.public
     homectl get-signing-key signtest.public | cmp - <(print_public_key)
-    homectl list-signing-keys | grep -q local.public
-    homectl list-signing-keys | grep -q signtest.public
+    homectl list-signing-keys | grep local.public >/dev/null
+    homectl list-signing-keys | grep signtest.public >/dev/null
 
     # Now create the account with this, it should work now
     print_identity | homectl create -P --identity=- --seize=no
@@ -880,8 +880,8 @@ EOF
     (! PASSWORD="test" homectl with signtest true)
 
     # Verify key is really gone
-    homectl list-signing-keys | grep -q local.public
-    (! (homectl list-signing-keys | grep -q signtest.public))
+    homectl list-signing-keys | grep local.public >/dev/null
+    (! (homectl list-signing-keys | grep signtest.public >/dev/null))
 
     # Test unregister + adopt
     mkdir /home/elsewhere
@@ -908,9 +908,9 @@ EOF
     # add signing key via credential
     wait_for_state signtest inactive
     homectl remove-signing-key signtest.public
-    (! (homectl list-signing-keys | grep -q signtest.public))
+    (! (homectl list-signing-keys | grep signtest.public >/dev/null))
     systemd-run --wait -p "SetCredential=home.add-signing-key.signtest.public:$(print_public_key)" homectl firstboot
-    homectl list-signing-keys | grep -q signtest.public
+    homectl list-signing-keys | grep signtest.public >/dev/null
 
     # register user via credential
     mkdir /home/elsewhere2
index f702cd135445fadc64b962b52475cf23642ab7e4..742fcf1d2f0f35855adb7647ed1e70f3a344bc44 100755 (executable)
@@ -18,16 +18,16 @@ if [[ "${ID_LIKE:-}" == alpine ]]; then
 fi
 
 systemd-dissect --json=short "$MINIMAL_IMAGE.raw" | \
-    grep -q -F '{"rw":"ro","designator":"root","partition_uuid":null,"partition_label":null,"fstype":"squashfs","architecture":null,"verity":"external"'
-systemd-dissect "$MINIMAL_IMAGE.raw" | grep -q -F "MARKER=1"
+    grep -F '{"rw":"ro","designator":"root","partition_uuid":null,"partition_label":null,"fstype":"squashfs","architecture":null,"verity":"external"' >/dev/null
+systemd-dissect "$MINIMAL_IMAGE.raw" | grep -F "MARKER=1" >/dev/null
 # shellcheck disable=SC2153
-systemd-dissect "$MINIMAL_IMAGE.raw" | grep -q -F -f <(sed 's/"//g' "$OS_RELEASE")
+systemd-dissect "$MINIMAL_IMAGE.raw" | grep -F -f <(sed 's/"//g' "$OS_RELEASE") >/dev/null
 
-systemd-dissect --list "$MINIMAL_IMAGE.raw" | grep -q '^etc/os-release$'
+systemd-dissect --list "$MINIMAL_IMAGE.raw" | grep '^etc/os-release$' >/dev/null
 systemd-dissect --mtree "$MINIMAL_IMAGE.raw" --mtree-hash yes | \
-    grep -qE "^.(/usr|)/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]* sha256sum=[a-z0-9]*$"
+    grep -E "^.(/usr|)/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]* sha256sum=[a-z0-9]*$" >/dev/null
 systemd-dissect --mtree "$MINIMAL_IMAGE.raw" --mtree-hash no  | \
-    grep -qE "^.(/usr|)/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]*$"
+    grep -E "^.(/usr|)/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]*$" >/dev/null
 
 read -r SHA256SUM1 _ < <(systemd-dissect --copy-from "$MINIMAL_IMAGE.raw" etc/os-release | sha256sum)
 test "$SHA256SUM1" != ""
@@ -35,7 +35,7 @@ read -r SHA256SUM2 _ < <(systemd-dissect --read-only --with "$MINIMAL_IMAGE.raw"
 test "$SHA256SUM2" != ""
 test "$SHA256SUM1" = "$SHA256SUM2"
 
-if systemctl --version | grep -qF -- "+LIBARCHIVE" ; then
+if systemctl --version | grep -F -- "+LIBARCHIVE"  >/dev/null; then
     # Make sure tarballs are reproducible
     read -r SHA256SUM1 _ < <(systemd-dissect --make-archive "$MINIMAL_IMAGE.raw" | sha256sum)
     test "$SHA256SUM1" != ""
@@ -52,15 +52,15 @@ systemd-dissect "$MINIMAL_IMAGE.raw" \
                 --json=short \
                 --root-hash="$MINIMAL_IMAGE_ROOTHASH" \
                 --verity-data="$MINIMAL_IMAGE.fooverity" | \
-                grep -q -F '{"rw":"ro","designator":"root","partition_uuid":null,"partition_label":null,"fstype":"squashfs","architecture":null,"verity":"external"'
+                grep -F '{"rw":"ro","designator":"root","partition_uuid":null,"partition_label":null,"fstype":"squashfs","architecture":null,"verity":"external"' >/dev/null
 systemd-dissect "$MINIMAL_IMAGE.raw" \
                 --root-hash="$MINIMAL_IMAGE_ROOTHASH" \
                 --verity-data="$MINIMAL_IMAGE.fooverity" | \
-                grep -q -F "MARKER=1"
+                grep -F "MARKER=1" >/dev/null
 systemd-dissect "$MINIMAL_IMAGE.raw" \
                 --root-hash="$MINIMAL_IMAGE_ROOTHASH" \
                 --verity-data="$MINIMAL_IMAGE.fooverity" | \
-                grep -q -F -f <(sed 's/"//g' "$OS_RELEASE")
+                grep -F -f <(sed 's/"//g' "$OS_RELEASE") >/dev/null
 mv "$MINIMAL_IMAGE.fooverity" "$MINIMAL_IMAGE.verity"
 mv "$MINIMAL_IMAGE.foohash" "$MINIMAL_IMAGE.roothash"
 
@@ -81,7 +81,7 @@ if [[ "$verity_count" -lt 1 ]]; then
 fi
 # Ensure the kernel is verifying the signature if the mkosi key is in the keyring
 if [ "$VERITY_SIG_SUPPORTED" -eq 1 ]; then
-    veritysetup status "$(cat "$MINIMAL_IMAGE.roothash")-verity" | grep -q "verified (with signature)"
+    veritysetup status "$(cat "$MINIMAL_IMAGE.roothash")-verity" | grep "verified (with signature)" >/dev/null
 fi
 systemd-dissect --umount "$IMAGE_DIR/mount"
 systemd-dissect --umount "$IMAGE_DIR/mount2"
@@ -92,16 +92,16 @@ systemd-dissect --umount "$IMAGE_DIR/mount2"
 SYSTEMD_VERITY_SHARING=0 systemd-dissect --mount "$MINIMAL_IMAGE.raw" "$IMAGE_DIR/mount"
 d=""
 for f in /dev/mapper/*; do
-    if [[ "$(basename "$f")" =~ ^loop.*-verity ]] && veritysetup status "$(basename "$f")" | grep -q "$MINIMAL_IMAGE.raw"; then
+    if [[ "$(basename "$f")" =~ ^loop.*-verity ]] && veritysetup status "$(basename "$f")" | grep "$MINIMAL_IMAGE.raw" >/dev/null; then
         d="$f"
         break
     fi
 done
 test -n "$d"
-dmsetup ls | grep -q "$(basename "$d")"
+dmsetup ls | grep "$(basename "$d")" >/dev/null
 umount -R "$IMAGE_DIR/mount"
 timeout 60 bash -c "while test -e $d; do sleep 0.1; done"
-( ! dmsetup ls | grep -q "$(basename "$d")")
+( ! dmsetup ls | grep "$(basename "$d")") >/dev/null
 
 # Test BindLogSockets=
 systemd-run --wait -p RootImage="$MINIMAL_IMAGE.raw" mountpoint /run/systemd/journal/socket
@@ -139,7 +139,7 @@ if [[ "$(findmnt -n -o FSTYPE /)" == btrfs ]]; then
     btrfs subvolume delete /test-dissect-btrfs-snapshot
 fi
 
-systemd-run -P -p RootImage="$MINIMAL_IMAGE.raw" cat /usr/lib/os-release | grep -q -F "MARKER=1"
+systemd-run -P -p RootImage="$MINIMAL_IMAGE.raw" cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 mv "$MINIMAL_IMAGE.verity" "$MINIMAL_IMAGE.fooverity"
 mv "$MINIMAL_IMAGE.roothash" "$MINIMAL_IMAGE.foohash"
 systemd-run -P \
@@ -147,13 +147,13 @@ systemd-run -P \
             -p RootHash="$MINIMAL_IMAGE.foohash" \
             -p RootVerity="$MINIMAL_IMAGE.fooverity" \
             -p BindLogSockets=yes \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 # Let's use the long option name just here as a test
 systemd-run -P \
             --property RootImage="$MINIMAL_IMAGE.raw" \
             --property RootHash="$MINIMAL_IMAGE_ROOTHASH" \
             --property RootVerity="$MINIMAL_IMAGE.fooverity" \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 mv "$MINIMAL_IMAGE.fooverity" "$MINIMAL_IMAGE.verity"
 mv "$MINIMAL_IMAGE.foohash" "$MINIMAL_IMAGE.roothash"
 
@@ -164,19 +164,19 @@ VERITY_UUID="$(systemd-id128 -u show "$(tail -c 32 "$MINIMAL_IMAGE.roothash")" -
 systemd-dissect --json=short \
                 --root-hash "$MINIMAL_IMAGE_ROOTHASH" \
                 "$MINIMAL_IMAGE.gpt" | \
-                grep -q '{"rw":"ro","designator":"root","partition_uuid":"'"$ROOT_UUID"'","partition_label":"Root Partition","fstype":"squashfs","architecture":"'"$ARCHITECTURE"'","verity":"signed",'
+                grep '{"rw":"ro","designator":"root","partition_uuid":"'"$ROOT_UUID"'","partition_label":"Root Partition","fstype":"squashfs","architecture":"'"$ARCHITECTURE"'","verity":"signed",' >/dev/null
 systemd-dissect --json=short \
                 --root-hash "$MINIMAL_IMAGE_ROOTHASH" \
                 "$MINIMAL_IMAGE.gpt" | \
-                grep -q '{"rw":"ro","designator":"root-verity","partition_uuid":"'"$VERITY_UUID"'","partition_label":"Verity Partition","fstype":"DM_verity_hash","architecture":"'"$ARCHITECTURE"'","verity":null,'
+                grep '{"rw":"ro","designator":"root-verity","partition_uuid":"'"$VERITY_UUID"'","partition_label":"Verity Partition","fstype":"DM_verity_hash","architecture":"'"$ARCHITECTURE"'","verity":null,' >/dev/null
 if [[ -n "${OPENSSL_CONFIG:-}" ]]; then
     systemd-dissect --json=short \
                     --root-hash "$MINIMAL_IMAGE_ROOTHASH" \
                     "$MINIMAL_IMAGE.gpt" | \
-                    grep -qE '{"rw":"ro","designator":"root-verity-sig","partition_uuid":"'".*"'","partition_label":"Signature Partition","fstype":"verity_hash_signature","architecture":"'"$ARCHITECTURE"'","verity":null,'
+                    grep -E '{"rw":"ro","designator":"root-verity-sig","partition_uuid":"'".*"'","partition_label":"Signature Partition","fstype":"verity_hash_signature","architecture":"'"$ARCHITECTURE"'","verity":null,' >/dev/null
 fi
-systemd-dissect --root-hash "$MINIMAL_IMAGE_ROOTHASH" "$MINIMAL_IMAGE.gpt" | grep -q -F "MARKER=1"
-systemd-dissect --root-hash "$MINIMAL_IMAGE_ROOTHASH" "$MINIMAL_IMAGE.gpt" | grep -q -F -f <(sed 's/"//g' "$OS_RELEASE")
+systemd-dissect --root-hash "$MINIMAL_IMAGE_ROOTHASH" "$MINIMAL_IMAGE.gpt" | grep -F "MARKER=1" >/dev/null
+systemd-dissect --root-hash "$MINIMAL_IMAGE_ROOTHASH" "$MINIMAL_IMAGE.gpt" | grep -F -f <(sed 's/"//g' "$OS_RELEASE") >/dev/null
 
 # Test image policies
 systemd-dissect --validate "$MINIMAL_IMAGE.gpt"
@@ -200,49 +200,49 @@ systemd-run --wait -P \
             -p RootImage="$MINIMAL_IMAGE.gpt" \
             -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
             -p MountAPIVFS=yes \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run --wait -P \
             -p RootImage="$MINIMAL_IMAGE.gpt" \
             -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
             -p RootImagePolicy='*' \
             -p MountAPIVFS=yes \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 (! systemd-run --wait -P \
                -p RootImage="$MINIMAL_IMAGE.gpt" \
                -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
                -p RootImagePolicy='~' \
                -p MountAPIVFS=yes \
-               cat /usr/lib/os-release | grep -q -F "MARKER=1")
+               cat /usr/lib/os-release | grep -F "MARKER=1") >/dev/null
 (! systemd-run --wait -P \
                -p RootImage="$MINIMAL_IMAGE.gpt" \
                -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
                -p RootImagePolicy='-' \
                -p MountAPIVFS=yes \
-               cat /usr/lib/os-release | grep -q -F "MARKER=1")
+               cat /usr/lib/os-release | grep -F "MARKER=1") >/dev/null
 (! systemd-run --wait -P \
                -p RootImage="$MINIMAL_IMAGE.gpt" \
                -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
                -p RootImagePolicy='root=absent' \
                -p MountAPIVFS=yes \
-               cat /usr/lib/os-release | grep -q -F "MARKER=1")
+               cat /usr/lib/os-release | grep -F "MARKER=1") >/dev/null
 systemd-run --wait -P \
             -p RootImage="$MINIMAL_IMAGE.gpt" \
             -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
             -p RootImagePolicy='root=verity' \
             -p MountAPIVFS=yes \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run --wait -P \
             -p RootImage="$MINIMAL_IMAGE.gpt" \
             -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
             -p RootImagePolicy='root=signed' \
             -p MountAPIVFS=yes \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 (! systemd-run --wait -P \
                -p RootImage="$MINIMAL_IMAGE.gpt" \
                -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
                -p RootImagePolicy='root=encrypted' \
                -p MountAPIVFS=yes \
-               cat /usr/lib/os-release | grep -q -F "MARKER=1")
+               cat /usr/lib/os-release | grep -F "MARKER=1") >/dev/null
 
 systemd-dissect --root-hash "$MINIMAL_IMAGE_ROOTHASH" --mount "$MINIMAL_IMAGE.gpt" "$IMAGE_DIR/mount"
 grep -q -F -f "$OS_RELEASE" "$IMAGE_DIR/mount/usr/lib/os-release"
@@ -261,15 +261,15 @@ systemd-run -P \
             -p RootImage="$MINIMAL_IMAGE.gpt" \
             -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
             -p MountAPIVFS=yes \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             -p RootImage="$MINIMAL_IMAGE.raw" \
             -p RootImageOptions="root:nosuid,dev home:ro,dev ro,noatime" \
-            mount | grep -F "squashfs" | grep -q -F "nosuid"
+            mount | grep -F "squashfs" | grep -F "nosuid" >/dev/null
 systemd-run -P \
             -p RootImage="$MINIMAL_IMAGE.gpt" \
             -p RootImageOptions="root:ro,noatime root:ro,dev" \
-            mount | grep -F "squashfs" | grep -q -F "noatime"
+            mount | grep -F "squashfs" | grep -F "noatime" >/dev/null
 
 mkdir -p "$IMAGE_DIR/result"
 cat >/run/systemd/system/testservice-50a.service <<EOF
@@ -283,8 +283,8 @@ RootImageOptions=root:ro,noatime home:ro,dev relatime,dev
 RootImageOptions=nosuid,dev
 EOF
 systemctl start testservice-50a.service
-grep -F "squashfs" "$IMAGE_DIR/result/a" | grep -q -F "noatime"
-grep -F "squashfs" "$IMAGE_DIR/result/a" | grep -q -F -v "nosuid"
+grep -F "squashfs" "$IMAGE_DIR/result/a" | grep -F "noatime" >/dev/null
+grep -F "squashfs" "$IMAGE_DIR/result/a" | grep -F -v "nosuid" >/dev/null
 
 cat >/run/systemd/system/testservice-50b.service <<EOF
 [Service]
@@ -299,7 +299,7 @@ RootImageOptions=home:ro,dev nosuid,dev,%%foo
 MountAPIVFS=yes
 EOF
 systemctl start testservice-50b.service
-grep -F "squashfs" "$IMAGE_DIR/result/b" | grep -q -F "noatime"
+grep -F "squashfs" "$IMAGE_DIR/result/b" | grep -F "noatime" >/dev/null
 
 # Check that specifier escape is applied %%foo → %foo
 busctl get-property org.freedesktop.systemd1 \
@@ -309,41 +309,41 @@ busctl get-property org.freedesktop.systemd1 \
 # Now do some checks with MountImages, both by itself, with options and in combination with RootImage, and as single FS or GPT image
 systemd-run -P \
             -p MountImages="$MINIMAL_IMAGE.gpt:/run/img1 $MINIMAL_IMAGE.raw:/run/img2" \
-            cat /run/img1/usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /run/img1/usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             -p MountImages="$MINIMAL_IMAGE.gpt:/run/img1 $MINIMAL_IMAGE.raw:/run/img2" \
-            cat /run/img2/usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /run/img2/usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             -p MountImages="$MINIMAL_IMAGE.gpt:/run/img1 $MINIMAL_IMAGE.raw:/run/img2:nosuid,dev" \
-            mount | grep -F "squashfs" | grep -q -F "nosuid"
+            mount | grep -F "squashfs" | grep -F "nosuid" >/dev/null
 systemd-run -P \
             -p MountImages="$MINIMAL_IMAGE.gpt:/run/img1:root:nosuid $MINIMAL_IMAGE.raw:/run/img2:home:suid" \
-            mount | grep -F "squashfs" | grep -q -F "nosuid"
+            mount | grep -F "squashfs" | grep -F "nosuid" >/dev/null
 systemd-run -P \
             -p MountImages="$MINIMAL_IMAGE.raw:/run/img2\:3" \
-            cat /run/img2:3/usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /run/img2:3/usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             -p MountImages="$MINIMAL_IMAGE.raw:/run/img2\:3:nosuid" \
-            mount | grep -F "squashfs" | grep -q -F "nosuid"
+            mount | grep -F "squashfs" | grep -F "nosuid" >/dev/null
 systemd-run -P \
             -p TemporaryFileSystem=/run \
             -p RootImage="$MINIMAL_IMAGE.raw" \
             -p MountImages="$MINIMAL_IMAGE.gpt:/run/img1 $MINIMAL_IMAGE.raw:/run/img2" \
-            cat /usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             -p TemporaryFileSystem=/run \
             -p RootImage="$MINIMAL_IMAGE.raw" \
             -p MountImages="$MINIMAL_IMAGE.gpt:/run/img1 $MINIMAL_IMAGE.raw:/run/img2" \
-            cat /run/img1/usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /run/img1/usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             -p TemporaryFileSystem=/run \
             -p RootImage="$MINIMAL_IMAGE.gpt" \
             -p RootHash="$MINIMAL_IMAGE_ROOTHASH" \
             -p MountImages="$MINIMAL_IMAGE.gpt:/run/img1 $MINIMAL_IMAGE.raw:/run/img2" \
-            cat /run/img2/usr/lib/os-release | grep -q -F "MARKER=1"
+            cat /run/img2/usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             -p MountImages="$MINIMAL_IMAGE.raw:/run/img2" \
-            veritysetup status "${MINIMAL_IMAGE_ROOTHASH}-verity" | grep -q "${MINIMAL_IMAGE_ROOTHASH}"
+            veritysetup status "${MINIMAL_IMAGE_ROOTHASH}-verity" | grep "${MINIMAL_IMAGE_ROOTHASH}" >/dev/null
 cat >/run/systemd/system/testservice-50c.service <<EOF
 [Service]
 MountAPIVFS=yes
@@ -359,8 +359,8 @@ Type=oneshot
 EOF
 systemctl start testservice-50c.service
 grep -q -F "MARKER=1" "$IMAGE_DIR/result/c"
-grep -F "squashfs" "$IMAGE_DIR/result/c" | grep -q -F "noatime"
-grep -F "squashfs" "$IMAGE_DIR/result/c" | grep -q -F -v "nosuid"
+grep -F "squashfs" "$IMAGE_DIR/result/c" | grep -F "noatime" >/dev/null
+grep -F "squashfs" "$IMAGE_DIR/result/c" | grep -F -v "nosuid" >/dev/null
 
 # Adding a new mounts at runtime works if the unit is in the active state,
 # so use Type=notify to make sure there's no race condition in the test
@@ -396,41 +396,41 @@ systemctl is-active testservice-50d.service
 systemd-run -P \
             --property ExtensionImages=/tmp/app0.raw \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /opt/script0.sh | grep -q -F "extension-release.app0"
+            cat /opt/script0.sh | grep -F "extension-release.app0" >/dev/null
 systemd-run -P \
             --property ExtensionImages=/tmp/app0.raw \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionImages="/tmp/app0.raw /tmp/app1.raw" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /opt/script0.sh | grep -q -F "extension-release.app0"
+            cat /opt/script0.sh | grep -F "extension-release.app0" >/dev/null
 systemd-run -P \
             --property ExtensionImages="/tmp/app0.raw /tmp/app1.raw" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionImages="/tmp/app0.raw /tmp/app1.raw" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /opt/script1.sh | grep -q -F "extension-release.app2"
+            cat /opt/script1.sh | grep -F "extension-release.app2" >/dev/null
 systemd-run -P \
             --property ExtensionImages="/tmp/app0.raw /tmp/app1.raw" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/other_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/other_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionImages=/tmp/app-nodistro.raw \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionImages=/etc/service-scoped-test.raw \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /etc/systemd/system/some_file | grep -q -F "MARKER_CONFEXT_123"
+            cat /etc/systemd/system/some_file | grep -F "MARKER_CONFEXT_123" >/dev/null
 systemd-run -P \
             --property ExtensionImages="/tmp/app0.raw /tmp/conf0.raw" \
-            veritysetup status "$(cat /tmp/app0.roothash)-verity" | grep -q "$(cat /tmp/app0.roothash)"
+            veritysetup status "$(cat /tmp/app0.roothash)-verity" | grep "$(cat /tmp/app0.roothash)" >/dev/null
 systemd-run -P \
             --property ExtensionImages="/tmp/app0.raw /tmp/conf0.raw" \
-            veritysetup status "$(cat /tmp/conf0.roothash)-verity" | grep -q "$(cat /tmp/conf0.roothash)"
+            veritysetup status "$(cat /tmp/conf0.roothash)-verity" | grep "$(cat /tmp/conf0.roothash)" >/dev/null
 
 # Check that two identical verity images at different paths do not fail with -ELOOP from OverlayFS
 mkdir -p /tmp/loop
@@ -444,7 +444,7 @@ systemd-run -P \
             --property ExtensionImages=/tmp/loop/app0_copy.raw \
             --property RootImage="$MINIMAL_IMAGE.raw" \
             "${BIND_LOG_SOCKETS[@]}" \
-            cat /opt/script0.sh | grep -q -F "extension-release.app0"
+            cat /opt/script0.sh | grep -F "extension-release.app0" >/dev/null
 rm -rf /tmp/loop/
 
 # Check that using a symlink to NAME-VERSION.raw works as long as the symlink has the correct name NAME.raw
@@ -454,7 +454,7 @@ ln -fs /tmp/symlink-test/app-nodistro-v1.raw /tmp/symlink-test/app-nodistro.raw
 systemd-run -P \
             --property ExtensionImages=/tmp/symlink-test/app-nodistro.raw \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 
 # Symlink check again but for confext
 mkdir -p /etc/symlink-test/
@@ -463,18 +463,18 @@ ln -fs /etc/symlink-test/service-scoped-test-v1.raw /etc/symlink-test/service-sc
 systemd-run -P \
             --property ExtensionImages=/etc/symlink-test/service-scoped-test.raw \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /etc/systemd/system/some_file | grep -q -F "MARKER_CONFEXT_123"
+            cat /etc/systemd/system/some_file | grep -F "MARKER_CONFEXT_123" >/dev/null
 # And again mixing sysext and confext
 systemd-run -P \
     --property ExtensionImages=/tmp/symlink-test/app-nodistro.raw \
     --property ExtensionImages=/etc/symlink-test/service-scoped-test.raw \
     --property RootImage="$MINIMAL_IMAGE.raw" \
-    cat /etc/systemd/system/some_file | grep -q -F "MARKER_CONFEXT_123"
+    cat /etc/systemd/system/some_file | grep -F "MARKER_CONFEXT_123" >/dev/null
 systemd-run -P \
     --property ExtensionImages=/tmp/symlink-test/app-nodistro.raw \
     --property ExtensionImages=/etc/symlink-test/service-scoped-test.raw \
     --property RootImage="$MINIMAL_IMAGE.raw" \
-    cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+    cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 
 cat >/run/systemd/system/testservice-50e.service <<EOF
 [Service]
@@ -524,35 +524,35 @@ systemd-dissect --mount /etc/service-scoped-test.raw "$IMAGE_DIR/service-scoped-
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/app0" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /opt/script0.sh | grep -q -F "extension-release.app0"
+            cat /opt/script0.sh | grep -F "extension-release.app0" >/dev/null
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/app0" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/app0 $IMAGE_DIR/app1" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /opt/script0.sh | grep -q -F "extension-release.app0"
+            cat /opt/script0.sh | grep -F "extension-release.app0" >/dev/null
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/app0 $IMAGE_DIR/app1" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/app0 $IMAGE_DIR/app1" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /opt/script1.sh | grep -q -F "extension-release.app2"
+            cat /opt/script1.sh | grep -F "extension-release.app2" >/dev/null
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/app0 $IMAGE_DIR/app1" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/other_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/other_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/app-nodistro" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /usr/lib/systemd/system/some_file | grep -q -F "MARKER=1"
+            cat /usr/lib/systemd/system/some_file | grep -F "MARKER=1" >/dev/null
 systemd-run -P \
             --property ExtensionDirectories="$IMAGE_DIR/service-scoped-test" \
             --property RootImage="$MINIMAL_IMAGE.raw" \
-            cat /etc/systemd/system/some_file | grep -q -F "MARKER_CONFEXT_123"
+            cat /etc/systemd/system/some_file | grep -F "MARKER_CONFEXT_123" >/dev/null
 cat >/run/systemd/system/testservice-50f.service <<EOF
 [Service]
 MountAPIVFS=yes
@@ -580,7 +580,7 @@ mkdir "$VDIR" "$EMPTY_VDIR"
 ln -s "$IMAGE_DIR/app0" "$VDIR/${VBASE}_0"
 ln -s "$IMAGE_DIR/app1" "$VDIR/${VBASE}_1"
 
-systemd-run -P --property ExtensionDirectories="$VDIR -$EMPTY_VDIR -$NONEXISTENT_VDIR" cat /opt/script1.sh | grep -q -F "extension-release.app2"
+systemd-run -P --property ExtensionDirectories="$VDIR -$EMPTY_VDIR -$NONEXISTENT_VDIR" cat /opt/script1.sh | grep -F "extension-release.app2" >/dev/null
 
 rm -rf "$VDIR" "$EMPTY_VDIR"
 
@@ -760,7 +760,7 @@ systemctl start testservice-50k.service
 systemctl is-active testservice-50k.service
 # Ensure the kernel is verifying the signature if the mkosi key is in the keyring
 if [ "$VERITY_SIG_SUPPORTED" -eq 1 ]; then
-    veritysetup status "$(cat "$MINIMAL_IMAGE.roothash")-verity" | grep -q "verified (with signature)"
+    veritysetup status "$(cat "$MINIMAL_IMAGE.roothash")-verity" | grep "verified (with signature)" >/dev/null
 fi
 # First reload should pick up the v1 marker
 mksquashfs "$VDIR/${VBASE}_1" "$VDIR2/${VBASE}_1.raw" -noappend
@@ -826,7 +826,7 @@ ln -s "$MINIMAL_IMAGE.raw" "$VDIR/${VBASE}_33.raw"
 ln -s "$MINIMAL_IMAGE.raw" "$VDIR/${VBASE}_34.raw"
 ln -s "$MINIMAL_IMAGE.raw" "$VDIR/${VBASE}_35.raw"
 
-systemd-run -P -p RootImage="$VDIR" cat /usr/lib/os-release | grep -q -F "MARKER=1"
+systemd-run -P -p RootImage="$VDIR" cat /usr/lib/os-release | grep -F "MARKER=1" >/dev/null
 
 rm "$VDIR/${VBASE}_33.raw" "$VDIR/${VBASE}_34.raw" "$VDIR/${VBASE}_35.raw"
 rmdir "$VDIR"
@@ -936,8 +936,8 @@ echo "MARKER_SYSEXT_123" >testkit/usr/lib/testfile
 mksquashfs testkit/ testkit.raw -noappend
 cp testkit.raw /run/extensions/
 unsquashfs -force -l /run/extensions/testkit.raw
-systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for portable service'
-systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for system'
+systemd-dissect --no-pager /run/extensions/testkit.raw | grep '✓ sysext for portable service' >/dev/null
+systemd-dissect --no-pager /run/extensions/testkit.raw | grep '✓ sysext for system' >/dev/null
 systemd-sysext merge
 systemd-sysext status
 grep -q -F "MARKER_SYSEXT_123" /usr/lib/testfile
@@ -952,8 +952,8 @@ echo "MARKER_CONFEXT_123" >testjob/etc/testfile
 mksquashfs testjob/ testjob.raw -noappend
 cp testjob.raw /run/confexts/
 unsquashfs -force -l /run/confexts/testjob.raw
-systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for system'
-systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for portable service'
+systemd-dissect --no-pager /run/confexts/testjob.raw | grep '✓ confext for system' >/dev/null
+systemd-dissect --no-pager /run/confexts/testjob.raw | grep '✓ confext for portable service' >/dev/null
 systemd-confext merge
 systemd-confext status
 grep -q -F "MARKER_CONFEXT_123" /etc/testfile
@@ -974,13 +974,13 @@ journalctl --sync
 # "journalctl -u foo.service" may not work as expected, especially entries for _TRANSPORT=stdout,
 # for short-living services or when the service manager generates debugging logs.
 # Instead, SYSLOG_IDENTIFIER= should be reliable for stdout. Let's use it.
-timeout -v 30s journalctl -b SYSLOG_IDENTIFIER=echo _TRANSPORT=stdout -o cat -n all --follow | grep -m 1 -q '^foo$'
+timeout -v 30s bash -c "journalctl -b SYSLOG_IDENTIFIER=echo _TRANSPORT=stdout -o cat -n all --follow | grep -m 1 -q '^foo$'"
 systemd-sysext unmerge --no-reload
 # Grep on the Warning to find the warning helper mentioning the daemon reload.
-systemctl status foo.service 2>&1 | grep -q -F "Warning"
+systemctl status foo.service 2>&1 | grep -F "Warning" >/dev/null
 systemd-sysext merge
 systemd-sysext unmerge
-systemctl status foo.service 2>&1 | grep -v -q -F "Warning"
+systemctl status foo.service 2>&1 | grep -v -F "Warning" >/dev/null
 rm /var/lib/extensions/app-reload.raw
 
 # Sneak in a couple of expected-to-fail invocations to cover
index 5985cbdb799b3340171210bd569f30cf8be5d76d..cf2a2284e9feedd3d500f1adf4567c77a48cf296 100755 (executable)
@@ -55,7 +55,7 @@ if (SYSTEMD_LOG_TARGET=console varlinkctl call \
         /run/systemd/userdb/io.systemd.NamespaceResource \
         io.systemd.NamespaceResource.AllocateUserRange \
         '{"name":"test-supported","size":65536,"userNamespaceFileDescriptor":0}' 2>&1 || true) |
-            grep -q "io.systemd.NamespaceResource.UserNamespaceInterfaceNotSupported"; then
+            grep "io.systemd.NamespaceResource.UserNamespaceInterfaceNotSupported" >/dev/null; then
     echo "User namespace interface not supported, skipping mountfsd/nsresourced tests"
     exit 0
 fi
index 6878141aae612ef67ec1489425d9e7db82733a52..9e2cee22ce1dd44ea5a075804e40b34c7aba2faa 100755 (executable)
@@ -54,7 +54,7 @@ EOF
     # Verify mount succeeds
     systemctl daemon-reload
     systemctl start "$unit"
-    systemctl --no-pager show -p SubState --value "$unit" | grep -q mounted
+    systemctl --no-pager show -p SubState --value "$unit" | grep mounted >/dev/null
 
     # Verify mount fails with different credential file content
     echo bar >"$credfile"
@@ -408,7 +408,7 @@ systemd-run -p "ImportCredentialEx=test.creds.first" \
 cmp /tmp/ts54-concat <(echo -n aaa)
 
 # Now test encrypted credentials (only supported when built with OpenSSL though)
-if systemctl --version | grep -q -- +OPENSSL ; then
+if systemctl --version | grep -- +OPENSSL  >/dev/null; then
     echo -n $RANDOM >/tmp/test-54-plaintext
     systemd-creds encrypt --name=test-54 /tmp/test-54-plaintext /tmp/test-54-ciphertext
     systemd-creds decrypt --name=test-54 /tmp/test-54-ciphertext | cmp /tmp/test-54-plaintext
@@ -484,7 +484,7 @@ if ! systemd-detect-virt -q -c ; then
     grep -q /injected /proc/self/mountinfo
 
     # Make sure the getty generator processed the credentials properly
-    systemctl -P Wants show getty.target | grep -q container-getty@idontexist.service
+    systemctl -P Wants show getty.target | grep container-getty@idontexist.service >/dev/null
 fi
 
 # Decrypt/encrypt via varlink
index 6010d67225d4475d6d45535afc99bc7aa4cab7af..19197309041436464714ec6c745eb9e0b831a5f7 100755 (executable)
@@ -103,7 +103,7 @@ test_basic() {
     systemctl "$@" status TEST-55-OOMD-workload.slice
 
     # Verify systemd-oomd is monitoring the expected units.
-    timeout 1m bash -xec "until oomctl | grep -q -F 'Path: $cgroup_path'; do sleep 1; done"
+    timeout 1m bash -xec "until oomctl | grep -F 'Path: $cgroup_path' >/dev/null; do sleep 1; done"
     assert_in 'Memory Pressure Limit: 20.00%' \
               "$(oomctl | tac | sed -e '/Memory Pressure Monitored CGroups:/q' | tac | grep -A8 "Path: $cgroup_path")"
 
index 6ae6ec5a292ee1ef154c8cbd1528b88ee05ab18b..de64c84c65a6bfc2053afd52248affab9a90a283 100755 (executable)
@@ -398,7 +398,7 @@ $imgs/zzz7 : start=     6291416, size=      131072, type=3B8F8425-20E0-4F3B-907F
 
     # Validate that the VolumeLabel= had the desired effect
     PASSWORD="" systemd-dissect "$imgs/zzz" -M "$imgs/mount"
-    udevadm info /dev/disk/by-label/schrupfel | grep -q ID_FS_TYPE=crypto_LUKS
+    udevadm info /dev/disk/by-label/schrupfel | grep ID_FS_TYPE=crypto_LUKS >/dev/null
     systemd-dissect -U "$imgs/mount"
 }
 
@@ -947,12 +947,12 @@ EOF
     fi
 
     systemd-dissect "$imgs/verity" --root-hash "$drh"
-    systemd-dissect "$imgs/verity" --root-hash "$drh" --json=short | grep -q '"imageUuid":"1d2ce291-7cce-4f7d-bc83-fdb49ad74ebd"'
+    systemd-dissect "$imgs/verity" --root-hash "$drh" --json=short | grep '"imageUuid":"1d2ce291-7cce-4f7d-bc83-fdb49ad74ebd"' >/dev/null
     systemd-dissect "$imgs/verity" --root-hash "$drh" -M "$imgs/mnt"
     systemd-dissect -U "$imgs/mnt"
 
     systemd-dissect "$imgs/offline" --root-hash "$offline_drh"
-    systemd-dissect "$imgs/offline" --root-hash "$offline_drh" --json=short | grep -q '"imageUuid":"1d2ce291-7cce-4f7d-bc83-fdb49ad74ebd"'
+    systemd-dissect "$imgs/offline" --root-hash "$offline_drh" --json=short | grep '"imageUuid":"1d2ce291-7cce-4f7d-bc83-fdb49ad74ebd"' >/dev/null
     systemd-dissect "$imgs/offline" --root-hash "$offline_drh" -M "$imgs/mnt"
     systemd-dissect -U "$imgs/mnt"
 }
@@ -1011,8 +1011,8 @@ EOF
     udevadm wait --timeout=60 --settle "${loop:?}p1" "${loop:?}p2"
 
     # Check that the verity block sizes are as expected
-    veritysetup dump "${loop}p2" | grep 'Data block size:' | grep -q '4096'
-    veritysetup dump "${loop}p2" | grep 'Hash block size:' | grep -q '1024'
+    veritysetup dump "${loop}p2" | grep 'Data block size:' | grep '4096' >/dev/null
+    veritysetup dump "${loop}p2" | grep 'Hash block size:' | grep '1024' >/dev/null
 }
 
 testcase_verity_hash_size_from_data_size() {
@@ -1089,7 +1089,7 @@ EOF
     assert_rc 0 test $data_bytes -lt $((100 * 1024 * 1024))
 
     # Check that the verity hash tree is created from the actual on-disk data, not the custom size
-    veritysetup dump "${loop}p2" | grep 'Data blocks:' | grep -q "$data_verity_blocks"
+    veritysetup dump "${loop}p2" | grep 'Data blocks:' | grep "$data_verity_blocks" >/dev/null
 }
 
 testcase_exclude_files() {
index 361d091a60d5613efc6ea2daecffcac82f516e61..9c89e90835b97a6b8da3f748bb889df880d11f81 100755 (executable)
@@ -174,6 +174,6 @@ systemctl daemon-reload
 systemctl start testservice-fail-restart-debug-59.service
 wait_on_state_or_fail "testservice-fail-restart-debug-59.service" "failed" "15"
 journalctl --sync
-journalctl -b | grep -q "Failed to follow symlinks on /nonexistent-debug-59: No such file or directory"
+journalctl -b | grep "Failed to follow symlinks on /nonexistent-debug-59: No such file or directory" >/dev/null
 
 touch /testok
index 77d4899f87e4d944421cda04b15f9c42bf061234..73ce80efd6e334e3768f96ccc9bc72c890773579 100755 (executable)
@@ -119,7 +119,7 @@ testcase_long_path() {
     systemctl daemon-reload
 
     # check that unit is active(mounted)
-    systemctl --no-pager show -p SubState --value "$long_path" | grep -q mounted
+    systemctl --no-pager show -p SubState --value "$long_path" | grep mounted >/dev/null
 
     # check that relevant part of journal doesn't contain any errors related to unit
     [ "$(journalctl -b --since="$ts" --priority=err | grep -c "$long_mnt")" = "0" ]
@@ -149,7 +149,7 @@ testcase_mount_ratelimit() {
     done
 
     systemctl daemon-reload
-    systemctl list-units -t mount tmp-meow* | grep -q tmp-meow
+    systemctl list-units -t mount tmp-meow* | grep tmp-meow >/dev/null
 
     for ((i = 0; i < num_dirs; i++)); do
         umount "/tmp/meow${i}"
@@ -158,14 +158,14 @@ testcase_mount_ratelimit() {
     # Figure out if we have entered the rate limit state.
     # If the infra is slow we might not enter the rate limit state; in that case skip the exit check.
     journalctl --sync
-    if timeout 2m journalctl -u init.scope --since="$ts" -n all --follow | grep -m 1 -q -F '(mount-monitor-dispatch) entered rate limit'; then
+    if timeout 2m bash -c "journalctl -u init.scope --since='$ts' -n all --follow | grep -m 1 -q -F '(mount-monitor-dispatch) entered rate limit'"; then
         journalctl --sync
-        timeout 2m journalctl -u init.scope --since="$ts" -n all --follow | grep -m 1 -q -F '(mount-monitor-dispatch) left rate limit'
+        timeout 2m bash -c "journalctl -u init.scope --since='$ts' -n all --follow | grep -m 1 -q -F '(mount-monitor-dispatch) left rate limit'"
     fi
 
     # Verify that the mount units are always cleaned up at the end.
     # Give some time for units to settle so we don't race between exiting the rate limit state and cleaning up the units.
-    timeout 2m bash -c 'while systemctl list-units -t mount tmp-meow* | grep -q tmp-meow; do systemctl daemon-reload; sleep 10; done'
+    timeout 2m bash -c 'while systemctl list-units -t mount tmp-meow* | grep tmp-meow >/dev/null; do systemctl daemon-reload; sleep 10; done'
 }
 
 mkdir -p /run/systemd/journald.conf.d
index 0c6a566d99a7d5f7dbdd951f18f8447c23a30163..6ed61aea2eca7be781c08184d1648b237012af01 100755 (executable)
@@ -35,7 +35,7 @@ if systemd-analyze compare-versions "$(uname -r)" lt 5.7; then
     exit 77
 fi
 
-if systemctl --version | grep -q -F -- "-BPF_FRAMEWORK"; then
+if systemctl --version | grep -F -- "-BPF_FRAMEWORK" >/dev/null; then
     echo "bpf-framework is disabled" >>/skipped
     exit 77
 fi
index af73c7dc7c87ad874ebf16f89a678132dfd465c9..ed20be680ad787f2ca5ceb9bd3aaed5456b67890 100755 (executable)
@@ -420,7 +420,7 @@ systemd-analyze security --offline=true /tmp/testfile.service
 (! systemd-analyze security --threshold=90 --offline=true /tmp/testfile.service)
 
 # Ensure we print the list of ACLs, see https://github.com/systemd/systemd/issues/23185
-systemd-analyze security --offline=true /tmp/testfile.service | grep -q -F "/dev/sda"
+systemd-analyze security --offline=true /tmp/testfile.service | grep -F "/dev/sda" >/dev/null
 
 # Make sure that running generators under systemd-analyze verify works.
 # Note: sd-analyze spawns generators in a sandbox which makes gcov unhapy, so temporarily override
@@ -1009,9 +1009,9 @@ systemd-analyze security --threshold=25 --offline=true \
 
 rm /tmp/img/usr/lib/systemd/system/testfile.service
 
-if systemd-analyze --version | grep -q -F "+ELFUTILS"; then
+if systemd-analyze --version | grep -F "+ELFUTILS" >/dev/null; then
     systemd-analyze inspect-elf /lib/systemd/systemd
-    systemd-analyze inspect-elf --json=short /lib/systemd/systemd | grep -q -F '"elfType":"executable"'
+    systemd-analyze inspect-elf --json=short /lib/systemd/systemd | grep -F '"elfType":"executable"' >/dev/null
 
     # For some unknown reason the .note.dlopen sections are removed when building with sanitizers, so only
     # run this test if we're not running under sanitizers.
@@ -1083,13 +1083,13 @@ check deny no "$name"
 
 # Let's also test the "image-policy" verb
 
-systemd-analyze image-policy '*' 2>&1 | grep -q -F "Long form: =verity+signed+encrypted+unprotected+unused+absent"
-systemd-analyze image-policy '-' 2>&1 | grep -q -F "Long form: =unused+absent"
-systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -q -F "Long form: usr=verity:home=encrypted:=unused+absent"
-systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -q -e '^home \+encrypted \+'
-systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -q -e '^usr \+verity \+'
-systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -q -e '^root \+ignore \+'
-systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -q -e '^usr-verity \+unprotected \+'
+systemd-analyze image-policy '*' 2>&1 | grep -F "Long form: =verity+signed+encrypted+unprotected+unused+absent" >/dev/null
+systemd-analyze image-policy '-' 2>&1 | grep -F "Long form: =unused+absent" >/dev/null
+systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -F "Long form: usr=verity:home=encrypted:=unused+absent" >/dev/null
+systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -e '^home \+encrypted \+' >/dev/null
+systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -e '^usr \+verity \+' >/dev/null
+systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -e '^root \+ignore \+' >/dev/null
+systemd-analyze image-policy 'home=encrypted:usr=verity' 2>&1 | grep -e '^usr-verity \+unprotected \+' >/dev/null
 
 (! systemd-analyze image-policy 'doedel')
 
index e8f3c9b7078d1f84db848c0add2f7880a252def5..c94d515ff9b82cbb09b224008cc57a8cdb738efe 100755 (executable)
@@ -12,7 +12,7 @@ cryptsetup_has_token_plugin_support() {
     local plugin_path
 
     plugin_path="$(cryptsetup --help | sed -nr 's/.*LUKS2 external token plugin path: (.*)\./\1/p')/libcryptsetup-token-systemd-tpm2.so)"
-    cryptsetup --help | grep -q 'LUKS2 external token plugin support is compiled-in' && [[ -f "$plugin_path" ]]
+    cryptsetup --help | grep 'LUKS2 external token plugin support is compiled-in' >/dev/null && [[ -f "$plugin_path" ]]
 }
 
 tpm_check_failure_with_wrong_pin() {
index 93a5ffb87f12dbf4bcc3e80a2cc042b873a19f8c..d74e382db339120502db1a63e975d11b0af3088e 100755 (executable)
@@ -299,9 +299,9 @@ EOF
     # sure that sysupdate still recognizes the installation and can complete it
     # in place
     rm -r "$WORKDIR/xbootldr/EFI/Linux/uki_v5.efi.extra.d"
-    "$SYSUPDATE" --offline list v5 | grep -q "incomplete"
+    "$SYSUPDATE" --offline list v5 | grep "incomplete" >/dev/null
     update_now
-    "$SYSUPDATE" --offline list v5 | grep -qv "incomplete"
+    "$SYSUPDATE" --offline list v5 | grep -v "incomplete" >/dev/null
     verify_version "$blockdev" "$sector_size" v3 1
     verify_version_current "$blockdev" "$sector_size" v5 2
 
@@ -311,9 +311,9 @@ EOF
     test ! -f "$WORKDIR/xbootldr/EFI/Linux/uki_v5.efi.extra.d/optional.efi"
     mkdir "$CONFIGDIR/optional.feature.d"
     echo -e "[Feature]\nEnabled=true" > "$CONFIGDIR/optional.feature.d/enable.conf"
-    "$SYSUPDATE" --offline list v5 | grep -q "incomplete"
+    "$SYSUPDATE" --offline list v5 | grep "incomplete" >/dev/null
     update_now
-    "$SYSUPDATE" --offline list v5 | grep -qv "incomplete"
+    "$SYSUPDATE" --offline list v5 | grep -v "incomplete" >/dev/null
     verify_version "$blockdev" "$sector_size" v3 1
     verify_version_current "$blockdev" "$sector_size" v5 2
     test -f "$WORKDIR/xbootldr/EFI/Linux/uki_v5.efi.extra.d/optional.efi"
@@ -322,7 +322,7 @@ EOF
     rm -r "$CONFIGDIR/optional.feature.d"
     (! "$SYSUPDATE" --verify=no check-new)
     "$SYSUPDATE" vacuum
-    "$SYSUPDATE" --offline list v5 | grep -qv "incomplete"
+    "$SYSUPDATE" --offline list v5 | grep -v "incomplete" >/dev/null
     verify_version "$blockdev" "$sector_size" v3 1
     verify_version_current "$blockdev" "$sector_size" v5 2
     test ! -f "$WORKDIR/xbootldr/EFI/Linux/uki_v5.efi.extra.d/optional.efi"
index 459b7040f8711948a4f28c8edde9a809d498ddd3..60e27d3f8726505c53943086e0bfcc2c75c06530 100755 (executable)
@@ -60,7 +60,7 @@ busctl emit --auto-start=no --destination=systemd-logind.service \
 systemd-run --quiet --service-type=notify --unit=test-busctl-wait --pty \
             -p Environment=SYSTEMD_LOG_LEVEL=debug \
             -p ExecStartPost="busctl emit /test org.freedesktop.fake1 TestSignal s success" \
-            busctl --timeout=30 wait /test org.freedesktop.fake1 TestSignal | grep -qF 's "success"'
+            busctl --timeout=30 wait /test org.freedesktop.fake1 TestSignal | grep -F 's "success"' >/dev/null
 
 busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager \
                     Version
index 5ae97b2a480bdb8515cf8a8d49c1adc661d46918..557bd3af0120447dd9dbfe9f66cd55308be0598a 100755 (executable)
@@ -77,7 +77,7 @@ systemd-firstboot --root="$ROOT" --keymap=foo
 grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
 
 systemd-firstboot --root="$ROOT" --timezone=Europe/Berlin
-readlink "$ROOT/etc/localtime" | grep -q "Europe/Berlin"
+readlink "$ROOT/etc/localtime" | grep "Europe/Berlin" >/dev/null
 
 systemd-firstboot --root="$ROOT" --hostname "foobar"
 grep -q "foobar" "$ROOT/etc/hostname"
@@ -145,7 +145,7 @@ systemd-firstboot --root="$ROOT" \
 grep -q "LANG=foo" "$ROOT$LOCALE_PATH"
 grep -q "LC_MESSAGES=bar" "$ROOT$LOCALE_PATH"
 grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
-readlink "$ROOT/etc/localtime" | grep -q "Europe/Berlin$"
+readlink "$ROOT/etc/localtime" | grep "Europe/Berlin$" >/dev/null
 grep -q "foobar" "$ROOT/etc/hostname"
 grep -q "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "$ROOT/etc/machine-id"
 grep -q "^root:x:0:0:.*:/bin/fooshell$" "$ROOT/etc/passwd"
@@ -166,7 +166,7 @@ systemd-firstboot --root="$ROOT" --force \
 grep -q "LANG=locale-overwrite" "$ROOT$LOCALE_PATH"
 grep -q "LC_MESSAGES=messages-overwrite" "$ROOT$LOCALE_PATH"
 grep -q "KEYMAP=keymap-overwrite" "$ROOT/etc/vconsole.conf"
-readlink "$ROOT/etc/localtime" | grep -q "/Europe/Berlin$"
+readlink "$ROOT/etc/localtime" | grep "/Europe/Berlin$" >/dev/null
 grep -q "hostname-overwrite" "$ROOT/etc/hostname"
 grep -q "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" "$ROOT/etc/machine-id"
 grep -q "^root:x:0:0:.*:/bin/barshell$" "$ROOT/etc/passwd"
@@ -227,7 +227,7 @@ if [ -d "/usr/share/keymaps/" ] || [ -d "/usr/share/kbd/keymaps/" ] || [ -d "/us
    systemd-firstboot --root="$ROOT" --prompt-keymap-auto >/dev/null
 fi
 echo -ne "Europe/Berlin\n" | systemd-firstboot --root="$ROOT" --prompt-timezone
-readlink "$ROOT/etc/localtime" | grep -q "Europe/Berlin$"
+readlink "$ROOT/etc/localtime" | grep "Europe/Berlin$" >/dev/null
 echo -ne "foobar\n" | systemd-firstboot --root="$ROOT" --prompt-hostname
 grep -q "foobar" "$ROOT/etc/hostname"
 # With no root password provided, a locked account should be created.
@@ -270,7 +270,7 @@ systemd-run --wait --pipe --service-type=exec \
 grep -q "LANG=foo" "$ROOT$LOCALE_PATH"
 grep -q "LC_MESSAGES=bar" "$ROOT$LOCALE_PATH"
 grep -q "KEYMAP=foo" "$ROOT/etc/vconsole.conf"
-readlink "$ROOT/etc/localtime" | grep -q "Europe/Berlin$"
+readlink "$ROOT/etc/localtime" | grep "Europe/Berlin$" >/dev/null
 grep -q "^root:x:0:0:.*:/bin/fooshell$" "$ROOT/etc/passwd"
 grep -q "^root:$ROOT_HASHED_PASSWORD1:" "$ROOT/etc/shadow"
 
index 53edb962e7cbdeb4d08837ac865cb58eecaebdf8..e166195ef7db5fca5607d41bb69c6368ba275b24 100755 (executable)
@@ -50,11 +50,9 @@ userdbctl group 65534 -j | userdbctl -F- group  | cmp - <(userdbctl group 65534)
 # Ensure NSS doesn't try to automount via open_tree
 if [[ ! -v ASAN_OPTIONS ]]; then
     systemctl stop systemd-userdbd.socket systemd-userdbd.service
-    set +o pipefail
-    systemd-run -q -t --property SystemCallFilter=~open_tree id definitelynotarealuser | grep -q "no such user"
-    systemd-run -q -t --property SystemCallFilter=~open_tree id --groups definitelynotarealuser | grep -q "no such user"
-    systemd-run -q -t --property SystemCallFilter=~open_tree groups definitelynotarealuser | grep -q "no such user"
-    set -o pipefail
+    (! systemd-run -q -t --property SystemCallFilter=~open_tree id definitelynotarealuser) | grep "no such user" >/dev/null
+    (! systemd-run -q -t --property SystemCallFilter=~open_tree id --groups definitelynotarealuser) | grep "no such user" >/dev/null
+    (! systemd-run -q -t --property SystemCallFilter=~open_tree groups definitelynotarealuser) | grep "no such user" >/dev/null
     # getent shows no output when the entry is not found, but exists with 2, while sd-run crashing will exit
     # with 1
     assert_rc 2 systemd-run -q -t --property SystemCallFilter=~open_tree getent passwd definitelynotarealuser
index 3d23a53253514b239935fa9a33500e40fb14934a..c7607ce7c4501f5b080461e843edfd52a42e3a51 100755 (executable)
@@ -199,7 +199,7 @@ varlinkctl introspect /run/systemd/io.systemd.Manager io.systemd.Unit
 varlinkctl --more call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{}'
 varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{"name": "multi-user.target"}'
 varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{"pid": {"pid": 1}}'
-(! varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{}' |& grep -q "called without 'more' flag")
+(! varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{}' |& grep "called without 'more' flag" >/dev/null)
 varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{"name": "init.scope", "pid": {"pid": 1}}'
 (! varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{"name": ""}')
 (! varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{"name": "non-existent.service"}')
index 5ec588309bfa9d50b67e622355216cb9d9f31bc1..31023ca17a3985d6388dae79ec68a06af4eb0b90 100755 (executable)
@@ -349,7 +349,7 @@ manual_testcase_02_mdns_llmnr() {
     # defaults to yes (both the global and per-link settings are yes)
     assert_in 'yes' "$(resolvectl mdns hoge)"
     assert_in 'yes' "$(resolvectl llmnr hoge)"
-    lsof -p "$(systemctl show --property MainPID --value systemd-resolved.service)" | grep -q ":mdns\|:5353"
+    lsof -p "$(systemctl show --property MainPID --value systemd-resolved.service)" | grep ":mdns\|:5353" >/dev/null
     # set per-link setting
     resolvectl mdns hoge yes
     resolvectl llmnr hoge yes
@@ -390,7 +390,7 @@ manual_testcase_02_mdns_llmnr() {
         echo "LLMNR=no"
     } >/run/systemd/resolved.conf.d/90-mdns-llmnr.conf
     systemctl reload systemd-resolved.service
-    (! lsof -p "$(systemctl show --property MainPID --value systemd-resolved.service)" | grep -q ":mdns\|:5353")
+    (! lsof -p "$(systemctl show --property MainPID --value systemd-resolved.service)" | grep ":mdns\|:5353" >/dev/null)
     # set per-link setting
     resolvectl mdns hoge yes
     resolvectl llmnr hoge yes
@@ -1417,7 +1417,7 @@ testcase_15_wait_online_dns() {
         /usr/lib/systemd/systemd-networkd-wait-online --timeout=0 --dns --interface=dns0
 
     # Wait until it blocks waiting for updated DNS config
-    timeout 30 bash -c "journalctl -b -u $unit -f | grep -q -m1 'dns0: No.*DNS server is accessible'"
+    timeout 30 bash -c "journalctl -b -u $unit -f | grep -m1 'dns0: No.*DNS server is accessible'" >/dev/null
 
     # Update the global configuration. Restart rather than reload systemd-resolved so that
     # systemd-networkd-wait-online has to re-connect to the varlink service.
index bac4af1988a7741377757a7feaa6c440e852f4a0..0f7fec17ae87816abcc9d371ff5389033a442643 100755 (executable)
@@ -120,7 +120,7 @@ systemd-run -u "$MYUNIT" -p Type=notify -p FileDescriptorStoreMax=7 "$MYSCRIPT"
 
 test "$(systemd-analyze fdstore "$MYUNIT" | wc -l)" -eq 2
 systemd-analyze fdstore "$MYUNIT" --json=short
-systemd-analyze fdstore "$MYUNIT" --json=short | grep -P -q '\[{"fdname":"quux","type":.*,"devno":\[.*\],"inode":.*,"rdevno":null,"path":"/tmp/.*","flags":"ro"}\]'
+systemd-analyze fdstore "$MYUNIT" --json=short | grep -P '\[{"fdname":"quux","type":.*,"devno":\[.*\],"inode":.*,"rdevno":null,"path":"/tmp/.*","flags":"ro"}\]' >/dev/null
 
 systemctl stop "$MYUNIT"
 rm "$MYSCRIPT"
index f615facb5369e823a0435a3ac1e9a2627e6560ad..8a63bb03b53d6c48f06cfdafcae4c525f5e12f5c 100755 (executable)
@@ -356,11 +356,11 @@ testcase_00_secureboot() {
     # Ensure secure boot is enabled and not in setup mode
     cmp /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c <(printf '\6\0\0\0\1')
     cmp /sys/firmware/efi/efivars/SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c <(printf '\6\0\0\0\0')
-    bootctl status | grep -q "Secure Boot: enabled"
+    bootctl status | grep "Secure Boot: enabled" >/dev/null
 
     # Ensure the addon is fully loaded and parsed
-    bootctl status | grep -q "global-addon: loader/addons/test.addon.efi"
-    bootctl status | grep "cmdline" | grep -q addonfoobar
+    bootctl status | grep "global-addon: loader/addons/test.addon.efi" >/dev/null
+    bootctl status | grep "cmdline" | grep addonfoobar >/dev/null
     grep -q addonfoobar /proc/cmdline
 }
 
index d68b4a2f961ae3a34fd3252c9c54dba04620acd7..92fa2eb9dce3f8b6fff13568156f29d69694503f 100755 (executable)
@@ -72,23 +72,23 @@ systemd-mount --umount "$LOOP"
 # Discover additional metadata (unit description should now contain filesystem label)
 systemd-mount --no-ask-password --discover "$LOOP" "$WORK_DIR/mnt"
 test -e "$WORK_DIR/mnt/foo.bar"
-systemctl show -P Description "$WORK_DIR/mnt" | grep -q sd-mount-test
+systemctl show -P Description "$WORK_DIR/mnt" | grep sd-mount-test >/dev/null
 systemd-umount "$WORK_DIR/mnt"
 # Set a unit description
 systemd-mount --description="Very Important Unit" "$LOOP" "$WORK_DIR/mnt"
 test -e "$WORK_DIR/mnt/foo.bar"
-systemctl show -P Description "$WORK_DIR/mnt" | grep -q "Very Important Unit"
+systemctl show -P Description "$WORK_DIR/mnt" | grep "Very Important Unit" >/dev/null
 systemd-umount "$WORK_DIR/mnt"
 # Set a property
 systemd-mount --property="Description=Foo Bar" "$LOOP" "$WORK_DIR/mnt"
 test -e "$WORK_DIR/mnt/foo.bar"
-systemctl show -P Description "$WORK_DIR/mnt" | grep -q "Foo Bar"
+systemctl show -P Description "$WORK_DIR/mnt" | grep "Foo Bar" >/dev/null
 systemd-umount "$WORK_DIR/mnt"
 # Set mount options
 systemd-mount --options=ro,x-foo-bar "$LOOP" "$WORK_DIR/mnt"
 test -e "$WORK_DIR/mnt/foo.bar"
-systemctl show -P Options "$WORK_DIR/mnt" | grep -Eq "(^ro|,ro)"
-systemctl show -P Options "$WORK_DIR/mnt" | grep -q "x-foo-bar"
+systemctl show -P Options "$WORK_DIR/mnt" | grep -E "(^ro|,ro)" >/dev/null
+systemctl show -P Options "$WORK_DIR/mnt" | grep "x-foo-bar" >/dev/null
 systemd-umount "$WORK_DIR/mnt"
 
 # Mount with only source set
@@ -108,7 +108,7 @@ systemctl status "$WORK_DIR/mnt"
 systemd-umount "$WORK_DIR/mnt"
 # Automount + automount-specific property
 systemd-mount -A --automount-property="Description=Bar Baz" "$LOOP" "$WORK_DIR/mnt"
-systemctl show -P Description "$(systemd-escape --path "$WORK_DIR/mnt").automount" | grep -q "Bar Baz"
+systemctl show -P Description "$(systemd-escape --path "$WORK_DIR/mnt").automount" | grep "Bar Baz" >/dev/null
 test -e "$WORK_DIR/mnt/foo.bar"
 # Call --umount via --machine=, first with a relative path (bad) and then with
 # an absolute one (good)
@@ -185,5 +185,5 @@ systemd-umount LABEL=owner-vfat
 GRACEFULTEST="/tmp/graceful/$RANDOM"
 systemd-mount --tmpfs --options="x-systemd.graceful-option=idefinitelydontexist,x-systemd.graceful-option=nr_inodes=4711,x-systemd.graceful-option=idonexisteither" "$GRACEFULTEST"
 findmnt -n -o options "$GRACEFULTEST"
-findmnt -n -o options "$GRACEFULTEST" | grep -q nr_inodes=4711
+findmnt -n -o options "$GRACEFULTEST" | grep nr_inodes=4711 >/dev/null
 umount "$GRACEFULTEST"
index f3f06137780bb9b1837f08b0a5e0a11ddef2b38a..337742f1f4dafc5ca53851b54a9209eb23873cfd 100755 (executable)
@@ -79,30 +79,30 @@ systemd-repart --dry-run=no --empty=create --size=410M --definitions=/tmp/valida
 systemd-dissect --mount --mkdir /var/tmp/validatefs-test.raw /tmp/validatefs-test.mount
 
 getfattr --dump /tmp/validatefs-test.mount/
-getfattr --dump /tmp/validatefs-test.mount/ | grep -q user.validatefs.gpt_type_uuid=
-getfattr --dump /tmp/validatefs-test.mount/ | grep -q user.validatefs.gpt_label=\"kromm\"
-getfattr --dump /tmp/validatefs-test.mount/ | grep -q user.validatefs.mount_point=\"/\"
+getfattr --dump /tmp/validatefs-test.mount/ | grep user.validatefs.gpt_type_uuid= >/dev/null
+getfattr --dump /tmp/validatefs-test.mount/ | grep user.validatefs.gpt_label=\"kromm\" >/dev/null
+getfattr --dump /tmp/validatefs-test.mount/ | grep user.validatefs.mount_point=\"/\" >/dev/null
 /usr/lib/systemd/systemd-validatefs --root=/tmp/validatefs-test.mount /tmp/validatefs-test.mount/
 (! /usr/lib/systemd/systemd-validatefs /tmp/validatefs-test.mount/ )
 
 getfattr --dump /tmp/validatefs-test.mount/usr
-getfattr --dump /tmp/validatefs-test.mount/usr | grep -q user.validatefs.gpt_type_uuid='".*\\000.*"'
-getfattr --dump /tmp/validatefs-test.mount/usr | grep -q user.validatefs.gpt_label='"plisch\\000plisch-verity"'
-getfattr --dump /tmp/validatefs-test.mount/usr | grep -q user.validatefs.mount_point=\"/usr\"
+getfattr --dump /tmp/validatefs-test.mount/usr | grep user.validatefs.gpt_type_uuid='".*\\000.*"' >/dev/null
+getfattr --dump /tmp/validatefs-test.mount/usr | grep user.validatefs.gpt_label='"plisch\\000plisch-verity"' >/dev/null
+getfattr --dump /tmp/validatefs-test.mount/usr | grep user.validatefs.mount_point=\"/usr\" >/dev/null
 /usr/lib/systemd/systemd-validatefs --root=/tmp/validatefs-test.mount /tmp/validatefs-test.mount/usr
 (! /usr/lib/systemd/systemd-validatefs /tmp/validatefs-test.mount/usr )
 
 getfattr --dump /tmp/validatefs-test.mount/home
-getfattr --dump /tmp/validatefs-test.mount/home | grep -q user.validatefs.gpt_type_uuid=
-getfattr --dump /tmp/validatefs-test.mount/home | grep -q user.validatefs.gpt_label=\"rupft\"
-getfattr --dump /tmp/validatefs-test.mount/home | grep -q user.validatefs.mount_point=\"/home\"
+getfattr --dump /tmp/validatefs-test.mount/home | grep user.validatefs.gpt_type_uuid= >/dev/null
+getfattr --dump /tmp/validatefs-test.mount/home | grep user.validatefs.gpt_label=\"rupft\" >/dev/null
+getfattr --dump /tmp/validatefs-test.mount/home | grep user.validatefs.mount_point=\"/home\" >/dev/null
 /usr/lib/systemd/systemd-validatefs --root=/tmp/validatefs-test.mount /tmp/validatefs-test.mount/home
 (! /usr/lib/systemd/systemd-validatefs /tmp/validatefs-test.mount/home )
 
 getfattr --dump /tmp/validatefs-test.mount/efi
-(! getfattr --dump /tmp/validatefs-test.mount/efi | grep -q user.validatefs.gpt_type_uuid= )
-(! getfattr --dump /tmp/validatefs-test.mount/efi | grep -q user.validatefs.gpt_label= )
-(! getfattr --dump /tmp/validatefs-test.mount/efi | grep -q  user.validatefs.mount_point= )
+(! getfattr --dump /tmp/validatefs-test.mount/efi | grep user.validatefs.gpt_type_uuid= >/dev/null )
+(! getfattr --dump /tmp/validatefs-test.mount/efi | grep user.validatefs.gpt_label= >/dev/null )
+(! getfattr --dump /tmp/validatefs-test.mount/efi | grep user.validatefs.mount_point= >/dev/null )
 /usr/lib/systemd/systemd-validatefs --root=/tmp/validatefs-test.mount /tmp/validatefs-test.mount/efi
 /usr/lib/systemd/systemd-validatefs /tmp/validatefs-test.mount/efi
 
index c62f8d9574b8282257c570618020ad680fb2d042..1f334945116d4761567a3c81e625dc94e8920e45 100755 (executable)
@@ -203,7 +203,7 @@ can_do_rootless_nspawn() {
     # Need to have bpf-lsm
     grep -q bpf /sys/kernel/security/lsm &&
     # ...and libbpf installed
-    find /usr/lib* -name "libbpf.so.*" 2>/dev/null | grep -q . &&
+    find /usr/lib* -name "libbpf.so.*" 2>/dev/null | grep . >/dev/null &&
 
     # Ensure mountfsd/nsresourced are listening
     systemctl start systemd-mountfsd.socket systemd-nsresourced.socket &&
@@ -222,7 +222,7 @@ can_do_rootless_nspawn() {
            io.systemd.NamespaceResource.AllocateUserRange \
            '{"name":"test-supported","size":65536,"userNamespaceFileDescriptor":0}' \
            2>&1 || true) |
-        grep -q "io.systemd.NamespaceResource.UserNamespaceInterfaceNotSupported"
+        grep "io.systemd.NamespaceResource.UserNamespaceInterfaceNotSupported" >/dev/null
 }
 
 # Bump the reboot counter and call systemctl with the given arguments