Lines Matching refs:err_exit

20 function err_exit
26 alias err_exit='err_exit $LINENO'
31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; }
53 [[ $g == $2 ]] || err_exit "umask 0; umask $1 failed -- expected $2, got $g"
56 umask u=rwx,go=rx || err_exit "umask u=rws,go=rx failed"
58 then err_exit 'umask -S incorrect'
62 cd $tmp || { err_exit "cd $tmp failed"; exit 1; }
67 [[ -r foobar ]] || err_exit 'umask not being restored after subshell'
82 then err_exit 'file expansion with trailing / not working'
85 then err_exit 'file expansion with single file not working'
89 then err_exit 'file expansion leading . not working'
91 date > dat1 || err_exit "date > dat1 failed"
92 test -r dat1 || err_exit "dat1 is not readable"
94 cat <$x > dat2 || err_exit "cat < $x > dat2 failed"
95 cat dat1 dat2 | cat | cat | cat > dat3 || err_exit "cat pipe failed"
103 then err_exit "dat* matches only $# files"
108 then err_exit 'foo* does not match foo\abc'
114 then err_exit 'TT* not expanding when file TT* exists'
117 cd ~- || err_exit "cd back failed"
124 then err_exit '$0 not correct for #! script'
129 then err_exit 'eval foo=\$bar not working'
134 then err_exit 'eval foo=\$bar, with bar="foo\ bar" not working'
137 cd ../../tmp || err_exit "cd ../../tmp failed"
139 then err_exit 'cd ../../tmp is not /tmp'
148 then err_exit "$foobar is not foobar"
156 then err_exit "output file pointer not shared correctly"
165 then err_exit "script not working"
168 then err_exit "script | cat not working"
171 then err_exit "output file pointer not shared correctly"
176 then err_exit " ( (print foo);(print bar ) failed"
180 then err_exit " ( (/bin/echo);(print bar ) failed"
184 then err_exit " ( (/bin/echo);(/bin/echo bar ) failed"
197 no) err_exit "[[ -p /dev/fd/0 ]] fails for standard input pipe" ;;
198 *) err_exit "builtin replaces standard input pipe" ;;
204 then err_exit '$0 not correct for . script'
206 cd $tmp || { err_exit "cd $tmp failed"; exit 1; }
211 then err_exit "nested scripts failed"
215 then err_exit "scripts in subshells fail"
217 cd ~- || err_exit "cd back failed"
220 then err_exit "subshell in command substitution fails"
226 then err_exit "command subsitution with stdout closed failed"
236 then err_exit "$SHELL not working when standard input is a pipe"
240 then err_exit "subshell in command substitution with 1 closed fails"
247 then err_exit "executing script with 0 closed fails"
257 then err_exit "traps ignored by parent not ignored"
269 then err_exit "standard input not positioned correctly"
273 then err_exit "pipe to { read line; /bin/cat;} not working"
277 then err_exit "pipe to ( read line; /bin/cat) not working"
280 then err_exit 'brace expansion not working'
286 then err_exit 'for loop subshell optimizer bug'
302 optbug || err_exit 'array size optimzation bug'
308 then err_exit 'jobs -p not reporting a background job'
315 (( $# == 2 )) || err_exit "$# jobs not reported -- 2 expected"
320 [[ $( (trap 'print alarm' ALRM; sleep 4) & sleep 2; kill -ALRM $!; sleep 2; wait) == alarm ]] || err_exit 'ALRM signal not working'
321 [[ $($SHELL -c 'trap "" HUP; $SHELL -c "(sleep 2;kill -HUP $$)& sleep 4;print done"') != done ]] && err_exit 'ignored traps not being ignored'
322 [[ $($SHELL -c 'o=foobar; for x in foo bar; do (o=save);print $o;done' 2> /dev/null ) == $'foobar\nfoobar' ]] || err_exit 'for loop optimization subshell bug'
325 then [[ $($SHELL -c 'cat <(print foo)' 2> /dev/null) == foo ]] || err_exit 'process substitution not working'
332 cat '$tmp/scriptx 2> /dev/null) == line1 ]] || err_exit '>() process substitution fails'
343 cat '$tmp/scriptx 2>> /dev/null) == line1 ]] || err_exit '>() process substitution fails in for loop'
345 err_exit 'process substitution of compound commands not working'
347 [[ $($SHELL -r 'command -p :' 2>&1) == *restricted* ]] || err_exit 'command -p not restricted'
350 [[ $($SHELL -c "print foo | $tmp/scriptx ;:" 2> /dev/null ) == foo ]] || err_exit 'piping into script fails'
351 [[ $($SHELL -c 'X=1;print -r -- ${X:=$(expr "a(0)" : '"'a*(\([^)]\))')}'" 2> /dev/null) == 1 ]] || err_exit 'x=1;${x:=$(..."...")} failure'
352 [[ $($SHELL -c 'print -r -- ${X:=$(expr "a(0)" : '"'a*(\([^)]\))')}'" 2> /dev/null) == 0 ]] || err_exit '${x:=$(..."...")} failure'
354 then [[ $(cat <(print hello) ) == hello ]] || err_exit "process substitution not working outside for or while loop"
355 $SHELL -c '[[ $(for i in 1;do cat <(print hello);done ) == hello ]]' 2> /dev/null|| err_exit "process substitution not working in for or while loop"
359 [[ $( print "($tmp/scriptx bar)" | $SHELL 2>/dev/null) == 'foo bar' ]] || err_exit 'script pipe to shell fails'
363 [[ $($tmp/scriptx) == $tmp/scriptx ]] || err_exit "\$0 is $0 instead of $tmp/scriptx"
369 (( $($SHELL $tmp/scriptx) > 2.0 )) && err_exit 'command substitution causes pipefail option to hang'
371 ( typeset -r foo=bar) 2> /dev/null || err_exit 'readonly variables set in a subshell cannot unset'
372 $SHELL -c 'x=${ print hello;}; [[ $x == hello ]]' 2> /dev/null || err_exit '${ command;} not supported'
373 $SHELL 2> /dev/null <<- \EOF || err_exit 'multiline ${...} command substitution not supported'
379 $SHELL 2> /dev/null <<- \EOF || err_exit '${...} command substitution with side effects not supported '
387 $SHELL 2> /dev/null <<- \EOF || err_exit 'nested ${...} command substitution not supported'
393 $SHELL 2> /dev/null <<- \EOF || err_exit 'terminating } is not a reserved word with ${ command }'
397 $SHELL 2> /dev/null <<- \EOF || err_exit '${ command;}xxx not working'
406 [[ ! ${foo[@]} ]] || err_exit '${foo[@]} is not empty when foo is unset'
407 [[ ! ${foo[3]} ]] || err_exit '${foo[3]} is not empty when foo is unset'
408 [[ $(print "[${ print foo }]") == '[foo]' ]] || err_exit '${...} not working when } is followed by ]'
409 [[ $(print "${ print "[${ print foo }]" }") == '[foo]' ]] || err_exit 'nested ${...} not working when } is followed by ]'
411 foo=$(false) > /dev/null && err_exit 'failed command substitution with redirection not returning false'
414 [[ $got == $expected ]] || err_exit "command substitution background process output error -- got '$got', expected '$expected'"
418 do x=$($false) && err_exit "x=\$($false) should fail"
419 $($false) && err_exit "\$($false) should fail"
420 $($false) > /dev/null && err_exit "\$($false) > /dev/null should fail"
423 then [[ $(env 'x-a=y' $SHELL -c 'env | grep x-a') == *x-a=y* ]] || err_exit 'invalid environment variables not preserved'
430 (( (SECONDS-s) < 4)) && err_exit '"command | while read...done" finishing too fast'
437 (( (SECONDS-s) < 2 )) || err_exit 'early termination not causing broken pipe'
438 [[ $({ trap 'print trap' 0; print -n | $(whence -p cat); } & wait $!) == trap ]] || err_exit 'trap on exit not getting triggered'
440 [[ $var == trap ]] || err_exit 'trap on ERR not getting triggered'
452 [[ $got == $exp ]] || err_exit "pipe to function with conditional fails -- expected '$exp', got '$got'"
458 [[ $got == $exp ]] || err_exit "pipe to { ... } with conditional fails -- expected '$exp', got '$got'"
465 [[ $got == $exp ]] || err_exit "pipe to ( ... ) with conditional fails -- expected '$exp', got '$got'"
467 ( $SHELL -c 'trap : DEBUG; x=( $foo); exit 0') 2> /dev/null || err_exit 'trap DEBUG fails'
476 (( (SECONDS-start) < 1 )) && err_exit "pipefail not waiting for pipe to finish"
478 (( (SECONDS-end) > 2 )) && err_exit "pipefail causing $bintrue to wait for other end of pipe"
481 { env A__z=C+SHLVL $SHELL -c : ;} 2> /dev/null || err_exit "SHLVL with wrong attribute fails"
486 (( (SECONDS-t0) < 1 )) && err_exit 'time not waiting for pipeline to complete'
495 (( (SECONDS-sec) < .7 )) && err_exit '. script does not restore output redirection with eval'
504 then err_exit 'output from pipe is lost with pipe to builtin'
509 $SHELL -c 'kill -0 123456789123456789123456789' 2> /dev/null && err_exit 'kill not catching process id overflows'
511 [[ $($SHELL -c '{ cd..; print ok;}' 2> /dev/null) == ok ]] || err_exit 'command name ending in .. causes shell to abort'
513 $SHELL -xc '$(LD_LIBRARY_PATH=$LD_LIBRARY_PATH exec $SHELL -c :)' > /dev/null 2>&1 || err_exit "ksh -xc '(name=value exec ksh)' fails with err=$?"
515 $SHELL 2> /dev/null -c $'for i;\ndo :;done' || err_exit 'for i ; <newline> not vaid'