sed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] panic-tests.sh fails when running as root


From: Jakub Martisko
Subject: [PATCH] panic-tests.sh fails when running as root
Date: Mon, 21 May 2018 14:00:08 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

Hello,

currently, "make check" fails when run with root privileges
because of the panic-tests.sh test. Possible fix is in the
attachment.

Regards,
Jakub
>From a53d98e8092f982e6e98147ce42e574559204907 Mon Sep 17 00:00:00 2001
From: Jakub Martisko <address@hidden>
Date: Mon, 21 May 2018 13:41:55 +0200
Subject: [PATCH] tests: panic-tests.sh should not fail when running as root

---
 testsuite/panic-tests.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/testsuite/panic-tests.sh b/testsuite/panic-tests.sh
index 76146f9..5c9efdb 100644
--- a/testsuite/panic-tests.sh
+++ b/testsuite/panic-tests.sh
@@ -32,12 +32,15 @@ cat <<\EOF >exp-err-temp || framework_failure_
 sed: couldn't open temporary file
 EOF
 
-# TODO: why exit-code 4 (currently hard-coded)
-returns_ 4 sed -i = a/a 2>err-temp || fail=1
-
-# trim the filename/errno message (using sed itself...)
-sed -i 's/file.*$/file/' err-temp || framework_failure_
-compare_ exp-err-temp err-temp || fail=1
+#skip this test if running as root
+if test $(id -u) -ne 0; then
+    # TODO: why exit-code 4 (currently hard-coded)
+    returns_ 4 sed -i = a/a 2>err-temp || fail=1
+
+    # trim the filename/errno message (using sed itself...)
+    sed -i 's/file.*$/file/' err-temp || framework_failure_
+    compare_ exp-err-temp err-temp || fail=1
+fi
 
 # restore writability, to ensure it can be deleted
 chmod a+w a || framework_failure_
-- 
2.14.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]