summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2009-06-14 16:21:51 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2009-06-14 16:21:51 +0000
commit1251149b3ca24fe7befe3fee201c0c014fe2ed4d (patch)
tree6c0da99257a7fd54516b4b562bc02a605146be1d /tools
parent51a8ff0c9c74d35f7f1db40c3c94c963e0eb9e27 (diff)
Notes
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bin/sh/builtins/trap1.022
-rw-r--r--tools/regression/bin/sh/execution/fork1.07
2 files changed, 29 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/trap1.0 b/tools/regression/bin/sh/builtins/trap1.0
new file mode 100644
index 000000000000..1a87f4cb7f8c
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/trap1.0
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+test "$(trap 'echo trapped' EXIT; :)" = trapped || exit 1
+
+test "$(trap 'echo trapped' EXIT; /usr/bin/true)" = trapped || exit 1
+
+result=$(sh -c 'trap "echo trapped" EXIT; /usr/bin/false')
+test $? -eq 1 || exit 1
+test "$result" = trapped || exit 1
+
+result=$(sh -c 'trap "echo trapped" EXIT; exec /usr/bin/false')
+test $? -eq 1 || exit 1
+test -z "$result" || exit 1
+
+result=0
+trap 'result=$((result+1))' INT
+kill -INT $$
+test "$result" -eq 1 || exit 1
+(kill -INT $$)
+test "$result" -eq 2 || exit 1
+
+exit 0
diff --git a/tools/regression/bin/sh/execution/fork1.0 b/tools/regression/bin/sh/execution/fork1.0
new file mode 100644
index 000000000000..3ed5de2ec1f1
--- /dev/null
+++ b/tools/regression/bin/sh/execution/fork1.0
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+result=$(sh -c 'ps -p $$ -o comm=')
+test "$result" = "ps" || exit 1
+
+result=$(sh -c 'ps -p $$ -o comm=; :')
+test "$result" = "sh" || exit 1