]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: replace 'grep -q' with 'grep >/dev/null'
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Jun 2026 01:49:40 +0000 (10:49 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Jun 2026 19:56:34 +0000 (04:56 +0900)
After afa3eb821d4442d3b9d9e693be5322ffbdf594ad, we have introduced 'grep -q'
at several places. Let's replace them.

test/units/TEST-13-NSPAWN.pull-oci.sh
test/units/TEST-50-DISSECT.dissect.sh
test/units/TEST-50-DISSECT.mountfsd.sh
test/units/TEST-58-REPART.sh
test/units/TEST-74-AUX-UTILS.varlinkctl.sh

index e673b711f0fe40eb9b2159390150262a3d09f992..bd42aa0af544574b6174cf6325290d14dd493bc3 100755 (executable)
@@ -126,13 +126,13 @@ systemd-mstack -U /tmp/ooo
 
 ls -alR /home/testuser/.local/state/machines/ocicombo.mstack
 
-run0 -u testuser importctl list-images --user | grep -q ocicombo
+run0 -u testuser importctl list-images --user | grep ocicombo >/dev/null
 
 ls -alR /home/testuser/.local/state/machines/ocicombo.mstack
 
-run0 -u testuser systemd-nspawn -q --pipe -M ocicombo /sbin/init | grep -q luftikus
+run0 -u testuser systemd-nspawn -q --pipe -M ocicombo /sbin/init | grep luftikus >/dev/null
 
-run0 -u testuser --pipe systemd-run -q --unit=fimpel --user -p PrivateUsers=managed -p RootMStack=/home/testuser/.local/state/machines/ocicombo.mstack --pipe /sbin/init | grep -q luftikus
+run0 -u testuser --pipe systemd-run -q --unit=fimpel --user -p PrivateUsers=managed -p RootMStack=/home/testuser/.local/state/machines/ocicombo.mstack --pipe /sbin/init | grep luftikus >/dev/null
 
 run0 -u testuser machinectl list-images -a --user
 
index 65e684fa07ad9899fb5b73387d5a3d0fd61e7e9b..136444532d350a73e78c98195855362c0434dffe 100755 (executable)
@@ -411,7 +411,7 @@ ExecStart=bash -c ' \\
         sleep 0.1; \\
     done; \\
     mount; \\
-    mount | grep -F "on /tmp/img type squashfs" | grep -q -F "nosuid"; \\
+    mount | grep -F "on /tmp/img type squashfs" | grep -F "nosuid" >/dev/null; \\
 '
 EOF
 systemctl start testservice-50d.service
index 12a72f8257d5db19b8016075a86be78a805910f2..d25743502d328e19588c8d1a55a0eeb661dfd142 100755 (executable)
@@ -175,13 +175,13 @@ EOF
     systemd-run -M testuser@ --user --pipe --wait \
         --property RootImage="$MINIMAL_IMAGE.gpt" \
         --property RootImageOptions="root:nosuid" \
-        sh -c "test -e \"/dev/mapper/${MINIMAL_IMAGE_ROOTHASH}-verity\" && mount | grep -F squashfs | grep -q -F nosuid"
+        sh -c "test -e \"/dev/mapper/${MINIMAL_IMAGE_ROOTHASH}-verity\" && mount | grep -F squashfs | grep -F nosuid >/dev/null"
 
     systemd-run -M testuser@ --user --pipe --wait \
         --property RootImage="$MINIMAL_IMAGE.raw" \
         --property ExtensionImages=/tmp/app0.raw \
         --property MountImages=/tmp/app0.raw:/var/tmp:nosuid \
-        sh -c "test -e \"/dev/mapper/${MINIMAL_IMAGE_ROOTHASH}-verity\" && test -e \"/dev/mapper/$(</tmp/app0.roothash)-verity\" && mount | grep -F /var/tmp | grep -q -F nosuid"
+        sh -c "test -e \"/dev/mapper/${MINIMAL_IMAGE_ROOTHASH}-verity\" && test -e \"/dev/mapper/$(</tmp/app0.roothash)-verity\" && mount | grep -F /var/tmp | grep -F nosuid >/dev/null"
 
     rm -f /etc/polkit-1/rules.d/mountoptions.rules
     systemctl try-reload-or-restart polkit.service
index 319b682298ce52c0d1fed3f9feecedaf480ba2ae..de7bc3275b4c1a9d8aca67684c899a7d18706ad1 100755 (executable)
@@ -1951,7 +1951,7 @@ EOF
     touch "$imgs/empty-password"
 
     # the expectation for hmac-sha256 is 'integrity: hmac(sha256)'
-    cryptsetup luksDump "${loop}p1" | grep -q "integrity: $(echo "$1" | sed -r 's/^hmac-(.*)$/hmac(\1)/')"
+    cryptsetup luksDump "${loop}p1" | grep "integrity: $(echo "$1" | sed -r 's/^hmac-(.*)$/hmac(\1)/')" >/dev/null
 
     cryptsetup open --type=luks2 --key-file="$imgs/empty-password" "${loop}p1" "$volume"
     dmsetup status > "$dmstatus"
index ec71e2641e0d587f660d6754320f252a857e3d4b..0e95360000be4899bc6ea717b7bc98969f8f0d9c 100755 (executable)
@@ -207,7 +207,7 @@ varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Manager.Reexecute '{}
 # Wait for the manager to finish re-exec before proceeding — the user manager
 # tests below use systemd-run which requires a functional PID 1.
 for _ in {1..10}; do
-    if systemctl is-system-running 2>/dev/null | grep -qE 'running|degraded'; then
+    if systemctl is-system-running 2>/dev/null | grep -E 'running|degraded' >/dev/null; then
         break
     fi
     sleep 1