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; }
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"
225 then err_exit "command subsitution with stdout closed failed"
234 then err_exit "$SHELL not working when standard input is a pipe"
238 then err_exit "subshell in command substitution with 1 closed fails"
245 then err_exit "executing script with 0 closed fails"
255 then err_exit "traps ignored by parent not ignored"
267 then err_exit "standard input not positioned correctly"
271 then err_exit "pipe to { read line; /bin/cat;} not working"
275 then err_exit "pipe to ( read line; /bin/cat) not working"
278 then err_exit 'brace expansion not working'
284 then err_exit 'for loop subshell optimizer bug'
300 optbug || err_exit 'array size optimzation bug'
306 then err_exit 'jobs -p not reporting a background job'
313 (( $# == 2 )) || err_exit "$# jobs not reported -- 2 expected"
318 [[ $( (trap 'print alarm' ALRM; sleep 4) & sleep 2; kill -ALRM $!; sleep 2; wait) == alarm ]] || err_exit 'ALRM signal not working'
319 [[ $($SHELL -c 'trap "" HUP; $SHELL -c "(sleep 2;kill -HUP $$)& sleep 4;print done"') != done ]] && err_exit 'ignored traps not being ignored'
320 [[ $($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'
323 then [[ $($SHELL -c 'cat <(print foo)' 2> /dev/null) == foo ]] || err_exit 'process substitution not working'
330 cat '$tmp/scriptx 2> /dev/null) == line1 ]] || err_exit '>() process substitution fails'
341 cat '$tmp/scriptx 2>> /dev/null) == line1 ]] || err_exit '>() process substitution fails in for loop'
343 err_exit 'process substitution of compound commands not working'
345 [[ $($SHELL -r 'command -p :' 2>&1) == *restricted* ]] || err_exit 'command -p not restricted'
348 [[ $($SHELL -c "print foo | $tmp/scriptx ;:" 2> /dev/null ) == foo ]] || err_exit 'piping into script fails'
349 [[ $($SHELL -c 'X=1;print -r -- ${X:=$(expr "a(0)" : '"'a*(\([^)]\))')}'" 2> /dev/null) == 1 ]] || err_exit 'x=1;${x:=$(..."...")} failure'
350 [[ $($SHELL -c 'print -r -- ${X:=$(expr "a(0)" : '"'a*(\([^)]\))')}'" 2> /dev/null) == 0 ]] || err_exit '${x:=$(..."...")} failure'
353 then [[ $(cat <(print hello) ) == hello ]] || err_exit "process substitution not working outside for or while loop"
354 $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"
358 [[ $( print "($tmp/scriptx bar)" | $SHELL 2>/dev/null) == 'foo bar' ]] || err_exit 'script pipe to shell fails'
362 [[ $($tmp/scriptx) == $tmp/scriptx ]] || err_exit "\$0 is $0 instead of $tmp/scriptx"
368 (( $($SHELL $tmp/scriptx) > 2.0 )) && err_exit 'command substitution causes pipefail option to hang'
370 ( typeset -r foo=bar) 2> /dev/null || err_exit 'readonly variables set in a subshell cannot unset'
371 $SHELL -c 'x=${ print hello;}; [[ $x == hello ]]' 2> /dev/null || err_exit '${ command;} not supported'
372 $SHELL 2> /dev/null <<- \EOF || err_exit 'multiline ${...} command substitution not supported'
378 $SHELL 2> /dev/null <<- \EOF || err_exit '${...} command substitution with side effects not supported '
386 $SHELL 2> /dev/null <<- \EOF || err_exit 'nested ${...} command substitution not supported'
392 $SHELL 2> /dev/null <<- \EOF || err_exit 'terminating } is not a reserved word with ${ command }'
396 $SHELL 2> /dev/null <<- \EOF || err_exit '${ command;}xxx not working'
405 [[ ! ${foo[@]} ]] || err_exit '${foo[@]} is not empty when foo is unset'
406 [[ ! ${foo[3]} ]] || err_exit '${foo[3]} is not empty when foo is unset'
407 [[ $(print "[${ print foo }]") == '[foo]' ]] || err_exit '${...} not working when } is followed by ]'
408 [[ $(print "${ print "[${ print foo }]" }") == '[foo]' ]] || err_exit 'nested ${...} not working when } is followed by ]'
410 foo=$(false) > /dev/null && err_exit 'failed command substitution with redirection not returning false'
413 [[ $got == $expected ]] || err_exit "command substitution background process output error -- got '$got', expected '$expected'"
417 do x=$($false) && err_exit "x=\$($false) should fail"
418 $($false) && err_exit "\$($false) should fail"
419 $($false) > /dev/null && err_exit "\$($false) > /dev/null should fail"
422 then [[ $(env 'x-a=y' $SHELL -c 'env | grep x-a') == *x-a=y* ]] || err_exit 'invalid environment variables not preserved'
429 (( (SECONDS-s) < 4)) && err_exit '"command | while read...done" finishing too fast'
436 (( (SECONDS-s) < 2 )) || err_exit 'early termination not causing broken pipe'
437 [[ $({ trap 'print trap' 0; print -n | $(whence -p cat); } & wait $!) == trap ]] || err_exit 'trap on exit not getting triggered'
439 [[ $var == trap ]] || err_exit 'trap on ERR not getting triggered'
451 [[ $got == $exp ]] || err_exit "pipe to function with conditional fails -- expected '$exp', got '$got'"
457 [[ $got == $exp ]] || err_exit "pipe to { ... } with conditional fails -- expected '$exp', got '$got'"
464 [[ $got == $exp ]] || err_exit "pipe to ( ... ) with conditional fails -- expected '$exp', got '$got'"
466 ( $SHELL -c 'trap : DEBUG; x=( $foo); exit 0') 2> /dev/null || err_exit 'trap DEBUG fails'
475 (( (SECONDS-start) < 1 )) && err_exit "pipefail not waiting for pipe to finish"
477 (( (SECONDS-start) > 2 )) && err_exit "pipefail causing /bin/true to wait for other end of pipe"
480 { env A__z=C+SHLVL $SHELL -c : ;} 2> /dev/null || err_exit "SHLVL with wrong attribute fails"