teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0762-tests-make-inverted-tests-actually-count.patch

b7dd4d
From f784cdd269ccba28e3e14b24ecd33ab9db148403 Mon Sep 17 00:00:00 2001
b7dd4d
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
b7dd4d
Date: Wed, 7 Apr 2021 23:24:25 +0200
b7dd4d
Subject: [PATCH] tests: make inverted tests actually count
b7dd4d
MIME-Version: 1.0
b7dd4d
Content-Type: text/plain; charset=UTF-8
b7dd4d
Content-Transfer-Encoding: 8bit
b7dd4d
b7dd4d
"! test ..." does not cause the script to fail, even with set -e.
b7dd4d
IIUC, bash treats this command as part of an expression line, as it
b7dd4d
would if 'test ... && ...' was used. Failing expression lines do not
b7dd4d
terminate the script.
b7dd4d
b7dd4d
This fixes the obvious cases by changing '! test' → 'test !'.
b7dd4d
Then the inversion happens internally in test and bash will propagate
b7dd4d
the failure.
b7dd4d
b7dd4d
(cherry picked from commit ffa328f060f437f3e1f0f0cb13513ee3dd9c3da5)
b7dd4d
b7dd4d
Related: #2087152
b7dd4d
---
b7dd4d
 test/TEST-22-TMPFILES/test-01.sh | 2 +-
b7dd4d
 1 file changed, 1 insertion(+), 1 deletion(-)
b7dd4d
b7dd4d
diff --git a/test/TEST-22-TMPFILES/test-01.sh b/test/TEST-22-TMPFILES/test-01.sh
b7dd4d
index d233e37fb2..b10b5aaa1a 100755
b7dd4d
--- a/test/TEST-22-TMPFILES/test-01.sh
b7dd4d
+++ b/test/TEST-22-TMPFILES/test-01.sh
b7dd4d
@@ -10,4 +10,4 @@ rm -fr /tmp/test
b7dd4d
 
b7dd4d
 echo "e /tmp/test - root root 1d" | systemd-tmpfiles --create -
b7dd4d
 
b7dd4d
-! test -e /tmp/test
b7dd4d
+test ! -e /tmp/test