/illumos-gate/usr/src/lib/libshell/common/tests/ |
H A D | alias.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 36 then err_exit 'foo, where foo is alias for "print hello" failed' 39 then err_exit 'foo world, where foo is alias for "print hello" failed' 44 then err_exit 'foo bar, where foo is alias for "print hello " failed' 47 then err_exit 'foo \bar, where foo is alias for "print hello " failed' 51 then err_exit 'bar, where bar is alias for "foo world" failed' 54 then err_exit 'alia [all...] |
H A D | append.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 34 then err_exit 'abc+def != abcdef' 39 then err_exit '3+4!=7' 44 then err_exit 'index array append fails' 50 then err_exit 'index array append to scalar fails' 56 then err_exit 'associative array append fails' 59 then err_exit 'number of elements of associative array append fails' 64 then err_exit 'compoun [all...] |
H A D | bracket.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 36 then err_exit "-z: null string should be of zero length" 41 then err_exit "-z: $file string should not be of zero length" 44 then err_exit "-a: $file shouldn't exist" 48 then err_exit "-a: $file should exist" 52 then err_exit "-r: $file should be readable" 55 then err_exit " [all...] |
H A D | case.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 46 then err_exit "$i not matching correct pattern" 52 *) err_exit "$f does not match \[*\]";; 62 then err_exit 'case abc {...} not working' 67 esac') != b ]] && err_exit 'bug in ;& at end of script' 80 ') == foo.h ]] || err_exit "optimizer bug"
|
H A D | enum.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 35 [[ $x == red ]] || err_exit 'Color_t does not default to red' 37 [[ $x == orange ]] || err_exit '$x should be orange' 38 ( x=violet) 2> /dev/null && err_exit 'x=violet should fail' 40 [[ ${x[2]} == green ]] || err_exit '${x[2]} should be green' 41 (( x[2] == 1 )) || err_exit '((x[2]!=1))' 42 [[ $((x[2])) == 1 ]] || err_exit '$((x[2]))!=1' 43 [[ $x == orange ]] || err_exit ' [all...] |
H A D | expand.sh | 20 function err_exit function 106 [[ $got == $expected ]] || err_exit "'$pattern' failed -- expected '$expected' got '$got'" 112 [[ $# == 1 && $1 == /dev/null ]] || err_exit "~(N)/dev/null not matching /dev/null" 114 [[ $# == 0 ]] || err_exit "~(N)/dev/nonexistant not empty" 116 [[ $# == 1 && ! $1 ]] || err_exit '""~(N)/dev/nonexistant not null argument' 118 [[ $# == 1 && ! $1 ]] || err_exit '~(N)/dev/nonexistent"" not null argument' 120 do err_exit "~(N)/dev/non_existent_file in for loop is $i" 123 do [[ ! $i ]] || err_exit '""~(N)/dev/non_existent_file not null'
|
H A D | quoting.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 then err_exit "single quotes not the same as double quotes" 35 then err_exit "$x not the same as 'hi there'" 38 then err_exit "$x not the same as \"hi there \"" 41 then err_exit " \\ differs from '' " 44 then err_exit " \"\" differs from '' " 47 then err_exit "\$(print -r - '') differs from ''" 50 then err_exit "\ [all...] |
H A D | quoting2.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 32 then err_exit "single quotes not the same as double quotes" 36 then err_exit "$x not the same as 'hi there'" 39 then err_exit "$x not the same as \"hi there \"" 42 then err_exit " \\ differs from '' " 45 then err_exit " \"\" differs from '' " 48 then err_exit "\$(print -r - '') differs from ''" 51 then err_exit "\ [all...] |
H A D | select.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 45 *) err_exit "select 1 not working" 55 foo) err_exit "select foo not working" 2>&3 58 then err_exit "select REPLY not correct" 2>&3 60 ( set -u; : $i ) || err_exit "select: i not set to null" 2>&3
|
H A D | sigchld.sh | 20 function err_exit function 27 alias err_exit='err_exit $LINENO' 58 ') || err_exit "test loop failed" 62 (( foreground == FOREGROUND )) || err_exit "expected '$FOREGROUND foreground' -- got '$foreground' (DELAY=$DELAY)" 63 (( background == BACKGROUND )) || err_exit "expected '$BACKGROUND background' -- got '$background' (DELAY=$DELAY)" 85 [[ $got == $exp ]] || err_exit "SIGCHLD trap queueing failed -- expected '$exp', got '$got'" 109 [[ $got == $exp ]] || err_exit "SIGCHLD trap queueing failed -- expected $(printf %q "$exp"), got $(printf %q "$got")" 117 [[ $got == good ]] || err_exit 'SIGCLD handler effects read behavior' 130 then err_exit "CHL [all...] |
H A D | sun_solaris_builtin_poll.sh | 32 function err_exit function 38 alias err_exit='err_exit $LINENO' 45 builtin -f libshell.so.1 poll || err_exit "poll builtin not found." 55 cat /dev/zero | { redirect 5<&0 ; poll -e d1.res -t 5. d1.u ; } || err_exit "poll returned non-zero exit code $?" 56 [[ "${d1.u[x].revents}" == "POLLIN" ]] || err_exit "d1.u[x].revents contains '${d1.u[x].revents}', not POLLIN" 57 [[ "${d1.u[y].revents}" == "POLLIN" ]] || err_exit "d1.u[y].revents contains '${d1.u[y].revents}', not POLLIN" 58 [[ "${d1.res[*]}" == "x y" ]] || err_exit "d1.res contains '${d1.res[*]}', not 'x y'" 64 { poll -e d1.res -t 5. d1.u ; } 5</dev/null 5>/dev/null || err_exit "poll returned non-zero exit code $?" 65 [[ "${d1.u[x].revents}" == "POLLIN" ]] || err_exit "d [all...] |
H A D | sun_solaris_builtin_sum.sh | 32 function err_exit function 38 alias err_exit='err_exit $LINENO' 47 builtin sum || err_exit "sum builtin not found" 50 x="$(print 'hello' | /usr/bin/sum)" || err_exit "/usr/bin/sum pipe failed." 51 [[ "$x" == "542 1" ]] || err_exit "print 'hello' | /usr/bin/sum did not return 542 1, got $x" 52 x="$(print 'hello' | sum)" || err_exit "sum builtin pipe failed." 53 [[ "$x" == "542 1" ]] || err_exit "print 'hello' | sum builtin did not return 542 1, got $x" 54 x="$(print 'hello' | sum -x md5)" || err_exit "sum md5 builtin pipe failed." 55 [[ "$x" == "b1946ac92492d2347c6235b4d2611184" ]] || err_exit "prin [all...] |
H A D | sun_solaris_cr_6713682_compound_var_bleeds_through_subshell.sh | 54 function err_exit function 60 alias err_exit='err_exit $LINENO' 70 var1="$(${SHELL} -c 'unset l ; ( l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." 71 var2="$(${SHELL} -c 'unset l ; ( ulimit -c 0 ; l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." 72 [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (with unset)." 75 var1="$(${SHELL} -c '( l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." 76 var2="$(${SHELL} -c '( ulimit -c 0 ; l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non-zero exit code." 77 [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed subshell output (without unset)." 80 var1="$(${SHELL} -c 'unset l ; ( compound l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "No [all...] |
H A D | sun_solaris_cr_6722134_background_CHLD_trap.sh | 43 function err_exit function 49 alias err_exit='err_exit $LINENO' 78 ' 2>&1 )" || err_exit "test loop failed." 80 [[ "$s" == ~(Er)$'14\nloop finished\ndone' ]] || err_exit "Expected '14\nloop finished\ndone' at the end of the output, got ${s}." 81 [[ "$s" == ~(El)$'0\n1\n2' ]] || err_exit "Expected '0\n1\n2' as at the beginning of the output, got ${s}." 84 (( count=$(fgrep "got_child" <<< "$s" | wc -l) )) || err_exit "counting failed." 85 (( count == 2 )) || err_exit "Expected count==2, got count==${count}." 112 ' 2>&1 )" || err_exit "test loop failed." 114 [[ "$s" == ~(Er)$'14\nloop finished\ndone' ]] || err_exit "Expecte [all...] |
H A D | sun_solaris_cr_6753538_subshell_leaks_umask.sh | 43 function err_exit function 49 alias err_exit='err_exit $LINENO' 60 [[ "$x" == "0022" ]] || err_exit "expected umask 0022, got $x" 63 [[ "$x" == "0020" ]] || err_exit "expected umask 0020, got $x" 66 [[ "$x" == "0000" ]] || err_exit "expected umask 0000, got $x" 73 [[ "$x" == "0022" ]] || err_exit "expected umask 0022, got $x" 76 [[ "$x" == "0020" ]] || err_exit "expected umas k 0020, got $x" 79 [[ "$x" == "0000" ]] || err_exit "expected umask 0000, got $x" 86 x=$(${SHELL} -c 'umask 22; ( umask 0); umask') || err_exit "shel [all...] |
H A D | sun_solaris_cr_6754020_weird_square_bracket_expansion.sh | 48 function err_exit function 54 alias err_exit='err_exit $LINENO' 65 [[ "$s" == 'F[[O]' ]] || err_exit "Expected 'F[[O]', got $s" 68 [[ "$s" == 'F[[[O]]' ]] || err_exit "Expected 'F[[[O]]', got $s" 73 [[ "$s" == 'F[[O]' ]] || err_exit "Expected 'F[[O]', got $s" 76 [[ "$s" == 'F[[[O]]' ]] || err_exit "Expected 'F[[[O]]', got $s"
|
H A D | sun_solaris_cr_6763594_command_failure_execs_twice.sh | 66 function err_exit function 72 alias err_exit='err_exit $LINENO' 80 mkdir "${testtmpdir}" || { err_exit "Could not create temporary directory ${testtmpdir}." ; exit ${Errors} ; } 82 cd "${testtmpdir}" || { err_exit "Cannot cd to temporary directory ${testtmpdir}." ; exit ${Errors} ; } 87 (( $? == 0 )) || err_exit "Return code $?, expected 0" 89 s=$( < out_stdout ) ; [[ "$s" == '126' ]] || err_exit "Expected '126', got $(printf "%q\n" "$s")." 90 s=$( < out_stderr ) ; [[ "$s" == ~(Elr)(.*:\ \./myfoo:\ \./myfoo:\ .*\[.*\]) ]] || err_exit "Output $(printf "%q\n" "$s") does not match pattern '~(Elr)(.*:\ \./myfoo:\ \./myfoo:\ .*\[.*\])'." 92 rm "myfoo" "out_stdout" "out_stderr" || err_exit "rm failed." 94 rmdir "${testtmpdir}" || err_exit "Faile [all...] |
H A D | sun_solaris_cr_6777491_lacks_arithmetric_function_iszero.sh | 60 function err_exit function 66 alias err_exit='err_exit $LINENO' 89 str="$( $SHELL -o errexit -c "${tests[i]}" 2>&1 )" || err_exit "test $i: returned non-zero exit code $?" 90 [[ "${str}" == "OK" ]] || err_exit "test $i: expected 'OK', got '${str}'"
|
H A D | sun_solaris_cr_6778077_sigthaw_trap.sh | 48 function err_exit function 54 alias err_exit='err_exit $LINENO' 62 ${SHELL} -o errexit -c 'trap "true" SIGTHAW ; true' || err_exit "SIGTHAW not supported." 63 ${SHELL} -o errexit -c 'trap "true" THAW ; true' || err_exit "THAW not supported." 64 ${SHELL} -o errexit -c 'trap "true" 35 ; true' || err_exit "signal 35 not supported." 69 ${SHELL} -o errexit -c 'trap "true" SIGFREEZE ; true' || err_exit "SIGFREEZE not supported." 70 ${SHELL} -o errexit -c 'trap "true" FREEZE ; true' || err_exit "FREEZE not supported." 71 ${SHELL} -o errexit -c 'trap "true" 34 ; true' || err_exit "signal 34 not supported." 76 str="$( ${SHELL} -c "trap true $i ; print 'ok'" 2>&1 )" || err_exit "shel [all...] |
H A D | sun_solaris_cr_6789247_printf_hexfloat_rounding.sh | 87 function err_exit function 93 alias err_exit='err_exit $LINENO' 106 result=$(printf "%.0a\n" r) || err_exit "printf returned non-zero exit code" 107 (( result == 2.0 )) || err_exit "result expected to be 2.0, got ${result}" 112 result=$(printf "%.0A\n" r) || err_exit "printf returned non-zero exit code" 113 (( result == 2.0 )) || err_exit "result expected to be 2.0, got ${result}" 118 str=$(printf "%.0a\n" r) || err_exit "printf returned non-zero exit code" 119 [[ "${str}" == ~(Glri)0x0*1p\+0*1 ]] || err_exit "str expected to match ~(Glri)0x0*1p\+0*1, got |${str}|" 124 str=$(printf "%.0A\n" r) || err_exit "print [all...] |
H A D | sun_solaris_cr_6805794_character_to_wchar_not_working.sh | 76 function err_exit function 82 alias err_exit='err_exit $LINENO' 95 err_exit "Local overrride failed." 101 [[ "${str}" == "8364" ]] || err_exit "expected 8364, got ${str}"
|
H A D | sun_solaris_cr_6805795_negative_zero.sh | 62 function err_exit function 68 alias err_exit='err_exit $LINENO' 81 ) || err_exit "test failed." 82 [[ "${str}" == "-0" ]] || err_exit "Expected copysign(0, -5) == -0, got ${str}" 99 ) || err_exit "test failed." 100 [[ "${str}" == "-0" ]] || err_exit "Expected c == -0, got ${str}" 112 ) || err_exit "test failed." 113 [[ "${str}" == "1" ]] || err_exit "Expected signbit(a, b) == 1, got ${str}" 128 ) || err_exit "tes [all...] |
H A D | sun_solaris_cr_6807179_shellpattern_uses_getpwnam.sh | 49 function err_exit function 55 alias err_exit='err_exit $LINENO' 63 tmpfile="$(mktemp -t "sun_solaris_cr_6807179_shellpattern_uses_getpwnam.${PPID}.$$.XXXXXX")" || err_exit "Cannot create temporary file." 68 truss -u :: -o "${tmpfile}" ${SHELL} -c '[[ ${hello} == ~(Elr)wo.*ld ]] ; true' || err_exit "truss returned failure=$?" 69 [[ "$( < "${tmpfile}")" != *getpwnam* ]] || err_exit "truss log reports the use of getpwnam() for pattern ~(Elr)wo.*ld" 70 rm "${tmpfile}" || err_exit "rm ${tmpfile} failed." 74 truss -u :: -o "${tmpfile}" ${SHELL} -c '[[ ${hello} == ~(Si)wo*ld ]] ; true' || err_exit "truss returned failure=$?" 75 [[ "$( < "${tmpfile}")" != *getpwnam* ]] || err_exit "truss log reports the use of getpwnam() for pattern ~(Si)wo*ld" 76 rm "${tmpfile}" || err_exit "r [all...] |
H A D | sun_solaris_cr_6835835_builtin_cat_n_broken.sh | 79 function err_exit function 85 alias err_exit='err_exit $LINENO' 118 out="$( ${SHELL} -o errexit -c "${tc.cmd}" )" || err_exit "${tc.name}: Shell failed" 119 [[ "${expected_output}" == "${out}" ]] || err_exit "${tc.name}: Builtin output does not match expected output" 121 out="$( ${SHELL} +o errexit -c "${tc.cmd}" )" || err_exit "${tc.name}: Shell failed" 122 [[ "${expected_output}" == "${out}" ]] || err_exit "${tc.name}: Builtin output does not match expected output" 134 || err_exit 'yes "" | head -5 | cat -n does not match expected output.'
|
H A D | sun_solaris_cr_6848486_echo_test_with_test_undefined_executes_test_builtin.sh | 59 function err_exit function 65 alias err_exit='err_exit $LINENO' 76 (( $? == 78 )) || err_exit "expected return code is 78, got $?" 81 out=$($SHELL -o errexit -c 'unset test ; print ${test} ; print "#mark"' 2>&1 ) || err_exit "Shell returned error code $?, expected 0." 82 [[ "$out" == $'\n#mark' ]] || err_exit "Expected output \$'\n#mark', got '${out}'" 88 out=$($SHELL -o errexit -c 'print ${sleep} ; print "#mark"' 2>&1 ) || err_exit "Shell returned error code $?, expected 0." 89 [[ "$out" == $'\n#mark' ]] || err_exit "Expected output \$'\n#mark', got '${out}'"
|