[Git][NTPsec/ntpsec][master] Hack tests/option-tester.sh to not crash on broken sh

Hal Murray gitlab at mg.gitlab.com
Fri Dec 7 05:11:40 UTC 2018


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
fb9c93bf by Hal Murray at 2018-12-07T05:08:12Z
Hack tests/option-tester.sh to not crash on broken sh

The old versions of sh on FreeBSD, NetBSD, and old CentOS
don't support pipefail.

The code now checks for that case and blunders on.  It won't
return an error code, but does print a big warning at the
end of the run where somebody might see it.

- - - - -


1 changed file:

- tests/option-tester.sh


Changes:

=====================================
tests/option-tester.sh
=====================================
@@ -9,9 +9,11 @@
 # Running again starts by deleting everything in the directory.
 
 # set pipefail to catch pipeline failures
-set -o pipefail
-# crash on unset shell variables
-set -u
+# Unfortunately, it doesn't work on some older sh-es
+if /bin/sh -c "set -o pipefail"
+then
+  set -o pipefail
+fi
 
 LINUX=""
 if [ `uname -s` = "Linux" -a -f /usr/include/seccomp.h ]
@@ -95,6 +97,14 @@ then
     echo "### Warning: Missing seccomp.h (on a Linux system)"
     echo
 fi
+
+if ! /bin/sh -c "set -o pipefail"
+then
+  echo "### old sh - no pipefail"
+  echo "We can't test for errors"
+  echo "###          You will have to scan the log files."
+fi
+
 echo "PYTHONPATH is" \"$PYTHONPATH\"
 grep VERSION: test*/test.log
 echo



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/fb9c93bf59e38aee243d839940b903bbe9e4d1a8

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/fb9c93bf59e38aee243d839940b903bbe9e4d1a8
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20181207/d84f05cf/attachment-0001.html>


More information about the vc mailing list