/titanic_44/usr/src/lib/libshell/common/tests/ |
H A D | bracket.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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 "-w: $file should be writable" 58 then err_exit "-x: $file should be executable" [all …]
|
H A D | substring.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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 "string1:1:j" 54 then err_exit "string1:(j?1:0):j" [all …]
|
H A D | arrays.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 45 then err_exit '$x is not element 0' 48 then err_exit '${x[0] is not element 0' 51 then err_exit "length of ${x[0]} is not 4" 54 then err_exit 'number of elements of x is not 6' 57 then err_exit ' element two is not 2' 60 then err_exit ' ${x[@]:2:1} is not two' 64 then err_exit '$x is not element 0' [all …]
|
H A D | options.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 36 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 43 then err_exit "${SHELL-ksh} -s not working" 51 then err_exit 'sh -e not working' 53 [[ $($SHELL -D -c 'print hi; print $"hello"') == '"hello"' ]] || err_exit 'ksh -D not working' 67 err_exit "\$ENV file &>/dev/null does not redirect stdout -- expected '', got $got" 73 …err_exit "\$ENV file &>/dev/null does not redirect stderr -- expected one diagnostic line, got $go… 81 err_exit 'privileged nointeractive shell reads $ENV file' 83 err_exit 'privileged -E reads $ENV file' [all …]
|
H A D | builtins.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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" 42 getopts :x: foo || err_exit "getopts :x: returns false" 43 [[ $foo = x && $OPTARG = foobar ]] || err_exit "getopts :x: failed" 47 then err_exit "'getopts :r:s var -r' not working" 52 then err_exit "'getopts :d#u OPT=d OPTARG=16177' failed -- OPT=$OPT OPTARG=$OPTARG" 56 do [[ $OPTIND == $((OPTIND)) ]] || err_exit "OPTIND optimization bug" [all …]
|
H A D | sun_solaris_builtin_sum.sh | 32 function err_exit function 38 alias err_exit='err_exit $LINENO' alias 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 "print 'hello' | sum md5 builtin did n… 56 x="$(print 'hello' | sum -x sha1)" || err_exit "sum sha1 builtin pipe failed." [all …]
|
H A D | attributes.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 39 (r=newval) 2> /dev/null && err_exit readonly attribute fails 42 then err_exit integer attributes fails 45 then err_exit integer base 8 fails 48 then err_exit uppercase fails 51 then err_exit lowercase fails 54 then err_exit reference variables fail 57 then err_exit tagged fails [all …]
|
H A D | basic.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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' [all …]
|
H A D | variables.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 34 [[ ${.sh.version} == "$KSH_VERSION" ]] || err_exit '.sh.version != KSH_VERSION' 36 [[ ${@ss} ]] && err_exit '${@ss} should be empty string when ss is unset' 37 [[ ${!ss} == ss ]] || err_exit '${!ss} should be ss when ss is unset' 41 then err_exit RANDOM variable not working 46 then err_exit SECONDS variable not working 51 then err_exit _ variable not working 63 then err_exit PWD variable failed, not equivalent to . [all …]
|
H A D | sun_solaris_compound_misc.sh | 33 function err_exit function 39 alias err_exit='err_exit $LINENO' alias 76 tmpdir="$(mktemp -t -d "test_sun_solaris_compound_misc.XXXXXXXX")" || err_exit "Cannot create tempo… 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 "Brackets not balanced for '$cy'" 99 count_brackets "$cz" || err_exit "Brackets not balanced for '$cz'" [all …]
|
H A D | sun_solaris_compoundvario.sh | 27 function err_exit function 33 alias err_exit='err_exit $LINENO' alias 158 } || err_exit "test returned exit code $?" 160 [[ "${s}" == "xhellox" ]] || err_exit "Expected 'xhellox', got ${s}" 161 count_brackets "$y" || err_exit "y: bracket open ${bracketstat.bopen} != bracket close ${bracketsta… 162 count_brackets "$(print -v y)" || err_exit "y: bracket open ${bracketstat.bopen} != bracket close $… 163 count_brackets "$(print -C y)" || err_exit "y: bracket open ${bracketstat.bopen} != bracket close $… 166 unset x y || err_exit "unset failed" 167 [[ "$x" == "" ]] || err_exit "cleanup failed for x" 168 [[ "$y" == "" ]] || err_exit "cleanup failed for y" [all …]
|
H A D | functions.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 33 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 56 then err_exit "command print not working inside print function" 61 then err_exit 'global variables not correct' 65 then err_exit '$0 not correct' 69 then err_exit 'environment override not correct' 72 then err_exit 'scoping error' 76 then err_exit non-local variables 81 then err_exit EXIT trap in wrong scope [all …]
|
H A D | io.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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 se… [all …]
|
H A D | cubetype.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 58 [[ "$got" == "$exp" ]] || err_exit "\${b.x} incorrect for iteration $i -- expected $exp, got '$got'" 60 (( got == exp )) || err_exit "b.len incorrect for iteration $i -- expected $exp, got '$got = sqrt($… 62 [[ "$got" == "$exp" ]] || err_exit "\${b.len} incorrect for iteration $i -- expected $exp, got '$go… 64 [[ "$got" == "${exp}" ]] || err_exit "\${b.name} incorrect for iteration $i -- expected $exp, got '… 66 (( got == exp )) || err_exit "b.count incorrect for iteration $i -- expected $exp, got '$got'" 68 [[ "$got" == "$exp" ]] || err_exit "\${b.ccount} incorrect for iteration $i -- expected $exp, got '… 72 [[ "$got" == "$exp" ]] || err_exit "\${#b.colors[@]} incorrect for iteration $i -- expected $exp, g… 94 [[ $b == "$bb" ]] || err_exit "\$b='$b' != \$bb='$bb'" [all …]
|
H A D | pointtype.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 43 [[ ${p.x} == 1 ]] || err_exit '${p[x]} is not 1' 45 [[ $(p.len) == 1 ]] || err_exit '$(p.len) != 1' 46 [[ ${p.len} == 1 ]] || err_exit '${p.len} != 1' 47 (( p.len == 1 )) || err_exit '((p.len != 1))' 49 (( q.x == 1 )) || err_exit 'q.x is not 1' 50 (( (q.len - sqrt(5)) < 10e-10 )) || err_exit 'q.len != sqrt(5)' 55 (( q.len == 3 )) || err_exit 'q.len is not 3' 57 [[ ${p.y} == 2 ]] || err_exit '${p[y]} is not 2' [all …]
|
H A D | return.sh | 22 function err_exit function 28 alias err_exit='err_exit $LINENO' alias 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 "default return value is not zero" 81 then err_exit "exit 35 is $ret not 35" [all …]
|
H A D | path.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 36 [[ -s out1 ]] && err_exit 'type should not write on stdout for not found case' 37 [[ -s out2 ]] || err_exit 'type should write on stderr for not found case' 51 [[ $( foobar) == foobar1 ]] || err_exit 'foobar should output foobar1' 54 [[ $(foobar) == foobar2 ]] || err_exit 'foobar should output foobar2' 57 [[ $(foobar) == foobar1 ]] || err_exit 'foobar should output foobar1 again' 60 [[ ${ foobar;} == foobar2 ]] || err_exit 'foobar should output foobar2 with ${}' 61 [[ ${ dir2;} == dir2 ]] || err_exit 'should be dir2' [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' alias 70 …et l ; ( l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non-zero exit co… 71 …et l ; ( ulimit -c 0 ; l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non-zero exit co… 72 [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed sub… 75 var1="$(${SHELL} -c '( l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non… 76 var2="$(${SHELL} -c '( ulimit -c 0 ; l=( a=1 b="BE" ) ; print "$l" ) ; print $l')" || err_exit "Non… 77 [[ "${var1}" == "${var2}" ]] || err_exit "Non-fork()'ed subshell output differes from fork()'ed sub… 80 … compound l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit co… 81 …it -c 0 ; compound l ; l.a=1 ; l.b="BE" ; print "$l" ) ; print $l')" || err_exit "Non-zero exit co… [all …]
|
H A D | comvar.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 36 then err_exit 'compound variable not working' 40 then err_exit 'reference to compound object not working' 53 then err_exit 'copying a compound object not working' 56 then err_exit 'copying integer field of compound object not working' 66 then err_exit 'compound assignemnt of associative arrays not working' 73 then err_exit 'name references not expanded on prefix matching' 80 [[ ${x.foo.bar} == 7 ]] || err_exit '[[ ${x.foo.bar} != 7 ]]' 81 (( x.foo.bar == 7 ))|| err_exit '(( x.foo.bar != 7 ))' [all …]
|
H A D | sun_solaris_array_default_datatype.sh | 34 function err_exit function 40 alias err_exit='err_exit $LINENO' alias 171 err_exit "${cycle}: Should not happen." 180 …(( mycpv.myindexedfloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] ==… 182 …(( mycpv.myindexedfloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] ==… 184 …(( mycpv.myindexedfloatarray[34] == 0.0 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] ==… 188 …(( mycpv.myindexedfloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] ==… 190 …(( mycpv.myindexedfloatarray[34] == 2.2 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] ==… 192 …(( mycpv.myindexedfloatarray[34] == 0.0 )) || err_exit "${cycle}: mycpv.myindexedfloatarray[34] ==… 199 …(( mycpv.myassociativefloatarray[34] == 1.1 )) || err_exit "${cycle}: mycpv.myassociativefloatarra… [all …]
|
H A D | restricted.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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 'SHELL asignment not resticted' 57 check_restricted 'PATH=/bin' || err_exit 'PATH asignment not resticted' [all …]
|
H A D | alias.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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 'alias bar, where bar is alias for "foo world" failed' 56 unalias foo || err_exit "unalias foo failed" [all …]
|
H A D | heredoc.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; } 40 then err_exit "'hello world' here doc not working" 45 cmp $f $g 2> /dev/null || err_exit "'hello world' quoted here doc not working" 49 cmp $f $g 2> /dev/null || err_exit "'hello world' tabbed here doc not working" 53 cmp $f $g 2> /dev/null || err_exit "'hello world' quoted tabbed here doc not working" 58 cmp $f $g 2> /dev/null || err_exit "'$x world' here doc not working" 62 cmp $f $g 2> /dev/null || err_exit "'$(print hello) world' here doc not working" 72 cmp $f $g 2> /dev/null || err_exit "unquoted here doc not working" [all …]
|
H A D | arith.sh | 20 function err_exit function 26 alias err_exit='err_exit $LINENO' alias 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 "y+3!=z+2" 56 then err_exit "y<<2!=1<<3" [all …]
|
H A D | sun_solaris_command_substitution.sh | 31 function err_exit function 37 alias err_exit='err_exit $LINENO' alias 60 tmpfile="$(mktemp -t "ksh93_tests_command_substitution.${PPID}.$$.XXXXXX")" || err_exit "Cannot cre… 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 av… 114 …cmp -s "${tmpfile}" "${tmpfile}.out" || err_exit "${currtst.name}: ${tmpfile} and ${tmpfile}.out d… 164 testout=${ printf "%B\n" testbody | sed 's/<CS>/$(/g;s/<CE>/)/g' | ${SHELL} 2>&1 || err_exit "comma… 165 [[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Ex… 168 testout=${ printf "%B\n" testbody | sed 's/<CS>/${ /g;s/<CE>/ ; }/g' | ${SHELL} 2>&1 || err_exit "c… 169 [[ "${testout}" == "command substitution calling myfunc successfully returned 0" ]] || err_exit "Ex… [all …]
|