6690 set_nfsv4_ephemeral_mount_to() tries to read AUTOMOUNT_TIMEOUT from defunct...
[unleashed.git] / usr / src / test / libc-tests / tests / quick_exit.ksh
blob94f9509491c889799663a4da88bbdc31d9a6e557
1 #!/usr/bin/ksh
3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
6 # 1.0 of the CDDL.
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2016 Joyent, Inc.
18 # Test quick_exit(3C). We specifically test the following things:
19 # o That we get a requested exit status
20 # o That at_quick_exit() functions fire in a registered, reverse order.
22 # These are all done by helper programs
25 set -o errexit
26 set -o pipefail
28 qe_root=$(dirname $0)
29 qe_status32=$qe_root/quick_exit_status.32
30 qe_status64=$qe_root/quick_exit_status.64
31 qe_order32=$qe_root/quick_exit_order.32
32 qe_order64=$qe_root/quick_exit_order.64
34 function fatal
36 typeset msg="$*"
37 echo "Test Failed: $msg" >&2
38 exit 1
41 function check_status
43 typeset stat=$1
44 $qe_status32 $stat
45 if [[ $? -ne $stat ]]; then
46 fatal "Test failed: Expected $qestatus32 to exit $stat " \
47 "got $?"
50 $qe_status64 $stat
51 if [[ $? -ne $stat ]]; then
52 fatal "Test failed: Expected $qestatus64 to exit $stat " \
53 "got $?" >&2
57 function check_order
59 $qe_order32 || fatal "$qe_order32 returned $?"
60 $qe_order64 || fatal "$qe_order32 returned $?"
63 check_status 0
64 check_status 23
65 check_status 42
66 check_order
67 exit 0