From: Yu Watanabe Date: Thu, 4 Jun 2026 01:49:40 +0000 (+0900) Subject: test: replace 'grep -q' with 'grep >/dev/null' X-Git-Tag: v261-rc4~82^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=421429e7feb389e490d74cca6afa80cf304425df;p=thirdparty%2Fsystemd.git test: replace 'grep -q' with 'grep >/dev/null' After afa3eb821d4442d3b9d9e693be5322ffbdf594ad, we have introduced 'grep -q' at several places. Let's replace them. --- diff --git a/test/units/TEST-13-NSPAWN.pull-oci.sh b/test/units/TEST-13-NSPAWN.pull-oci.sh index e673b711f0f..bd42aa0af54 100755 --- a/test/units/TEST-13-NSPAWN.pull-oci.sh +++ b/test/units/TEST-13-NSPAWN.pull-oci.sh @@ -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 diff --git a/test/units/TEST-50-DISSECT.dissect.sh b/test/units/TEST-50-DISSECT.dissect.sh index 65e684fa07a..136444532d3 100755 --- a/test/units/TEST-50-DISSECT.dissect.sh +++ b/test/units/TEST-50-DISSECT.dissect.sh @@ -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 diff --git a/test/units/TEST-50-DISSECT.mountfsd.sh b/test/units/TEST-50-DISSECT.mountfsd.sh index 12a72f8257d..d25743502d3 100755 --- a/test/units/TEST-50-DISSECT.mountfsd.sh +++ b/test/units/TEST-50-DISSECT.mountfsd.sh @@ -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/$(/dev/null" rm -f /etc/polkit-1/rules.d/mountoptions.rules systemctl try-reload-or-restart polkit.service diff --git a/test/units/TEST-58-REPART.sh b/test/units/TEST-58-REPART.sh index 319b682298c..de7bc3275b4 100755 --- a/test/units/TEST-58-REPART.sh +++ b/test/units/TEST-58-REPART.sh @@ -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" diff --git a/test/units/TEST-74-AUX-UTILS.varlinkctl.sh b/test/units/TEST-74-AUX-UTILS.varlinkctl.sh index ec71e2641e0..0e95360000b 100755 --- a/test/units/TEST-74-AUX-UTILS.varlinkctl.sh +++ b/test/units/TEST-74-AUX-UTILS.varlinkctl.sh @@ -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