sun_solaris_cr_6778077_sigthaw_trap.sh revision 3e14f97f673e8a630f076077de35afdd43dc1587
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
#
# This test checks whether ksh93 supports traps for the SIGTHAW
# signal.
#
# This was reported as CR #6778077 ("*ksh93* does not understand "THAW"
# as a signal for use with trap"):
# -- snip --
# While ksh93 understand THAW in the list of signals for kill it does
# not understand it for "trap'
#
# : pod5.eu TS 6 $; kill -l | egrep '(THAW|FREEZE)'
# FREEZE
# THAW
# : pod5.eu TS 7 $; trap "echo THAW" THAW
# ksh93: trap: THAW: bad trap
# : pod5.eu TS 8 $;
#
# Using the signal number (35) works around this.
# -- snip --
#
# test setup
function err_exit
{
print -u2 -n "\t"
}
alias err_exit='err_exit $LINENO'
set -o nounset
integer Errors=0
## test one: Check whether the shell supports SIGTHAW as trap
## test two: Check whether the shell supports SIGFREEZE as trap
## (we check this since it is SIGTHAW's counterpart)
## test three: Check all other signals listed by "kill -l"
kill -l | while read i ; do
str="$( ${SHELL} -c "trap true $i ; print 'ok'" 2>&1 )" || err_exit "shell returned code $? for trap $i"
done
# tests done