aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/tests/execution
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2020-06-14 19:41:24 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2020-06-14 19:41:24 +0000
commit7312c97fa4611ccecff9122d6e4e8681b0539679 (patch)
tree6f8b3d44c6b60f58ebc1c9722ae44039cce945b1 /bin/sh/tests/execution
parenta4ec123c569adc860c69827bc54c306b333c924b (diff)
Notes
Diffstat (limited to 'bin/sh/tests/execution')
-rw-r--r--bin/sh/tests/execution/Makefile2
-rw-r--r--bin/sh/tests/execution/bg11.016
-rw-r--r--bin/sh/tests/execution/bg12.012
3 files changed, 30 insertions, 0 deletions
diff --git a/bin/sh/tests/execution/Makefile b/bin/sh/tests/execution/Makefile
index 1f7f1c80ae2b..c457c148b8f3 100644
--- a/bin/sh/tests/execution/Makefile
+++ b/bin/sh/tests/execution/Makefile
@@ -17,6 +17,8 @@ ${PACKAGE}FILES+= bg7.0
${PACKAGE}FILES+= bg8.0
${PACKAGE}FILES+= bg9.0
${PACKAGE}FILES+= bg10.0 bg10.0.stdout
+${PACKAGE}FILES+= bg11.0
+${PACKAGE}FILES+= bg12.0
${PACKAGE}FILES+= env1.0
${PACKAGE}FILES+= fork1.0
${PACKAGE}FILES+= fork2.0
diff --git a/bin/sh/tests/execution/bg11.0 b/bin/sh/tests/execution/bg11.0
new file mode 100644
index 000000000000..e0c48ed16076
--- /dev/null
+++ b/bin/sh/tests/execution/bg11.0
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX`
+trap 'rm -rf $T' 0
+cd $T || exit 3
+mkfifo fifo1
+# Use a trap, not the default action, since the shell may catch SIGINT and
+# therefore its processing may be delayed.
+{ trap 'exit 5' TERM; read dummy <fifo1; exit 4; } &
+exec 3>fifo1
+kill -INT "$!"
+kill -TERM "$!"
+exec 3>&-
+wait "$!"
+r=$?
+[ "$r" = 5 ]
diff --git a/bin/sh/tests/execution/bg12.0 b/bin/sh/tests/execution/bg12.0
new file mode 100644
index 000000000000..78102ecf6306
--- /dev/null
+++ b/bin/sh/tests/execution/bg12.0
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX`
+trap 'rm -rf $T' 0
+cd $T || exit 3
+mkfifo fifo1
+{ trap - INT; : >fifo1; sleep 5; exit 4; } &
+: <fifo1
+kill -INT "$!"
+wait "$!"
+r=$?
+[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ]