From 52854b093cc6b0b3a6703a5ff1f4ccd815830c7a Mon Sep 17 00:00:00 2001 From: jilles Date: Sun, 14 Jun 2009 16:21:51 +0000 Subject: Add tests for r194127 and r194128. Approved by: ed (mentor) --- tools/regression/bin/sh/builtins/trap1.0 | 22 ++++++++++++++++++++++ tools/regression/bin/sh/execution/fork1.0 | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100644 tools/regression/bin/sh/builtins/trap1.0 create mode 100644 tools/regression/bin/sh/execution/fork1.0 (limited to 'tools/regression') diff --git a/tools/regression/bin/sh/builtins/trap1.0 b/tools/regression/bin/sh/builtins/trap1.0 new file mode 100644 index 0000000..1a87f4c --- /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 0000000..3ed5de2 --- /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 -- cgit v1.1