/illumos-gate/usr/src/lib/libshell/common/tests/ |
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 | 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 | 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 | 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 | restricted.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 49 cd $tmp || err_exit "cd $tmp failed" 52 rksh -c '[[ -o restricted ]]' || err_exit 'restricted option not set' 53 [[ $(rksh -c 'print hello') == hello ]] || err_exit 'unable to run print' 54 check_restricted /bin/echo || err_exit '/bin/echo not resticted' 55 check_restricted ./echo || err_exit './echo not resticted' 56 check_restricted 'SHELL=ksh' || err_exit 'SHEL [all...] |
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}'"
|
H A D | return.sh | 22 function err_exit function 28 alias err_exit='err_exit $LINENO' 33 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 66 [[ $foo = EXIT ]] || err_exit "foo "$@" : exit trap not set" 69 err_exit "foo $@: doesn't remove $file" 74 (exit 0) || err_exit "exit 0 is not zero" 75 (return 0) || err_exit "return 0 is not zero" 76 (exit) || err_exit "default exit value is not zero" 77 (return) || err_exit "defaul [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_6862121_shbinexec_kernel_module_defunct.sh | 66 function err_exit function 72 alias err_exit='err_exit $LINENO' 84 tmpdir="$(mktemp -t -d "test_sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.XXXXXXXX")" || err_exit "Cannot create temporary directory" 86 cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors)) ; } 98 /usr/bin/shcomp "script1.sh" "script1" || err_exit "shcomp failed with error=$?" 100 [[ -x "./script1" ]] || err_exit "Script script1 not executable" 101 out="$(/usr/bin/bash -c './script1 a b "c d"' 2>&1 )" || err_exit "Compiled script failed to execute, error=$?" 102 [[ "${out}" == $'hello\nargs=a\nargs=b\nargs=c d' ]] || err_exit "Expected xxx, got $(printf "%q\n" "$out")" 107 rmdir "${tmpdir}" || err_exit "Canno [all...] |
H A D | arith.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 38 then err_exit 2+2!=4 41 then err_exit x+y!=z 44 then err_exit $x+$y!=$z 47 then err_exit "(x|y)!=z" 50 then err_exit "y>=z" 53 then err_exit " [all...] |
H A D | timetype.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 50 [[ $t == "$d" ]] || err_exit 'printf %T and Time_t are different' 51 (( t == s )) || err_exit 'numerical Time_t not correct' 53 [[ $t == $s ]] || err_exit 'setting _ to %# not getting correct results' 57 [[ ${!tt[@]} == '0 1 2 3' ]] || err_exit 'indexed array subscript names not correct' 58 [[ ${tt[0]} == *+00:00 ]] || err_exit 'tt[0] is not yesterday' 59 [[ ${tt[1]} == *+00:00 ]] || err_exit 'tt[1] is not today' 60 [[ ${tt[2]} == *+00:00 ]] || err_exit 't [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_6766246_pattern_matching_bug.sh | 73 function err_exit function 79 alias err_exit='err_exit $LINENO' 103 pat="foo-bar" ; [[ "$(do_match "${pat}")" == "nomatch" ]] || err_exit "${pat} matched." 104 pat="foo+bar" ; [[ "$(do_match "${pat}")" == "match" ]] || err_exit "${pat} not matched." 105 pat="foo/bar" ; [[ "$(do_match "${pat}")" == "nomatch" ]] || err_exit "${pat} matched." 106 pat="foo_bar" ; [[ "$(do_match "${pat}")" == "nomatch" ]] || err_exit "${pat} matched." 107 pat="foo@bar" ; [[ "$(do_match "${pat}")" == "match" ]] || err_exit "${pat} not matched." 108 pat="foobar-" ; [[ "$(do_match "${pat}")" == "nomatch" ]] || err_exit "${pat} matched." 109 pat="foobar+" ; [[ "$(do_match "${pat}")" == "match" ]] || err_exit " [all...] |
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_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 | 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 | 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 | 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 | 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 | 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 | substring.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 33 then err_exit "string1:0" 36 then err_exit "string1: -1" 39 then err_exit "string1:0" 42 then err_exit "string1:1" 45 then err_exit "string1:1:4" 48 then err_exit "string1: -5:4" 51 then err_exit "string [all...] |
H A D | sun_solaris_compound_misc.sh | 33 function err_exit function 39 alias err_exit='err_exit $LINENO' 76 tmpdir="$(mktemp -t -d "test_sun_solaris_compound_misc.XXXXXXXX")" || err_exit "Cannot create temporary directory" 78 cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors)) ; } 93 [[ "$cx" == "$cy" ]] || err_exit "'$cx' != '$cy'" 94 [[ "$cx" == "$cz" ]] || err_exit "'$cx' != '$cz'" 95 [[ "$cy" == "$cz" ]] || err_exit "'$cy' != '$cz'" 97 count_brackets "$cx" || err_exit "Brackets not balanced for '$cx'" 98 count_brackets "$cy" || err_exit "Bracket [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}'"
|