Author: jilles
Date: Sun Jun 14 19:41:24 2020
New Revision: 362182
URL: https://svnweb.freebsd.org/changeset/base/362182
Log:
sh/tests: Add tests for SIGINT in non-jobc background commands
If job control is not enabled, background commands shall ignore SIGINT and
SIGQUIT, and it shall be possible to override that ignore in the same shell.
MFC after: 1 week
Added:
head/bin/sh/tests/execution/bg11.0 (contents, props changed)
head/bin/sh/tests/execution/bg12.0 (contents, props changed)
Modified:
head/bin/sh/tests/execution/Makefile
Modified: head/bin/sh/tests/execution/Makefile
==============================================================================
--- head/bin/sh/tests/execution/Makefile Sun Jun 14 18:49:06 2020
(r362181)
+++ head/bin/sh/tests/execution/Makefile Sun Jun 14 19:41:24 2020
(r362182)
@@ -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
Added: head/bin/sh/tests/execution/bg11.0
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/bin/sh/tests/execution/bg11.0 Sun Jun 14 19:41:24 2020
(r362182)
@@ -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 ]
Added: head/bin/sh/tests/execution/bg12.0
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/bin/sh/tests/execution/bg12.0 Sun Jun 14 19:41:24 2020
(r362182)
@@ -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 ]
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"