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; }
48 [[ $a == foo ]] || err_exit "bad file descriptor $i in comsub script"
51 [[ $(fun) == good ]] || err_exit 'file 3 closed before subshell completes'
53 cd $tmp || { err_exit "cd $tmp failed"; exit ; }
57 then err_exit 'append (>>) not working'
64 then err_exit "read on <> fd failed -- expected '$exp', got '$line'"
67 then err_exit 'noclobber not causing exclusive open'
91 [[ $semantics == @(${FDFS[fdfs].semantics}) ]] || err_exit "'4< ${FDFS[fdfs].dir}/3' $semantics semantics instead of ${FDFS[fdfs].semantics} -- expected '$exp', got '$got'"
109 [[ $semantics == @(${FDFS[fdfs].semantics}) ]] || err_exit "${FDFS[fdfs].dir}/N $semantics semantics instead of ${FDFS[fdfs].semantics} -- expected '$exp', got '$got'"
119 then err_exit "picked up file descriptor zero for opening script file"
128 ./close0 2> /dev/null || err_exit "multiple exec 4< /dev/null can fail"
139 [[ $? == 0 ]] || err_exit 'builtin cat truncates files'
147 [[ $( $SHELL ./script) == $'hello\nworld' ]] || err_exit 'closing 3 & 4 causes script to fail'
148 cd ~- || err_exit "cd back failed"
149 ( exec > '' ) 2> /dev/null && err_exit '> "" does not fail'
151 ( exec > ${x} ) 2> /dev/null && err_exit '> $x, where x null does not fail'
159 then err_exit 'file descriptor not restored after exec in subshell'
174 !) == $'line 1\nline 2\nline 3' ]] || err_exit 'read error with subshells'
193 [[ $($SHELL $tmp/1) == ok ]] || err_exit "parent i/o causes child script to fail"
204 [[ $($tmp/1) == ok ]] || err_exit "trap on EXIT loses last command redirection"
208 then err_exit "{n}<&0 not working with for loop"
213 !) == world ]] || err_exit 'I/O not synchronized with <&'
219 then (( $(3<#) == 0 )) || err_exit "not at position 0"
220 (( $(3<# ((EOF))) == 40*62 )) || err_exit "not at end-of-file"
221 command exec 3<# ((40*8)) || err_exit "absolute seek fails"
223 [[ $REPLY == +(i) ]] || err_exit "expected iiii..., got $REPLY"
224 [[ $(3<#) == $(3<# ((CUR)) ) ]] || err_exit '$(3<#)!=$(3<#((CUR)))'
227 [[ $REPLY == {39}(l) ]] || err_exit "expected lll..., got $REPLY"
230 [[ $REPLY == +(9) ]] || err_exit "expected 999..., got $REPLY"
235 [[ $REPLY == +(@) ]] || err_exit "expected @@@..., got $REPLY"
237 [[ $REPLY == +(d) ]] || err_exit "expected ddd..., got $REPLY"
240 (( $(3<# ((CUR-0))) == 40*63 )) || err_exit "not at extended end-of-file"
243 [[ $REPLY == +(^) ]] || err_exit "expected ddd..., got $REPLY"
247 [[ $REPLY == {39}(j) ]] || err_exit "<# pattern failed"
248 [[ $(command exec 3<## *llll*) = {39}(k) ]] || err_exit "<## pattern not saving standard output"
250 [[ $REPLY == {39}(l) ]] || err_exit "<## pattern failed to position"
252 read -u3 && err_exit "not found pattern not positioning at eof"
254 [[ $REPLY == *WWWWW* ]] || err_exit '<# not working for pipes'
255 { < $tmp/seek <# ((2358336120)) ;} 2> /dev/null || err_exit 'long seek not working'
256 else err_exit "$tmp/seek: cannot open for reading"
263 then { command exec {n}<#((EOF)) ;} 2> /dev/null || err_exit '{n}<# not working'
265 then (( $({n}<#) == 40*62)) || err_exit '$({n}<#) not working'
266 else err_exit 'not able to parse {n}</dev/null'
281 (( exitval )) && err_exit "print to unit $exitval failed"
283 [[ -s $tmp/1 || -s $tmp/2 ]] && err_exit 'commands with standard output closed produce output'
284 $SHELL -c "$SHELL -c ': 3>&1' 1>&- 2>/dev/null" && err_exit 'closed standard output not passed to subshell'
293 EOF) == 'hello world' ]] || err_exit 'invalid readahead on stdin'
294 $SHELL -c 'exec 3>; /dev/null' 2> /dev/null && err_exit '>; with exec should be an error'
295 $SHELL -c ': 3>; /dev/null' 2> /dev/null || err_exit '>; not working with at all'
298 then [[ $(<$tmp/1) == hello ]] || err_exit '>; not preserving file on failure'
301 then [[ $(<$tmp/1) == 'hello world' ]] || err_exit '>; not updating file on success'
304 $SHELL -c 'exec 3<>; /dev/null' 2> /dev/null && err_exit '<>; with exec should be an error'
305 $SHELL -c ': 3<>; /dev/null' 2> /dev/null || err_exit '<>; not working with at all'
308 then [[ $(<$tmp/1) == $'hello\nworld' ]] || err_exit '<>; not preserving file on failure'
311 then [[ $(<$tmp/1) == hello ]] || err_exit '<>; not truncating file on success of head'
315 then [[ $(<$tmp/1) == world ]] || err_exit '<>; not truncating file on success of behead'
323 then err_exit 'read -n1 not working'
329 [[ $a == abc ]] || err_exit 'read -N3 here-document not working'
330 [[ $b == d ]] || err_exit 'read -N1 here-document not working'
334 [[ $a == abc ]] || err_exit 'read -n3 here-document not working'
336 [[ $a == abc ]] || err_exit 'read -N3 from pipe not working'
337 [[ $b == d ]] || err_exit 'read -N1 from pipe not working'
339 [[ $a == a ]] || err_exit 'read -n3 from pipe not working'
343 read -u5 -n3 -t2 a || err_exit 'read -n3 from fifo timedout'
344 read -u5 -n1 -t2 b || err_exit 'read -n1 from fifo timedout'
346 [[ $a == a ]] || err_exit 'read -n3 from fifo not working'
351 read -u5 -N3 -t2 a || err_exit 'read -N3 from fifo timed out'
352 read -u5 -N1 -t2 b || err_exit 'read -N1 from fifo timedout'
354 [[ $a == abc ]] || err_exit 'read -N3 from fifo not working'
355 [[ $b == d ]] || err_exit 'read -N1 from fifo not working'
370 [[ $? == 0 ]] && err_exit 'should have timed out'
371 [[ $line1 == 'prompt1: ' ]] || err_exit "line1 should be 'prompt1: '"
372 [[ $line2 == line2 ]] || err_exit "line2 should be line2"
373 [[ $line3 == 'prompt2: ' ]] || err_exit "line3 should be 'prompt2: '"
374 [[ ! $line4 ]] || err_exit "line4 should be empty"
397 [[ $g == "${e[i]}" ]] || err_exit "LC_ALL=$lc_all read ${o[i]} from pipe '$a $b' failed -- expected '${e[i]}', got '$g'"
416 [[ $g == "$e" ]] || err_exit "read -${o}${i} failed for '${c[w]}' -- expected '$e', got '$g'"
431 [[ $got == $exp ]] || err_exit "output garbled when stderr is duped -- expected $(printf %q "$exp"), got $(printf %q "$got")"
434 (( $(wc -c < $file) == 5 )) || err_exit "$file was not truncate to 5 bytes"
442 [[ -s $tmp/11.out ]] && err_exit "standard output leaked past redirection"
443 [[ -s $tmp/12.out ]] && err_exit "standard error leaked past redirection"
446 [[ $exp == "$got" ]] || err_exit "standard output garbled -- expected $(printf %q "$exp"), got $(printf %q "$got")"
449 [[ $exp == "$got" ]] || err_exit "standard error garbled -- expected $(printf %q "$exp"), got $(printf %q "$got")"