From: Zbigniew Jędrzejewski-Szmek Date: Thu, 22 Mar 2018 07:42:02 +0000 (+0100) Subject: test-execute: simplify checks if grep output is empty X-Git-Tag: v239~483^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c725631f4bebe9ead39c6371431e0b6be8eab2c1;p=thirdparty%2Fsystemd.git test-execute: simplify checks if grep output is empty grep already indicates if it matched anything by return value. Additional advantage is then that if the test fails, the unexpected matching lines are visible in the log output. --- diff --git a/test/test-execute/exec-capabilityboundingset-invert.service b/test/test-execute/exec-capabilityboundingset-invert.service index fd5d248702f..1abe3906016 100644 --- a/test/test-execute/exec-capabilityboundingset-invert.service +++ b/test/test-execute/exec-capabilityboundingset-invert.service @@ -2,6 +2,6 @@ Description=Test for CapabilityBoundingSet [Service] -ExecStart=/bin/sh -x -c 'c=$$(capsh --print | grep "^Bounding set .*cap_chown"); test -z "$$c"' +ExecStart=/bin/sh -x -c '! capsh --print | grep "^Bounding set .*cap_chown"' Type=oneshot CapabilityBoundingSet=~CAP_CHOWN diff --git a/test/test-execute/exec-privatenetwork-yes.service b/test/test-execute/exec-privatenetwork-yes.service index 3df543ec93c..5077f7eed2c 100644 --- a/test/test-execute/exec-privatenetwork-yes.service +++ b/test/test-execute/exec-privatenetwork-yes.service @@ -2,6 +2,6 @@ Description=Test for PrivateNetwork [Service] -ExecStart=/bin/sh -x -c 'i=$$(ip link | grep ": " | grep -v ": lo:"); test -z "$$i"' +ExecStart=/bin/sh -x -c '! ip link | grep ": " | grep -v ": lo:"' Type=oneshot PrivateNetwork=yes