mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
Add tests for r194127 and r194128.
Approved by: ed (mentor)
This commit is contained in:
parent
51a8ff0c9c
commit
1251149b3c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194196
22
tools/regression/bin/sh/builtins/trap1.0
Normal file
22
tools/regression/bin/sh/builtins/trap1.0
Normal file
@ -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
|
7
tools/regression/bin/sh/execution/fork1.0
Normal file
7
tools/regression/bin/sh/execution/fork1.0
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user