add test cases for trap ... but disabled for now until trap support is committed

This commit is contained in:
Mike Frysinger 2009-03-29 09:54:40 +00:00
parent 038fe44713
commit fd303b11ef
8 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,4 @@
sending USR2
caught
sending USR2
sending USR2

View File

@ -0,0 +1,20 @@
# avoid ugly warnings about signals not being caught
trap ":" USR1 USR2
hush -c '
trap "echo caught" USR2
echo "sending USR2"
kill -USR2 $$
trap "" USR2
echo "sending USR2"
kill -USR2 $$
trap "-" USR2
echo "sending USR2"
kill -USR2 $$
echo "not reached"
'
trap "-" USR1 USR2

View File

@ -0,0 +1,2 @@
cow
moo

View File

@ -0,0 +1,3 @@
hush -c 'trap "echo cow" 0'
hush -c 'trap "echo moo" EXIT'
hush -c 'trap "echo no" 0; trap 0'

View File

@ -0,0 +1,2 @@
YEAH
0

View File

@ -0,0 +1,4 @@
# make sure we do not corrupt $? across traps
trap "echo YEAH; false" USR1
kill -USR1 $$
echo $?

View File

@ -0,0 +1,14 @@
___
___
___
trap -- 'a' EXIT
trap -- 'a' INT
trap -- 'a' USR1
trap -- 'a' USR2
___
___
trap -- 'a' USR1
trap -- 'a' USR2
___
___
trap -- 'a' USR2

View File

@ -0,0 +1,23 @@
# no output -- default state
echo ___
trap
# assign some traps
echo ___
trap "a" EXIT INT USR1 USR2
# show them all
echo ___
trap
# clear one
echo ___
trap 0 INT
echo ___
trap
# clear another
echo ___
trap "-" USR1
echo ___
trap