/illumos-gate/usr/src/lib/libshell/common/tests/ |
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 | signal.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 34 cd $tmp || err_exit "cd $tmp failed" 47 (( $? == 0)) || err_exit "SIGPIPE with wrong error code $?" 48 [[ $(<out2) == $'PIPED\nPIPED' ]] || err_exit 'SIGPIPE output on standard error is not correct' 55 else err_exit "pipe with --pipefail PIPE trap hangs" 65 done) == 01got_child23 ]] || err_exit 'SIGCHLD not working' 252 do [[ $out == ${expected[$ops]} ]] || err_exit "interrup [all...] |
H A D | subshell.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 59 [[ $z == "$val" ]] || err_exit 'compound variable with mixed arrays not working' 61 [[ ${z.bar[1]} == yesyes ]] || err_exit 'reassign of index array compound variable fails' 63 [[ ${z.bar[1]} == $'(\n\tx=12\n\ty=5\n)' ]] || err_exit 'reassign array simple to compound variable fails' 67 [[ ${z.foo[three]} == good ]] || err_exit 'associative array assignment in subshell not working' 69 [[ $z == "$val" ]] || err_exit 'compound variable changes after associative array assignment' 74 [[ ${z.foo[two]} == ok ]] || err_exit 'associativ [all...] |
H A D | sun_solaris_array_default_datatype.sh | 34 function err_exit function 40 alias err_exit='err_exit $LINENO' 171 err_exit "${cycle}: Should not happen." 180 (( mycpv.myindexedfloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 1.1" 182 (( mycpv.myindexedfloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 2.2" 184 (( mycpv.myindexedfloatarray[34] == 0.0 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 0.0" 188 (( mycpv.myindexedfloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 1.1" 190 (( mycpv.myindexedfloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] == ${mycpv.myindexedfloatarray[34]}, expected 2.2" 192 (( mycpv.myindexedfloatarray[34] == 0.0 )) || err_exit " [all...] |
H A D | sun_solaris_command_substitution.sh | 31 function err_exit function 37 alias err_exit='err_exit $LINENO' 60 tmpfile="$(mktemp -t "ksh93_tests_command_substitution.${PPID}.$$.XXXXXX")" || err_exit "Cannot create temporary file." 108 err_exit "${currtst.name}: child (pid=${childpid}) still busy, filesize=${testfilesize}." 111 wait || err_exit "${currtst.name}: Child returned non-zero exit code." # wait for child (and/or avoid zombies/slime) 114 cmp -s "${tmpfile}" "${tmpfile}.out" || err_exit "${currtst.name}: ${tmpfile} and ${tmpfile}.out differ, filesize=${testfilesize}." 164 testout=${ printf "%B\n" testbody | sed 's/<CS>/$(/g;s/<CE>/)/g' | ${SHELL} 2>&1 || err_exit "command returned exit code $?" } 165 [[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Expected 'command substitution calling myfunc successfully returned 0', got ${testout}" 168 testout=${ printf "%B\n" testbody | sed 's/<CS>/${ /g;s/<CE>/ ; }/g' | ${SHELL} 2>&1 || err_exit "comman [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_6805792_varmovetest1.sh | 82 function err_exit function 88 alias err_exit='err_exit $LINENO' 145 [[ "${tree1.subtree["a_node"].one}" == "hello" ]] || err_exit "Expected tree1.subtree[\"a_node\"].one == 'hello', got ${tree1.subtree["a_node"].one}" 146 [[ "${tree1.subtree["a_node"].two}" == "world" ]] || err_exit "Expected tree1.subtree[\"a_node\"].two == 'world', got ${tree1.subtree["a_node"].two}" 147 [[ "${tree1}" == "${tree2}" ]] || err_exit "tree1 and tree2 differ:"$'\n'"$(diff -u <( printf '%B\n' tree1 ) <( printf '%B\n' tree2 ) )"
|
H A D | sun_solaris_cr_6904575_cut_-d_with_multibyte_character_no_longer_works.sh | 61 function err_exit function 67 alias err_exit='err_exit $LINENO' 79 tmpdir="$(mktemp -t -d "test_sun_solaris_cr_6904575_cut_-d_with_multibyte_character_no_longer_works.XXXXXXXX")" || err_exit "Cannot create temporary directory" 81 cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors)) ; } 147 out="$(printf "${tc.input_format}" | ${SHELL} -c "${cut_cmd} \"\$@\"" dummy "${cut_args[@]}" 2>&1)" || err_exit "${testname}: Command returned exit code $?" 148 [[ "${out}" == ${output_format} ]] || err_exit "${testname}: Expected match for $(printf "%q\n" "${output_format}"), got $(printf "%q\n" "${out}")" 172 out=$( LC_ALL=ja_JP.eucJP ${SHELL} -o pipefail -o errexit -c '$1 -d $(cat delim) -f1 "mb.eucjp" | od -tx1' dummy "${cutcmd}" 2>&1 ) || err_exit "${testname}: Test failed with exit code $?" 173 [[ "${out}" == $'0000000 a4 a2 0a\n0000003' ]] || err_exit "${testname}: Expected \$'0000000 a4 a2 0a\n0000003', got $(printf "%q\n" "${out}")" 190 rmdir "${tmpdir}" || err_exit "Canno [all...] |
H A D | sun_solaris_cr_6904878_join_-t_no_longer_works_with_multibyte_char_separator.sh | 57 function err_exit function 63 alias err_exit='err_exit $LINENO' 75 tmpdir="$(mktemp -t -d "test_sun_solaris_cr_6904878_join_-t_no_longer_works_with_multibyte_char_separator.XXXXXXXX")" || err_exit "Cannot create temporary directory" 77 cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors)) ; } 141 out="$(${SHELL} -c "${join_cmd} \"\$@\"" dummy "${join_args[@]}" 2>&1)" || err_exit "${testname}: Command returned exit code $?" 142 [[ "${out}" == ${output_format} ]] || err_exit "${testname}: Expected match for $(printf "%q\n" "${output_format}"), got $(printf "%q\n" "${out}")" 169 out=$( LC_ALL=ja_JP.eucJP ${SHELL} -o pipefail -o errexit -c '$1 -j1 1 -j2 2 -o 1.1 -t $(cat delim) input1 input2' dummy "${joincmd}" 2>&1 ) || err_exit "${testname}: Test failed with exit code $?" 170 [[ "${out}" == 'f1' ]] || err_exit "${testname}: Expected 'f1', got $(printf "%q\n" "${out}")" 187 rmdir "${tmpdir}" || err_exit "Canno [all...] |
H A D | sun_solaris_cr_6907460_EXIT_trap_handlers_are_sometimes_executed_twice.sh | 94 function err_exit function 100 alias err_exit='err_exit $LINENO' 112 tmpdir="$(mktemp -t -d "test_sun_solaris_cr_6907460_EXIT_trap_handlers_are_sometimes_executed_twice.XXXXXXXX")" || err_exit "Cannot create temporary directory" 114 cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors)) ; } 168 ${SHELL} ${vari.shell_options} "testscript.sh" >/dev/null 2>&1 || err_exit "${testname}: Unexpected error code $?" 175 err_exit "${testname}: File 'log' not found." 177 [[ "${out}" == $'TRAP A\nTRAP B' ]] || err_exit "${testname}: Expected \$'TRAP A\nTRAP B', got $(printf "%q\n" "${out}")" 206 ) | ${SHELL} >/dev/null 2>&1 || err_exit "Unexpected error code $?" 212 err_exit "Fil [all...] |
H A D | sun_solaris_getconf.sh | 32 function err_exit function 38 alias err_exit='err_exit $LINENO' 51 [[ ! -f "/bin/getconf" ]] && err_exit '/bin/getconf not found.' 52 [[ ! -x "/bin/getconf" ]] && err_exit '/bin/getconf not executable.' 59 function err_exit function 65 alias err_exit='err_exit \$LINENO' 121 err_exit '/bin/getconf not found in the list of builtins.' 127 err_exit 'getcon [all...] |
H A D | sun_solaris_local_compound_nameref001.sh | 32 function err_exit function 38 alias err_exit='err_exit $LINENO' 64 [[ "$x" != 'x=19, y=20' ]] && err_exit "expected 'x=19, y=20', got '${x}'"
|
H A D | sun_solaris_locale_misc.sh | 32 function err_exit function 38 alias err_exit='err_exit $LINENO' 49 tmpdir="$(mktemp -t -d "test_sun_solaris_locale_misc.XXXXXXXX")" || err_exit "Cannot create temporary directory" 51 cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors)) ; } 91 ${SHELL} -c 'LC_MESSAGES=C ${SHELL} -c "cd no_dir_llkk ; export LC_ALL="ko_KR.UTF-8" ; cd "no_dir_ooo" ; true"' >"out" 2>&1 || err_exit "Test shell failed with non-zero exit code $?" 100 (( korean_count >= 10 )) || err_exit "Expected at least 10 korean characters, got ${korean_count}" 159 ${SHELL} -c "unset LANG \${!LC_*} ; ${SHELL} -c \"${ts}\"" >out 2>&1 || err_exit "test returned non-zero exit code $?" 167 err_exit "test '${tg.name}'/'$ts' failed: Expected '_A_', got '${out2}'" 185 rmdir "${tmpdir}" || err_exit "Canno [all...] |
H A D | sun_solaris_vartree001.sh | 53 function err_exit function 59 alias err_exit='err_exit $LINENO' 186 # (( $(print -r -- "$mytree" | wc -l) > 10 )) || err_exit "Compound tree too small."
|
H A D | sun_solaris_vartree003.sh | 34 function err_exit function 40 alias err_exit='err_exit $LINENO'
|
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 | treemove.sh | 37 function err_exit function 44 alias err_exit='err_exit $LINENO' 80 [[ "${tree1.subtree["a_node"].one}" == "hello" ]] || err_exit "expected tree1.subtree[\"a_node\"].one == 'hello', got ${tree1.subtree["a_node"].one}" 81 [[ "${tree1.subtree["a_node"].two}" == "world" ]] || err_exit "expected tree1.subtree[\"a_node\"].two == 'world', got ${tree1.subtree["a_node"].two}" 82 [[ "${tree1}" == "${tree2}" ]] || err_exit "tree1 and tree2 differ:$'\n'"
|
H A D | vartree1.sh | 27 function err_exit function 34 alias err_exit='err_exit $LINENO' 183 err_exit 'build_tree mytree_global mysrcdata_global leaf_compound returned an error' 185 (( $(print -r -- "${mytree_global}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_global' too small" 190 err_exit 'build_tree mytree_local mysrcdata_local leaf_compound returned an error' 192 (( $(print -r -- "${mytree_local}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_local' too small" 196 err_exit "compound trees 'mytree_local' and 'mytree_global' not identical" 200 err_exit "variable 'mytree_global.l1[urw].l2[itc zapfdingbats].l3[medium].entries[abcd].filenames[0]' not found" 202 [[ "${mytree_global}" != "${mytree_local}" ]] || err_exit "mytree_globa [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 | sun_solaris_compound_nameref.sh | 29 function err_exit function 35 alias err_exit='err_exit $LINENO' 48 function err_exit function 54 alias err_exit='err_exit \$LINENO' 75 [[ "\$x" == 'x=19, y=20' ]] || err_exit "expected 'x=19, y=20', got '\${x}'" 105 ) | out=$( ${SHELL} ) || err_exit "shell returned exit code $?" 107 (( ${ wc -l <<<"${out}" ; } == 4 )) || err_exit "Expected four lines of output, got ${out}" 108 (set -o errexit ; read -C tmp <<<"${out}" ; [[ "$(typeset +p tmp.nodes)" == *-A* ]]) || err_exit "missin [all...] |
H A D | sun_solaris_cr_6887363_shell_sometimes_mishandles_return_value_of_its_child_process.sh | 53 function err_exit function 59 alias err_exit='err_exit $LINENO' 71 tmpdir="$(mktemp -t -d "test_sun_solaris_cr_6887363_shell_sometimes_mishandles_return_value_of_its_child_process.XXXXXXXX")" || err_exit "Cannot create temporary directory" 73 cd "${tmpdir}" || { err_exit "cd ${tmpdir} failed." ; exit $((Errors)) ; } 171 out="$(unset VMALLOC_OPTIONS VMDEBUG ; cat_test | ${SHELL} 2>&1)" || err_exit "Unexpected exit code $?" 172 [[ "${out}" != "" ]] || err_exit "No output from test" 176 [[ "${out2}" == "" ]] || err_exit "Unexpected output '${out2}'" 180 rmdir "${tmpdir}" || err_exit "Cannot remove temporary directory ${tmpdir}".
|
H A D | sun_solaris_vartree002.sh | 34 function err_exit function 40 alias err_exit='err_exit $LINENO' 266 err_exit 'build_tree1 mytree_global1 mysrcdata_global leaf_compound returned an error' 267 (( $(print -r -- "${mytree_global1}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_global1' too small." 270 err_exit 'build_tree2 mytree_global2 mysrcdata_global leaf_compound returned an error' 271 (( $(print -r -- "${mytree_global2}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_global2' too small." 279 err_exit 'build_tree1 mytree_local1 mysrcdata_local leaf_compound returned an error' 280 (( $(print -r -- "${mytree_local1}" | wc -l) > 10 )) || err_exit "Compound tree 'mytree_local1' too small." 283 err_exit 'build_tree [all...] |
H A D | vartree2.sh | 27 function err_exit function 34 alias err_exit='err_exit $LINENO' 256 err_exit 'build_tree1 mytree_global1 mysrcdata_global leaf_compound returned an error' 257 (( $(print -r -- "${mytree_global1}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_global1' too small" 260 err_exit 'build_tree2 mytree_global2 mysrcdata_global leaf_compound returned an error' 261 (( $(print -r -- "${mytree_global2}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_global2' too small" 269 err_exit 'build_tree1 mytree_local1 mysrcdata_local leaf_compound returned an error' 270 (( $(print -r -- "${mytree_local1}" | wc -l) > 10 )) || err_exit "compound tree 'mytree_local1' too small" 273 err_exit 'build_tree [all...] |
H A D | basic.sh | 20 function err_exit function 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 'fil [all...] |
H A D | builtins.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 : ${foo=bar} || err_exit ": failed" 37 [[ $foo = bar ]] || err_exit ": side effects failed" 39 [[ $# = 2 && $1 = - && $2 = foobar ]] || err_exit "set -- - foobar failed" 41 [[ $# = 2 && $1 = -x && $2 = foobar ]] || err_exit "set -- -x foobar failed" 42 getopts :x: foo || err_exit "getopts :x: returns false" 43 [[ $foo = x && $OPTARG = foobar ]] || err_exit "getopt [all...] |