summaryrefslogtreecommitdiff
path: root/unit-tests/sh-errctl.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/sh-errctl.mk')
-rw-r--r--unit-tests/sh-errctl.mk26
1 files changed, 26 insertions, 0 deletions
diff --git a/unit-tests/sh-errctl.mk b/unit-tests/sh-errctl.mk
new file mode 100644
index 000000000000..ecc2485e9b72
--- /dev/null
+++ b/unit-tests/sh-errctl.mk
@@ -0,0 +1,26 @@
+# $NetBSD: sh-errctl.mk,v 1.1 2020/12/12 15:06:11 rillig Exp $
+#
+# Test a shell with error control. This only works in jobs mode; in compat
+# mode, the default shell is always used, see InitShellNameAndPath.
+#
+# There is a subtle difference between error control and echo control.
+# With error control, each simple command is checked, whereas with echo
+# control, only the last command from each line is checked. A shell command
+# line that behaves differently in these two modes is "false; true". In
+# error control mode, this fails, while in echo control mode, it succeeds.
+
+.MAKEFLAGS: -j1 -dj
+
+.SHELL: \
+ name="sh" \
+ path="${.SHELL}" \
+ hasErrCtl="yes" \
+ check="\# error checking on\nset -e" \
+ ignore="\# error checking off\nset +e" \
+ echo="\# echo on" \
+ quiet="\# echo off"
+
+all:
+ @echo silent
+ -echo ignerr; false
+ +echo always