Lines Matching defs:err_exit

20 function err_exit
26 alias err_exit='err_exit $LINENO'
31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; }
36 : ${foo=bar} || err_exit ": failed"
37 [[ $foo = bar ]] || err_exit ": side effects failed"
39 [[ $# = 2 && $1 = - && $2 = foobar ]] || err_exit "set -- - foobar failed"
41 [[ $# = 2 && $1 = -x && $2 = foobar ]] || err_exit "set -- -x foobar failed"
42 getopts :x: foo || err_exit "getopts :x: returns false"
43 [[ $foo = x && $OPTARG = foobar ]] || err_exit "getopts :x: failed"
47 then err_exit "'getopts :r:s var -r' not working"
52 then err_exit "'getopts :d#u OPT=d OPTARG=16177' failed -- OPT=$OPT OPTARG=$OPTARG"
56 do [[ $OPTIND == $((OPTIND)) ]] || err_exit "OPTIND optimization bug"
69 [[ $OPT == S && $OPTARG == $2 ]] || err_exit "OPT=$OPT OPTARG=$OPTARG -- expected OPT=S OPTARG=$2"
73 false ${foo=bar} && err_exit "false failed"
77 [[ $REPLY = 'hello world' ]] || err_exit "read builtin failed"
80 then err_exit "IFS=: read ... not working"
86 [[ $REPLY = 'hello world' ]] || err_exit "read continuation failed"
90 [[ $REPLY = 'hello world' ]] || err_exit "read builtin failed"
96 [[ $REPLY == 'hello world' ]] || err_exit "read continuation2 failed"
109 then err_exit "read multiple continuation failed"
112 then err_exit "read from pipeline failed"
117 then err_exit "read from /dev/null failed"
120 then err_exit "print -R not working correctly"
123 then err_exit "print -- not working correctly"
127 then err_exit "%n format of printf not working"
130 [[ -w /dev/fd/1 ]] || err_exit "2<&1- with built-ins has side effects"
133 then err_exit '$0 not correct for eval'
135 $SHELL -c 'read x <<< hello' 2> /dev/null || err_exit 'syntax <<< not recognized'
136 ($SHELL -c 'read x[1] <<< hello') 2> /dev/null || err_exit 'read x[1] not working'
141 then err_exit 'unset readonly variables are not displayed'
148 then err_exit 'continue breaks out of loop'
150 (continue bad 2>/dev/null && err_exit 'continue bad should return an error')
151 (break bad 2>/dev/null && err_exit 'break bad should return an error')
152 (continue 0 2>/dev/null && err_exit 'continue 0 should return an error')
153 (break 0 2>/dev/null && err_exit 'break 0 should return an error')
162 then err_exit "$fun call in ${fun}fun breaks out of for loop"
166 then err_exit 'print -f "%b" not working'
169 then err_exit 'print -f "%P" not working'
172 then err_exit 'break labels not working'
175 then err_exit 'command -v not working'
181 then err_exit "read -r of blank line not working"
183 mkdir -p $tmp/a/b/c 2>/dev/null || err_exit "mkdir -p failed"
184 $SHELL -c "cd $tmp/a/b; cd c" 2>/dev/null || err_exit "initial script relative cd fails"
189 [[ $got == $exp ]] || err_exit "\$(trap) failed -- expected \"$exp\", got \"$got\""
192 [[ $got == $exp ]] || err_exit "\$(trap -p TERM) failed -- expected \"$exp\", got \"$got\""
194 [[ $($SHELL -c 'trap "print ok" SIGTERM; kill -s SIGTERM $$' 2> /dev/null) == ok ]] || err_exit 'SIGTERM not recognized'
195 [[ $($SHELL -c 'trap "print ok" sigterm; kill -s sigterm $$' 2> /dev/null) == ok ]] || err_exit 'SIGTERM not recognized'
196 [[ $($SHELL -c '( trap "" TERM);kill $$;print bad' == bad) ]] 2> /dev/null && err_exit 'trap ignored in subshell causes it to be ignored by parent'
198 [[ $(kill -l $?) == HUP ]] || err_exit 'kill -1 -pid not working'
200 [[ $(kill -l $?) == HUP ]] || err_exit 'kill -n1 -pid not working'
202 [[ $(kill -l $?) == HUP ]] || err_exit 'kill -HUP -pid not working'
210 then err_exit "printf %$i not working"
214 then err_exit 'trap on EXIT not working'
217 then err_exit 'trap on EXIT not being cleared'
220 then err_exit 'whence -v test not a builtin'
224 then err_exit 'whence -v test after builtin -d incorrect'
229 then err_exit "printf $forrmat not working"
232 then err_exit 'printf \0 not working'
235 then err_exit 'printf %bx%s\n not working'
239 then err_exit 'printf %10.%s\n not working'
243 then err_exit 'printf "%10.5E" not normalizing correctly'
247 then err_exit 'printf "%g" not working correctly'
252 #FIXME#) 2> /dev/null || err_exit ksh read -s var fails
254 then err_exit 'printf is not processing formats beginning with + correctly'
257 then err_exit "printf not exiting non-zero with conversion errors"
260 then err_exit 'trap builtin terminating after --version'
263 then err_exit 'set builtin terminating after --veresion'
272 then err_exit '\f...\f not working in getopts usage strings'
275 then err_exit 'printf %H not working'
278 then err_exit 'printf %R not working'
281 then err_exit "printf '%..:c' not working"
284 then err_exit "printf '%..*c' not working"
287 then err_exit "printf '%..:s' not working"
290 then err_exit "printf '%..*s' not working"
292 [[ $(printf '%q\n') == '' ]] || err_exit 'printf "%q" with missing arguments'
296 err_exit 'printf "%T" now'
304 then err_exit "read reading ahead on a pipe"
311 then err_exit "read -n1 failed -- expected '$exp', got '$y'"
316 then err_exit 'read of incomplete line not working correctly'
321 then err_exit 'set -f not working'
328 (( $? == 127 )) || err_exit "job known to subshell"
332 (( $? == 1 )) || err_exit "wait not saving exit value"
334 (( $? == 127 )) || err_exit "subshell job known to parent"
343 then err_exit '"name=value exec -c ..." not working'
346 [[ $? == 1 ]] || err_exit 'getopts with negative OPTIND not working'
348 [[ $OPTARG == 3 ]] || err_exit 'getopts with numerical arguments failed'
350 then err_exit 'printf %2$s %1$s not working'
372 [[ $out == $val ]] || err_exit "printf $fmt $arg failed -- expected '$val', got '$out'"
374 then [[ $err ]] || err_exit "printf $fmt $arg failed, error message expected"
375 else [[ $err ]] && err_exit "$err: printf $fmt $arg failed, error message not expected -- got '$err'"
377 (( $ret == $code )) || err_exit "printf $fmt $arg failed -- expected exit code $code, got $ret"
393 then err_exit "\$OPTIND after getopts loop incorrect -- expected ${ARGC[$i]}, got $OPTIND"
401 a|c) [[ $OPTARG ]] && err_exit "getopts $options \$OPTARG for flag $opt failed, expected \"\", got \"$OPTARG\"" ;;
402 b) [[ $OPTARG == $optarg ]] || err_exit "getopts $options \$OPTARG failed -- \"$optarg\" expected, got \"$OPTARG\"" ;;
403 *) err_exit "getopts $options failed -- got flag $opt" ;;
412 [[ $a == $exp ]] || err_exit "read -N3 here-document failed -- expected '$exp', got '$a'"
414 [[ $b == $exp ]] || err_exit "read -N1 here-document failed -- expected '$exp', got '$b'"
419 [[ $a == $exp ]] || err_exit "read -n3 here-document failed -- expected '$exp', got '$a'"
421 #[[ $a == $exp ]] || err_exit "read -N3 from pipe failed -- expected '$exp', got '$a'"
423 #[[ $b == $exp ]] || err_exit "read -N1 from pipe failed -- expected '$exp', got '$b'"
426 #[[ $a == $exp ]] || err_exit "read -n3 from pipe failed -- expected '$exp', got '$a'"
431 # read -u5 -n3 -t2 a || err_exit 'read -n3 from fifo timedout'
432 # read -u5 -n1 -t2 b || err_exit 'read -n1 from fifo timedout'
435 # [[ $a == $exp ]] || err_exit "read -n3 from fifo failed -- expected '$exp', got '$a'"
440 # read -u5 -N3 -t2 a || err_exit 'read -N3 from fifo timed out'
441 # read -u5 -N1 -t2 b || err_exit 'read -N1 from fifo timedout'
444 # [[ $a == $exp ]] || err_exit "read -N3 from fifo failed -- expected '$exp', got '$a'"
446 # [[ $b == $exp ]] || err_exit "read -N1 from fifo failed -- expected '$exp', got '$b'"
463 (( sum == n )) || err_exit "command -x processed only $sum arguments"
465 [[ $? != 1 ]] && err_exit 'incorrect exit status for command -x'
473 (( sum > n )) || err_exit "command -x processed only $sum arguments"
474 (( (sum-n)%3==0 )) || err_exit "command -x processed only $sum arguments"
475 (( sum == n+3)) && err_exit "command -x processed only $sum arguments"
477 [[ $? != 1 ]] && err_exit 'incorrect exit status for command -x'
484 done) == $'0\n0\n1\n1\n2' ]] || err_exit "DEBUG trap not working"
486 [[ $($SHELL -c 'echo -3') == -3 ]] || err_exit "echo -3 not working in ucb universe"
495 #then err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) minimum - too long"
497 #then err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) minimum - too fast"
499 #$SHELL -c 'sleep $(printf "%a" .95)' 2> /dev/null || err_exit "sleep doesn't except %a format constants"
500 #$SHELL -c 'test \( ! -e \)' 2> /dev/null ; [[ $? == 1 ]] || err_exit 'test \( ! -e \) not working'
501 [[ $(ulimit) == "$(ulimit -fS)" ]] || err_exit 'ulimit is not the same as ulimit -fS'
504 [[ $( . "$tmpfile") == "$tmpfile 2 1" ]] || err_exit 'dot command not working'
506 [[ $($SHELL -c ". $tmpfile"$'\n print ok' 2> /dev/null) == ok ]] || err_exit 'syntax error in dot command affects next command'
514 #(( exitval )) && err_exit "sleep doesn't exit 0 with ALRM interupt"
515 #(( sec > (del - 1) )) || err_exit "ALRM signal causes sleep to terminate prematurely -- expected 3 sec, got $sec"
519 do ( unset $i) 2>/dev/null && err_exit "unset $i should fail"
523 do unset $i || print -u2 "err_exit unset $i should not fail"
525 [[ $($SHELL -c 'y=3; unset 123 y;print $?$y') == 1 ]] 2> /dev/null || err_exit 'y is not getting unset with unset 123 y'
526 [[ $($SHELL -c 'trap foo TERM; (trap;(trap) )') == 'trap -- foo TERM' ]] || err_exit 'traps not getting reset when subshell is last process'