test suite updates: highlight failed test scripts; optionally save failed test output; report number of successful tests; exit based on number of test failures; indent warning messages to make them stand out

This commit is contained in:
Chet Ramey
2025-10-16 11:44:26 -04:00
parent 6a48b39bba
commit 2a645237d3
132 changed files with 1364 additions and 813 deletions
+22
View File
@@ -11984,3 +11984,25 @@ execute_cmd.c
around calls to run_debug_trap the same way we do it for
run_return_trap
Report from Александр Ушаков <anushakov@edu.hse.ru>
10/14
-----
tests/run-all
- keep track of how many tests run and how many exit with status 0,
and report tests that exit with a non-zero status
Report and patch from Alexander Bantyev <alexander.bantyev@tweag.io>
- keep output of failed tests if the BASH_TSTOUT_SAVEDIR environment
variable is set to a valid directory
Report and patch from Alexander Bantyev <alexander.bantyev@tweag.io>
10/15
-----
tests/run-*
- indent the second and subsequent lines of warning messages so they
stand out a little more
tests/*.tests
- use test_runsub to run sub-tests instead of calling ${THIS_SH}
directly, so we can print a message with the name of the sub-test
script into the output. This will help with identifying the script
that fails
+2
View File
@@ -10,4 +10,6 @@ export TMPDIR
export BASH_TSTOUT=/tmp/xx
rm -f ${BASH_TSTOUT}
export TAB=' '
${THIS_SH} "$@"
+4 -4
View File
@@ -265,13 +265,13 @@ efg
0
0
arith9.sub
./arith9.sub: line 4: a: unbound variable
./arith9.sub: line 5: a: unbound variable
./arith9.sub: line 17: a: unbound variable
./arith9.sub: line 18: a: unbound variable
0
after 3 0
0
after 4 0
./arith9.sub: line 14: b: expression recursion level exceeded (error token is "b")
./arith9.sub: line 27: b: expression recursion level exceeded (error token is "b")
+ var=42
+ echo 42
42
@@ -288,7 +288,7 @@ after 4 0
+ echo 1
1
+ set +x
./arith9.sub: line 37: 4+: arithmetic syntax error: operand expected (error token is "+")
./arith9.sub: line 50: 4+: arithmetic syntax error: operand expected (error token is "+")
x = 4+ y =
arith10.sub
== arraysub ==
+3 -3
View File
@@ -30,15 +30,15 @@ echo $(( $intmax_min2 % -1 ))
echo $(( $intmax_max % -1 ))
lvalue=$intmax_min1
(( lvalue%= -1 ))
(( lvalue %= -1 ))
echo $lvalue
lvalue=$intmax_min2
(( lvalue%= -1 ))
(( lvalue %= -1 ))
echo $lvalue
lvalue=$intmax_max
(( lvalue%= -1 ))
(( lvalue %= -1 ))
echo $lvalue
# and these
+13
View File
@@ -1,3 +1,16 @@
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# test expression evaluation with unset variables
set -u
+28 -5
View File
@@ -85,8 +85,8 @@ enable unset
enable -n test worked
enable -n test
enable test worked
./builtins.tests: line 126: enable: notbuiltin: not a shell builtin
./builtins.tests: line 127: enable: test: not dynamically loaded
./builtins.tests: line 128: enable: notbuiltin: not a shell builtin
./builtins.tests: line 129: enable: test: not dynamically loaded
specialname
-specialname
FOO=BAR
@@ -94,25 +94,34 @@ FOO=BAR
hash: hash table empty
0
no-newline
source1.sub
AVAR
foo
source2.sub
in source.sub2, calling return
5
source3.sub
a b c
source3.sub
a b c
x y z
a b c
source4.sub
a b c
m n o p
source4.sub
a b c
m n o p
builtins1.sub
/tmp/bash-dir-a
/tmp/bash-dir-a
/tmp/bash-dir-a
/
source5.sub
./source5.sub: line 23: /tmp/source-notthere: No such file or directory
after bad source 1
./source5.sub: line 30: /tmp/source-notthere: No such file or directory
source6.sub
one - OK
0
0
@@ -122,6 +131,7 @@ three - OK
0
four - OK
0
source7.sub
abc
def
ghi
@@ -139,6 +149,7 @@ abc
def
ghi
ok
source8.sub
./source8.sub: line 40: improbable-filename: No such file or directory
./source8.sub: line 41: improbable-filename: No such file or directory
an improbable filename
@@ -152,6 +163,7 @@ bash: line 1: .: cwd-filename: file not found
bash: line 1: .: cwd-filename: file not found
file in the current directory
file in the current directory
source1.sub
AVAR
foo
foo
@@ -162,12 +174,13 @@ AVAR
foo
declare -x foo=""
declare -x FOO="\$\$"
./builtins.tests: line 242: declare: FOO: not found
./builtins.tests: line 251: declare: FOO: not found
declare -x FOO="\$\$"
ok
ok
./builtins.tests: line 274: kill: 4096: invalid signal specification
./builtins.tests: line 283: kill: 4096: invalid signal specification
1
builtins2.sub
a\n\n\nb
a
@@ -175,9 +188,11 @@ a
b
-p
a b c
builtins3.sub
before: f = 4
inside
after: f = 8 bar = 4
builtins4.sub
declare -a c
declare -A d
declare -a c=([0]="4")
@@ -188,6 +203,7 @@ declare -a c=([0]="1" [1]="2" [2]="3")
declare -a c=([0]="1" [1]="2" [2]="3")
unset
unset
builtins5.sub
assoc 1 unset
array 1 unset
assoc 2 unset
@@ -220,6 +236,7 @@ scalar: 0
scalar: 1
scalar: 0
scalar: 0
builtins6.sub
all set:
one
two
@@ -261,6 +278,7 @@ f2 ()
funcs unset:
one-two
two-two
builtins7.sub
bash: line 1: notthere: No such file or directory
one
bash: line 1: notthere: No such file or directory
@@ -297,6 +315,7 @@ type
+ command -p -- command -v type
type
+ set +x
builtins8.sub
u=rw,g=rx,o=rx
u=r,g=rx,o=rx
u=rwx,g=rwx,o=
@@ -315,6 +334,7 @@ u=rwx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=x
builtins9.sub
hash: hash table empty
./builtins9.sub: line 19: hash: notthere: not found
1
@@ -333,6 +353,7 @@ builtin hash -p /nosuchdir/nosuchfile cat
found
./builtins9.sub: line 52: hash: /: Is a directory
builtin hash -p /nosuchfile cat
builtins10.sub
./builtins10.sub: line 17: help: -x: invalid option
help: usage: help [-dms] [pattern ...]
These shell commands are defined internally. Type `help' to see this list.
@@ -475,6 +496,7 @@ A star (*) next to a name means that the command is disabled.
hash [-lr] [-p pathname] [-dt] [name > { COMMANDS ; }
help [-dms] [pattern ...]
./builtins10.sub: line 39: help: no help topics match `bash'. Try `help help' or `man -k bash' or `info bash'.
builtins11.sub
unlimited
unlimited
./builtins11.sub: line 27: ulimit: +1999: invalid number
@@ -483,6 +505,7 @@ unlimited
./builtins11.sub: line 37: ulimit: -g: invalid option
ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPRT] [limit]
./builtins11.sub: line 39: ulimit: max user processes: cannot modify limit: Operation not permitted
builtins12.sub
/tmp /bin
/tmp /bin
/bin /tmp
@@ -502,5 +525,5 @@ popd: usage: popd [-n] [+N | -N]
./builtins12.sub: line 36: popd: +8: directory stack index out of range
/tmp /
/
./builtins.tests: line 325: exit: status: numeric argument required
./builtins.tests: line 334: exit: status: numeric argument required
after non-numeric arg to exit: 2
+25 -16
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
# tests for miscellaneous builtins not tested elsewhere
set +p
set +o posix
@@ -164,18 +166,22 @@ unset -v SFILE
AVAR=AVAR
printf '\tsource1.sub\n'
. ./source1.sub
AVAR=foo . ./source1.sub
printf '\tsource2.sub\n'
. ./source2.sub
echo $?
printf '\tsource3.sub\n'
set -- a b c
. ./source3.sub
# make sure source with arguments does not change the shell's positional
# parameters, but that the sourced file sees the arguments as its
# positional parameters
printf '\tsource3.sub\n'
echo "$@"
. ./source3.sub x y z
echo "$@"
@@ -184,6 +190,7 @@ echo "$@"
# should be reflected in the calling shell's positional parameters. this
# also tests one of the shopt options that controls source using $PATH to
# find the script
printf '\tsource4.sub\n'
echo "$@"
shopt -u sourcepath
. source4.sub
@@ -191,29 +198,31 @@ echo "$@"
# this is complicated when the sourced scripts gets its own positional
# parameters from arguments to `.'
printf '\tsource4.sub\n'
set -- a b c
echo "$@"
. source4.sub x y z
echo "$@"
# test out cd and $CDPATH
${THIS_SH} ./builtins1.sub
test_runsub ./builtins1.sub
# test behavior of `.' when given a non-existent file argument
${THIS_SH} ./source5.sub
test_runsub ./source5.sub
# test bugs in sourcing non-regular files, fixed post-bash-3.2
${THIS_SH} ./source6.sub
test_runsub ./source6.sub
# test bugs with source called from multiline aliases and other contexts
${THIS_SH} ./source7.sub
test_runsub ./source7.sub
# test source/. -p path
${THIS_SH} ./source8.sub
test_runsub ./source8.sub
# in posix mode, assignment statements preceding special builtins are
# reflected in the shell environment. `.' and `eval' need special-case
# code.
printf '\tsource1.sub\n'
set -o posix
echo $AVAR
AVAR=foo . ./source1.sub
@@ -284,37 +293,37 @@ y=$(kill -l SIGINT)
unset -v x y
# test behavior of shopt xpg_echo
${THIS_SH} ./builtins2.sub
test_runsub ./builtins2.sub
# test behavior of declare -g
${THIS_SH} ./builtins3.sub
test_runsub ./builtins3.sub
# test behavior of using declare to create variables without assigning values
${THIS_SH} ./builtins4.sub
test_runsub ./builtins4.sub
# test behavior of set and unset array variables
${THIS_SH} ./builtins5.sub
test_runsub ./builtins5.sub
# test behavior of unset builtin with -f and -v options
${THIS_SH} ./builtins6.sub
test_runsub ./builtins6.sub
# test behavior of command builtin after changing it to a pseudo-keyword
${THIS_SH} ./builtins7.sub
test_runsub ./builtins7.sub
# POSIX complete symbolic umask tests
${THIS_SH} ./builtins8.sub
test_runsub ./builtins8.sub
# hash tests
${THIS_SH} ./builtins9.sub
test_runsub ./builtins9.sub
# help tests
${THIS_SH} ./builtins10.sub
test_runsub ./builtins10.sub
# ulimit tests
${THIS_SH} ./builtins11.sub
test_runsub ./builtins11.sub
# pushd/popd/dirs
${THIS_SH} ./builtins12.sub
test_runsub ./builtins12.sub
shift 0 # succeeds silently
+5 -1
View File
@@ -5,7 +5,7 @@ retest
and match
no more clauses
1.0
./case.tests: line 42: xx: readonly variable
./case.tests: line 44: xx: readonly variable
1.1
matches 1
no
@@ -18,6 +18,7 @@ esac
unset word ok 1
unset word ok 2
unset word ok 3
case1.sub
ok 1
ok 2
ok 3
@@ -29,6 +30,7 @@ ok 8
ok 9
mysterious 1
mysterious 2
case2.sub
argv[1] = <\a\b\c\^A\d\e\f>
argv[1] = <\a\b\c\^A\d\e\f>
argv[1] = <abc^Adef>
@@ -40,6 +42,7 @@ ok 5
ok 6
ok 7
ok 8
case3.sub
--- testing: soh
ok1ok2ok3ok4ok5
ok1ok2ok3ok4ok5
@@ -64,3 +67,4 @@ ok1ok2ok3ok4ok5
ok1ok2ok3ok4ok5
ok1ok2ok3ok4ok5
ok1ok2ok3ok4ok5
case4.sub
+6 -4
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
case foo in
bar) echo skip ;;
foo) echo fallthrough ;&
@@ -76,7 +78,7 @@ unset|$unset) echo unset word ok 3 ;;
esac
# tests of quote removal and pattern matching
${THIS_SH} ./case1.sub
${THIS_SH} ./case2.sub
${THIS_SH} ./case3.sub
${THIS_SH} ./case4.sub
test_runsub ./case1.sub
test_runsub ./case2.sub
test_runsub ./case3.sub
test_runsub ./case4.sub
+7
View File
@@ -1,19 +1,26 @@
comsub-eof0.sub
./comsub-eof0.sub: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
hi
./comsub-eof0.sub: line 11: warning: here-document at line 9 delimited by end-of-file (wanted `EOF')
hi
comsub-eof1.sub
hi
comsub-eof2.sub
./comsub-eof2.sub: line 2: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
hi
comsub-eof3.sub
./comsub-eof3.sub: line 4: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
./comsub-eof3.sub: line 5: unexpected EOF while looking for matching `)'
comsub-eof4.sub
./comsub-eof4.sub: line 3: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
contents
comsub-eof5.sub
./comsub-eof5.sub: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `)')
hi
./comsub-eof5.sub: line 9: warning: here-document at line 7 delimited by end-of-file (wanted `EOF')
hi
./comsub-eof5.sub: line 15: warning: here-document at line 13 delimited by end-of-file (wanted `)')
hi
comsub-eof6.sub
./comsub-eof6.sub: command substitution: line 3: unexpected EOF while looking for matching `)'
+9 -7
View File
@@ -1,13 +1,15 @@
${THIS_SH} ./comsub-eof0.sub
. ./test-aux-functions
${THIS_SH} ./comsub-eof1.sub
test_runsub ./comsub-eof0.sub
${THIS_SH} ./comsub-eof2.sub
test_runsub ./comsub-eof1.sub
${THIS_SH} ./comsub-eof3.sub
test_runsub ./comsub-eof2.sub
${THIS_SH} ./comsub-eof4.sub
test_runsub ./comsub-eof3.sub
${THIS_SH} ./comsub-eof5.sub
test_runsub ./comsub-eof4.sub
${THIS_SH} ./comsub-eof6.sub
test_runsub ./comsub-eof5.sub
test_runsub ./comsub-eof6.sub
+5
View File
@@ -59,8 +59,10 @@ here-doc with \()
here-doc terminated with a parenthesis
' # or a single back- or doublequote
line terminated with a backslash
comsub-posix1.sub
./comsub-posix1.sub: line 1: syntax error near unexpected token `)'
./comsub-posix1.sub: line 1: `echo $( if x; then echo foo )'
comsub-posix2.sub
swap32_posix is a function
swap32_posix ()
{
@@ -76,6 +78,8 @@ swap32_posix ()
));
done
}
comsub-posix3.sub
comsub-posix5.sub
bash: -c: line 1: syntax error near unexpected token `done' while looking for matching `)'
bash: -c: line 1: `: $(case x in x) ;; x) done esac)'
bash: -c: line 1: syntax error near unexpected token `done' while looking for matching `)'
@@ -86,6 +90,7 @@ bash: -c: line 1: syntax error near unexpected token `in' while looking for matc
bash: -c: line 1: `: $(case x in esac|in) foo;; esac)'
bash: -c: line 1: syntax error near unexpected token `done' while looking for matching `)'
bash: -c: line 1: `: $(case x in x) ;; x) done)'
comsub-posix6.sub
case: -c: line 3: syntax error near unexpected token `esac' while looking for matching `)'
case: -c: line 3: `$( esac ; bar=foo ; echo "$bar")) echo bad 2;;'
ok 2
+8 -6
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
: ${HOME:=/}
# works right
@@ -233,13 +235,13 @@ echo $(
echo line terminated with a backslash # \
)
${THIS_SH} ./comsub-posix1.sub
${THIS_SH} ./comsub-posix2.sub
${THIS_SH} ./comsub-posix3.sub
test_runsub ./comsub-posix1.sub
test_runsub ./comsub-posix2.sub
test_runsub ./comsub-posix3.sub
#${THIS_SH} ./comsub-posix4.sub
${THIS_SH} ./comsub-posix5.sub
${THIS_SH} ./comsub-posix6.sub
#test_runsub ./comsub-posix4.sub
test_runsub ./comsub-posix5.sub
test_runsub ./comsub-posix6.sub
# produced a parse error through bash-4.0-beta2
: $(echo foo)"
+8 -1
View File
@@ -1,4 +1,4 @@
./comsub.tests: line 19: hijkl: command not found
./comsub.tests: line 21: hijkl: command not found
argv[1] = <ab>
argv[2] = <cd>
argv[1] = <abmn>
@@ -25,6 +25,7 @@ blank ----
blank ----
blank ----
func: v = comsub
comsub1.sub
#esac
a
ok 1
@@ -35,10 +36,12 @@ ok 5
ok 6
xyz
ok 7
comsub2.sub
\/tmp\/foo\/bar
/tmp/foo/bar
/tmp/foo/bar
/tmp/foo/bar
comsub3.sub
1
2
3
@@ -55,12 +58,14 @@ b
c
1
2
comsub4.sub
d \
g
d \
g
d \
g
comsub5.sub
ok 1
ok 2
ok 3
@@ -71,6 +76,7 @@ ok 7
ok 9
ok 8
ok 8
comsub6.sub
Mon Aug 29 20:03:02 EDT 2022
post foo
Mon Aug 29 20:03:02 EDT 2022
@@ -82,6 +88,7 @@ Mon Aug 29 20:03:02 EDT 2022
hey after x
./comsub6.sub: line 40: syntax error near unexpected token `)'
./comsub6.sub: line 40: `math1)'
comsub7.sub
123
123
0
+9 -7
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# command substution parsing tests
TABSIZE=`grep -v '^[ #]' $CAPS </dev/null | grep -v "^$" | grep -v "^capalias"| grep -v "^infoalias" | wc -l`
@@ -100,10 +102,10 @@ func()
}
func
${THIS_SH} ./comsub1.sub
${THIS_SH} ./comsub2.sub
${THIS_SH} ./comsub3.sub
${THIS_SH} ./comsub4.sub
${THIS_SH} ./comsub5.sub
${THIS_SH} ./comsub6.sub
${THIS_SH} ./comsub7.sub
test_runsub ./comsub1.sub
test_runsub ./comsub2.sub
test_runsub ./comsub3.sub
test_runsub ./comsub4.sub
test_runsub ./comsub5.sub
test_runsub ./comsub6.sub
test_runsub ./comsub7.sub
+11 -5
View File
@@ -19,14 +19,14 @@ argv[1] = <>
argv[1] = <>
aa,bb
JOBaa bb cc ddCONTROL
./comsub2.tests: line 68: p: command not found
./comsub2.tests: line 69: p: command not found
NOTFOUND
./comsub2.tests: line 75: p: command not found
./comsub2.tests: line 75: p: command not found
./comsub2.tests: line 76: p: command not found
./comsub2.tests: line 76: p: command not found
expand_aliases off
expand_aliases off
outside:
./comsub2.tests: line 79: alias: p: not found
./comsub2.tests: line 80: alias: p: not found
alias e='echo inside redefine'
expand_aliases off
1
@@ -34,7 +34,7 @@ expand_aliases on
2
expand_aliases on
outside:
./comsub2.tests: line 89: alias: p: not found
./comsub2.tests: line 90: alias: p: not found
expand_aliases on
1
xx
@@ -62,6 +62,7 @@ one two
42
42
42
comsub21.sub
123
123
0
@@ -75,6 +76,7 @@ Mon Aug 29 20:03:02 EDT 2022
123
before 123
in for 123
comsub22.sub
outside before: value
inside before: value
inside after: funsub
@@ -82,6 +84,7 @@ inside: after false xxx
outside after: funsub
=====posix mode=====
outside before: value
comsub23.sub
.
declare -a a=([0]="1" [1]="2" [2]="3" [3]="4")
declare -- int="2"
@@ -104,6 +107,7 @@ uname
after arith for
1) a[${ break;}]
#? after select
comsub24.sub
a b c == 1 2 3
== 1 2 3
before return
@@ -115,6 +119,7 @@ declare -- IFS=" "
*???
*???
yyy zzzz
comsub25.sub
argv[1] = <AA^ABB>
argv[1] = <AA^OBB>
argv[1] = <AA^?BB>
@@ -178,6 +183,7 @@ argv[1] = <AA>
argv[2] = <BB>
argv[1] = <AA BB>
argv[1] = <AA BB>
comsub26.sub
inside1-inside2-outside
BEFOREAA
BB
+8 -7
View File
@@ -11,7 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# initial set of tests for ${Ccommand; } nofork command substitution
# basic functionality
@@ -145,9 +146,9 @@ echo $(( ${ echo 14 + 18; }+ 10))
echo ${ echo $(( 24+18 )); }
# alias expansion and nested funsubs in other constructs
${THIS_SH} ./comsub21.sub
${THIS_SH} ./comsub22.sub
${THIS_SH} ./comsub23.sub
${THIS_SH} ./comsub24.sub
${THIS_SH} ./comsub25.sub
${THIS_SH} ./comsub26.sub
test_runsub ./comsub21.sub
test_runsub ./comsub22.sub
test_runsub ./comsub23.sub
test_runsub ./comsub24.sub
test_runsub ./comsub25.sub
test_runsub ./comsub26.sub
+7 -2
View File
@@ -12,7 +12,7 @@ returns: 0
returns: 0
returns: 1
returns: 0
./cond.tests: line 65: [[: X: integer expected
./cond.tests: line 66: [[: X: integer expected
returns: 2
returns: 0
returns: 1
@@ -29,7 +29,7 @@ returns: 0
returns: 1
returns: 1
returns: 0
./cond.tests: line 126: [[: 4+: arithmetic syntax error: operand expected (error token is "+")
./cond.tests: line 127: [[: 4+: arithmetic syntax error: operand expected (error token is "+")
returns: 1
returns: 0
returns: 0
@@ -60,6 +60,7 @@ ok c3
ok c4
ok c5
ok c6
cond-regexp1.sub
match 1
match 2
match 3
@@ -84,6 +85,7 @@ match control-a 2
match control-a 3
match control-a 4
match control-a 5
cond-regexp2.sub
ok 1
ok 2
ok 3
@@ -97,6 +99,7 @@ ok 9
ok 10
ok 11
ok 12
cond-regexp3.sub
argv[1] = <\^?>
0
1
@@ -148,6 +151,7 @@ ok 5
ok 6
ok 7
ok 8
cond-error1.sub
bash: -c: line 1: unexpected token `EOF', expected `)'
bash: -c: line 2: syntax error: unexpected end of file from `[[' command on line 1
bash: -c: line 1: unexpected EOF while looking for `]]'
@@ -181,6 +185,7 @@ bash: -c: line 1: syntax error near `<'
bash: -c: line 1: `[[ -n < ]]'
ERR: 22: -[[ -n $unset ]]- failed
ERR: 28: -func- failed
cond-xtrace1.sub
+ [[ -t X ]]
./cond-xtrace1.sub: line 6: [[: X: integer expected
+ [[ '' > 7 ]]
+6 -5
View File
@@ -11,6 +11,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# the test/[ code is tested elsewhere, and the [[...]] just uses the same
# code. this tests the special features of [[...]]
@@ -240,9 +241,9 @@ var=$'ab\001c'
[[ $var == a* ]] && echo ok c5
[[ $var == $'ab\001'* ]] && echo ok c6
${THIS_SH} ./cond-regexp1.sub
${THIS_SH} ./cond-regexp2.sub
${THIS_SH} ./cond-regexp3.sub
test_runsub ./cond-regexp1.sub
test_runsub ./cond-regexp2.sub
test_runsub ./cond-regexp3.sub
${THIS_SH} ./cond-error1.sub
${THIS_SH} ./cond-xtrace1.sub
test_runsub ./cond-error1.sub
test_runsub ./cond-xtrace1.sub
+31 -30
View File
@@ -11,7 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# first, let's start with the basics
recho "$@"
@@ -240,96 +241,96 @@ esac
# tests for the effect of quoting $* and $@ in an assignment context (plus
# arrays) -- bugs through bash 4.2
${THIS_SH} ./dollar-at-star1.sub
test_runsub ./dollar-at-star1.sub
# more tests for expanding $@ and $* in a context where there is no word
# splitting
${THIS_SH} ./dollar-at-star2.sub
${THIS_SH} ./dollar-at-star3.sub
${THIS_SH} ./dollar-at-star4.sub
${THIS_SH} ./dollar-at-star5.sub
${THIS_SH} ./dollar-at-star6.sub
${THIS_SH} ./dollar-at-star7.sub
test_runsub ./dollar-at-star2.sub
test_runsub ./dollar-at-star3.sub
test_runsub ./dollar-at-star4.sub
test_runsub ./dollar-at-star5.sub
test_runsub ./dollar-at-star6.sub
test_runsub ./dollar-at-star7.sub
# tests for expansions of $@ and ${a[@]} (vs. $* and ${a[*]}) on the RHS of
# assignment statements with non-default IFS: $@ expands to args or array
# members separated by spaces
${THIS_SH} ./dollar-at-star8.sub
test_runsub ./dollar-at-star8.sub
# more tests of the expansions of $@ and $* (and their array equivalents)
# with different values for IFS
${THIS_SH} ./dollar-at-star9.sub
test_runsub ./dollar-at-star9.sub
# tests for expansions of "$*" and "$@" and their array equivalents when $1 == ''
# and we're using the POSIX word expansions
${THIS_SH} ./dollar-at-star10.sub
${THIS_SH} ./dollar-at-star11.sub
test_runsub ./dollar-at-star10.sub
test_runsub ./dollar-at-star11.sub
# tests for special expansion of "$*" and "${array[*]}" when used with other
# expansions -- bugs through bash-2.05b
${THIS_SH} ./dollar-star1.sub
test_runsub ./dollar-star1.sub
# tests for expansion of "$@" on rhs of things like ${param:+word}. Bugs
# though bash-2.05b
${THIS_SH} ./dollar-at1.sub
test_runsub ./dollar-at1.sub
# tests for expansion of other variables in double-quoted strings containing
# $@. Bugs through bash-2.05b
${THIS_SH} ./dollar-at2.sub
test_runsub ./dollar-at2.sub
# tests for various expansions of $* in different contexts -- word split,
# no splitting, etc. when $IFS is NUL
${THIS_SH} ./dollar-star2.sub
test_runsub ./dollar-star2.sub
# tests for expansions of "${array[*]}" and "${array[@]}" when $IFS is not the
# default and the array contains null elements
${THIS_SH} ./dollar-star3.sub
test_runsub ./dollar-star3.sub
# test for set -u and expansions of $@ when there are no positional parameters
${THIS_SH} ./dollar-at3.sub
test_runsub ./dollar-at3.sub
# test for set -u and expansions of $* when there are no positional parameters
${THIS_SH} ./dollar-star4.sub
test_runsub ./dollar-star4.sub
# tests for expansions of $* when IFS is null
${THIS_SH} ./dollar-star5.sub
test_runsub ./dollar-star5.sub
# tests for inappropriate word splitting through bash-4.2
${THIS_SH} ./dollar-at4.sub
test_runsub ./dollar-at4.sub
# tests for problems with "$@" preceded and followed by other quoted expansions
# through bash-4.2
${THIS_SH} ./dollar-at5.sub
test_runsub ./dollar-at5.sub
# tests for problems with "${@:1}" and other expansions with null entries
# in positional parameters
${THIS_SH} ./dollar-at6.sub
test_runsub ./dollar-at6.sub
# tests for expansions of $* when $1 == ""; problem through bash-4.2
${THIS_SH} ./dollar-star6.sub
test_runsub ./dollar-star6.sub
# tests for expansions of $* (unquoted) when IFS changes (e.g., ${IFS:=-})
# problem through bash-4.2
${THIS_SH} ./dollar-star7.sub
test_runsub ./dollar-star7.sub
# tests for expansions of $* (unquoted) when IFS is null and word splitting is
# not going to be performed.
# problem through bash-4.4 in some parameter expansion contexts
${THIS_SH} ./dollar-star8.sub
test_runsub ./dollar-star8.sub
# tests for expansions of "$@" when there are no positional parameter or when
# $1 == '' and the expansion is preceded by something that results in a quoted
# null string
${THIS_SH} ./dollar-at7.sub
test_runsub ./dollar-at7.sub
# tests for expansions of $* when in an assignment context (no splitting) and
# IFS is null
${THIS_SH} ./dollar-star9.sub
test_runsub ./dollar-star9.sub
# more tests for expansions of $* when not splitting with IFS set or unset and
# null strings as the positional parameters
${THIS_SH} ./dollar-star10.sub
test_runsub ./dollar-star10.sub
# tests for expansions of $* when IFS=$'\1'
${THIS_SH} ./dollar-star11.sub
test_runsub ./dollar-star11.sub
exit 0
+29
View File
@@ -95,6 +95,7 @@ ok 1
ok 2
ok 3
ok 4
dollar-at-star1.sub
var=${a[*]} ... one:::two:three:::four
var="${a[*]}" ... one:::two:three:::four
var=$* ... one:::two:three:::four
@@ -103,6 +104,7 @@ var=${a[@]} ... one:::two three:::four
var="${a[@]}" ... one:::two three:::four
var=$@ ... one:::two three:::four
var="$@" ... one:::two three:::four
dollar-at-star2.sub
ok 1
ok 2
ok 3
@@ -156,6 +158,7 @@ ok at 6
ok at 7
ok at 8
ok at 9
dollar-at-star3.sub
argv[1] = <a>
argv[1] = <a>
argv[1] = <a>
@@ -169,6 +172,7 @@ argv[1] = <o>
argv[1] = <one>
<123 abc> <def> <ghi 456>
<123 abc> <def> <ghi\ 456>
dollar-at-star4.sub
<c>
a bc
a b
@@ -199,6 +203,7 @@ argv[1] = <a b>
<c>
<d>
<d>
dollar-at-star5.sub
0
0
1
@@ -232,6 +237,7 @@ argv[1] = <>
variable
argv[1] = <>
dollar-at
dollar-at-star6.sub
argv[1] = <'a'>
argv[2] = <'b'>
argv[3] = <'c'>
@@ -269,6 +275,7 @@ argv[3] = <'c'>
argv[1] = <'a'>
argv[2] = <'b'>
argv[3] = <'c'>
dollar-at-star7.sub
|this|
|is|
|a|
@@ -297,11 +304,13 @@ argv[3] = <'c'>
|is|
|a|
|test|
dollar-at-star8.sub
a1=a b c a,b,c a b c a,b,c a b c a,b,c
a2=a b c a,b,c a b c a,b,c a b c a,b,c
a3=a b c a,b,c a b c a,b,c a b c a,b,c
a4=a b c a,b,c a b c a,b,c a b c a,b,c
dollar-at-star9.sub
argv[1] = < >
argv[1] = < >
argv[1] = < >
@@ -399,6 +408,7 @@ argv[1] = <^?>
argv[1] = <^?>
argv[1] = <>
argv[1] = <>
dollar-at-star10.sub
argv[1] = <>
argv[1] = <>
argv[1] = <>
@@ -427,6 +437,7 @@ argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
dollar-at-star11.sub
argv[1] = <>
argv[1] = <>
argv[1] = <>
@@ -466,6 +477,7 @@ argv[1] = <>
argv[1] = <>
argv[1] = </>
1:1
dollar-star1.sub
xa|xb|xc
xa|xb|xc
a|b|c
@@ -482,6 +494,7 @@ a|b|c
a|b|c
xa|xb|xc
xa|xb|xc
dollar-at1.sub
3
3
3
@@ -490,12 +503,14 @@ xa|xb|xc
3
3
3
dollar-at2.sub
argv[1] = <echo 1 ; echo 1>
argv[1] = <echo 1 2 ; echo 1>
argv[2] = <2>
argv[1] = <echo 1 ; echo 1>
argv[1] = <echo 1 2 ; echo 1>
argv[2] = <2>
dollar-star2.sub
argv[1] = <AB>
argv[1] = <AB>
argv[1] = <A BC D>
@@ -505,6 +520,7 @@ argv[1] = <A B>
argv[2] = <C D>
argv[1] = <A BC D>
argv[1] = <A BC D>
dollar-star3.sub
argv[1] = <fooq//barq/>
argv[1] = <fooq>
argv[2] = <>
@@ -520,23 +536,27 @@ argv[1] = <ooq>
argv[2] = <>
argv[3] = <arq>
argv[4] = <>
dollar-at3.sub
0
bar
after 1
after 2
dollar-star4.sub
0
bar
after 1
after 2
dollar-star5.sub
a b
ab
cd
ok 1
ok 2
dollar-at4.sub
argv[1] = <a b>
argv[2] = <c d>
argv[1] = <a>
@@ -545,6 +565,7 @@ argv[3] = <c>
argv[4] = <d>
argv[1] = <a b c d>
argv[1] = <a b c d>
dollar-at5.sub
<1> <2> <3> <4> <5 1>
<1 1> <2> <3> <4> <5>
<11> <2> <3> <4> <51>
@@ -596,6 +617,7 @@ ${@:2}c$1 c2 c3 #works as long as quoting omitted
set y zcx c2 c3
0
declare -a c=([0]="y" [1]="zcx" [2]="c2" [3]="c3")
dollar-at6.sub
argv[1] = <>
argv[2] = <x>
argv[1] = <>
@@ -617,6 +639,7 @@ argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
dollar-star6.sub
argv[1] = <AwR>
argv[1] = <AwR>
argv[1] = <AR>
@@ -629,6 +652,7 @@ argv[1] = <A^?R>
argv[1] = <AwR>
argv[1] = <AwR>
argv[1] = <A^?R>
dollar-star7.sub
<a> <b> <ca> <b> <c-a-b-c>
after 1: IFS -
argv[1] = <a-b-c>
@@ -645,6 +669,7 @@ argv[2] = <b>
argv[3] = <c>
argv[4] = <d>
argv[1] = <a b c d>
dollar-star8.sub
<3>
<abc>
<def ghi>
@@ -675,6 +700,7 @@ argv[1] = <a b c d>
<def>
<ghi>
<jkl>
dollar-at7.sub
argv[1] = <1>
argv[2] = <>
argv[1] = <2>
@@ -722,6 +748,7 @@ argv[1] = <1>
argv[2] = <>
argv[1] = <2>
argv[2] = <>
dollar-star9.sub
<12><12><12><12><12><12>
<12><12><12><12><12><12>
<12><'1''2'>
@@ -742,6 +769,8 @@ argv[2] = <2>
var=1 2
argv[1] = <1 2>
argv[1] = <1 2>
dollar-star10.sub
dollar-star11.sub
argv[1] = <^Aaa^Abb^Acc^A--^Add^A>
argv[1] = <^A--^A>
ok 1
+123 -108
View File
@@ -1,145 +1,146 @@
unalias: usage: unalias [-a] name [name ...]
./errors.tests: line 31: alias: -x: invalid option
./errors.tests: line 33: alias: -x: invalid option
alias: usage: alias [-p] [name[=value] ... ]
./errors.tests: line 32: unalias: -x: invalid option
./errors.tests: line 34: unalias: -x: invalid option
unalias: usage: unalias [-a] name [name ...]
./errors.tests: line 33: alias: hoowah: not found
./errors.tests: line 34: unalias: hoowah: not found
./errors.tests: line 37: `1': not a valid identifier
./errors.tests: line 41: `f\1': not a valid identifier
./errors.tests: line 45: `invalid-name': not a valid identifier
./errors.tests: line 47: `f\1': not a valid identifier
./errors.tests: line 50: `1': not a valid identifier
./errors.tests: line 51: `f\1': not a valid identifier
./errors.tests: line 52: `invalid-name': not a valid identifier
./errors.tests: line 54: `1': not a valid identifier
./errors.tests: line 55: `f\1': not a valid identifier
./errors.tests: line 59: `$1': not a valid identifier
./errors.tests: line 35: alias: hoowah: not found
./errors.tests: line 36: unalias: hoowah: not found
./errors.tests: line 39: `1': not a valid identifier
./errors.tests: line 43: `f\1': not a valid identifier
./errors.tests: line 47: `invalid-name': not a valid identifier
./errors.tests: line 49: `f\1': not a valid identifier
./errors.tests: line 52: `1': not a valid identifier
./errors.tests: line 53: `f\1': not a valid identifier
./errors.tests: line 54: `invalid-name': not a valid identifier
./errors.tests: line 56: `1': not a valid identifier
./errors.tests: line 57: `f\1': not a valid identifier
./errors.tests: line 61: `$1': not a valid identifier
declare -fr func
./errors.tests: line 76: func: readonly function
./errors.tests: line 79: unset: -x: invalid option
./errors.tests: line 78: func: readonly function
./errors.tests: line 81: unset: -x: invalid option
unset: usage: unset [-f] [-v] [-n] [name ...]
./errors.tests: line 82: unset: func: cannot unset: readonly function
./errors.tests: line 85: declare: func: readonly function
./errors.tests: line 89: declare: -a: invalid option
./errors.tests: line 90: declare: -i: invalid option
./errors.tests: line 94: unset: XPATH: cannot unset: readonly variable
./errors.tests: line 100: unset: cannot simultaneously unset a function and a variable
./errors.tests: line 103: declare: -z: invalid option
./errors.tests: line 84: unset: func: cannot unset: readonly function
./errors.tests: line 87: declare: func: readonly function
./errors.tests: line 91: declare: -a: invalid option
./errors.tests: line 92: declare: -i: invalid option
./errors.tests: line 96: unset: XPATH: cannot unset: readonly variable
./errors.tests: line 102: unset: cannot simultaneously unset a function and a variable
./errors.tests: line 105: declare: -z: invalid option
declare: usage: declare [-aAfFgiIlnrtux] [name[=value] ...] or declare -p [-aAfFilnrtux] [name ...]
./errors.tests: line 105: declare: `-z': not a valid identifier
./errors.tests: line 106: declare: `/bin/sh': not a valid identifier
./errors.tests: line 110: declare: cannot use `-f' to make functions
./errors.tests: line 113: exec: -i: invalid option
./errors.tests: line 107: declare: `-z': not a valid identifier
./errors.tests: line 108: declare: `/bin/sh': not a valid identifier
./errors.tests: line 112: declare: cannot use `-f' to make functions
./errors.tests: line 115: exec: -i: invalid option
exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
./errors.tests: line 120: export: XPATH: not a function
./errors.tests: line 123: break: only meaningful in a `for', `while', or `until' loop
./errors.tests: line 124: continue: only meaningful in a `for', `while', or `until' loop
./errors.tests: line 127: shift: label: numeric argument required
./errors.tests: line 132: shift: too many arguments
./errors.tests: line 138: let: expression expected
./errors.tests: line 141: local: can only be used in a function
./errors.tests: line 144: logout: not login shell: use `exit'
./errors.tests: line 147: hash: notthere: not found
./errors.tests: line 150: hash: -v: invalid option
./errors.tests: line 122: export: XPATH: not a function
./errors.tests: line 125: break: only meaningful in a `for', `while', or `until' loop
./errors.tests: line 126: continue: only meaningful in a `for', `while', or `until' loop
./errors.tests: line 129: shift: label: numeric argument required
./errors.tests: line 134: shift: too many arguments
./errors.tests: line 140: let: expression expected
./errors.tests: line 143: local: can only be used in a function
./errors.tests: line 146: logout: not login shell: use `exit'
./errors.tests: line 149: hash: notthere: not found
./errors.tests: line 152: hash: -v: invalid option
hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
./errors.tests: line 153: hash: -d: option requires an argument
./errors.tests: line 157: hash: hashing disabled
./errors.tests: line 160: unset: [-2]: bad array subscript
./errors.tests: line 164: AA: readonly variable
./errors.tests: line 168: AA: readonly variable
./errors.tests: line 176: shift: 5: shift count out of range
./errors.tests: line 177: shift: -2: shift count out of range
./errors.tests: line 155: hash: -d: option requires an argument
./errors.tests: line 159: hash: hashing disabled
./errors.tests: line 162: unset: [-2]: bad array subscript
./errors.tests: line 166: AA: readonly variable
./errors.tests: line 170: AA: readonly variable
./errors.tests: line 178: shift: 5: shift count out of range
./errors.tests: line 179: shift: -2: shift count out of range
./errors.tests: line 182: shopt: no_such_option: invalid shell option name
./errors.tests: line 183: shopt: no_such_option: invalid shell option name
./errors.tests: line 184: shopt: no_such_option: invalid option name
./errors.tests: line 187: umask: 09: octal number out of range
./errors.tests: line 188: umask: `:': invalid symbolic mode character
./errors.tests: line 189: umask: `:': invalid symbolic mode operator
./errors.tests: line 192: umask: -i: invalid option
./errors.tests: line 180: shift: 5: shift count out of range
./errors.tests: line 181: shift: -2: shift count out of range
./errors.tests: line 184: shopt: no_such_option: invalid shell option name
./errors.tests: line 185: shopt: no_such_option: invalid shell option name
./errors.tests: line 186: shopt: no_such_option: invalid option name
./errors.tests: line 189: umask: 09: octal number out of range
./errors.tests: line 190: umask: `:': invalid symbolic mode character
./errors.tests: line 191: umask: `:': invalid symbolic mode operator
./errors.tests: line 194: umask: -i: invalid option
umask: usage: umask [-p] [-S] [mode]
./errors.tests: line 196: umask: `p': invalid symbolic mode character
./errors.tests: line 205: VAR: readonly variable
./errors.tests: line 208: declare: VAR: readonly variable
./errors.tests: line 209: declare: VAR: readonly variable
./errors.tests: line 211: declare: unset: not found
./errors.tests: line 214: VAR: readonly variable
./errors.tests: line 198: umask: `p': invalid symbolic mode character
./errors.tests: line 207: VAR: readonly variable
./errors.tests: line 210: declare: VAR: readonly variable
./errors.tests: line 211: declare: VAR: readonly variable
./errors.tests: line 213: declare: unset: not found
./errors.tests: line 216: VAR: readonly variable
comsub: -c: line 1: syntax error near unexpected token `)'
comsub: -c: line 1: `: $( for z in 1 2 3; do )'
comsub: -c: line 1: syntax error near unexpected token `done' while looking for matching `)'
comsub: -c: line 1: `: $( for z in 1 2 3; done )'
./errors.tests: line 221: cd: HOME not set
./errors.tests: line 222: cd: /tmp/xyz.bash: No such file or directory
./errors.tests: line 224: cd: OLDPWD not set
./errors.tests: line 225: cd: /bin/sh: Not a directory
./errors.tests: line 227: cd: /tmp/cd-notthere: No such file or directory
./errors.tests: line 229: cd: too many arguments
./errors.tests: line 223: cd: HOME not set
./errors.tests: line 224: cd: /tmp/xyz.bash: No such file or directory
./errors.tests: line 226: cd: OLDPWD not set
./errors.tests: line 227: cd: /bin/sh: Not a directory
./errors.tests: line 229: cd: /tmp/cd-notthere: No such file or directory
./errors.tests: line 231: cd: too many arguments
bash: line 1: PWD: readonly variable
1
bash: line 1: OLDPWD: readonly variable
1
./errors.tests: line 236: .: filename argument required
./errors.tests: line 238: .: filename argument required
.: usage: . [-p path] filename [arguments]
./errors.tests: line 237: source: filename argument required
./errors.tests: line 239: source: filename argument required
source: usage: source [-p path] filename [arguments]
./errors.tests: line 240: .: -i: invalid option
./errors.tests: line 242: .: -i: invalid option
.: usage: . [-p path] filename [arguments]
./errors.tests: line 243: set: -q: invalid option
./errors.tests: line 245: set: -q: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 246: enable: sh: not a shell builtin
./errors.tests: line 246: enable: bash: not a shell builtin
./errors.tests: line 249: shopt: cannot set and unset shell options simultaneously
./errors.tests: line 252: read: -x: invalid option
./errors.tests: line 248: enable: sh: not a shell builtin
./errors.tests: line 248: enable: bash: not a shell builtin
./errors.tests: line 251: shopt: cannot set and unset shell options simultaneously
./errors.tests: line 254: read: -x: invalid option
read: usage: read [-Eers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
./errors.tests: line 255: read: var: invalid timeout specification
./errors.tests: line 258: read: `/bin/sh': not a valid identifier
./errors.tests: line 259: read: `/bin/sh': not a valid identifier
./errors.tests: line 260: read: `invalid-name': not a valid identifier
./errors.tests: line 263: VAR: readonly variable
./errors.tests: line 266: read: XX: invalid file descriptor specification
./errors.tests: line 267: read: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 270: mapfile: XX: invalid file descriptor specification
./errors.tests: line 271: mapfile: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 275: mapfile: empty array variable name
./errors.tests: line 276: mapfile: `invalid-var': not a valid identifier
./errors.tests: line 279: readonly: -x: invalid option
./errors.tests: line 257: read: var: invalid timeout specification
./errors.tests: line 260: read: `/bin/sh': not a valid identifier
./errors.tests: line 261: read: `/bin/sh': not a valid identifier
./errors.tests: line 262: read: `invalid-name': not a valid identifier
./errors.tests: line 265: VAR: readonly variable
./errors.tests: line 268: read: XX: invalid file descriptor specification
./errors.tests: line 269: read: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 272: mapfile: XX: invalid file descriptor specification
./errors.tests: line 273: mapfile: 42: invalid file descriptor: Bad file descriptor
./errors.tests: line 277: mapfile: empty array variable name
./errors.tests: line 278: mapfile: `invalid-var': not a valid identifier
./errors.tests: line 281: readonly: -x: invalid option
readonly: usage: readonly [-aAf] [name[=value] ...] or readonly -p
./errors.tests: line 282: eval: -i: invalid option
./errors.tests: line 284: eval: -i: invalid option
eval: usage: eval [arg ...]
./errors.tests: line 283: command: -i: invalid option
./errors.tests: line 285: command: -i: invalid option
command: usage: command [-pVv] command [arg ...]
./errors.tests: line 286: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 287: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 290: trap: NOSIG: invalid signal specification
./errors.tests: line 293: trap: -s: invalid option
./errors.tests: line 288: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 289: /bin/sh + 0: arithmetic syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 292: trap: NOSIG: invalid signal specification
./errors.tests: line 295: trap: -s: invalid option
trap: usage: trap [-Plp] [[action] signal_spec ...]
./errors.tests: line 299: return: can only `return' from a function or sourced script
./errors.tests: line 303: break: 0: loop count out of range
./errors.tests: line 307: continue: 0: loop count out of range
./errors.tests: line 312: builtin: -x: invalid option
./errors.tests: line 301: return: can only `return' from a function or sourced script
./errors.tests: line 305: break: 0: loop count out of range
./errors.tests: line 309: continue: 0: loop count out of range
./errors.tests: line 314: builtin: -x: invalid option
builtin: usage: builtin [shell-builtin [arg ...]]
./errors.tests: line 315: builtin: bash: not a shell builtin
./errors.tests: line 319: bg: no job control
./errors.tests: line 320: fg: no job control
./errors.tests: line 317: builtin: bash: not a shell builtin
./errors.tests: line 321: bg: no job control
./errors.tests: line 322: fg: no job control
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
./errors.tests: line 324: kill: -s: option requires an argument
./errors.tests: line 326: kill: S: invalid signal specification
./errors.tests: line 328: kill: `': not a pid or valid job spec
./errors.tests: line 326: kill: -s: option requires an argument
./errors.tests: line 328: kill: S: invalid signal specification
./errors.tests: line 330: kill: `': not a pid or valid job spec
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
./errors.tests: line 332: kill: SIGBAD: invalid signal specification
./errors.tests: line 334: kill: BAD: invalid signal specification
./errors.tests: line 336: kill: `@12': not a pid or valid job spec
./errors.tests: line 339: unset: BASH_LINENO: cannot unset
./errors.tests: line 339: unset: BASH_SOURCE: cannot unset
./errors.tests: line 342: set: trackall: invalid option name
./errors.tests: line 343: set: -q: invalid option
./errors.tests: line 334: kill: SIGBAD: invalid signal specification
./errors.tests: line 336: kill: BAD: invalid signal specification
./errors.tests: line 338: kill: `@12': not a pid or valid job spec
./errors.tests: line 341: unset: BASH_LINENO: cannot unset
./errors.tests: line 341: unset: BASH_SOURCE: cannot unset
./errors.tests: line 344: set: trackall: invalid option name
./errors.tests: line 345: set: -q: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 344: set: -i: invalid option
./errors.tests: line 346: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 348: xx: readonly variable
./errors.tests: line 350: xx: readonly variable
1
errors1.sub
./errors1.sub: line 14: .: -i: invalid option
.: usage: . [-p path] filename [arguments]
./errors1.sub: line 22: shift: -4: shift count out of range
@@ -149,11 +150,14 @@ set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors1.sub: line 29: break: -5: loop count out of range
./errors1.sub: line 30: continue: -5: loop count out of range
after f
errors2.sub
./errors2.sub: line 3: ${$NO_SUCH_VAR}: bad substitution
1
errors3.sub
./errors3.sub: line 5: no_such_file: No such file or directory
TEST
./errors3.sub: line 7: no_such_file: No such file or directory
errors4.sub
1
2
./errors4.sub: line 20: var: readonly variable
@@ -170,14 +174,17 @@ after readonly assignment
3) 3
#? ./errors4.sub: line 40: var: readonly variable
./errors4.sub: line 45: break: x: numeric argument required
errors4.sub
1
2
./errors4.sub: line 20: var: readonly variable
errors5.sub
./errors5.sub: line 6: array: unbound variable
./errors5.sub: line 7: array: unbound variable
./errors5.sub: line 8: array[7]: unbound variable
./errors5.sub: line 11: 7: unbound variable
./errors5.sub: line 12: 7: unbound variable
errors6.sub
after 1: 1
after 2: 1
after 3: 1
@@ -201,6 +208,7 @@ unset
./errors6.sub: line 54: invalid-ident: invalid variable name
./errors6.sub: line 55: invalid-ident: invalid variable name
./errors6.sub: line 56: invalid-ident: invalid variable name
errors6.sub
4
array after 1: 0
@@ -221,6 +229,7 @@ unset
./errors6.sub: line 54: invalid-ident: invalid variable name
./errors6.sub: line 55: invalid-ident: invalid variable name
./errors6.sub: line 56: invalid-ident: invalid variable name
errors7.sub
./errors7.sub: line 21: x: readonly variable
./errors7.sub: line 21: notthere: command not found
after no such command: 127
@@ -232,6 +241,7 @@ after special builtin: 0
./errors7.sub: line 27: x: readonly variable
./errors7.sub: line 29: x: readonly variable
./errors7.sub: line 32: v: readonly variable
errors7.sub
./errors7.sub: line 21: x: readonly variable
after no such command: 1
./errors7.sub: line 23: x: readonly variable
@@ -240,6 +250,7 @@ after non-special builtin: 1
./errors7.sub: line 27: x: readonly variable
./errors7.sub: line 29: x: readonly variable
./errors7.sub: line 32: v: readonly variable
errors8.sub
./errors8.sub: eval: line 7: syntax error: unexpected end of file from `(' command on line 6
ok 1
./errors8.sub: line 8: v: readonly variable
@@ -257,12 +268,14 @@ ok 7
./errors8.sub: line 17: .: -x: invalid option
.: usage: . [-p path] filename [arguments]
ok 8
errors9.sub
DEBUG
./errors9.sub: line 6: [[: ++: arithmetic syntax error: operand expected (error token is "+")
DEBUG
./errors9.sub: line 8: ((: -- : arithmetic syntax error: operand expected (error token is "- ")
DEBUG
./errors9.sub: line 10: ((: -- : arithmetic syntax error: operand expected (error token is "- ")
errors10.sub
invalid numeric argument
bash: line 1: exit: abcde: numeric argument required
after exit: 2
@@ -302,6 +315,7 @@ errors: line 3: break: too many arguments
after break: 2
errors: line 3: continue: too many arguments
after continue: 2
errors11.sub
bash: line 1: readonly: `non-identifier': not a valid identifier
after: 1
bash: line 1: export: `non-identifier': not a valid identifier
@@ -330,6 +344,7 @@ bash: line 1: readonly: `AA[4]': not a valid identifier
array: 1
sh: line 1: export: `AA[4]': not a valid identifier
sh: line 1: readonly: `AA[4]': not a valid identifier
errors12.sub
bash: -c: line 5: syntax error: unexpected end of file from `if' command on line 1
bash: -c: line 3: syntax error: unexpected end of file from `while' command on line 1
bash: -c: line 4: syntax error: unexpected end of file from `until' command on line 1
+17 -12
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# These should all be safe
LC_ALL=C
LC_CTYPE=C
@@ -348,31 +350,34 @@ readonly xx=5
echo $((xx=5))
echo $?
${THIS_SH} ./errors1.sub
${THIS_SH} ./errors2.sub
${THIS_SH} ./errors3.sub
${THIS_SH} ./errors4.sub
test_runsub ./errors1.sub
test_runsub ./errors2.sub
test_runsub ./errors3.sub
test_runsub ./errors4.sub
printf '\terrors4.sub\n'
${THIS_SH} -o posix ./errors4.sub
${THIS_SH} ./errors5.sub
test_runsub ./errors5.sub
${THIS_SH} ./errors6.sub
test_runsub ./errors6.sub
printf '\terrors6.sub\n'
THIS_SH="${THIS_SH} -o posix" ${THIS_SH} ./errors6.sub
${THIS_SH} ./errors7.sub
test_runsub ./errors7.sub
printf '\terrors7.sub\n'
${THIS_SH} -o posix ./errors7.sub
${THIS_SH} ./errors8.sub
${THIS_SH} ./errors9.sub
test_runsub ./errors8.sub
test_runsub ./errors9.sub
# invalid numeric arguments and too many arguments
${THIS_SH} ./errors10.sub
test_runsub ./errors10.sub
# invalid identifiers to readonly/export
${THIS_SH} ./errors11.sub
test_runsub ./errors11.sub
# EOF when parsing compound commands
${THIS_SH} ./errors12.sub
test_runsub ./errors12.sub
${THIS_SH} -c 'return ; echo after return' bash
${THIS_SH} -o posix -c 'return ; echo after return' bash
+25 -6
View File
@@ -5,14 +5,14 @@ after exec1.sub with args: 0
after exec1.sub without args: 0
after exec1.sub: one two three
./execscript: line 37: notthere: command not found
./execscript: line 39: notthere: command not found
127
we would do something here with notthere
/tmp/bash: notthere: No such file or directory
127
/bin/sh: /bin/sh: cannot execute binary file
126
./execscript: line 64: /: Is a directory
./execscript: line 66: /: Is a directory
126
/: /: Is a directory
126
@@ -20,7 +20,7 @@ bash: line 1: exec: .: cannot execute: Is a directory
posix-bash: line 1: exec: .: cannot execute: Is a directory
bash: line 1: exec: .: cannot execute: Is a directory
posix-bash: line 1: exec: .: cannot execute: Is a directory
./execscript: line 79: .: /: is a directory
./execscript: line 81: .: /: is a directory
1
126
0
@@ -37,26 +37,30 @@ trap -- 'echo USR1' SIGUSR1
trap -- 'rm -f x.sh x.output ; echo EXIT' EXIT
USR1
EXIT
./execscript: line 103: notthere: command not found
127
./execscript: line 105: notthere: command not found
127
./execscript: line 107: notthere: command not found
127
./execscript: line 113: notthere: command not found
./execscript: line 109: notthere: command not found
127
./execscript: line 115: notthere: command not found
127
./execscript: line 117: notthere: command not found
127
./execscript: line 119: notthere: command not found
127
this is sh
this is sh
unset
ok
exec2.sub
5
exec4.sub
exec5.sub
./exec5.sub: line 4: exec: bash-notthere: not found
127
this is ohio-state
exec6.sub
0
1
1
@@ -78,8 +82,10 @@ this is ohio-state
0
1
0
exec7.sub
testb
expand_aliases on
exec9.sub
1
1
1
@@ -88,6 +94,7 @@ expand_aliases on
0
0
0
exec10.sub
/usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
cannot find cat in $TMPDIR
cannot find cat with empty $PATH
@@ -95,6 +102,7 @@ PATH = /usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
cannot find cat in $TMPDIR with hash
cannot find cat with empty $PATH with hash
PATH = /usr/local/bin:/usr/GNU/bin:/usr/bin:/bin:.
exec11.sub
trap -- 'echo foo $BASH_SUBSHELL' EXIT
trap -- 'echo USR1 $BASHPID' SIGUSR1
between
@@ -109,11 +117,17 @@ group pipeline: 1
EXIT-group.1
foo 0
after
exec12.sub
exit code: 1
exec12.sub
exit code: 1
exec12.sub
exit code: 1
exec12.sub
exit code: 1
exec12.sub
exit code: 1
exec12.sub
exit code: 1
a
b
@@ -125,6 +139,7 @@ d
c
d
e
exec13.sub
x1
x1a
x2
@@ -133,6 +148,7 @@ x2b
x3
x3a
x3b
exec14.sub
WORKS
done
WORKS
@@ -189,6 +205,7 @@ w
x
y
z
exec15.sub
Darwin
x
archive
@@ -219,6 +236,7 @@ test
sub3
1 done
42
exec16.sub
test invert
reached subshell
reached group
@@ -247,6 +265,7 @@ reached AND-AND body
reached OR-OR body
reached AND-AND group
reached OR-OR group
exec17.sub
./exec17.sub: line 26: exec: notthere: not found
after failed exec: 127
./exec17.sub: line 31: exec: notthere: not found
+21 -19
View File
@@ -18,6 +18,8 @@ if [ $UID -eq 0 ]; then
echo "execscript: the test suite should not be run as root" >&2
fi
. ./test-aux-functions
# this should succeed silently
$cmd &
@@ -129,13 +131,13 @@ echo ${PATH-unset}
echo "echo ok" | ${THIS_SH} -t
${THIS_SH} ./exec2.sub
test_runsub ./exec2.sub
echo $?
${THIS_SH} ./exec4.sub
test_runsub ./exec4.sub
# try exec'ing a command that cannot be found in $PATH
${THIS_SH} ./exec5.sub
test_runsub ./exec5.sub
# this was a bug in bash versions before bash-2.04
${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-
@@ -143,17 +145,17 @@ ${THIS_SH} -c 'cat </dev/null | cat >/dev/null' >&-
# checks for proper return values in subshell commands with inverted return
# values
${THIS_SH} ./exec6.sub
test_runsub ./exec6.sub
# checks for properly deciding what constitutes an executable file
${THIS_SH} ./exec7.sub
test_runsub ./exec7.sub
HISTFILE= ${THIS_SH} --norc -i ${PWD}/exec8.sub
${THIS_SH} ./exec9.sub
test_runsub ./exec9.sub
${THIS_SH} ./exec10.sub
${THIS_SH} ./exec11.sub
test_runsub ./exec10.sub
test_runsub ./exec11.sub
true | `echo true` &
@@ -181,13 +183,13 @@ fi
# problem with undoing redirections before running exit trap through bash-4.3
${THIS_SH} ./exec12.sub false # function
${THIS_SH} ./exec12.sub command false
${THIS_SH} ./exec12.sub $FALSE
test_runsub ./exec12.sub false # function
test_runsub ./exec12.sub command false
test_runsub ./exec12.sub $FALSE
${THIS_SH} ./exec12.sub notfound
${THIS_SH} ./exec12.sub syntaxerror
${THIS_SH} ./exec12.sub nosuchcommand
test_runsub ./exec12.sub notfound
test_runsub ./exec12.sub syntaxerror
test_runsub ./exec12.sub nosuchcommand
# problem with fork optimization in bash-4.4-alpha
@@ -197,14 +199,14 @@ $THIS_SH -c 'echo A && /bin/echo B'
$THIS_SH -c '/bin/echo c && echo d'
$THIS_SH -c '/bin/echo c && /bin/echo d && echo e'
${THIS_SH} ./exec13.sub
${THIS_SH} ./exec14.sub
test_runsub ./exec13.sub
test_runsub ./exec14.sub
# problems with fork optimization in bash-5.2
${THIS_SH} ./exec15.sub
test_runsub ./exec15.sub
# problems with set -e and inverting commands' return status
${THIS_SH} ./exec16.sub
test_runsub ./exec16.sub
# test behavior of redirections when exec fails and does not exit the shell
${THIS_SH} ./exec17.sub
test_runsub ./exec17.sub
+13
View File
@@ -155,6 +155,7 @@ a b c
argv[1] = <a>
argv[2] = <b>
argv[3] = <>
exp1.sub
argv[1] = <^?>
argv[1] = <^?>
argv[1] = <^?>
@@ -180,20 +181,24 @@ argv[1] = <\^A^?>
argv[1] = <\^A^?>
argv[1] = <^\^A ^\^?>
argv[1] = <^A ^_>
exp2.sub
0.net
0.net0
0.net
0.net
0.net
exp3.sub
graph
yes
a
a
exp4.sub
val
val
val
no arg passed
exp5.sub
hello
[0;31m\]
]
@@ -202,6 +207,7 @@ hello
hello
eo
exp6.sub
argv[1] = <a>
argv[1] = <a>
argv[1] = <^?>
@@ -229,6 +235,7 @@ argv[1] = <correct>
argv[2] = <a>
argv[1] = <correct>
argv[2] = <a>
exp7.sub
argv[1] = <^A>
argv[1] = <3>
argv[2] = <^C>
@@ -241,6 +248,7 @@ argv[1] = <XY^AYX>
argv[1] = <XY>
argv[2] = <Y>
argv[1] = <XY^AY>
exp8.sub
argv[1] = <x^Ay^?z>
argv[1] = <x^Ay^?z>
declare -- var=$'x\001y\177z'
@@ -258,6 +266,7 @@ declare -a array=([0]=$'x\001y\177z')
argv[1] = <x^Ay^?z>
declare -a array=([0]=$'x\001y\177z')
declare -A array=([$'x\001y\177z']=$'a\242b\002c' )
exp9.sub
abc
def
ghi
@@ -360,6 +369,7 @@ jkl
[]
[foo]
[]
exp10.sub
< A >< B >< A >< B >
< A >< B >< A >< B >
< A >< B >< a >< b >
@@ -371,6 +381,7 @@ jkl
< A >< B >< a >< b >
< A >< B >< A >< B >
< A >< B ><' A '><' B '>
exp11.sub
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
@@ -412,6 +423,7 @@ ok 6
ok 7
ok 8
ok 9
exp12.sub
argv[1] = <file.o>
argv[1] = <posix>
argv[1] = </src/cmd>
@@ -425,6 +437,7 @@ cdefg
abcdefg
abcde
abcdefg
exp13.sub
foo
declare -- a="foo"
7
+15 -18
View File
@@ -19,6 +19,8 @@
#
# Chet Ramey
. ./test-aux-functions
#
# If you comment out the body of this function, you can do a diff against
# `expansion-tests.right' to see if the shell is behaving correctly
@@ -415,21 +417,16 @@ echo ${a//\?/ }
${THIS_SH} -c 'var=a:b: ; IFS=" :" ; recho $var""' bash
${THIS_SH} ./exp1.sub
${THIS_SH} ./exp2.sub
${THIS_SH} ./exp3.sub
${THIS_SH} ./exp4.sub
${THIS_SH} ./exp5.sub
${THIS_SH} ./exp6.sub
${THIS_SH} ./exp7.sub
${THIS_SH} ./exp8.sub
${THIS_SH} ./exp9.sub
${THIS_SH} ./exp10.sub
${THIS_SH} ./exp11.sub
${THIS_SH} ./exp12.sub
${THIS_SH} ./exp13.sub
test_runsub ./exp1.sub
test_runsub ./exp2.sub
test_runsub ./exp3.sub
test_runsub ./exp4.sub
test_runsub ./exp5.sub
test_runsub ./exp6.sub
test_runsub ./exp7.sub
test_runsub ./exp8.sub
test_runsub ./exp9.sub
test_runsub ./exp10.sub
test_runsub ./exp11.sub
test_runsub ./exp12.sub
test_runsub ./exp13.sub
+5 -2
View File
@@ -3,9 +3,12 @@ exportfunc ok 2
./exportfunc.tests: line 37: cve7169-bad: No such file or directory
./exportfunc.tests: eval: line 44: syntax error: unexpected end of file from `{' command on line 42
./exportfunc.tests: line 43: cve7169-bad2: No such file or directory
exportfunc1.sub
./exportfunc1.sub: line 14: maximum here-document count exceeded
./exportfunc.tests: line 72: HELLO_WORLD: No such file or directory
./exportfunc.tests: eval: line 83: unexpected EOF while looking for matching `}'
exportfunc2.sub
./exportfunc.tests: line 74: HELLO_WORLD: No such file or directory
./exportfunc.tests: eval: line 85: unexpected EOF while looking for matching `}'
exportfunc3.sub
./exportfunc3.sub: line 23: export: foo=bar: cannot export
status: 1
equals-1
+3
View File
@@ -44,9 +44,11 @@ eval 'X() { (a)>\' ; . ./bar 2>/dev/null
rm -f cve7169-bad2 $TMPDIR/bar
# CVE-2014-7186
printf '\texportfunc1.sub\n'
${THIS_SH} ./exportfunc1.sub
# CVE-2014-7187
printf '\texportfunc2.sub\n'
${THIS_SH} ./exportfunc2.sub
# CVE-2014-6277
@@ -90,4 +92,5 @@ unset -f foo
env $'BASH_FUNC_#badname%%'=$'() { :; }\nfoo () { echo transform-4; } ' ${THIS_SH} -c 'foo' 2>/dev/null
# tests of exported names
printf '\texportfunc3.sub\n'
${THIS_SH} ./exportfunc3.sub
+8
View File
@@ -79,6 +79,7 @@ a b a,b a-b a.b a:b a;b a_b
a b a,b a-b a.b a:b a;b a_b
argv[1] = <ef>
a,b
extglob1.sub
a.c
a.c
a.c
@@ -88,10 +89,12 @@ a.c
ok 1
ok 2
ok 3
extglob1a.sub
a ab
a ab
a ab
a
extglob3.sub
*(.)
a.log
*(foo)
@@ -104,6 +107,7 @@ a.log
*(foo|bar).*
a.log
a.log
extglob4.sub
.x .y .z
a b c
.x .y .z a b c
@@ -113,7 +117,9 @@ a b c
a b c
.x .y .z a b c
.x .y .z a b c
extglob5.sub
*
extglob6.sub
.b a
.b a
a .b
@@ -124,6 +130,7 @@ a .b
a .b
.b
.b
extglob7.sub
dotglob: .a .foo bar
@(.foo)
.foo
@@ -182,6 +189,7 @@ no dotglob: .a .foo bar
? . .. .a .foo
*
bar
extglob8.sub
extglob off
x
extglob off
+10 -8
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# test the ksh-like extended globbing features: [!@*?+](patlist)
shopt -s extglob
@@ -384,13 +386,13 @@ foo=
foo=${foo/#*([.])}
unset foo
${THIS_SH} ./extglob1.sub
${THIS_SH} ./extglob1a.sub
${THIS_SH} ./extglob3.sub
${THIS_SH} ./extglob4.sub
${THIS_SH} ./extglob5.sub
${THIS_SH} ./extglob6.sub
${THIS_SH} ./extglob7.sub
${THIS_SH} ./extglob8.sub
test_runsub ./extglob1.sub
test_runsub ./extglob1a.sub
test_runsub ./extglob3.sub
test_runsub ./extglob4.sub
test_runsub ./extglob5.sub
test_runsub ./extglob6.sub
test_runsub ./extglob7.sub
test_runsub ./extglob8.sub
exit 0
+5
View File
@@ -38,6 +38,7 @@ zf ()
{
echo this is zf
}
func1.sub
f is a function
f ()
{
@@ -118,6 +119,7 @@ testgrp ()
} 1>&2;
echo testgrp-b
}
func2.sub
funca is a function
funca ()
{
@@ -141,6 +143,7 @@ foo-bar ()
{
:
}
func3.sub
expect 5 10
5 10
expect 20
@@ -153,6 +156,7 @@ expect 2 40
2 40
expect 5 20
5 20
func4.sub
./func4.sub: line 23: foo: maximum function nesting level exceeded (100)
1
after: f = 100
@@ -166,6 +170,7 @@ after FUNCNEST unset: f = 201
./func4.sub: line 23: foo: maximum function nesting level exceeded (20)
1
after FUNCNEST assign: f = 38
func5.sub
./func5.sub: line 31: `sys$read': not a valid identifier
11111 ()
{
+7 -5
View File
@@ -17,6 +17,8 @@ if [ -n "$funcs" ]; then
unset -f $funcs
fi
. ./test-aux-functions
a()
{
x=$((x - 1))
@@ -168,20 +170,20 @@ ${THIS_SH} -c 'type -t zf'
${THIS_SH} -c 'type zf'
unset -f zf
${THIS_SH} ./func1.sub
test_runsub ./func1.sub
# tests for functions whose bodies are not group commands, with and without
# attached redirections
${THIS_SH} ./func2.sub
test_runsub ./func2.sub
# test for some posix-specific function behavior
${THIS_SH} ./func3.sub
test_runsub ./func3.sub
# FUNCNEST testing
${THIS_SH} ./func4.sub
test_runsub ./func4.sub
# function naming restrictions
${THIS_SH} ./func5.sub
test_runsub ./func5.sub
unset -f myfunction
myfunction() {
+19 -1
View File
@@ -2,34 +2,45 @@ getopts: usage: getopts optstring name [arg ...]
2
getopts: usage: getopts optstring name [arg ...]
2
./getopts.tests: line 23: getopts: -a: invalid option
./getopts.tests: line 25: getopts: -a: invalid option
getopts: usage: getopts optstring name [arg ...]
getopts1.sub
-a specified
-b bval specified
remaining args: one two three
getopts1.sub
-a specified
-b bval specified
remaining args: one two three four five six seven eight nine ten eleven twelve
getopts1.sub
./getopts1.sub: option requires an argument -- b
Usage: ./getopts1.sub [-a] [-b value] args
getopts2.sub
-a specified
-c cval specified
-d specified
getopts3.sub
-a specified
-b 3 specified
remaining args: one two three four five
getopts4.sub
-a specified
-b bval specified
remaining args: one two three
getopts4.sub
-a specified
-b bval specified
remaining args: one two three
getopts4.sub
./getopts4.sub: error: option `b' requires an argument
Usage: ./getopts4.sub [-a] [-b value] args
getopts4.sub
./getopts4.sub: error: illegal option character `c'
Usage: ./getopts4.sub [-a] [-b value] args
getopts4.sub
-a specified
remaining args: -b bval one two three
getopts5.sub
OPTERR=0
a here
something else here
@@ -45,22 +56,29 @@ something else here
getop: OPTIND=5
OPTIND=3
OPTERR=0
getopts6.sub
-a specified
remaining args:
getopts6.sub
-a specified
remaining args:
getopts6.sub
-a specified
remaining args:
0
getopts7.sub
./getopts7.sub: line 17: getopts: `opt-var': not a valid identifier
remaining args:
getopts8.sub
opt: x
opt: y
opt: a
opt: b
opt: c
opt: z
getopts9.sub
$1 = a
getopts10.sub
./getopts10.sub: line 16: OPTARG: readonly variable
OPTARG = x = ?
unset x = ?
+20 -18
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# getopts tests
# this should fail
getopts
@@ -22,35 +24,35 @@ echo $?
# used in error messages, but not yet
getopts -a opts name
${THIS_SH} ./getopts1.sub -a -b bval one two three
test_runsub ./getopts1.sub -a -b bval one two three
# make sure getopts works when there are more than 9 positional parameters
${THIS_SH} ./getopts1.sub -a -b bval one two three four five six seven eight nine ten eleven twelve
${THIS_SH} ./getopts1.sub -a -b
test_runsub ./getopts1.sub -a -b bval one two three four five six seven eight nine ten eleven twelve
test_runsub ./getopts1.sub -a -b
${THIS_SH} ./getopts2.sub -ad -c cval three four five
test_runsub ./getopts2.sub -ad -c cval three four five
${THIS_SH} ./getopts3.sub
test_runsub ./getopts3.sub
# make sure that `-b bval' and `-bbval' are equivalent
${THIS_SH} ./getopts4.sub -a -b bval one two three
${THIS_SH} ./getopts4.sub -a -bbval one two three
test_runsub ./getopts4.sub -a -b bval one two three
test_runsub ./getopts4.sub -a -bbval one two three
# this tests `silent' error reporting
${THIS_SH} ./getopts4.sub -a -b
${THIS_SH} ./getopts4.sub -a -c
test_runsub ./getopts4.sub -a -b
test_runsub ./getopts4.sub -a -c
# make sure that `--' can be used to end the list of options
${THIS_SH} ./getopts4.sub -a -- -b bval one two three
test_runsub ./getopts4.sub -a -- -b bval one two three
${THIS_SH} ./getopts5.sub -a -c
test_runsub ./getopts5.sub -a -c
${THIS_SH} ./getopts6.sub -a
${THIS_SH} ./getopts6.sub -a -c
${THIS_SH} ./getopts6.sub -ac
test_runsub ./getopts6.sub -a
test_runsub ./getopts6.sub -a -c
test_runsub ./getopts6.sub -ac
echo $? # this should be 2
${THIS_SH} ./getopts7.sub -a
test_runsub ./getopts7.sub -a
${THIS_SH} ./getopts8.sub
${THIS_SH} ./getopts9.sub
test_runsub ./getopts8.sub
test_runsub ./getopts9.sub
${THIS_SH} ./getopts10.sub
test_runsub ./getopts10.sub
+12 -1
View File
@@ -1,4 +1,6 @@
glob1.sub
foo/bar foobar/bar
glob2.sub
ok 1
ok 2
ok 3
@@ -13,6 +15,7 @@ argv[1] = <a
0000004
ok 6
ok 7
glob3.sub
invalid bracket expression
== LANG=C ==
[[:alpha:]
@@ -64,6 +67,7 @@ ok 2
ok 3
ok 4
ok 5
glob4.sub
argv[1] = <a\?>
a\?
argv[1] = <a\?>
@@ -71,6 +75,7 @@ a\?
a\a
<define\/\
/>
glob5.sub
./tmp/a/b/c ./tmp/a/b/c ./tmp/a/b/c
./tmp/a/b/c ./tmp/a/b/c ./tmp/a/b/c
./tmp/a/b/c
@@ -99,6 +104,7 @@ argv[1] = <./tmp/>
argv[1] = <\$foo>
argv[2] = <\$foo>
argv[1] = <mixed\$foo/>
glob6.sub
<abcdefg>
<\.>
*abc.c
@@ -111,20 +117,25 @@ readable/\.
searchable/.
searchable/.
searchable/.
glob7.sub
1: [qwe/qwe]
2: [qwe/
3: [qwe/]
4:
5: [qwe/
6:
glob8.sub
a\*b
a\*b*
glob9.sub
é/*
é/*
glob10.sub
a aa b bb
.a .aa .b .bb a aa b bb
.a .aa .b .bb
. .. .a .aa .b .bb
glob11.sub
mailcheck.o make_cmd.o mksignames mksignames.o mksyntax mksyntax.dSYM
mailcheck.o make_cmd.o mksignames mksignames.o mksyntax mksyntax.dSYM
@@ -157,7 +168,7 @@ argv[2] = <abc>
argv[3] = <abd>
argv[4] = <abe>
tmp/l1 tmp/l2 tmp/*4 tmp/l3
./glob.tests: line 67: no match: tmp/*4
./glob.tests: line 69: no match: tmp/*4
argv[1] = <bdir/>
argv[1] = <*>
argv[1] = <a*>
+14 -12
View File
@@ -20,18 +20,20 @@ expect()
: # if needed, change me to echo expect "$@"
}
. ./test-aux-functions
# First, a test that bash-2.01.1 fails
${THIS_SH} ./glob1.sub
${THIS_SH} ./glob2.sub
${THIS_SH} ./glob3.sub
${THIS_SH} ./glob4.sub
${THIS_SH} ./glob5.sub
${THIS_SH} ./glob6.sub
${THIS_SH} ./glob7.sub
${THIS_SH} ./glob8.sub
${THIS_SH} ./glob9.sub
${THIS_SH} ./glob10.sub
${THIS_SH} ./glob11.sub
test_runsub ./glob1.sub
test_runsub ./glob2.sub
test_runsub ./glob3.sub
test_runsub ./glob4.sub
test_runsub ./glob5.sub
test_runsub ./glob6.sub
test_runsub ./glob7.sub
test_runsub ./glob8.sub
test_runsub ./glob9.sub
test_runsub ./glob10.sub
test_runsub ./glob11.sub
MYDIR=$PWD # save where we are
@@ -64,7 +66,7 @@ mkdir tmp
touch tmp/l1 tmp/l2 tmp/l3
builtin echo tmp/l[12] tmp/*4 tmp/*3
shopt -s failglob
builtin echo tmp/l[12] tmp/*4 tmp/*3
( builtin echo tmp/l[12] tmp/*4 tmp/*3 ) 2>&1
rm -r tmp
shopt -u failglob
+3
View File
@@ -150,9 +150,11 @@ getenv.o
input_avail.o
itos.o
alias.o builtins builtins/history.o builtins/jobs.o builtins/kill.o builtins/let.o builtins/mapfile.o lib lib/glob lib/glob/glob.o lib/glob/smatch.o lib/glob/strmatch.o lib/readline lib/readline/bind.o lib/readline/callback.o lib/readline/compat.o lib/readline/complete.o lib/readline/display.o lib/sh lib/sh/casemod.o lib/sh/clktck.o lib/sh/clock.o lib/sh/eaccess.o lib/sh/fdprintf.o lib/sh/fmtullong.o lib/sh/fmtulong.o lib/sh/fmtumax.o lib/sh/fpurge.o lib/sh/getenv.o lib/sh/input_avail.o lib/sh/itos.o pcomplib.o print_cmd.o redir.o shell.o sig.o stringlib.o subst.o syntax.o test.o trap.o unwind_prot.o variables.o version.o xmalloc.o y.tab.o
globstar1.sub
bar/foo foo
bar/foo/ foo/
bar/foo/e bar/foo/f foo/a foo/b
globstar2.sub
<a>
<a/a>
<a/a/a>
@@ -582,6 +584,7 @@ bar/foo/e bar/foo/f foo/a foo/b
<b/b/a/a>
<b/b/a/b>
<b/b/b/a>
globstar3.sub
a a/aa a/ab b b/bb b/bc c
a/ b/ c/
a/ab b b/bb
+5 -3
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
: ${TMPDIR:=/var/tmp}
dir=$PWD
@@ -51,6 +53,6 @@ echo **
cd $dir
rm -rf $GDIR
${THIS_SH} ./globstar1.sub
${THIS_SH} ./globstar2.sub
${THIS_SH} ./globstar3.sub
test_runsub ./globstar1.sub
test_runsub ./globstar2.sub
test_runsub ./globstar3.sub
+11 -1
View File
@@ -51,6 +51,7 @@ ENDOFINPUT
aa=1
}
heredoc1.sub
foo is a function
foo ()
{
@@ -70,7 +71,9 @@ qux
bar
qux
heredoc2.sub
abc def geh
heredoc3.sub
./heredoc3.sub: line 20: warning: here-document at line 18 delimited by end-of-file (wanted `EOF')
= here is the text =
./heredoc3.sub: line 26: warning: here-document at line 24 delimited by end-of-file (wanted `EOF')
@@ -96,6 +99,7 @@ hello
end hello<NL>\END
./heredoc3.sub: line 98: warning: here-document at line 96 delimited by end-of-file (wanted `EOF')
./heredoc3.sub: line 99: syntax error: unexpected end of file from `(' command on line 96
heredoc4.sub
heredoc1
EOF
Ok:0
@@ -104,6 +108,8 @@ argv[2] = <threefour>
argv[1] = <two>
argv[2] = <threefi>
argv[3] = <ve>
heredoc5.sub
heredoc6.sub
1: OK
2: OK
3: OK
@@ -124,6 +130,7 @@ argv[3] = <ve>
5: ${x#$pat}
6: ${y#$'not'}
7: ${y#'not'}
heredoc7.sub
./heredoc7.sub: line 17: warning: command substitution: 1 unterminated here-document
foo bar
./heredoc7.sub: line 21: after: command not found
@@ -131,6 +138,8 @@ foo bar
./heredoc7.sub: line 26: foobar: command not found
./heredoc7.sub: line 27: EOF: command not found
grep: *.c: No such file or directory
heredoc8.sub
heredoc9.sub
foo ()
{
echo begin;
@@ -153,6 +162,7 @@ HERE
echo 3 4;
done
}
heredoc10.sub
hello
world
hello
@@ -162,7 +172,7 @@ here-doc line 2
here-document
here-document
comsub here-string
./heredoc.tests: line 184: warning: here-document at line 181 delimited by end-of-file (wanted `')
./heredoc.tests: line 186: warning: here-document at line 183 delimited by end-of-file (wanted `')
hi
there
''
+12 -10
View File
@@ -148,28 +148,30 @@ type fff
export -f fff
${THIS_SH} -c 'type fff'
${THIS_SH} ./heredoc1.sub
. ./test-aux-functions
test_runsub ./heredoc1.sub
# test heredocs in command substitutions
${THIS_SH} ./heredoc2.sub
${THIS_SH} ./heredoc3.sub
${THIS_SH} ./heredoc4.sub
test_runsub ./heredoc2.sub
test_runsub ./heredoc3.sub
test_runsub ./heredoc4.sub
# heredoc tests that use different size documents to test pipe implementation
${THIS_SH} ./heredoc5.sub
test_runsub ./heredoc5.sub
# test $'...' and $"..." quoted strings in here-documents
${THIS_SH} ./heredoc6.sub
test_runsub ./heredoc6.sub
# interaction between here-documents and command substitutions
${THIS_SH} ./heredoc7.sub
${THIS_SH} ./heredoc8.sub
test_runsub ./heredoc7.sub
test_runsub ./heredoc8.sub
# various tests for printing here-documents in function bodies
${THIS_SH} ./heredoc9.sub
test_runsub ./heredoc9.sub
# test various combinations of here-documents and aliases
${THIS_SH} ./heredoc10.sub
test_runsub ./heredoc10.sub
echo $(
cat <<< "comsub here-string"
+1
View File
@@ -32,6 +32,7 @@ echo $(echo hi)
echo ho
echo off to work we go
declare -a uu=([0]="" [1]="kghfjk" [2]="jkfzuk" [3]=$'i\n')
herestr1.sub
foo bar
foo bar
qux:::::bax
+1
View File
@@ -77,4 +77,5 @@ cat <<< "echo $(echo off to work we go)"
IFS="/" read -r -d $'\000' -a uu <<< /kghfjk/jkfzuk/i
declare -p uu
printf '\therestr1.sub\n'
${THIS_SH} ./herestr1.sub
+8 -1
View File
@@ -1,5 +1,5 @@
echo $BASH_VERSION
./histexp.tests: line 37: history: !!:z: history expansion failed
./histexp.tests: line 39: history: !!:z: history expansion failed
1 for i in one two three; do echo $i; done
2 /bin/sh -c 'echo this is $0'
3 ls
@@ -138,6 +138,7 @@ echo four ; echo two
3
echo $((1+2))
3
histexp1.sub
!
!
!
@@ -155,6 +156,7 @@ echo $((1+2))
2 hi 0
!
!
histexp2.sub
a
b
c
@@ -162,6 +164,7 @@ echo "#!/bin/bash" set -o posix
#!/bin/bash set -o posix
!!
!!
histexp3.sub
a
echo $(echo echo a)
echo a
@@ -197,6 +200,7 @@ echo i echo i
j
echo `echo j` echo j
j echo j
histexp4.sub
a
cat < <(echo echo a)
echo a
@@ -210,6 +214,7 @@ d
e
! !
./histexp4.sub: line 33: !': event not found
histexp5.sub
/tmp/Step1
echo /$(echo tmp)/Step1
/tmp/Step1
@@ -230,6 +235,7 @@ echo +(/one|/two|/three)/Step1
*(/tmp|/dev|/usr)/Step1
echo *(/tmp|/dev|/usr)/Step1
*(/tmp|/dev|/usr)/Step1
histexp6.sub
one
echo echo one
echo one
@@ -247,6 +253,7 @@ echo two
1 echo two
2 for f in a b c; do echo echo two; done
3 history
histexp7.sub
a
echo !!
--between--
+9 -7
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
LC_ALL=C
LANG=C
trap 'rm $TMPDIR/newhistory' 0
@@ -153,10 +155,10 @@ echo !$ ; echo !:2:p
echo $((1+2))
echo !!:1
${THIS_SH} ./histexp1.sub
${THIS_SH} ./histexp2.sub
${THIS_SH} ./histexp3.sub
${THIS_SH} ./histexp4.sub
${THIS_SH} ./histexp5.sub
${THIS_SH} ./histexp6.sub
${THIS_SH} ./histexp7.sub
test_runsub ./histexp1.sub
test_runsub ./histexp2.sub
test_runsub ./histexp3.sub
test_runsub ./histexp4.sub
test_runsub ./histexp5.sub
test_runsub ./histexp6.sub
test_runsub ./histexp7.sub
+14 -5
View File
@@ -1,7 +1,7 @@
./history.tests: line 17: history: -x: invalid option
./history.tests: line 19: history: -x: invalid option
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
./history.tests: line 19: history: cannot use more than one of -anrw
./history.tests: line 22: fc: -v: invalid option
./history.tests: line 21: history: cannot use more than one of -anrw
./history.tests: line 24: fc: -v: invalid option
fc: usage: fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]
1 for i in one two three; do echo $i; done
2 /bin/sh -c 'echo this is $0'
@@ -97,7 +97,7 @@ line 2 for history
6 HISTFILE=$TMPDIR/newhistory
7 echo displaying \$HISTFILE after history -a
8 cat $HISTFILE
./history.tests: line 91: fc: no command found
./history.tests: line 93: fc: no command found
15 echo line 2 for history
16 unset HISTSIZE
17 unset HISTFILE
@@ -107,7 +107,7 @@ echo xx xb xc
xx xb xc
echo 44 48 4c
44 48 4c
./history.tests: line 106: fc: no command found
./history.tests: line 108: fc: no command found
aa
bb
cc
@@ -121,6 +121,7 @@ echo cc
echo cc
cc
1
history1.sub
one
two
three
@@ -142,10 +143,12 @@ two
three
(exit 42)
42
history2.sub
5.3
echo ${BASH_VERSION%\.*}
5.3
echo ${BASH_VERSION%\.*}
history3.sub
a
b
c
@@ -182,6 +185,7 @@ i
./history3.sub: line 48: history: @42: invalid number
./history3.sub: line 49: history: @42: numeric argument required
history4.sub
0
1
@@ -231,6 +235,7 @@ mid
right)
A
B
history5.sub
a
b
./history5.sub: line 24: fc: history specification out of range
@@ -284,6 +289,7 @@ e
6 echo a
7 echo d
8 echo e
history6.sub
1
2
3
@@ -317,6 +323,7 @@ e
7 echo 9
8 echo 10
5 echo 10
history7.sub
$ 1
$ 2
$ 3
@@ -361,6 +368,7 @@ $ 1
$ 2
$ exit
0
history8.sub
a
b
c
@@ -372,6 +380,7 @@ d
5 history
./history8.sub: line 15: history: 72: history position out of range
./history8.sub: line 16: history: -72: history position out of range
history9.sub
1 echo below zero
2 cat <<EOF
+11 -9
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
trap 'rm $TMPDIR/newhistory' 0
# bad options
@@ -124,14 +126,14 @@ set +o history
shopt -q -o history
echo $?
${THIS_SH} ./history1.sub
test_runsub ./history1.sub
rm -f $TMPDIR/foohist-*
${THIS_SH} ./history2.sub
${THIS_SH} ./history3.sub
${THIS_SH} ./history4.sub
${THIS_SH} ./history5.sub
${THIS_SH} ./history6.sub
${THIS_SH} ./history7.sub
${THIS_SH} ./history8.sub
${THIS_SH} ./history9.sub
test_runsub ./history2.sub
test_runsub ./history3.sub
test_runsub ./history4.sub
test_runsub ./history5.sub
test_runsub ./history6.sub
test_runsub ./history7.sub
test_runsub ./history8.sub
test_runsub ./history9.sub
+1
View File
@@ -8,5 +8,6 @@ a:b:c:d:e
a:b:c:d:e
a b c d e
a b c d e
ifs1.sub
argv[1] = <file>
argv[1] = <*>
+3 -1
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
OIFS="$IFS"
IFS=":$IFS"
eval foo="a:b:c"
@@ -73,4 +75,4 @@ echo $x
IFS="$DEFIFS"
${THIS_SH} ./ifs1.sub
test_runsub ./ifs1.sub
+7
View File
@@ -8,20 +8,25 @@ ok 2
aéb
0000000 141 303 251 142
0000004
intl1.sub
-абвгдежзиклмноп - 16
-абвгдежзиклмноп- 15
-абвгд- 5
intl2.sub
1,0000
1.0000
1.0000
1.0000
1.0000
1,0000
intl3.sub
1
bytematch
0000000 254 012
0000002
unicode1.sub
Passed all 1770 Unicode tests
unicode2.sub
0000000 303 277 012
0000003
0000000 303 277 012
@@ -50,11 +55,13 @@ Passed all 1770 Unicode tests
0000003
0000000 101 040 302 243 040 305 222 012
0000010
unicode3.sub
./unicode3.sub: line 5: $'5\247@3\231+\306S8\237\242\352\263': command not found
./unicode3.sub: line 7: cd: $'5\247@3\231+\306S8\237\242\352\263': No such file or directory
$'5\247@3\231+\306S8\237\242\352\263'
+ : $'5\247@3\231+\306S8\237\242\352\263'
+ set +x
intl4.sub
ಇಳಿಕೆಗಳು
ಇಳ
+7 -7
View File
@@ -54,17 +54,17 @@ printf '%s\n' "$*"
printf '%s' "$*" | od -b | _intl_normalize_spaces
# display differences make this problematic
${THIS_SH} ./intl1.sub
test_runsub ./intl1.sub
# this tests both international handling in printf and temporary environments
${THIS_SH} ./intl2.sub
test_runsub ./intl2.sub
# test splitting on characters instead of bytes
${THIS_SH} ./intl3.sub
test_runsub ./intl3.sub
${THIS_SH} ./unicode1.sub # 2>/dev/null
${THIS_SH} ./unicode2.sub
test_runsub ./unicode1.sub # 2>/dev/null
test_runsub ./unicode2.sub
${THIS_SH} ./unicode3.sub 2>&1
test_runsub ./unicode3.sub 2>&1
${THIS_SH} ./intl4.sub
test_runsub ./intl4.sub
+3
View File
@@ -71,11 +71,13 @@ Shell options:
-abefhkmnptuvxBCEHPT or -o option
this-bash this-bash
$- for -c includes c
invocation1.sub
bash: line 0: badopt: invalid shell option name
checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
checkhash:checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
./invocation1.sub: line 40: BASHOPTS: readonly variable
invocation2.sub
braceexpand:hashall:interactive-comments
braceexpand:hashall:interactive-comments
hashall:interactive-comments
@@ -83,6 +85,7 @@ hashall:interactive-comments
braceexpand:hashall:interactive-comments:noglob
braceexpand:hashall:interactive-comments:noglob
./invocation2.sub: line 50: SHELLOPTS: readonly variable
invocation3.sub
for i in 1 2 3;
do
select var in a b c;
+4 -3
View File
@@ -11,6 +11,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
: ${THIS_SH:=./bash}
@@ -34,12 +35,12 @@ unset BASH_ARGV0
{ ${THIS_SH} -c 'echo $-' bash | grep c >/dev/null; } && echo '$- for -c includes c'
# BASHOPTS
${THIS_SH} ./invocation1.sub
test_runsub ./invocation1.sub
# SHELLOPTS
${THIS_SH} ./invocation2.sub
test_runsub ./invocation2.sub
# rudimentary pretty-print tests
${THIS_SH} ./invocation3.sub
test_runsub ./invocation3.sub
: ${TMPDIR:=/tmp}
TDIR=$TMPDIR/invocation-$$
+1
View File
@@ -59,6 +59,7 @@ argv[1] = <aaa^?bbb>
argv[1] = <ccc^?ddd>
argv[1] = <eee^?fff>
argv[1] = <ggg^?hhh>
iquote1.sub
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <xy>
+3 -1
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# bug in bash up to and including bash-3.0 (including patches)
#
# problem is conflict between CTLNUL used internally to denote quoted null
@@ -155,4 +157,4 @@ recho ccc""ddd
recho "eeefff"
recho ggg"$(echo $'\177')"hhh
${THIS_SH} ./iquote1.sub
test_runsub ./iquote1.sub
+30 -21
View File
@@ -1,5 +1,8 @@
jobs1.sub
jobs2.sub
./jobs2.sub: line 9: fg: job 1 started without job control
fg: 1
jobs3.sub
Waiting for job 0
job 0 returns 0
Waiting for job 1
@@ -16,6 +19,7 @@ Waiting for job 6
job 6 returns 0
Waiting for job 7
job 7 returns 0
jobs4.sub
[1] Running sleep 2 &
[2] Running sleep 2 &
[3] Running sleep 2 &
@@ -24,6 +28,7 @@ job 7 returns 0
4
0
i killed it
jobs5.sub
12
[1]- Running sleep 20 &
[3]+ Running sleep 20 &
@@ -35,18 +40,22 @@ i killed it
./jobs5.sub: line 71: declare: wpid: not found
./jobs5.sub: line 74: wait: `invalid-varname': not a valid identifier
./jobs5.sub: line 76: wait: WV: cannot unset: readonly variable
jobs6.sub
child1 exit status 0
jobs7.sub
[1]+ Running sleep 20 &
./jobs7.sub: line 5: fg: no current jobs
[1]+ Running sleep 20 &
jobs8.sub
jobs9.sub
got USR1
0
./jobs.tests: line 45: wait: %1: no such job
./jobs.tests: line 50: fg: no job control
./jobs.tests: line 47: wait: %1: no such job
./jobs.tests: line 52: fg: no job control
wait-for-pid
wait-errors
./jobs.tests: line 70: wait: `1-1': not a pid or valid job spec
./jobs.tests: line 71: wait: `-4': not a pid or valid job spec
./jobs.tests: line 72: wait: `1-1': not a pid or valid job spec
./jobs.tests: line 73: wait: `-4': not a pid or valid job spec
wait-for-background-pids
async list wait-for-background-pids
async list wait for child
@@ -55,7 +64,7 @@ wait-when-no-children
posix jobs output
[1]+ Done sleep 1
wait-for-job
./jobs.tests: line 96: wait: %2: no such job
./jobs.tests: line 98: wait: %2: no such job
127
async list wait-for-job
forked
@@ -68,21 +77,21 @@ sleep 2
fg-bg 4
sleep 2
fg-bg 5
./jobs.tests: line 123: fg: %2: no such job
./jobs.tests: line 124: bg: job 1 already in background
./jobs.tests: line 125: fg: %2: no such job
./jobs.tests: line 126: bg: job 1 already in background
fg-bg 6
./jobs.tests: line 131: fg: -s: invalid option
./jobs.tests: line 133: fg: -s: invalid option
fg: usage: fg [job_spec]
./jobs.tests: line 132: bg: -s: invalid option
./jobs.tests: line 134: bg: -s: invalid option
bg: usage: bg [job_spec ...]
./jobs.tests: line 137: disown: -s: invalid option
./jobs.tests: line 139: disown: -s: invalid option
disown: usage: disown [-h] [-ar] [jobspec ... | pid ...]
./jobs.tests: line 141: disown: %1: no such job
./jobs.tests: line 144: disown: %2: no such job
./jobs.tests: line 147: disown: warning: @12: job specification requires leading `%'
./jobs.tests: line 147: disown: @12: no such job
./jobs.tests: line 143: disown: %1: no such job
./jobs.tests: line 146: disown: %2: no such job
./jobs.tests: line 149: disown: warning: @12: job specification requires leading `%'
./jobs.tests: line 149: disown: @12: no such job
wait-for-non-child
./jobs.tests: line 150: wait: pid 1 is not a child of this shell
./jobs.tests: line 152: wait: pid 1 is not a child of this shell
127
3 -- 1 2 3 -- 1 - 2 - 3
[1] Running sleep 300 &
@@ -92,8 +101,8 @@ running jobs:
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
./jobs.tests: line 167: kill: %4: no such job
./jobs.tests: line 169: jobs: %4: no such job
./jobs.tests: line 169: kill: %4: no such job
./jobs.tests: line 171: jobs: %4: no such job
current job:
[3]+ Running sleep 400 &
previous job:
@@ -123,9 +132,9 @@ done
after KILL -STOP, foregrounding %1
sleep 4
done
./jobs.tests: line 229: jobs: -q: invalid option
./jobs.tests: line 231: jobs: -q: invalid option
jobs: usage: jobs [-lnprs] [jobspec ...] or jobs -x command [args]
./jobs.tests: line 231: suspend: -z: invalid option
./jobs.tests: line 233: suspend: -z: invalid option
suspend: usage: suspend [-f]
./jobs.tests: line 232: suspend: cannot suspend: no job control
./jobs.tests: line 233: suspend: cannot suspend: no job control
./jobs.tests: line 234: suspend: cannot suspend: no job control
./jobs.tests: line 235: suspend: cannot suspend: no job control
+11 -9
View File
@@ -11,32 +11,34 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
# test out %+, jobs -p, and $! agreement in a subshell first
${THIS_SH} ./jobs1.sub
test_runsub ./jobs1.sub
# test out fg/bg failure in a subshell
${THIS_SH} ./jobs2.sub
test_runsub ./jobs2.sub
# test out behavior of waiting for background pids -- bug in versions
# before 2.03
${THIS_SH} ./jobs3.sub
test_runsub ./jobs3.sub
# test out behavior of using job control notation when job control is not
# active
${THIS_SH} ./jobs4.sub
test_runsub ./jobs4.sub
# test out wait -n framework
${THIS_SH} ./jobs5.sub
test_runsub ./jobs5.sub
# test out wait -f framework
${THIS_SH} ./jobs6.sub
test_runsub ./jobs6.sub
${THIS_SH} ./jobs7.sub
test_runsub ./jobs7.sub
# more disown -h tests
${THIS_SH} ./jobs8.sub
test_runsub ./jobs8.sub
# wait interrupted by signal for which a trap has been set
${THIS_SH} ./jobs9.sub
test_runsub ./jobs9.sub
jobs
echo $?
+3
View File
@@ -8,7 +8,9 @@ last = c
1 -- 0 0 1
1 -- 0 1 0
1 42
lastpipe1.sub
lastpipe1.sub returns 14
lastpipe2.sub
A1
A2
B1
@@ -19,5 +21,6 @@ A2
B1
B2
HI -- 42 -- 0 42
lastpipe3.sub
x=x
x=x
+5 -3
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
binfalse()
{
$binfalse || return 1 # normalize return value
@@ -70,8 +72,8 @@ binfalse | true | true | VAR=42
echo $? $VAR
set +o pipefail
${THIS_SH} ./lastpipe1.sub
test_runsub ./lastpipe1.sub
echo lastpipe1.sub returns $?
${THIS_SH} ./lastpipe2.sub
${THIS_SH} ./lastpipe3.sub
test_runsub ./lastpipe2.sub
test_runsub ./lastpipe3.sub
+2
View File
@@ -152,6 +152,7 @@ a
[28] aaa
[29] aaa
declare -a array=([0]="a" [1]="b" [2]="c" [3]=$'\n')
mapfile1.sub
1 2 3 4 5
foo 0 1
@@ -163,6 +164,7 @@ foo 3 4
foo 4 5
mapfile2.sub
0 abc
1 def
2 ghi
+4 -2
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
declare -a A
mapfile A < mapfile.data
for (( i = 0 ; i < ${#A[@]} ; i++ )); do
@@ -58,5 +60,5 @@ mapfile -t -d $'\xff' array <<<"$s"
declare -p array
unset -v s array
${THIS_SH} ./mapfile1.sub
${THIS_SH} ./mapfile2.sub
test_runsub ./mapfile1.sub
test_runsub ./mapfile2.sub
+44 -19
View File
@@ -27,20 +27,23 @@ changevar: expect <three four five>
argv[1] = <three four five>
expect <three four five>
argv[1] = <three four five>
./nameref.tests: line 106: foo: readonly variable
./nameref.tests: line 107: foo: readonly variable
./nameref.tests: line 108: foo: readonly variable
./nameref.tests: line 109: foo: readonly variable
one
one
./nameref.tests: line 119: foo: readonly variable
./nameref.tests: line 116: foo: readonly variable
./nameref.tests: line 121: foo: readonly variable
./nameref.tests: line 118: foo: readonly variable
one
abxde
abxde
nameref1.sub
one
bar
nameref2.sub
./nameref2.sub: line 5: foo: readonly variable
nameref3.sub
expect <unset>
argv[1] = <unset>
expect <unset>
@@ -57,6 +60,7 @@ two
three
unset
four
nameref4.sub
0
expect <a b>
a b
@@ -97,6 +101,7 @@ X
expect <X>
X
errors = 0
nameref5.sub
1
2
v1: 1
@@ -114,6 +119,7 @@ ref -> one, value: 1
ref -> two, value: 2
ref -> three, value: 3
final state: ref -> three, value: 3
nameref6.sub
./nameref6.sub: line 15: typeset: x: nameref variable self references not allowed
./nameref6.sub: line 18: typeset: x[3]: reference variable cannot be an array
./nameref6.sub: line 25: typeset: x: reference variable cannot be an array
@@ -123,8 +129,10 @@ y -- 0
2 -- 0
2 -- 0
y -- 0
nameref7.sub
bar
unset
nameref8.sub
./nameref8.sub: line 16: typeset: warning: v: circular name reference
./nameref8.sub: line 16: warning: v: circular name reference
./nameref8.sub: line 18: warning: v: maximum nameref depth (8) exceeded
@@ -143,10 +151,12 @@ local
./nameref8.sub: line 67: warning: x: circular name reference
./nameref8.sub: line 68: warning: x: circular name reference
x =
nameref9.sub
idx2
idX2
idx2
idX2
nameref10.sub
declare -n foo="x[\$zero]"
42
declare -a x=([0]="4")
@@ -180,6 +190,7 @@ declare -i bar="8"
8
declare -n foo="bar"
./nameref10.sub: line 77: typeset: bar: not found
nameref11.sub
./nameref11.sub: line 14: declare: `/': invalid variable name for name reference
./nameref11.sub: line 15: declare: `/': invalid variable name for name reference
./nameref11.sub: line 16: `/': not a valid identifier
@@ -210,33 +221,34 @@ x
declare -a r=()
./nameref11.sub: line 33: declare: r: reference variable cannot be an array
./nameref11.sub: line 34: printf: `/': not a valid identifier
./nameref11.sub: line 36: `': not a valid identifier
./nameref11.sub: line 37: declare: `': not a valid identifier
./nameref11.sub: line 38: `': not a valid identifier
./nameref11.sub: line 39: printf: `': not a valid identifier
./nameref11.sub: line 40: declare: `': invalid variable name for name reference
./nameref11.sub: line 39: declare: `': not a valid identifier
./nameref11.sub: line 40: `': not a valid identifier
./nameref11.sub: line 41: printf: `': not a valid identifier
./nameref11.sub: line 42: declare: `': invalid variable name for name reference
declare -r ROVAR="42"
./nameref11.sub: line 45: ROVAR: readonly variable
./nameref11.sub: line 45: ROVAR: cannot unset: readonly variable
./nameref11.sub: line 47: ROVAR: readonly variable
./nameref11.sub: line 47: ROVAR: cannot unset: readonly variable
declare -r ROVAR="42"
./nameref11.sub
./nameref11.sub: line 47: `@': not a valid identifier
./nameref11.sub: line 49: `@': not a valid identifier
./nameref11.sub
declare -n ref="x"
./nameref11.sub: line 52: RO: readonly variable
./nameref11.sub: line 54: RO: readonly variable
declare -r RO_PID
./nameref11.sub: line 52: RO: cannot unset: readonly variable
./nameref11.sub: line 54: RO: cannot unset: readonly variable
declare -r RO="x"
./nameref11.sub: line 52: declare: RO_PID: not found
./nameref11.sub: line 54: RO2: readonly variable
./nameref11.sub: line 54: declare: RO_PID: not found
./nameref11.sub: line 56: RO2: readonly variable
declare -r RO2="a"
2
./nameref11.sub: line 65: typeset: `2': invalid variable name for name reference
./nameref11.sub: line 67: typeset: `2': invalid variable name for name reference
2
./nameref11.sub: line 70: typeset: `2': invalid variable name for name reference
./nameref11.sub: line 72: typeset: `2': invalid variable name for name reference
2
./nameref11.sub: line 75: foo[2]: invalid indirect expansion
./nameref11.sub: line 76: bar: invalid indirect expansion
./nameref11.sub: line 77: foo[2]: invalid indirect expansion
./nameref11.sub: line 78: bar: invalid indirect expansion
nameref12.sub
./nameref12.sub: line 19: declare: `/': invalid variable name for name reference
./nameref12.sub: line 22: declare: `%': invalid variable name for name reference
./nameref12.sub: line 26: `^': not a valid identifier
@@ -262,6 +274,7 @@ declare -n ref
declare -- ref="global"
declare -a var=([0]="foo2")
./nameref12.sub: line 113: declare: global: not found
nameref13.sub
declare -- a
declare -n r="a"
declare -- a
@@ -278,6 +291,7 @@ declare -n r
declare -n foo
./nameref13.sub: line 110: typeset: `12345': invalid variable name for name reference
declare -n foo
nameref14.sub
declare -nx ref="var"
var
var
@@ -300,6 +314,7 @@ after
declare -n ref="var"
./nameref14.sub: line 45: typeset: var: not found
declare -n ref="var"
nameref15.sub
./nameref15.sub: line 14: local: warning: a: circular name reference
./nameref15.sub: line 14: warning: a: circular name reference
./nameref15.sub: line 14: `a[0]': not a valid identifier
@@ -356,6 +371,7 @@ declare -a v=([0]="0")
declare -a xref=([1]="one")
./nameref15.sub: line 126: warning: xref: removing nameref attribute
declare -a xref=([1]="one")
nameref16.sub
declare -n r1="y"
declare -n r2="x"
./nameref16.sub: line 25: typeset: x: not found
@@ -372,6 +388,7 @@ declare -n r1="y"
declare -n r2="x"
declare -- x="one"
declare -- y="two"
nameref17.sub
./nameref17.sub: line 21: declare: bar: not found
./nameref17.sub: line 22: unset: foo0: cannot unset: readonly variable
declare -nr foo0="bar"
@@ -409,6 +426,7 @@ declare -nr foo5
declare -r foo5
declare -nr foo5
declare -r foo5
nameref18.sub
./nameref18.sub: line 15: mapfile: `XXX[0]': not a valid identifier
./nameref18.sub: line 16: declare: XXX[0]: not found
./nameref18.sub: line 22: `XXX[0]': not a valid identifier
@@ -450,6 +468,7 @@ argv[2] = <2>
argv[3] = <31>
argv[4] = <2>
argv[5] = <3>
nameref19.sub
declare -n foo="bar"
declare -- foo="bar"
./nameref19.sub: line 22: declare: bar: not found
@@ -468,6 +487,7 @@ declare -- foo="bar"
declare -- bar
8
declare -n ivar="foo"
nameref20.sub
declare -a v=([0]="Y")
r: <Y>
v: <Y>
@@ -497,6 +517,7 @@ declare -- ref="Y"
declare -- ref="Y"
./nameref20.sub: line 74: declare: var: not found
declare -- ref="Y"
nameref21.sub
declare -n ref="var"
declare -A var=([2]="" )
declare -n ref="var"
@@ -511,6 +532,7 @@ declare -n ref="var"
declare -ai var=([1]="0")
declare -n ref="var"
declare -- var="1"
nameref22.sub
a string with spaces
many spaces
declare -n foo="bar[0]"
@@ -532,6 +554,7 @@ declare -a array
declare -ai array=([0]="one")
declare -a array=([0]="zero")
declare -a array=([0]="one" [1]="two" [2]="three")
nameref23.sub
declare -ai a=([0]="5")
declare -ai a=([0]="6")
declare -ai a=([0]="42")
@@ -566,6 +589,7 @@ declare -ai a=([0]="0" [1]="16")
12
16
declare -ai a=([0]="0" [1]="16")
nameref24.sub
./nameref24.sub: line 24: declare: `': not a valid identifier
./nameref24.sub: line 25: declare: `a&b': invalid variable name for name reference
3
@@ -577,6 +601,7 @@ declare -ai a=([0]="0" [1]="16")
3
3
5
nameref25.sub
bash: line 1: a[k]: unbound variable
ok 1
bash: line 1: r0: unbound variable
+3 -1
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
# basic nameref tests
bar=one
flow=two
@@ -129,5 +131,5 @@ echo ${!x//c/x}
echo ${v//c/x}
for testfile in ./nameref[0-9].sub ./nameref[1-9][0-9].sub ; do
${THIS_SH} "$testfile"
test_runsub "$testfile"
done
+2
View File
@@ -33,6 +33,8 @@ declare -n r; mapfile r < /dev/null ; declare -p r; unset r ; unset -n r
mapfile r < /dev/null; declare -n r ; unset r ; unset -n r
declare -n r; printf -v r / ; unset -n r
declare -n r ; declare -u r r ; unset -n r
declare -n r; r="" ; unset -n r
declare -n r="" ; unset -n r
declare -n r; : ${r=} ; unset -n r
+103 -87
View File
File diff suppressed because one or more lines are too long
+50 -48
View File
@@ -15,6 +15,8 @@ if (( $UID == 0 )); then
echo "new-exp.tests: the test suite should not be run as root" >&2
fi
. ./test-aux-functions
# must do this because posix mode causes process substitution to be disabled
# and flagged as a syntax error, which causes the shell to exit
set +o posix
@@ -292,15 +294,6 @@ echo "$BVAR"
unset AVAR BVAR
# run process substitution tests in a subshell so that syntax errors
# caused by a shell not implementing process substitution (e.g., one
# built on a NeXT) will not cause the whole test to exit prematurely
${THIS_SH} ./new-exp1.sub
# run the tests of $(<filename) in a subshell to avoid cluttering up
# this script
${THIS_SH} ./new-exp2.sub
expect '<6>'
recho ${#:-foo}
expect $0: '${#:}: bad substitution'
@@ -540,12 +533,6 @@ recho "${RECEIVED:$((${#RECEIVED}-1)):1}"
RECEIVED=""
recho "${RECEIVED:$((${#RECEIVED}-1)):1}"
# tests of new prefix expansion ${!prefix*}
${THIS_SH} ./new-exp3.sub
# bug with indirect expansion through bash-2.05b
${THIS_SH} ./new-exp4.sub
# these caused errors and core dumps in versions before bash-2.04
c=""
echo ${c//${$(($#-1))}/x/}
@@ -587,8 +574,6 @@ recho ${1%%[!/]*}
recho ${1#*/}
recho ${1##*/}
${THIS_SH} ./new-exp5.sub
unset var
var=blah
@@ -608,37 +593,6 @@ echo ${var[*]//#abc/foo}
echo ${var[*]/#abc/foo}
unset var
${THIS_SH} ./new-exp6.sub
${THIS_SH} ./new-exp7.sub
${THIS_SH} ./new-exp8.sub
# tests to check whether things like indirect expansion of a variable whose
# value is 'anothervar[@]' stop working
${THIS_SH} ./new-exp9.sub
# new parameter transformation `@' expansion operator
${THIS_SH} ./new-exp10.sub
# parameter substring replacement and removal operators with multibyte chars
${THIS_SH} ./new-exp11.sub
# indirect expansion with arrays and local variables
${THIS_SH} ./new-exp12.sub
# more indirect expansion and parameter transformation issues
${THIS_SH} ./new-exp13.sub
# new K parameter transformation operator
${THIS_SH} ./new-exp14.sub
# ongoing work with a/A parameter transformations and `nounset'
${THIS_SH} ./new-exp15.sub
# pattern substitution with `&' (quoted and unquoted) in the replacement string
${THIS_SH} ./new-exp16.sub
# problems with stray CTLNUL in bash-4.0-alpha
unset a
@@ -667,5 +621,53 @@ echo "${b/\/#/%%}"
unset a b
# run process substitution tests in a subshell so that syntax errors
# caused by a shell not implementing process substitution (e.g., one
# built on a NeXT) will not cause the whole test to exit prematurely
test_runsub ./new-exp1.sub
# run the tests of $(<filename) in a subshell to avoid cluttering up
# this script
test_runsub ./new-exp2.sub
# tests of new prefix expansion ${!prefix*}
test_runsub ./new-exp3.sub
# bug with indirect expansion through bash-2.05b
test_runsub ./new-exp4.sub
test_runsub ./new-exp5.sub
test_runsub ./new-exp6.sub
test_runsub ./new-exp7.sub
test_runsub ./new-exp8.sub
# tests to check whether things like indirect expansion of a variable whose
# value is 'anothervar[@]' stop working
test_runsub ./new-exp9.sub
# new parameter transformation `@' expansion operator
test_runsub ./new-exp10.sub
# parameter substring replacement and removal operators with multibyte chars
test_runsub ./new-exp11.sub
# indirect expansion with arrays and local variables
test_runsub ./new-exp12.sub
# more indirect expansion and parameter transformation issues
test_runsub ./new-exp13.sub
# new K parameter transformation operator
test_runsub ./new-exp14.sub
# ongoing work with a/A parameter transformations and `nounset'
test_runsub ./new-exp15.sub
# pattern substitution with `&' (quoted and unquoted) in the replacement string
test_runsub ./new-exp16.sub
expect $0: 'ABXD: parameter unset'
${THIS_SH} -c 'recho ${ABXD:?"parameter unset"}' $0
+5
View File
@@ -39,9 +39,11 @@ argv[1] = <a^Ib^Ic>
argv[1] = <$'a\tb\tc'>
AD
E
nquote1.sub
hello' world
hello world!
hello' world!
nquote2.sub
' | '
' | '
x | x
@@ -60,14 +62,17 @@ $'\''
$'\'abcd\''
'
1
nquote3.sub
argv[1] = <^?>
0000000 del nl
0000002
0000000 esc fs gs rs us del nl
0000007
\q
nquote4.sub
foo
./nquote4.sub: line 6: quux: command not found
nquote5.sub
argv[1] = <a^A)b>
argv[1] = <a^Ab>
argv[1] = <^A>
+7 -5
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
expect()
{
echo expect "$@"
@@ -135,8 +137,8 @@ recho "$'a\tb\tc'"
# tests for $'...' being expanded in command substitution, and when
echo "$(echo $'\t\t\101\104\n\105')"
${THIS_SH} ./nquote1.sub
${THIS_SH} ./nquote2.sub
${THIS_SH} ./nquote3.sub
${THIS_SH} ./nquote4.sub
${THIS_SH} ./nquote5.sub
test_runsub ./nquote1.sub
test_runsub ./nquote2.sub
test_runsub ./nquote3.sub
test_runsub ./nquote4.sub
test_runsub ./nquote5.sub
+2
View File
@@ -1,5 +1,7 @@
bash: -c: line 1: unexpected EOF while looking for matching `)'
parser1.sub
AAA
posix2syntax.sub
bash5: line 1: `invalid-name': not a valid identifier
in
in
+3 -2
View File
@@ -1,4 +1,5 @@
# catch-all for parsing problems that don't fit anywhere else
. ./test-aux-functions
# word_top issues in bash-5.2
case x in x) if ((1)); then :; fi ;; esac
@@ -11,6 +12,6 @@ case x in x) if ((true ) ); then :; fi esac
${THIS_SH} -c '((X=([))]' bash
# this has to be in a separate file to get desired EOF behavior
${THIS_SH} ./parser1.sub
test_runsub ./parser1.sub
${THIS_SH} ./posix2syntax.sub
test_runsub ./posix2syntax.sub
+10 -1
View File
@@ -37,6 +37,10 @@ argv[1] = <'bar>
argv[1] = <foo 'bar baz>
argv[1] = <}z>
argv[1] = <''z}>
posixexp1.sub
posixexp1.sub
posixexp2.sub
posixexp3.sub
argv[1] = <1>
argv[2] = <2>
argv[1] = <1>
@@ -79,6 +83,7 @@ argv[1] = <1 2>
argv[1] = <1 2>
argv[1] = <12>
argv[1] = <12>
posixexp4.sub
normal IFS
argv[1] = <abc>
argv[2] = <def>
@@ -112,6 +117,7 @@ argv[2] = <def ghi>
argv[3] = <jkl >
argv[1] = < abc def ghi jkl >
argv[1] = < abc def ghi jkl >
posixexp5.sub
001: IFS = (unset): unset -v foo; set -- ${foo=$*}
soh stx etx del / soh stx etx del
@@ -256,6 +262,7 @@ soh stx etx del / soh stx etx del
048: IFS = sp ht nl: foo=; set -- "${foo:=$@}"
soh stx etx del / soh stx etx del
posixexp6.sub
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
argv[1] = <^A^B^C^?>
@@ -275,6 +282,7 @@ argv[2] = <b>
[ abc def ghi jkl / abc def ghi jkl ]
[ abc def ghi jkl ]
[ abc def ghi jkl / abc def ghi jkl / abc def ghi jkl ]
posixexp7.sub
1: OK
2: $'not'
3: OK
@@ -300,9 +308,10 @@ tOK
./posixexp7.sub: line 70: ${'x1'%'t'}: bad substitution
./posixexp7.sub: line 73: ${'x1'%'t'}: bad substitution
./posixexp7.sub: line 74: ${'x1'%'t'}: bad substitution
posixexp8.sub
"A"
A
argv[1] = <"A">
argv[1] = <A>
argv[1] = <A>
./posixexp.tests: line 97: unexpected EOF while looking for matching `}'
./posixexp.tests: line 101: unexpected EOF while looking for matching `}'
+13 -9
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
unset a
printf "%s\n" ${a:=a\ b}
echo "$a"
@@ -79,18 +81,20 @@ recho "${IFS+'}'z}"
: ${TMPDIR:=/var/tmp}
rm -f $TMPDIR/sh
cp ${THIS_SH} $TMPDIR/sh
THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp1.sub || echo "sh posixexp1.sub: test $? failed"
${THIS_SH} ./posixexp1.sub || echo "bash posixexp1.sub: test $? failed"
THIS_SH=$TMPDIR/sh test_runsub ./posixexp1.sub || echo "sh posixexp1.sub: test $? failed"
test_runsub ./posixexp1.sub || echo "bash posixexp1.sub: test $? failed"
THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp2.sub || echo "sh posixexp2.sub: test $? failed"
THIS_SH=$TMPDIR/sh test_runsub ./posixexp2.sub || echo "sh posixexp2.sub: test $? failed"
rm -f $TMPDIR/sh
${THIS_SH} ./posixexp3.sub
${THIS_SH} ./posixexp4.sub
${THIS_SH} ./posixexp5.sub
${THIS_SH} ./posixexp6.sub
${THIS_SH} ./posixexp7.sub
${THIS_SH} ./posixexp8.sub
. ./test-aux-functions
test_runsub ./posixexp3.sub
test_runsub ./posixexp4.sub
test_runsub ./posixexp5.sub
test_runsub ./posixexp6.sub
test_runsub ./posixexp7.sub
test_runsub ./posixexp8.sub
# this will be an error
foo=bar
+19 -12
View File
@@ -1,10 +1,10 @@
printf: usage: printf [-v var] format [arguments]
printf: usage: printf [-v var] format [arguments]
./printf.tests: line 44: printf: -x: invalid option
./printf.tests: line 46: printf: -x: invalid option
printf: usage: printf [-v var] format [arguments]
./printf.tests: line 47: printf: `invalid-var': not a valid identifier
./printf.tests: line 49: printf: `invalid-var': not a valid identifier
abc
./printf.tests: line 48: printf: `invalid-var': not a valid identifier
./printf.tests: line 50: printf: `invalid-var': not a valid identifier
10
one
one\ctwo
@@ -40,7 +40,7 @@ A7
--\"abcd\"--
--\'abcd\'--
--a\x--
./printf.tests: line 133: printf: missing hex digit for \x
./printf.tests: line 135: printf: missing hex digit for \x
--\x--
----
----
@@ -101,12 +101,12 @@ A7
26
26
26
./printf.tests: line 257: printf: `%10': missing format character
./printf.tests: line 258: printf: `M': invalid format character
ab./printf.tests: line 261: printf: `y': invalid format character
./printf.tests: line 264: printf: GNU: invalid number
./printf.tests: line 259: printf: `%10': missing format character
./printf.tests: line 260: printf: `M': invalid format character
ab./printf.tests: line 263: printf: `y': invalid format character
./printf.tests: line 266: printf: GNU: invalid number
0
./printf.tests: line 265: printf: GNU: invalid number
./printf.tests: line 267: printf: GNU: invalid number
0
-
(foo )(bar )
@@ -167,12 +167,13 @@ xx
''
9223372036854775807
-9223372036854775808
./printf.tests: line 386: printf: +: invalid number
./printf.tests: line 388: printf: +: invalid number
0
./printf.tests: line 387: printf: z: invalid number
./printf.tests: line 389: printf: z: invalid number
0
./printf.tests: line 388: printf: : invalid number
./printf.tests: line 390: printf: : invalid number
0
printf1.sub
one
one\ctwo
4\.2
@@ -277,6 +278,8 @@ A7
^G
^Ge
"?
printf2.sub
printf3.sub
16:09:15
./printf3.sub: line 27: printf: warning: `Z': invalid time format specification
%(abde)Z
@@ -288,6 +291,7 @@ random time: 2010-05-30 04:09:15 PM -0400
local time: Sun May 30 16:09:15 EDT 2010
Sun May 30 16:09:15 EDT 2010 date-style time
05/30/10 (foo) 16:09:15 date-style time
printf4.sub
x 123x
x 123x
x 123x
@@ -322,6 +326,7 @@ x +123x
x +123x
x +123x
x +123x
printf5.sub
abcd
ab
123
@@ -342,6 +347,7 @@ hello --
hello --
123 --
6 --
printf6.sub
0000000 000
0000001
0000000 000
@@ -372,6 +378,7 @@ hello --
0000000 340 262 207 040 040 040 055 055 055 012
000000a
[][]
printf7.sub
[]
[X]
VAR=[]
+9 -7
View File
@@ -17,6 +17,8 @@ LC_NUMERIC=C
: ${TMPDIR:=/tmp}
TMPF=$TMPDIR/printf-oflow-$RANDOM
. ./test-aux-functions
printf_overflow ()
{
local r;
@@ -388,11 +390,11 @@ printf '%d\n' z
printf '%d\n' ''
# tests variable assignment with -v
${THIS_SH} ./printf1.sub
${THIS_SH} ./printf2.sub
${THIS_SH} ./printf3.sub
${THIS_SH} ./printf4.sub
${THIS_SH} ./printf5.sub
test_runsub ./printf1.sub
test_runsub ./printf2.sub
test_runsub ./printf3.sub
test_runsub ./printf4.sub
test_runsub ./printf5.sub
# multibyte characters with %ls/%S and %lc/%C
${THIS_SH} ./printf6.sub
${THIS_SH} ./printf7.sub
test_runsub ./printf6.sub
test_runsub ./printf7.sub
+2
View File
@@ -25,7 +25,9 @@ extern
0
0
0
procsub1.sub
123
procsub2.sub
bar1
ouch
bar2
+2 -2
View File
@@ -117,5 +117,5 @@ moo() { ls -al "$1" >/dev/null; (true); ls -al "$1" >/dev/null; }; moo >(true)
unset -f moo
${THIS_SH} ./procsub1.sub
${THIS_SH} ./procsub2.sub
test_runsub ./procsub1.sub
test_runsub ./procsub2.sub
+4
View File
@@ -74,6 +74,7 @@ string \
string \}
escape\
escape\
quote1.sub
'weferfds'\''dsfsdf'
'weferfdsdsfsdf'
'weferfds'\''dsfsdf'
@@ -88,6 +89,7 @@ test'string
a'b'c
foo b c baz
foo 'bar baz
quote2.sub
argv[1] = <>
argv[1] = <>
argv[1] = <>
@@ -130,6 +132,7 @@ argv[2] = <>
argv[1] = <>
argv[2] = <>
argv[1] = <>
quote3.sub
argv[1] = <4>
argv[2] = <>
argv[1] = <ab>
@@ -144,6 +147,7 @@ argv[1] = <ab ''>
argv[1] = <ab >
argv[1] = <ab ''>
argv[1] = <ab >
quote4.sub
0
1
1
+6 -4
View File
@@ -135,12 +135,14 @@ echo ${foo:-string \\\}}
: ${TMPDIR:=/tmp}
. ./test-aux-functions
${THIS_SH} -c 'echo escape\'
printf 'echo escape\' > $TMPDIR/quote-$$
${THIS_SH} $TMPDIR/quote-$$
rm -f $TMPDIR/quote-$$
${THIS_SH} ./quote1.sub
${THIS_SH} ./quote2.sub
${THIS_SH} ./quote3.sub
${THIS_SH} ./quote4.sub
test_runsub ./quote1.sub
test_runsub ./quote2.sub
test_runsub ./quote3.sub
test_runsub ./quote4.sub
+12 -7
View File
@@ -1,9 +1,9 @@
declare -A assoc=(["x],b[\$(echo uname >&2)"]="1" )
declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="1" )
declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="2" )
./quotearray.tests: line 31: ((: 'assoc[x\],b\[\$(echo uname >&2)]++' : arithmetic syntax error: operand expected (error token is "'assoc[x\],b\[\$(echo uname >&2)]++' ")
./quotearray.tests: line 32: ((: 'assoc[x\],b\[\$(echo uname >&2)]++' : arithmetic syntax error: operand expected (error token is "'assoc[x\],b\[\$(echo uname >&2)]++' ")
declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="2" )
./quotearray.tests: line 34: ((: 'assoc[x\],b\[\$(echo uname >&2)]'++ : arithmetic syntax error: operand expected (error token is "'assoc[x\],b\[\$(echo uname >&2)]'++ ")
./quotearray.tests: line 35: ((: 'assoc[x\],b\[\$(echo uname >&2)]'++ : arithmetic syntax error: operand expected (error token is "'assoc[x\],b\[\$(echo uname >&2)]'++ ")
declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="2" )
declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="3" )
4
@@ -24,15 +24,16 @@ declare -a a=([0]="12" [1]="42")
declare -Ai assoc=(["']"]="3" ["\$var"]="1" )
105
declare -A assoc=(["\` echo >&2 foo\`"]="42" ["\$( echo >&2 bar)"]="63" )
./quotearray.tests: line 140: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
./quotearray.tests: line 144: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
./quotearray.tests: line 141: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
./quotearray.tests: line 145: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
1
./quotearray.tests: line 147: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
./quotearray.tests: line 148: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
1
./quotearray.tests: line 150: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
./quotearray.tests: line 151: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
1
./quotearray.tests: line 153: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
./quotearray.tests: line 154: x],b[$(echo uname >&2): arithmetic syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)")
1
quotearray1.sub
declare -A assoc
0
0
@@ -62,6 +63,7 @@ foo
[[ -v assoc[a] ]]; $?=0
[[ -v assoc["] ]]; $?=0
declare -A assoc=(["\""]="123" [a]="123" )
quotearray2.sub
declare -A a=([1]="1" [0]="0" [" "]="11" )
7
7
@@ -79,6 +81,7 @@ declare -A A=(["*"]="X" ["@"]="X" )
declare -A assoc
declare -A assoc=(["\$(echo foo)"]="1" )
0
quotearray3.sub
declare -A assoc=(["\$var"]="value" )
declare -A assoc=(["\$var"]="value" )
declare -A assoc=(["\$var"]="value" )
@@ -100,6 +103,7 @@ declare -A map=(["foo\$(uname >/dev/tty)bar"]="1" )
declare -A map=()
$(DOESNOTEXIST)
declare -A blah=()
quotearray4.sub
declare -A assoc=(["*"]="star" ["!"]="bang" ["@"]="at" )
declare -A assoc=(["*"]="star" ["!"]="bang" )
declare -A assoc=(["!"]="bang" )
@@ -127,6 +131,7 @@ declare -a array=([0]="1" [1]="2" [2]="3")
0
./quotearray4.sub: line 115: array[@]: bad array subscript
declare -a array=([0]="1" [1]="2" [2]="3")
quotearray5.sub
./quotearray5.sub: line 27: unset: `a[$(echo': not a valid identifier
./quotearray5.sub: line 27: unset: `foo)]': not a valid identifier
declare -A a=()
+6 -5
View File
@@ -13,6 +13,7 @@
#
# a set of tests for associative arrays in arithmetic contexts
. ./test-aux-functions
declare -A assoc
key='x],b[$(echo uname >&2)'
@@ -153,12 +154,12 @@ echo $?
(( expr ))
echo $?
${THIS_SH} ./quotearray1.sub
${THIS_SH} ./quotearray2.sub
${THIS_SH} ./quotearray3.sub
test_runsub ./quotearray1.sub
test_runsub ./quotearray2.sub
test_runsub ./quotearray3.sub
# behavior of builtins with array subscripts @ and *
${THIS_SH} ./quotearray4.sub
test_runsub ./quotearray4.sub
# behavior of unset with quoted and unquoted array arguments
${THIS_SH} ./quotearray5.sub
test_runsub ./quotearray5.sub
+11 -1
View File
@@ -31,8 +31,9 @@ argv[1] = < foo>
argv[1] = <foo>
argv[1] = <foo>
argv[1] = < foo>
./read.tests: line 101: b: readonly variable
./read.tests: line 103: b: readonly variable
a = a b = c = stat = 2
read1.sub
a = abcdefg
xyz
a = xyz
@@ -52,6 +53,7 @@ a = abc
<$'spring\375'>
<summer>
<automn>
read2.sub
timeout 1: ok
unset or null 1
timeout 2: ok
@@ -64,6 +66,7 @@ unset or null 3
abcde
abcde
abcde
read3.sub
./read3.sub: line 17: read: -1: invalid number
abc
defg
@@ -71,10 +74,12 @@ ab
abc
#
0
read4.sub
while read -u 3 var
do
echo "$var"
done 3<$0
read5.sub
argv[1] = <>
argv[1] = <>
argv[1] = <>
@@ -86,9 +91,11 @@ argv[2] = <>
argv[3] = <>
FOO
0 0 0
read6.sub
0
0
1
read7.sub
timeout 1: ok
unset or null 1
timeout 2: ok
@@ -99,10 +106,13 @@ timeout 4: ok
abcde
abcde
read8.sub
one
two three four
one
two three four
read9.sub
read10.sub
IFS=[,] var=[abc] rest=[def,ghi]
IFS=[] var=[abc] rest=[def,ghi]
IFS=[ ] var=[ abc] rest=[def,ghi ]
+12 -10
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
echo " a " | (read x; echo "$x.")
echo " a b " | ( read x y ; echo -"$x"-"$y"- )
@@ -106,31 +108,31 @@ EOF
echo a = $a b = $b c = $c stat = $?
# test read -d delim behavior
${THIS_SH} ./read1.sub
test_runsub ./read1.sub
# test read -t timeout behavior
${THIS_SH} ./read2.sub
test_runsub ./read2.sub
# test read -n nchars behavior
${THIS_SH} ./read3.sub
test_runsub ./read3.sub
# test read -u fd behavior
${THIS_SH} ./read4.sub
test_runsub ./read4.sub
# test behavior when IFS is not the default -- bug through bash-2.05b
${THIS_SH} ./read5.sub
test_runsub ./read5.sub
# test behavior of read -t 0
${THIS_SH} ./read6.sub
test_runsub ./read6.sub
# test behavior of readline timeouts
${THIS_SH} ./read7.sub
test_runsub ./read7.sub
# test behavior of read -n and read -d on regular files
${THIS_SH} ./read8.sub
test_runsub ./read8.sub
# test behavior of trailing IFS whitespace - POSIX conformance
${THIS_SH} ./read9.sub
test_runsub ./read9.sub
# test behavior of read builtin modifying $IFS
${THIS_SH} ./read10.sub
test_runsub ./read10.sub
+16 -5
View File
@@ -1,13 +1,13 @@
abc
./redir.tests: line 31: /tmp/redir-test: cannot overwrite existing file
./redir.tests: line 32: /tmp/redir-test: cannot overwrite existing file
abc
def
def
ghi
./redir.tests: line 52: -1: ambiguous redirect
./redir.tests: line 53: exec: -1: invalid option
./redir.tests: line 53: -1: ambiguous redirect
./redir.tests: line 54: exec: -1: invalid option
exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
./redir.tests: line 58: $z: ambiguous redirect
./redir.tests: line 59: $z: ambiguous redirect
Point 1
Point 2
to a
@@ -20,12 +20,15 @@ to b
Point 4
to c
Point 5
redir1.sub
this is redir1.sub
this is redir2.sub
redir3.sub
read line1 "ab"
read line2 "root"
read line3 "cd"
read line4 "daemon"
redir4.sub
from stdin: aa
to stdout
./redir4.sub: line 45: $fd: ambiguous redirect
@@ -48,7 +51,8 @@ kl
ab
cd
cd
./redir.tests: line 184: redir1.*: No such file or directory
./redir.tests: line 186: redir1.*: No such file or directory
redir5.sub
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@@ -103,6 +107,7 @@ f ()
}
after read
# This program is free software: you can redistribute it and/or modify
redir6.sub
/
/
/
@@ -111,10 +116,12 @@ after read
0
before block
after block
redir7.sub
c1 is 1
c2 is 2
c3 is 3
c4 is 4
redir8.sub
fd 10
fd 8
fd 10
@@ -131,6 +138,7 @@ fd 8
4
cat /tmp/foo
whatsis
redir9.sub
hey
to stdout
to stderr
@@ -158,7 +166,9 @@ bix ()
foo
foo
foo
redir10.sub
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
redir11.sub
1
7
after: 42
@@ -169,6 +179,7 @@ foo
foo
./redir11.sub: line 77: 42: No such file or directory
42
redir12.sub
./redir12.sub: line 27: unwritable-file: Permission denied
1 x =
./redir12.sub: line 31: unwritable-file: cannot overwrite existing file
+12 -10
View File
@@ -12,6 +12,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
: ${TMPDIR:=/tmp}
. ./test-aux-functions
export LC_ALL=C
export LANG=C
@@ -92,13 +93,14 @@ rm -f $TMPDIR/bash-a $TMPDIR/bash-b $TMPDIR/bash-c
#
# Test the effect of input buffering on the shell's input
#
printf '\tredir1.sub\n'
${THIS_SH} < redir1.sub
# more open, close, duplicate file descriptors
${THIS_SH} ./redir3.sub < ./redir3.in1
test_runsub ./redir3.sub < ./redir3.in1
# still more redirections
${THIS_SH} ./redir4.sub < redir4.in1
test_runsub ./redir4.sub < redir4.in1
# various forms of null redirection
testf()
@@ -184,10 +186,10 @@ set -o posix
cat < redir1.*
# test ksh93 dup-and-close (move fd) redirections
${THIS_SH} ./redir5.sub
test_runsub ./redir5.sub
# test behavior after a write error with a builtin command
${THIS_SH} ./redir6.sub
test_runsub ./redir6.sub
# problem with redirections using fds bash uses internally
: ${TMPDIR:=$TMPDIR}
@@ -203,9 +205,9 @@ echo before block
echo after block
${THIS_SH} ./redir7.sub
test_runsub ./redir7.sub
${THIS_SH} ./redir8.sub
test_runsub ./redir8.sub
exec 9>&2
command exec 2>>$TMPDIR/foo-$$
@@ -216,9 +218,9 @@ rm -f $TMPDIR/foo-$$
exec 2>&9
exec 9>&-
${THIS_SH} ./redir9.sub
${THIS_SH} ./redir10.sub
${THIS_SH} ./redir11.sub
${THIS_SH} ./redir12.sub
test_runsub ./redir9.sub
test_runsub ./redir10.sub
test_runsub ./redir11.sub
test_runsub ./redir12.sub
${THIS_SH} < ./redir13.in
+1
View File
@@ -72,6 +72,7 @@ a?b
ab
a/b
ab
rhs-exp1.sub
argv[1] = <bc>
argv[1] = <bc>
argv[1] = <ab>
+3 -1
View File
@@ -11,6 +11,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
. ./test-aux-functions
#
selvecs='&m68kcoff_vec'
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS='$selvecs'}"
recho "TDEFAULTS = ${selvecs:+-DSELECT_VECS=\'$selvecs\'}"
@@ -61,4 +63,4 @@ var="a?b" ; echo "${var//\?/}"
var="a/b" ; echo "${var//\\//}"
var="a/b" ; echo "${var//\//}"
${THIS_SH} ./rhs-exp1.sub
test_runsub ./rhs-exp1.sub
+14 -12
View File
@@ -1,20 +1,22 @@
rsh1.sub
./rsh1.sub: line 22: /bin/sh: restricted
./rsh1.sub: line 24: sh: not found
./rsh1.sub: line 25: a: command not found
rsh2.sub
./rsh2.sub: line 23: hash: /bin/sh: restricted
./rsh2.sub: line 25: hash: sh: not found
./rsh2.sub: line 26: a: command not found
./rsh.tests: line 25: cd: restricted
./rsh.tests: line 26: PATH: readonly variable
./rsh.tests: line 27: SHELL: readonly variable
./rsh.tests: line 28: /bin/sh: restricted: cannot specify `/' in command names
./rsh.tests: line 29: /bin/cat: restricted: cannot specify `/' in command names
./rsh.tests: line 31: .: ./source.sub3: restricted
./rsh.tests: line 34: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 38: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 43: command: -p: restricted
./rsh.tests: line 45: set: +r: invalid option
./rsh.tests: line 26: cd: restricted
./rsh.tests: line 27: PATH: readonly variable
./rsh.tests: line 28: SHELL: readonly variable
./rsh.tests: line 29: /bin/sh: restricted: cannot specify `/' in command names
./rsh.tests: line 30: /bin/cat: restricted: cannot specify `/' in command names
./rsh.tests: line 32: .: ./source.sub3: restricted
./rsh.tests: line 35: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 39: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 44: command: -p: restricted
./rsh.tests: line 46: set: +r: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./rsh.tests: line 46: set: restricted: invalid option name
./rsh.tests: line 48: exec: restricted
./rsh.tests: line 47: set: restricted: invalid option name
./rsh.tests: line 49: exec: restricted
./rsh.tests: after exec
+3 -2
View File
@@ -12,13 +12,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# test restricted shell mode -- these should all be errors
. ./test-aux-functions
#
# things not tested for:
# adding builtins dynamically with enable -f
# importing function definitions from environment
${THIS_SH} ./rsh1.sub
${THIS_SH} ./rsh2.sub
test_runsub ./rsh1.sub
test_runsub ./rsh2.sub
set -r
+40 -3
View File
@@ -56,15 +56,52 @@ ${THIS_SH} ./version
rm -f ${BASH_TSTOUT}
export TAB=' '
echo Any output from any test, unless otherwise noted, indicates a possible anomaly
# keep track of passed and failed tests and report them
if [ -t 1 ]; then
# can't rely on having $'...' or printf understanding \e
# bright red background, white foreground text
CSTART=$(printf '\033[01;101;37m') CEND=$(printf '\033[0m')
else
CSTART= CEND=
fi
passed=0
total=0
failed=0
if [ -n "$BASH_TSTOUT_SAVEDIR" ] && [ -d "$BASH_TSTOUT_SAVEDIR" ]; then
echo "Using $BASH_TSTOUT_SAVEDIR to save output from failed tests"
else
unset BASH_TSTOUT_SAVEDIR
fi
for x in run-*
do
case $x in
$0|run-minimal|run-gprof) ;;
*.orig|*~) ;;
*) echo $x ; sh $x ; rm -f ${BASH_TSTOUT} ;;
*.orig|*.save|*~) ;;
*) echo $x
total=$(( $total + 1 ))
if sh $x; then
passed=$(( $passed + 1 ))
else
failed=$(( $failed + 1 ))
echo "${CSTART}${x}: NON-ZERO exit status $?${CEND}"
if [ -n "$BASH_TSTOUT_SAVEDIR" ]; then
mv ${BASH_TSTOUT} ${BASH_TSTOUT_SAVEDIR}/${x}-${SUFFIX}
echo "${CSTART}output saved to ${BASH_TSTOUT_SAVEDIR}/${x}-${SUFFIX}${CEND}"
elif [ $failed -eq 1 ]; then
echo "${CSTART}Set environment variable BASH_TSTOUT_SAVEDIR to a directory to save failed test output${CEND}"
fi
fi
rm -f ${BASH_TSTOUT}
;;
esac
done
exit 0
echo "${CSTART}${passed}/${total} tests succeeded${CEND}"
exit $failed
+3 -3
View File
@@ -1,6 +1,6 @@
echo "warning: all of these tests will fail if arrays have not" >&2
echo "warning: been compiled into the shell" >&2
echo "warning: the BASH_ARGC and BASH_ARGV tests will fail if debugging support" >&2
echo "warning: has not been compiled into the shell" >&2
echo "${TAB}been compiled into the shell" >&2
echo "warning: the BASH_ARGC and BASH_ARGV tests will fail if debugging" >&2
echo "${TAB}support has not been compiled into the shell" >&2
${THIS_SH} ./array.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} array.right && rm -f ${BASH_TSTOUT}
+1 -1
View File
@@ -1,4 +1,4 @@
echo "warning: all of these tests will fail if arrays have not" >&2
echo "warning: been compiled into the shell" >&2
echo "${TAB}been compiled into the shell" >&2
${THIS_SH} ./array-at-star > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} array2.right && rm -f ${BASH_TSTOUT}
+1 -1
View File
@@ -1,4 +1,4 @@
echo "warning: all of these tests will fail if arrays have not" >&2
echo "warning: been compiled into the shell" >&2
echo "${TAB}been compiled into the shell" >&2
${THIS_SH} ./assoc.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} assoc.right && rm -f ${BASH_TSTOUT}
+2 -2
View File
@@ -1,6 +1,6 @@
echo "warning: some of these tests may fail if process substitution has not" >&2
echo "warning: been compiled into the shell or if the OS does not provide" >&2
echo "warning: /dev/fd." >&2
echo "${TAB}been compiled into the shell or if the OS does not provide" >&2
echo "${TAB}/dev/fd." >&2
${THIS_SH} ./builtins.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} builtins.right && rm -f ${BASH_TSTOUT}
+3 -3
View File
@@ -1,9 +1,9 @@
echo "warning: all of these tests will fail if the conditional command has not" >&2
echo "warning: been compiled into the shell" >&2
echo "${TAB}been compiled into the shell" >&2
echo "warning: some of these tests will fail if extended pattern matching has not" >&2
echo "warning: been compiled into the shell" >&2
echo "${TAB}been compiled into the shell" >&2
echo "warning: the text of system error messages may vary between systems and" >&2
echo "warning: produce diff output." >&2
echo "${TAB}produce diff output." >&2
${THIS_SH} ./cond.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} cond.right && rm -f ${BASH_TSTOUT}
+1 -2
View File
@@ -1,6 +1,5 @@
TEST_NAME='dbg-support'
TEST_FILE="/tmp/${TEST_NAME}.check"
TEST_FILE="${BASH_TSTOUT}"
${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null
set -f
diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE
+1 -1
View File
@@ -1,6 +1,6 @@
TEST_NAME='dbg-support2'
TEST_FILE="/tmp/${TEST_NAME}.check"
TEST_FILE="${BASH_TSTOUT}"
${THIS_SH} ./${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null
set -f
diff $TEST_FILE ${TEST_NAME}.right && rm -f $TEST_FILE
+5 -5
View File
@@ -13,11 +13,11 @@
#
echo "warning: the text of a system error message may vary between systems and" >&2
echo "warning: produce diff output." >&2
echo "warning: if the text of the error messages concerning \`notthere' or" >&2
echo "warning: \`/tmp/bash-notthere' not being found or \`/' being a directory" >&2
echo "warning: produce diff output, please do not consider this a test failure" >&2
echo "${TAB}produce diff output." >&2
echo "${TAB}if the text of the error messages concerning \`notthere' or" >&2
echo "${TAB}\`/tmp/bash-notthere' not being found or \`/' being a directory" >&2
echo "${TAB}produce diff output, please do not consider this a test failure" >&2
echo "warning: if diff output differing only in the location of the bash" >&2
echo "warning: binary appears, please do not consider this a test failure" >&2
echo "${TAB}binary appears, please do not consider this a test failure" >&2
${THIS_SH} ./execscript > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} exec.right && rm -f ${BASH_TSTOUT}
+2 -2
View File
@@ -1,5 +1,5 @@
echo "warning: if you have exported functions defined in your environment," >&2
echo "warning: they may show up as diff output." >&2
echo "warning: if so, please do not consider this a test failure" >&2
echo "${TAB}they may show up as diff output." >&2
echo "${TAB}If so, please do not consider this a test failure" >&2
${THIS_SH} ./func.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} func.right && rm -f ${BASH_TSTOUT}
+1 -1
View File
@@ -3,5 +3,5 @@ export PATH
( diff -a glob.right glob.right >/dev/null 2>&1 ) && AFLAG=-a
${THIS_SH} ./glob.tests > ${BASH_TSTOUT} 2>&1
${THIS_SH} ./glob.tests > ${BASH_TSTOUT} # 2>&1
diff ${AFLAG} ${BASH_TSTOUT} glob.right && rm -f ${BASH_TSTOUT}
+2 -2
View File
@@ -1,6 +1,6 @@
echo "warning: UNIX versions number signals and schedule processes differently." >&2
echo "warning: If output differing only in line numbers is produced, please" >&2
echo "warning: do not consider this a test failure." >&2
echo "${TAB}If output differing only in line numbers is produced, please" >&2
echo "${TAB}do not consider this a test failure." >&2
${THIS_SH} ./heredoc.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} heredoc.right && rm -f ${BASH_TSTOUT}

Some files were not shown because too many files have changed in this diff Show More