Adding upstream version 2.25.15.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
This commit is contained in:
parent
10737b110a
commit
b543f2e88d
485 changed files with 191459 additions and 0 deletions
6
test/bashisms/531327.sh
Normal file
6
test/bashisms/531327.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
foo() {}
|
||||
|
||||
foo \
|
||||
source something
|
6
test/bashisms/535368.mk
Normal file
6
test/bashisms/535368.mk
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
foo:
|
||||
if [ "$$(< $(DEBIAN)/foo md5sum)" != "$$(cat $(DEBIAN)/foo.md5)" ] ; then \
|
||||
echo moo; \
|
||||
fi
|
9
test/bashisms/808271.sh
Normal file
9
test/bashisms/808271.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
if type which; then
|
||||
echo "use which"
|
||||
fi
|
||||
|
||||
if ! type which; then
|
||||
echo "well, idk"
|
||||
fi
|
4
test/bashisms/808271.sh.out
Normal file
4
test/bashisms/808271.sh.out
Normal file
|
@ -0,0 +1,4 @@
|
|||
possible bashism in bashisms/808271.sh line 3 (type):
|
||||
if type which; then
|
||||
possible bashism in bashisms/808271.sh line 7 (type):
|
||||
if ! type which; then
|
21
test/bashisms/arith.sh
Normal file
21
test/bashisms/arith.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
metric=0
|
||||
echo $((metric=metric+1))
|
||||
|
||||
m=0
|
||||
n=2
|
||||
echo $((n-m++)) # BASHISM
|
||||
echo $((++m)) # BASHISM
|
||||
echo $(( m-- )) # BASHISM
|
||||
echo $((--m)) # BASHISM
|
||||
|
||||
foo_bar=0
|
||||
echo $((foo_bar++)) # BASHISM
|
||||
echo $((foo_bar=foo_bar*2))
|
||||
echo $((foo_bar*3/6))
|
||||
|
||||
echo $((2*n++)) # BASHISM
|
||||
|
||||
echo $(($n*n++)) # BASHISM
|
||||
|
||||
echo $((3**2)) # BASHISM
|
16
test/bashisms/arith.sh.out
Normal file
16
test/bashisms/arith.sh.out
Normal file
|
@ -0,0 +1,16 @@
|
|||
possible bashism in bashisms/arith.sh line 7 ('$((n++))' should be '$n; $((n=n+1))'):
|
||||
echo $((n-m++)) # BASHISM
|
||||
possible bashism in bashisms/arith.sh line 8 ('$((++n))' should be '$((n=n+1))'):
|
||||
echo $((++m)) # BASHISM
|
||||
possible bashism in bashisms/arith.sh line 9 ('$((n--))' should be '$n; $((n=n-1))'):
|
||||
echo $(( m-- )) # BASHISM
|
||||
possible bashism in bashisms/arith.sh line 10 ('$((--n))' should be '$((n=n-1))'):
|
||||
echo $((--m)) # BASHISM
|
||||
possible bashism in bashisms/arith.sh line 13 ('$((n++))' should be '$n; $((n=n+1))'):
|
||||
echo $((foo_bar++)) # BASHISM
|
||||
possible bashism in bashisms/arith.sh line 17 ('$((n++))' should be '$n; $((n=n+1))'):
|
||||
echo $((2*n++)) # BASHISM
|
||||
possible bashism in bashisms/arith.sh line 19 ('$((n++))' should be '$n; $((n=n+1))'):
|
||||
echo $(($n*n++)) # BASHISM
|
||||
possible bashism in bashisms/arith.sh line 21 (exponentiation is not POSIX):
|
||||
echo $((3**2)) # BASHISM
|
60
test/bashisms/array-expansion.sh
Normal file
60
test/bashisms/array-expansion.sh
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This is a TO DO, but irrelevant to this test case:
|
||||
foo=(foo bar moo BASH ISM)
|
||||
|
||||
n=1
|
||||
|
||||
echo BASHISM ${foo[1]%r}
|
||||
echo BASHISM ${foo[$n]%r}
|
||||
echo BASHISM ${foo[*]%o}
|
||||
echo BASHISM ${foo[@]%o}
|
||||
|
||||
echo BASHISM ${foo[1]%%r}
|
||||
echo BASHISM ${foo[$n]%%r}
|
||||
echo BASHISM ${foo[*]%%o}
|
||||
echo BASHISM ${foo[@]%%o}
|
||||
|
||||
echo BASHISM ${foo[1]#*a}
|
||||
echo BASHISM ${foo[$n]#*a}
|
||||
echo BASHISM ${foo[*]#*o}
|
||||
echo BASHISM ${foo[@]#*o}
|
||||
|
||||
echo BASHISM ${foo[1]##*a}
|
||||
echo BASHISM ${foo[$n]##*a}
|
||||
echo BASHISM ${foo[*]##*o}
|
||||
echo BASHISM ${foo[@]##*o}
|
||||
|
||||
echo BASHISM ${#foo[1]}
|
||||
echo BASHISM ${#foo[$n]}
|
||||
echo BASHISM ${#foo[*]}
|
||||
echo BASHISM ${#foo[@]}
|
||||
|
||||
# Technically, there are two bashisms here, but I'm happy if it at
|
||||
# least matches one. The regexes become more complex without real gain
|
||||
# otherwise. (hence the "BASH ISMS", with the extra space)
|
||||
|
||||
echo BASHISM BASH ISMS ${foo[1]^*a}
|
||||
echo BASHISM BASH ISMS ${foo[$n]^*a}
|
||||
echo BASHISM BASH ISMS ${foo[*]^*o}
|
||||
echo BASHISM BASH ISMS ${foo[@]^*o}
|
||||
|
||||
echo BASHISM BASH ISMS ${foo[1]^^*a}
|
||||
echo BASHISM BASH ISMS ${foo[$n]^^*a}
|
||||
echo BASHISM BASH ISMS ${foo[*]^^*o}
|
||||
echo BASHISM BASH ISMS ${foo[@]^^*o}
|
||||
|
||||
echo BASHISM BASH ISMS ${foo[1],*a}
|
||||
echo BASHISM BASH ISMS ${foo[$n],*a}
|
||||
echo BASHISM BASH ISMS ${foo[*],*a}
|
||||
echo BASHISM BASH ISMS ${foo[@],*a}
|
||||
|
||||
echo BASHISM BASH ISMS ${foo[1],,*a}
|
||||
echo BASHISM BASH ISMS ${foo[$n],,*a}
|
||||
echo BASHISM BASH ISMS ${foo[*],,*a}
|
||||
echo BASHISM BASH ISMS ${foo[@],,*a}
|
||||
|
||||
echo BASHISM BASH ISMS ${foo[1]/a/R}
|
||||
echo BASHISM BASH ISMS ${foo[$n]/a/R}
|
||||
echo BASHISM BASH ISMS ${foo[*]/a/R}
|
||||
echo BASHISM BASH ISMS ${foo[@]/a/R}
|
80
test/bashisms/array-expansion.sh.out
Normal file
80
test/bashisms/array-expansion.sh.out
Normal file
|
@ -0,0 +1,80 @@
|
|||
possible bashism in bashisms/array-expansion.sh line 8 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[1]%r}
|
||||
possible bashism in bashisms/array-expansion.sh line 9 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[$n]%r}
|
||||
possible bashism in bashisms/array-expansion.sh line 10 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[*]%o}
|
||||
possible bashism in bashisms/array-expansion.sh line 11 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[@]%o}
|
||||
possible bashism in bashisms/array-expansion.sh line 13 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[1]%%r}
|
||||
possible bashism in bashisms/array-expansion.sh line 14 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[$n]%%r}
|
||||
possible bashism in bashisms/array-expansion.sh line 15 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[*]%%o}
|
||||
possible bashism in bashisms/array-expansion.sh line 16 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[@]%%o}
|
||||
possible bashism in bashisms/array-expansion.sh line 18 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[1]#*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 19 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[$n]#*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 20 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[*]#*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 21 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[@]#*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 23 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[1]##*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 24 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[$n]##*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 25 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[*]##*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 26 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${foo[@]##*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 28 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${#foo[1]}
|
||||
possible bashism in bashisms/array-expansion.sh line 29 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${#foo[$n]}
|
||||
possible bashism in bashisms/array-expansion.sh line 30 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${#foo[*]}
|
||||
possible bashism in bashisms/array-expansion.sh line 31 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM ${#foo[@]}
|
||||
possible bashism in bashisms/array-expansion.sh line 37 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[1]^*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 38 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[$n]^*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 39 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[*]^*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 40 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[@]^*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 42 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[1]^^*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 43 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[$n]^^*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 44 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[*]^^*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 45 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[@]^^*o}
|
||||
possible bashism in bashisms/array-expansion.sh line 47 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[1],*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 48 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[$n],*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 49 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[*],*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 50 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[@],*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 52 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[1],,*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 53 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[$n],,*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 54 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[*],,*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 55 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[@],,*a}
|
||||
possible bashism in bashisms/array-expansion.sh line 57 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[1]/a/R}
|
||||
possible bashism in bashisms/array-expansion.sh line 58 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[$n]/a/R}
|
||||
possible bashism in bashisms/array-expansion.sh line 59 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[*]/a/R}
|
||||
possible bashism in bashisms/array-expansion.sh line 60 (bash arrays, ${name[0|*|@]}):
|
||||
echo BASHISM BASH ISMS ${foo[@]/a/R}
|
4
test/bashisms/ash-setvar.sh
Normal file
4
test/bashisms/ash-setvar.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
setvar foo bar # BASHISM
|
||||
[ bar = "$foo" ]
|
2
test/bashisms/ash-setvar.sh.out
Normal file
2
test/bashisms/ash-setvar.sh.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/ash-setvar.sh line 3 (setvar 'foo' 'bar' should be eval 'foo="'"$bar"'"'):
|
||||
setvar foo bar # BASHISM
|
6
test/bashisms/basic-bash-override.mk
Normal file
6
test/bashisms/basic-bash-override.mk
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
override SHELL := bash
|
||||
|
||||
test:
|
||||
@echo -e foo
|
6
test/bashisms/basic-bash.mk
Normal file
6
test/bashisms/basic-bash.mk
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
SHELL := bash
|
||||
|
||||
test:
|
||||
echo -e foo
|
21
test/bashisms/basic.mk
Normal file
21
test/bashisms/basic.mk
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# bug:
|
||||
overrideSHELL := bash
|
||||
|
||||
test:
|
||||
-echo -e "foo BASHISM"
|
||||
@echo -e "bar BASHISM"
|
||||
@-echo -e "bar BASHISM" && false
|
||||
-@echo -e "bar BASHISM" && false
|
||||
true
|
||||
|
||||
dirs:
|
||||
source diff:
|
||||
source diff.gz::
|
||||
source file-stamp:
|
||||
caller %.so:
|
||||
:
|
||||
|
||||
foo: $(shell echo dir/BASHISM/{foo,bar})
|
||||
:
|
10
test/bashisms/basic.mk.out
Normal file
10
test/bashisms/basic.mk.out
Normal file
|
@ -0,0 +1,10 @@
|
|||
possible bashism in bashisms/basic.mk line 7 (echo -e):
|
||||
-echo -e "foo BASHISM"
|
||||
possible bashism in bashisms/basic.mk line 8 (echo -e):
|
||||
@echo -e "bar BASHISM"
|
||||
possible bashism in bashisms/basic.mk line 9 (echo -e):
|
||||
@-echo -e "bar BASHISM" && false
|
||||
possible bashism in bashisms/basic.mk line 10 (echo -e):
|
||||
-@echo -e "bar BASHISM" && false
|
||||
possible bashism in bashisms/basic.mk line 20 (brace expansion):
|
||||
foo: $(shell echo dir/BASHISM/{foo,bar})
|
9
test/bashisms/brace-expansion.sh
Normal file
9
test/bashisms/brace-expansion.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo BASHISM{1..10}
|
||||
echo BASHISM{1..10..2}
|
||||
echo BASHISM{a..z}
|
||||
echo BASHISM{Z..a}
|
||||
echo BASHISM{a..z..2}
|
||||
echo {a.._}
|
||||
echo {a..9}
|
10
test/bashisms/brace-expansion.sh.out
Normal file
10
test/bashisms/brace-expansion.sh.out
Normal file
|
@ -0,0 +1,10 @@
|
|||
possible bashism in bashisms/brace-expansion.sh line 3 (brace expansion, {a..b[..c]}should be $(seq a [c] b)):
|
||||
echo BASHISM{1..10}
|
||||
possible bashism in bashisms/brace-expansion.sh line 4 (brace expansion, {a..b[..c]}should be $(seq a [c] b)):
|
||||
echo BASHISM{1..10..2}
|
||||
possible bashism in bashisms/brace-expansion.sh line 5 (brace expansion):
|
||||
echo BASHISM{a..z}
|
||||
possible bashism in bashisms/brace-expansion.sh line 6 (brace expansion):
|
||||
echo BASHISM{Z..a}
|
||||
possible bashism in bashisms/brace-expansion.sh line 7 (brace expansion):
|
||||
echo BASHISM{a..z..2}
|
19
test/bashisms/case-modification.sh
Normal file
19
test/bashisms/case-modification.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
foo=foo
|
||||
bar=BAR
|
||||
|
||||
echo BASHISM: ${foo^f}
|
||||
echo BASHISM: ${foo^^o}
|
||||
echo BASHISM: ${bar,B}
|
||||
echo BASHISM: ${bar,,R}
|
||||
|
||||
echo BASHISM: ${foo^}
|
||||
echo BASHISM: ${foo^^}
|
||||
echo BASHISM: ${bar,}
|
||||
echo BASHISM: ${bar,,}
|
||||
|
||||
echo BASHISM: ${@^}
|
||||
echo BASHISM: ${*^^}
|
||||
echo BASHISM: ${@,}
|
||||
echo BASHISM: ${*,,}
|
24
test/bashisms/case-modification.sh.out
Normal file
24
test/bashisms/case-modification.sh.out
Normal file
|
@ -0,0 +1,24 @@
|
|||
possible bashism in bashisms/case-modification.sh line 6 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${foo^f}
|
||||
possible bashism in bashisms/case-modification.sh line 7 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${foo^^o}
|
||||
possible bashism in bashisms/case-modification.sh line 8 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${bar,B}
|
||||
possible bashism in bashisms/case-modification.sh line 9 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${bar,,R}
|
||||
possible bashism in bashisms/case-modification.sh line 11 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${foo^}
|
||||
possible bashism in bashisms/case-modification.sh line 12 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${foo^^}
|
||||
possible bashism in bashisms/case-modification.sh line 13 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${bar,}
|
||||
possible bashism in bashisms/case-modification.sh line 14 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${bar,,}
|
||||
possible bashism in bashisms/case-modification.sh line 16 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${@^}
|
||||
possible bashism in bashisms/case-modification.sh line 17 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${*^^}
|
||||
possible bashism in bashisms/case-modification.sh line 18 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${@,}
|
||||
possible bashism in bashisms/case-modification.sh line 19 (${parm,[,][pat]} or ${parm^[^][pat]}):
|
||||
echo BASHISM: ${*,,}
|
16
test/bashisms/command.sh
Normal file
16
test/bashisms/command.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
command test
|
||||
command -p test
|
||||
command -v test
|
||||
command -V test
|
||||
command -p test
|
||||
command -p -v test
|
||||
command -pv test
|
||||
command -p -v -a test # BASHISM
|
||||
command -p -a -v test # BASHISM
|
||||
command -pa test # BASHISM
|
||||
command -ap test # BASHISM
|
||||
command -p -a test # BASHISM
|
||||
command -pV -a test # BASHISM
|
||||
command -p test
|
12
test/bashisms/command.sh.out
Normal file
12
test/bashisms/command.sh.out
Normal file
|
@ -0,0 +1,12 @@
|
|||
possible bashism in bashisms/command.sh line 10 ('command' with option other than -p, -v or -V):
|
||||
command -p -v -a test # BASHISM
|
||||
possible bashism in bashisms/command.sh line 11 ('command' with option other than -p, -v or -V):
|
||||
command -p -a -v test # BASHISM
|
||||
possible bashism in bashisms/command.sh line 12 ('command' with option other than -p, -v or -V):
|
||||
command -pa test # BASHISM
|
||||
possible bashism in bashisms/command.sh line 13 ('command' with option other than -p, -v or -V):
|
||||
command -ap test # BASHISM
|
||||
possible bashism in bashisms/command.sh line 14 ('command' with option other than -p, -v or -V):
|
||||
command -p -a test # BASHISM
|
||||
possible bashism in bashisms/command.sh line 15 ('command' with option other than -p, -v or -V):
|
||||
command -pV -a test # BASHISM
|
7
test/bashisms/comments-in-quoted-strings1.sh
Normal file
7
test/bashisms/comments-in-quoted-strings1.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo 's#/##g
|
||||
s# #/#'
|
||||
|
||||
echo '
|
||||
' # foo() {} "
|
4
test/bashisms/comments-in-quoted-strings2.sh
Normal file
4
test/bashisms/comments-in-quoted-strings2.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "
|
||||
\" # " # foo() {} '
|
3
test/bashisms/comments-parsing-fns.sh
Normal file
3
test/bashisms/comments-parsing-fns.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo $# ; echo -e BASHISM
|
2
test/bashisms/comments-parsing-fns.sh.out
Normal file
2
test/bashisms/comments-parsing-fns.sh.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/comments-parsing-fns.sh line 3 (echo -e):
|
||||
echo $# ; echo -e BASHISM
|
3
test/bashisms/coproc.sh
Normal file
3
test/bashisms/coproc.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
coproc true # BASHISM
|
2
test/bashisms/coproc.sh.out
Normal file
2
test/bashisms/coproc.sh.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/coproc.sh line 3 (coproc):
|
||||
coproc true # BASHISM
|
9
test/bashisms/dynamic-length.sh
Normal file
9
test/bashisms/dynamic-length.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
len=1
|
||||
f=foo
|
||||
|
||||
echo "${f:1}" # BASHISM
|
||||
echo "${f:$len}" # BASHISM
|
||||
echo "${f:$len$len}" # BASHISM
|
||||
echo "${f:${len}}" # BASHISM
|
8
test/bashisms/dynamic-length.sh.out
Normal file
8
test/bashisms/dynamic-length.sh.out
Normal file
|
@ -0,0 +1,8 @@
|
|||
possible bashism in bashisms/dynamic-length.sh line 6 (${foo:3[:1]}):
|
||||
echo "${f:1}" # BASHISM
|
||||
possible bashism in bashisms/dynamic-length.sh line 7 (${foo:3[:1]}):
|
||||
echo "${f:$len}" # BASHISM
|
||||
possible bashism in bashisms/dynamic-length.sh line 8 (${foo:3[:1]}):
|
||||
echo "${f:$len$len}" # BASHISM
|
||||
possible bashism in bashisms/dynamic-length.sh line 9 (${foo:3[:1]}):
|
||||
echo "${f:${len}}" # BASHISM
|
7
test/bashisms/exit-code.sh
Normal file
7
test/bashisms/exit-code.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# http://bugs.debian.org/687450
|
||||
exit -- 2 # BASHISM
|
||||
exit 255
|
||||
exit 256 # BASHISM
|
||||
exit -1 # BASHISM
|
6
test/bashisms/exit-code.sh.out
Normal file
6
test/bashisms/exit-code.sh.out
Normal file
|
@ -0,0 +1,6 @@
|
|||
possible bashism in bashisms/exit-code.sh line 4 ('exit --' should be 'exit' (idem for return)):
|
||||
exit -- 2 # BASHISM
|
||||
possible bashism in bashisms/exit-code.sh line 6 (exit|return status code greater than 255):
|
||||
exit 256 # BASHISM
|
||||
possible bashism in bashisms/exit-code.sh line 7 (exit|return with negative status code):
|
||||
exit -1 # BASHISM
|
3
test/bashisms/fail2ban.sh
Normal file
3
test/bashisms/fail2ban.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
eval $_INITSCRIPT force-reload ${HIDEOUTPUT:+\>/dev/null 2\>&1}
|
9
test/bashisms/fps.sh
Normal file
9
test/bashisms/fps.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo -e "BASHISM" \
|
||||
"something else \n"
|
||||
|
||||
#exec ${loclibdir}/tkcon.tcl \
|
||||
# -eval "source ${loclibdir}/console.tcl" \
|
||||
# -slave "package require Tk; set argc $#; set argv [list $*]; \
|
||||
# source ${loclibdir}/xcircuit.tcl"
|
3
test/bashisms/fps.sh.out
Normal file
3
test/bashisms/fps.sh.out
Normal file
|
@ -0,0 +1,3 @@
|
|||
possible bashism in bashisms/fps.sh line 4 (echo -e):
|
||||
echo -e "BASHISM" \
|
||||
"something else \n"
|
66
test/bashisms/functions.sh
Normal file
66
test/bashisms/functions.sh
Normal file
|
@ -0,0 +1,66 @@
|
|||
#!/bin/sh
|
||||
|
||||
foo() {
|
||||
:
|
||||
}
|
||||
|
||||
_all_good () {
|
||||
:
|
||||
}
|
||||
|
||||
_all_good101_ ( ) {
|
||||
:
|
||||
}
|
||||
|
||||
function BASHISM() {
|
||||
:
|
||||
}
|
||||
|
||||
function BASHISM {
|
||||
:
|
||||
}
|
||||
|
||||
function BASHISM {
|
||||
echo foo
|
||||
} &>/dev/null # BASHISM
|
||||
|
||||
,() { # BASHISM
|
||||
:
|
||||
}
|
||||
|
||||
function foo:bar:BASHISM { # BASHISMS
|
||||
:
|
||||
}
|
||||
|
||||
function foo-bar-BASHISM() { # BASHISMS
|
||||
:
|
||||
}
|
||||
|
||||
foo-bar-BASHISM ( ) {
|
||||
:
|
||||
}
|
||||
|
||||
_ () {
|
||||
:
|
||||
}
|
||||
|
||||
function _ { #BASHISM
|
||||
:
|
||||
}
|
||||
|
||||
=() { #BASHISM
|
||||
:
|
||||
}
|
||||
|
||||
function BASHISM=() { #BASHISMS
|
||||
:
|
||||
}
|
||||
|
||||
function BASHISM= { #BASHISMS
|
||||
:
|
||||
}
|
||||
|
||||
# This doesn't work:
|
||||
#foo=() {
|
||||
# :
|
||||
#}
|
32
test/bashisms/functions.sh.out
Normal file
32
test/bashisms/functions.sh.out
Normal file
|
@ -0,0 +1,32 @@
|
|||
possible bashism in bashisms/functions.sh line 15 ('function' is useless):
|
||||
function BASHISM() {
|
||||
possible bashism in bashisms/functions.sh line 19 ('function' is useless):
|
||||
function BASHISM {
|
||||
possible bashism in bashisms/functions.sh line 23 ('function' is useless):
|
||||
function BASHISM {
|
||||
possible bashism in bashisms/functions.sh line 25 (should be >word 2>&1):
|
||||
} &>/dev/null # BASHISM
|
||||
possible bashism in bashisms/functions.sh line 27 (function names should only contain [a-z0-9_]):
|
||||
,() { # BASHISM
|
||||
possible bashism in bashisms/functions.sh line 31 (function names should only contain [a-z0-9_]):
|
||||
function foo:bar:BASHISM { # BASHISMS
|
||||
possible bashism in bashisms/functions.sh line 31 ('function' is useless):
|
||||
function foo:bar:BASHISM { # BASHISMS
|
||||
possible bashism in bashisms/functions.sh line 35 (function names should only contain [a-z0-9_]):
|
||||
function foo-bar-BASHISM() { # BASHISMS
|
||||
possible bashism in bashisms/functions.sh line 35 ('function' is useless):
|
||||
function foo-bar-BASHISM() { # BASHISMS
|
||||
possible bashism in bashisms/functions.sh line 39 (function names should only contain [a-z0-9_]):
|
||||
foo-bar-BASHISM ( ) {
|
||||
possible bashism in bashisms/functions.sh line 47 ('function' is useless):
|
||||
function _ { #BASHISM
|
||||
possible bashism in bashisms/functions.sh line 51 (function names should only contain [a-z0-9_]):
|
||||
=() { #BASHISM
|
||||
possible bashism in bashisms/functions.sh line 55 (function names should only contain [a-z0-9_]):
|
||||
function BASHISM=() { #BASHISMS
|
||||
possible bashism in bashisms/functions.sh line 55 ('function' is useless):
|
||||
function BASHISM=() { #BASHISMS
|
||||
possible bashism in bashisms/functions.sh line 59 (function names should only contain [a-z0-9_]):
|
||||
function BASHISM= { #BASHISMS
|
||||
possible bashism in bashisms/functions.sh line 59 ('function' is useless):
|
||||
function BASHISM= { #BASHISMS
|
5
test/bashisms/gettext.sh
Normal file
5
test/bashisms/gettext.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo $"hello world -- BASHISM"
|
||||
|
||||
echo "foo ' bar moo'$"
|
2
test/bashisms/gettext.sh.out
Normal file
2
test/bashisms/gettext.sh.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/gettext.sh line 3 ($"foo" should be eval_gettext "foo"):
|
||||
echo $"hello world -- BASHISM"
|
4
test/bashisms/glob-ignore.sh
Normal file
4
test/bashisms/glob-ignore.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
GLOBIGNORE="run-tests.sh:BASHISM"
|
||||
echo *.sh | grep -q run-tests.sh || echo meh
|
2
test/bashisms/glob-ignore.sh.out
Normal file
2
test/bashisms/glob-ignore.sh.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/glob-ignore.sh line 3 (GLOBIGNORE=):
|
||||
GLOBIGNORE="run-tests.sh:BASHISM"
|
5
test/bashisms/hash.sh
Normal file
5
test/bashisms/hash.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
: BASHISM; hash
|
||||
hash which # BASHISM
|
||||
hash -r # BASHISM
|
6
test/bashisms/hash.sh.out
Normal file
6
test/bashisms/hash.sh.out
Normal file
|
@ -0,0 +1,6 @@
|
|||
possible bashism in bashisms/hash.sh line 3 (hash):
|
||||
: BASHISM; hash
|
||||
possible bashism in bashisms/hash.sh line 4 (hash):
|
||||
hash which # BASHISM
|
||||
possible bashism in bashisms/hash.sh line 5 (hash):
|
||||
hash -r # BASHISM
|
35
test/bashisms/heredoc-with-dash.sh
Normal file
35
test/bashisms/heredoc-with-dash.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
cat << -EOF1- 1>&2
|
||||
CLEAN
|
||||
-EOF1-
|
||||
|
||||
cat << -EOF2 1>&2
|
||||
CLEAN
|
||||
-EOF2
|
||||
|
||||
cat <<-EOF3 1>&2
|
||||
CLEAN
|
||||
EOF3
|
||||
|
||||
cat <<- EOF4 1>&2
|
||||
CLEAN
|
||||
EOF4
|
||||
|
||||
foo=bar
|
||||
|
||||
cat << '-EOF1-' 1>&2
|
||||
CLEAN $foo
|
||||
-EOF1-
|
||||
|
||||
cat << '-EOF2' 1>&2
|
||||
CLEAN $foo
|
||||
-EOF2
|
||||
|
||||
cat <<-'EOF3' 1>&2
|
||||
CLEAN $foo
|
||||
EOF3
|
||||
|
||||
cat <<- 'EOF4' 1>&2
|
||||
CLEAN $foo
|
||||
EOF4
|
77
test/bashisms/heredoc-with-others.sh
Normal file
77
test/bashisms/heredoc-with-others.sh
Normal file
|
@ -0,0 +1,77 @@
|
|||
#!/bin/sh
|
||||
|
||||
cat << =EOF1
|
||||
function CLEAN() {}
|
||||
=EOF1
|
||||
|
||||
cat << :EOF2
|
||||
function CLEAN() {}
|
||||
:EOF2
|
||||
|
||||
cat << ,EOF3
|
||||
function CLEAN() {}
|
||||
,EOF3
|
||||
|
||||
cat << ?EOF4
|
||||
function CLEAN() {}
|
||||
?EOF4
|
||||
|
||||
cat << E$OF5
|
||||
function CLEAN() {}
|
||||
E$OF5
|
||||
|
||||
cat << $EOF6
|
||||
function CLEAN() {}
|
||||
$EOF6
|
||||
|
||||
cat << EOF_7
|
||||
function CLEAN() {}
|
||||
EOF_7
|
||||
|
||||
cat << EOF;:
|
||||
function CLEAN() {}
|
||||
EOF
|
||||
|
||||
cat << EOF{}9
|
||||
function CLEAN() {}
|
||||
EOF{}9
|
||||
|
||||
cat << EOF\ 10
|
||||
function CLEAN() {}
|
||||
EOF 10
|
||||
|
||||
cat << EOF\;11
|
||||
function CLEAN() {}
|
||||
EOF;11
|
||||
|
||||
cat << EOF\12
|
||||
function CLEAN() {}
|
||||
EOF12
|
||||
|
||||
cat << EOF\\13
|
||||
function CLEAN() {}
|
||||
EOF\13
|
||||
|
||||
cat << EOF\\1\\4
|
||||
function CLEAN() {}
|
||||
EOF\1\4
|
||||
|
||||
cat << \<EOF15\>
|
||||
function CLEAN() {}
|
||||
<EOF15>
|
||||
|
||||
cat << "E\OF16"
|
||||
function CLEAN() {}
|
||||
E\OF16
|
||||
|
||||
cat << 'E\OF17'
|
||||
function CLEAN() {}
|
||||
E\OF17
|
||||
|
||||
cat << EOF18|:
|
||||
function CLEAN() {}
|
||||
EOF18
|
||||
|
||||
cat << EOF19>/dev/null
|
||||
echo -e CLEAN() {}
|
||||
EOF19
|
52
test/bashisms/heredocs.sh
Normal file
52
test/bashisms/heredocs.sh
Normal file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/sh
|
||||
|
||||
cat <<- FOO
|
||||
foo
|
||||
bar
|
||||
moo
|
||||
FOO
|
||||
|
||||
echo -e moo # BASHISM
|
||||
|
||||
foo() {
|
||||
cat <<- FOO
|
||||
foo
|
||||
bar
|
||||
moo
|
||||
FOO
|
||||
echo -e BASHISM
|
||||
}
|
||||
|
||||
bar() {
|
||||
cat <<- FOO
|
||||
foo
|
||||
bar
|
||||
moo
|
||||
FOO
|
||||
echo -e nothing wrong here
|
||||
FOO
|
||||
echo -e BASHISM
|
||||
}
|
||||
|
||||
|
||||
moo() {
|
||||
cat << FOO
|
||||
foo
|
||||
bar
|
||||
moo
|
||||
FOO
|
||||
echo -e nothing wrong here
|
||||
FOO
|
||||
echo -e still nothing wrong here
|
||||
FOO
|
||||
echo -e BASHISM
|
||||
}
|
||||
|
||||
baz() {
|
||||
cat << EOF1
|
||||
EOF1
|
||||
echo -e still inside the here doc
|
||||
EOF1 ; echo -e still inside...
|
||||
EOF1
|
||||
echo -e BASHISM
|
||||
}
|
10
test/bashisms/heredocs.sh.out
Normal file
10
test/bashisms/heredocs.sh.out
Normal file
|
@ -0,0 +1,10 @@
|
|||
possible bashism in bashisms/heredocs.sh line 9 (echo -e):
|
||||
echo -e moo # BASHISM
|
||||
possible bashism in bashisms/heredocs.sh line 17 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/heredocs.sh line 28 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/heredocs.sh line 42 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/heredocs.sh line 51 (echo -e):
|
||||
echo -e BASHISM
|
15
test/bashisms/jobs.sh
Normal file
15
test/bashisms/jobs.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
# POSIX+UP:
|
||||
jobs # BASHISM
|
||||
jobs -l # BASHISM
|
||||
jobs -p # BASHISM
|
||||
|
||||
# Non-POSIX at all:
|
||||
|
||||
sleep 10 &
|
||||
j=$(jobs -p) # possible BASHISM (context changes because of subshell)
|
||||
jobs -r # BASHISM
|
||||
jobs -s # BASHISM
|
||||
jobs -n # BASHISM
|
||||
jobs -x # BASHISM
|
16
test/bashisms/jobs.sh.out
Normal file
16
test/bashisms/jobs.sh.out
Normal file
|
@ -0,0 +1,16 @@
|
|||
possible bashism in bashisms/jobs.sh line 4 (jobs):
|
||||
jobs # BASHISM
|
||||
possible bashism in bashisms/jobs.sh line 5 (jobs):
|
||||
jobs -l # BASHISM
|
||||
possible bashism in bashisms/jobs.sh line 6 (jobs):
|
||||
jobs -p # BASHISM
|
||||
possible bashism in bashisms/jobs.sh line 11 (jobs):
|
||||
j=$(jobs -p) # possible BASHISM (context changes because of subshell)
|
||||
possible bashism in bashisms/jobs.sh line 12 (jobs):
|
||||
jobs -r # BASHISM
|
||||
possible bashism in bashisms/jobs.sh line 13 (jobs):
|
||||
jobs -s # BASHISM
|
||||
possible bashism in bashisms/jobs.sh line 14 (jobs):
|
||||
jobs -n # BASHISM
|
||||
possible bashism in bashisms/jobs.sh line 15 (jobs):
|
||||
jobs -x # BASHISM
|
19
test/bashisms/line-continuation.sh
Normal file
19
test/bashisms/line-continuation.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo foo; \
|
||||
shopt something # BASHISM
|
||||
|
||||
echo foo; echo \
|
||||
shopt something
|
||||
|
||||
cat <<EOF \
|
||||
&>/dev/null #BASHISM
|
||||
bar
|
||||
moo
|
||||
EOF
|
||||
|
||||
cat <<EOF
|
||||
foo\
|
||||
bar\
|
||||
moo
|
||||
EOF
|
6
test/bashisms/line-continuation.sh.out
Normal file
6
test/bashisms/line-continuation.sh.out
Normal file
|
@ -0,0 +1,6 @@
|
|||
possible bashism in bashisms/line-continuation.sh line 4 (shopt):
|
||||
echo foo; \
|
||||
shopt something # BASHISM
|
||||
possible bashism in bashisms/line-continuation.sh line 10 (should be >word 2>&1):
|
||||
cat <<EOF \
|
||||
&>/dev/null #BASHISM
|
11
test/bashisms/negations.sh
Normal file
11
test/bashisms/negations.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
case "moo" in
|
||||
[^f]oo) # BASHISM
|
||||
echo hey
|
||||
;;
|
||||
[!f]oo)
|
||||
echo hey
|
||||
;;
|
||||
esac
|
||||
|
2
test/bashisms/negations.sh.out
Normal file
2
test/bashisms/negations.sh.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/negations.sh line 4 ([^] should be [!]):
|
||||
[^f]oo) # BASHISM
|
15
test/bashisms/other-vars.sh
Normal file
15
test/bashisms/other-vars.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
test() {
|
||||
echo $FUNCNAME BASHISM
|
||||
}
|
||||
|
||||
test
|
||||
|
||||
echo $DIRSTACK BASHISM
|
||||
echo $SECONDS BASHISM
|
||||
echo $TMOUT BASHISM
|
||||
echo $TIMEFORMAT BASHISM
|
||||
TMOUT=2 # BASHISM
|
||||
read REPLY
|
||||
TIMEFORMAT='' # BASHISM
|
14
test/bashisms/other-vars.sh.out
Normal file
14
test/bashisms/other-vars.sh.out
Normal file
|
@ -0,0 +1,14 @@
|
|||
possible bashism in bashisms/other-vars.sh line 4 ($FUNCNAME):
|
||||
echo $FUNCNAME BASHISM
|
||||
possible bashism in bashisms/other-vars.sh line 9 ($DIRSTACK):
|
||||
echo $DIRSTACK BASHISM
|
||||
possible bashism in bashisms/other-vars.sh line 10 ($SECONDS):
|
||||
echo $SECONDS BASHISM
|
||||
possible bashism in bashisms/other-vars.sh line 11 ($TMOUT):
|
||||
echo $TMOUT BASHISM
|
||||
possible bashism in bashisms/other-vars.sh line 12 ($TIMEFORMAT):
|
||||
echo $TIMEFORMAT BASHISM
|
||||
possible bashism in bashisms/other-vars.sh line 13 (TMOUT=):
|
||||
TMOUT=2 # BASHISM
|
||||
possible bashism in bashisms/other-vars.sh line 15 (TIMEFORMAT=):
|
||||
TIMEFORMAT='' # BASHISM
|
7
test/bashisms/printf.sh
Normal file
7
test/bashisms/printf.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
printf -v some_var "this is a BASHISM"
|
||||
|
||||
printf "the use of %q is bad\n" "BASHISMS" >/dev/null
|
||||
|
||||
printf "%q leading the string is bad\n" "BASHISMS" >/dev/null
|
6
test/bashisms/printf.sh.out
Normal file
6
test/bashisms/printf.sh.out
Normal file
|
@ -0,0 +1,6 @@
|
|||
possible bashism in bashisms/printf.sh line 3 ('printf -v var ...' should be var='$(printf ...)'):
|
||||
printf -v some_var "this is a BASHISM"
|
||||
possible bashism in bashisms/printf.sh line 5 (printf %q):
|
||||
printf "the use of %q is bad\n" "BASHISMS" >/dev/null
|
||||
possible bashism in bashisms/printf.sh line 7 (printf %q):
|
||||
printf "%q leading the string is bad\n" "BASHISMS" >/dev/null
|
37
test/bashisms/quoted-strings.sh
Normal file
37
test/bashisms/quoted-strings.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
foo="
|
||||
echo -e nothing wrong here
|
||||
#crap"
|
||||
|
||||
echo -e BASHISM
|
||||
|
||||
foo="\
|
||||
#crap"
|
||||
|
||||
echo -e BASHISM
|
||||
|
||||
case foo in
|
||||
*\'*)
|
||||
echo -e BASHISM
|
||||
;;
|
||||
esac
|
||||
#'
|
||||
echo -e BASHISM
|
||||
|
||||
case foo in
|
||||
*\\"*")
|
||||
echo -e BASHISM
|
||||
;;
|
||||
*\\\"*)
|
||||
echo -e BASHISM
|
||||
;;
|
||||
*\"*)
|
||||
echo -e BASHISM
|
||||
;;
|
||||
esac
|
||||
#"
|
||||
echo -e BASHISM
|
||||
|
||||
foo='\'
|
||||
echo -e BASHISM
|
18
test/bashisms/quoted-strings.sh.out
Normal file
18
test/bashisms/quoted-strings.sh.out
Normal file
|
@ -0,0 +1,18 @@
|
|||
possible bashism in bashisms/quoted-strings.sh line 7 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 12 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 16 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 20 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 24 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 27 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 30 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 34 (echo -e):
|
||||
echo -e BASHISM
|
||||
possible bashism in bashisms/quoted-strings.sh line 37 (echo -e):
|
||||
echo -e BASHISM
|
9
test/bashisms/read.sh
Normal file
9
test/bashisms/read.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
read
|
||||
read -r
|
||||
read file.txt
|
||||
|
||||
read-local-command
|
||||
read-local-command -r
|
||||
read-local-command file.txt
|
4
test/bashisms/read.sh.out
Normal file
4
test/bashisms/read.sh.out
Normal file
|
@ -0,0 +1,4 @@
|
|||
possible bashism in bashisms/read.sh line 3 (read without variable):
|
||||
read
|
||||
possible bashism in bashisms/read.sh line 4 (read without variable):
|
||||
read -r
|
13
test/bashisms/return.sh
Normal file
13
test/bashisms/return.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
foo() {
|
||||
return -- 1 # BASHISM
|
||||
}
|
||||
|
||||
bar () {
|
||||
return 256 # BASHISM
|
||||
}
|
||||
|
||||
moo () {
|
||||
return -1 # BASHISM
|
||||
}
|
6
test/bashisms/return.sh.out
Normal file
6
test/bashisms/return.sh.out
Normal file
|
@ -0,0 +1,6 @@
|
|||
possible bashism in bashisms/return.sh line 4 ('exit --' should be 'exit' (idem for return)):
|
||||
return -- 1 # BASHISM
|
||||
possible bashism in bashisms/return.sh line 8 (exit|return status code greater than 255):
|
||||
return 256 # BASHISM
|
||||
possible bashism in bashisms/return.sh line 12 (exit|return with negative status code):
|
||||
return -1 # BASHISM
|
5
test/bashisms/shell-vars.mk
Normal file
5
test/bashisms/shell-vars.mk
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
foo:
|
||||
read foo bar | echo $$foo and $$bar
|
||||
echo my pid: $$$$
|
2
test/bashisms/source
Normal file
2
test/bashisms/source
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
source foo.sh # BASHISM
|
2
test/bashisms/source.out
Normal file
2
test/bashisms/source.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/source line 2 (should be '.', not 'source'):
|
||||
source foo.sh # BASHISM
|
13
test/bashisms/special-case.sh
Normal file
13
test/bashisms/special-case.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
case "foo" in
|
||||
foo)
|
||||
echo once
|
||||
;& # BASHISM
|
||||
moo)
|
||||
echo twice
|
||||
;;& # BASHISM
|
||||
foo)
|
||||
echo foo again
|
||||
;;
|
||||
esac
|
4
test/bashisms/special-case.sh.out
Normal file
4
test/bashisms/special-case.sh.out
Normal file
|
@ -0,0 +1,4 @@
|
|||
possible bashism in bashisms/special-case.sh line 6 (;;& and ;& special case operators):
|
||||
;& # BASHISM
|
||||
possible bashism in bashisms/special-case.sh line 9 (;;& and ;& special case operators):
|
||||
;;& # BASHISM
|
26
test/bashisms/special-expansions.sh
Normal file
26
test/bashisms/special-expansions.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -- foo bar moo
|
||||
|
||||
echo BASHISM: ${#@}
|
||||
echo BASHISM: ${#*}
|
||||
|
||||
echo BASHISM: ${@%f*}
|
||||
echo BASHISM: ${*%f*}
|
||||
echo BASHISM: ${@%%f*}
|
||||
echo BASHISM: ${*%%f*}
|
||||
|
||||
echo BASHISM: ${@#*o}
|
||||
echo BASHISM: ${*#*o}
|
||||
echo BASHISM: ${@##*o}
|
||||
echo BASHISM: ${*##*o}
|
||||
|
||||
echo BASHISM: ${@/?/u}
|
||||
echo BASHISM: ${*/?/u}
|
||||
echo BASHISM: ${@/?/}
|
||||
echo BASHISM: ${*/?/}
|
||||
|
||||
echo BASHISM: ${@:2}
|
||||
echo BASHISM: ${*:2}
|
||||
echo BASHISM: ${@:1:1}
|
||||
echo BASHISM: ${*:1:1}
|
36
test/bashisms/special-expansions.sh.out
Normal file
36
test/bashisms/special-expansions.sh.out
Normal file
|
@ -0,0 +1,36 @@
|
|||
possible bashism in bashisms/special-expansions.sh line 5 (${#@} or ${#*}):
|
||||
echo BASHISM: ${#@}
|
||||
possible bashism in bashisms/special-expansions.sh line 6 (${#@} or ${#*}):
|
||||
echo BASHISM: ${#*}
|
||||
possible bashism in bashisms/special-expansions.sh line 8 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${@%f*}
|
||||
possible bashism in bashisms/special-expansions.sh line 9 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${*%f*}
|
||||
possible bashism in bashisms/special-expansions.sh line 10 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${@%%f*}
|
||||
possible bashism in bashisms/special-expansions.sh line 11 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${*%%f*}
|
||||
possible bashism in bashisms/special-expansions.sh line 13 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${@#*o}
|
||||
possible bashism in bashisms/special-expansions.sh line 14 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${*#*o}
|
||||
possible bashism in bashisms/special-expansions.sh line 15 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${@##*o}
|
||||
possible bashism in bashisms/special-expansions.sh line 16 (${[@|*]#[#]pat} or ${[@|*]%[%]pat}):
|
||||
echo BASHISM: ${*##*o}
|
||||
possible bashism in bashisms/special-expansions.sh line 18 (${parm/?/pat[/str]}):
|
||||
echo BASHISM: ${@/?/u}
|
||||
possible bashism in bashisms/special-expansions.sh line 19 (${parm/?/pat[/str]}):
|
||||
echo BASHISM: ${*/?/u}
|
||||
possible bashism in bashisms/special-expansions.sh line 20 (${parm/?/pat[/str]}):
|
||||
echo BASHISM: ${@/?/}
|
||||
possible bashism in bashisms/special-expansions.sh line 21 (${parm/?/pat[/str]}):
|
||||
echo BASHISM: ${*/?/}
|
||||
possible bashism in bashisms/special-expansions.sh line 23 (${foo:3[:1]}):
|
||||
echo BASHISM: ${@:2}
|
||||
possible bashism in bashisms/special-expansions.sh line 24 (${foo:3[:1]}):
|
||||
echo BASHISM: ${*:2}
|
||||
possible bashism in bashisms/special-expansions.sh line 25 (${foo:3[:1]}):
|
||||
echo BASHISM: ${@:1:1}
|
||||
possible bashism in bashisms/special-expansions.sh line 26 (${foo:3[:1]}):
|
||||
echo BASHISM: ${*:1:1}
|
3
test/bashisms/subshell-no-arith.sh
Normal file
3
test/bashisms/subshell-no-arith.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo $((echo foo); echo bar)
|
41
test/bashisms/tilde-expansion.sh
Normal file
41
test/bashisms/tilde-expansion.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo tilde alone: ~/
|
||||
echo tilde with name: ~root/
|
||||
|
||||
cd ; cd - >/dev/null
|
||||
|
||||
echo BASHISM: tilde plus: ~+
|
||||
echo BASHISM: tilde minus: ~-
|
||||
|
||||
pushd ~ >/dev/null 2>&1 # BASHISM
|
||||
for i in $(seq 1 9); do
|
||||
pushd / >/dev/null 2>&1 # BASHISM
|
||||
done
|
||||
|
||||
echo BASHISM: tilde plus n: ~+1
|
||||
echo BASHISM: tilde implicit plus n: ~1
|
||||
echo BASHISM: tilde minus n: ~-1
|
||||
|
||||
echo BASHISM: tilde plus 10: ~+10
|
||||
echo BASHISM: tilde implicit plus 10: ~10
|
||||
echo BASHISM: tilde minus 10: ~-10
|
||||
|
||||
echo BASHISM=~-/bin
|
||||
echo BASHISM=/:~+/bin/
|
||||
BASHISM=~-/bin ; echo $BASHISM
|
||||
BASHISM=/:~+/bin/ ; echo $BASHISM
|
||||
|
||||
echo nothing wrong here: ~+foo/
|
||||
echo nothing wrong here: ~-moo/
|
||||
echo nothing wrong here: ~+1foo/
|
||||
echo nothing wrong here: ~1foo/
|
||||
echo nothing wrong here: ~-1moo/
|
||||
|
||||
# Again, but without the slash
|
||||
echo nothing wrong here: ~+foo
|
||||
echo nothing wrong here: ~-moo
|
||||
echo nothing wrong here: ~+1foo
|
||||
echo nothing wrong here: ~1foo
|
||||
echo nothing wrong here: ~-1moo
|
||||
|
28
test/bashisms/tilde-expansion.sh.out
Normal file
28
test/bashisms/tilde-expansion.sh.out
Normal file
|
@ -0,0 +1,28 @@
|
|||
possible bashism in bashisms/tilde-expansion.sh line 8 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde plus: ~+
|
||||
possible bashism in bashisms/tilde-expansion.sh line 9 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde minus: ~-
|
||||
possible bashism in bashisms/tilde-expansion.sh line 11 ((push|pop)d):
|
||||
pushd ~ >/dev/null 2>&1 # BASHISM
|
||||
possible bashism in bashisms/tilde-expansion.sh line 13 ((push|pop)d):
|
||||
pushd / >/dev/null 2>&1 # BASHISM
|
||||
possible bashism in bashisms/tilde-expansion.sh line 16 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde plus n: ~+1
|
||||
possible bashism in bashisms/tilde-expansion.sh line 17 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde implicit plus n: ~1
|
||||
possible bashism in bashisms/tilde-expansion.sh line 18 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde minus n: ~-1
|
||||
possible bashism in bashisms/tilde-expansion.sh line 20 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde plus 10: ~+10
|
||||
possible bashism in bashisms/tilde-expansion.sh line 21 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde implicit plus 10: ~10
|
||||
possible bashism in bashisms/tilde-expansion.sh line 22 (non-standard tilde expansion):
|
||||
echo BASHISM: tilde minus 10: ~-10
|
||||
possible bashism in bashisms/tilde-expansion.sh line 24 (non-standard tilde expansion):
|
||||
echo BASHISM=~-/bin
|
||||
possible bashism in bashisms/tilde-expansion.sh line 25 (non-standard tilde expansion):
|
||||
echo BASHISM=/:~+/bin/
|
||||
possible bashism in bashisms/tilde-expansion.sh line 26 (non-standard tilde expansion):
|
||||
BASHISM=~-/bin ; echo $BASHISM
|
||||
possible bashism in bashisms/tilde-expansion.sh line 27 (non-standard tilde expansion):
|
||||
BASHISM=/:~+/bin/ ; echo $BASHISM
|
17
test/bashisms/traps.sh
Normal file
17
test/bashisms/traps.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
trap foo ERR # BASHISM
|
||||
trap foo RETURN # BASHISM
|
||||
trap foo DEBUG # BASHISM
|
||||
|
||||
trap "echo BASHISM" ERR
|
||||
trap "echo BASHISM" RETURN
|
||||
trap "echo BASHISM" DEBUG
|
||||
|
||||
foo() {
|
||||
echo ": dummy function"
|
||||
}
|
||||
|
||||
trap $(foo BASHISM) ERR
|
||||
trap "$(foo BASHISM)" RETURN
|
||||
trap "echo $foo BASHISM" DEBUG
|
18
test/bashisms/traps.sh.out
Normal file
18
test/bashisms/traps.sh.out
Normal file
|
@ -0,0 +1,18 @@
|
|||
possible bashism in bashisms/traps.sh line 3 (trap with ERR|DEBUG|RETURN):
|
||||
trap foo ERR # BASHISM
|
||||
possible bashism in bashisms/traps.sh line 4 (trap with ERR|DEBUG|RETURN):
|
||||
trap foo RETURN # BASHISM
|
||||
possible bashism in bashisms/traps.sh line 5 (trap with ERR|DEBUG|RETURN):
|
||||
trap foo DEBUG # BASHISM
|
||||
possible bashism in bashisms/traps.sh line 7 (trap with ERR|DEBUG|RETURN):
|
||||
trap "echo BASHISM" ERR
|
||||
possible bashism in bashisms/traps.sh line 8 (trap with ERR|DEBUG|RETURN):
|
||||
trap "echo BASHISM" RETURN
|
||||
possible bashism in bashisms/traps.sh line 9 (trap with ERR|DEBUG|RETURN):
|
||||
trap "echo BASHISM" DEBUG
|
||||
possible bashism in bashisms/traps.sh line 15 (trap with ERR|DEBUG|RETURN):
|
||||
trap $(foo BASHISM) ERR
|
||||
possible bashism in bashisms/traps.sh line 16 (trap with ERR|DEBUG|RETURN):
|
||||
trap "$(foo BASHISM)" RETURN
|
||||
possible bashism in bashisms/traps.sh line 17 (trap with ERR|DEBUG|RETURN):
|
||||
trap "echo $foo BASHISM" DEBUG
|
3
test/bashisms/underscore-var.sh
Normal file
3
test/bashisms/underscore-var.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo BASHISM $_
|
2
test/bashisms/underscore-var.sh.out
Normal file
2
test/bashisms/underscore-var.sh.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
possible bashism in bashisms/underscore-var.sh line 3 ($_):
|
||||
echo BASHISM $_
|
297
test/bashisms/unknown-fns.sh
Normal file
297
test/bashisms/unknown-fns.sh
Normal file
|
@ -0,0 +1,297 @@
|
|||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# #
|
||||
# Copyright (c) 2009 FUJITSU LIMITED #
|
||||
# #
|
||||
# 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 2 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, write to the Free Software #
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
# #
|
||||
# Author: Miao Xie <miaox@cn.fujitsu.com> #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
cd $LTPROOT/testcases/bin
|
||||
|
||||
. ./cpuset_funcs.sh
|
||||
|
||||
export TCID="cpuset01"
|
||||
export TST_TOTAL=97
|
||||
export TST_COUNT=1
|
||||
|
||||
nr_cpus=$NR_CPUS
|
||||
nr_mems=$N_NODES
|
||||
|
||||
cpus_all="$(seq -s, 0 $((nr_cpus-1)))"
|
||||
mems_all="$(seq -s, 0 $((nr_mems-1)))"
|
||||
|
||||
exit_status=0
|
||||
|
||||
cfile_name=
|
||||
|
||||
# base_op_write_and_test <write_file_name> <write_string> <expect_string>
|
||||
base_op_write_and_test()
|
||||
{
|
||||
local write_file="$1"
|
||||
local write_string="$2"
|
||||
local expect_string="$3"
|
||||
local write_result=
|
||||
local ret=0
|
||||
|
||||
mkdir -p "$(dirname $write_file)" || {
|
||||
tst_brkm TFAIL "Failed to mkdir -p $(basename $write_file)"
|
||||
return 1
|
||||
}
|
||||
[ "$write_string" = NULL ] && write_string=" "
|
||||
|
||||
/bin/echo "$write_string" > "$write_file" 2> $CPUSET_TMP/stderr
|
||||
ret=$?
|
||||
write_result="$(cat "$write_file")"
|
||||
|
||||
case "$expect_string" in
|
||||
EMPTY)
|
||||
test -z "$write_result" -a $ret = 0
|
||||
ret=$?
|
||||
;;
|
||||
WRITE_ERROR)
|
||||
ret=$((!$ret))
|
||||
;;
|
||||
*)
|
||||
test "$expect_string" = "$write_result" -a $ret = 0
|
||||
ret=$?
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
tst_resm TPASS "$cfile_name: Get the expected string"
|
||||
else
|
||||
tst_resm TFAIL "$cfile_name: Test result - $write_result Expected string - \"$expect_string\""
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
base_op_test()
|
||||
{
|
||||
setup
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
else
|
||||
base_op_write_and_test "$@"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
fi
|
||||
|
||||
cleanup
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
fi
|
||||
fi
|
||||
: $((TST_COUNT++)) #BASHISM
|
||||
}
|
||||
|
||||
test_cpus()
|
||||
{
|
||||
cfile_name="cpus"
|
||||
while read cpus result
|
||||
do
|
||||
base_op_test "$CPUSET/1/cpus" "$cpus" "$result"
|
||||
done <<- EOF
|
||||
NULL EMPTY
|
||||
0 0
|
||||
$nr_cpus WRITE_ERROR
|
||||
$cpus_all 0-$((nr_cpus-1))
|
||||
${cpus_all}$nr_cpus WRITE_ERROR
|
||||
0,0 0
|
||||
0-0 0
|
||||
0-$((nr_cpus-1)) 0-$((nr_cpus-1))
|
||||
-1 WRITE_ERROR
|
||||
0-$nr_cpus WRITE_ERROR
|
||||
0- WRITE_ERROR
|
||||
0--$((nr_cpus-1)) WRITE_ERROR
|
||||
0,1-$((nr_cpus-2)),$((nr_cpus-1)) 0-$((nr_cpus-1))
|
||||
0,1-$((nr_cpus-2)), 0-$((nr_cpus-2))
|
||||
0AAA WRITE_ERROR
|
||||
AAA WRITE_ERROR
|
||||
EOF
|
||||
# while read cpus result
|
||||
}
|
||||
|
||||
test_mems()
|
||||
{
|
||||
cfile_name="mems"
|
||||
while read mems result
|
||||
do
|
||||
base_op_test "$CPUSET/1/mems" "$mems" "$result"
|
||||
done <<- EOF
|
||||
NULL EMPTY
|
||||
0 0
|
||||
$nr_mems WRITE_ERROR
|
||||
$mems_all 0-$((nr_mems-1))
|
||||
${mems_all}$nr_mems WRITE_ERROR
|
||||
0,0 0
|
||||
0-0 0
|
||||
0-$((nr_mems-1)) 0-$((nr_mems-1))
|
||||
-1 WRITE_ERROR
|
||||
0-$nr_mems WRITE_ERROR
|
||||
0- WRITE_ERROR
|
||||
0--$((nr_mems-1)) WRITE_ERROR
|
||||
0,1-$((nr_mems-2)),$((nr_mems-1)) 0-$((nr_mems-1))
|
||||
0,1-$((nr_mems-2)), 0-$((nr_mems-2))
|
||||
0AAA WRITE_ERROR
|
||||
AAA WRITE_ERROR
|
||||
EOF
|
||||
# while read mems result
|
||||
}
|
||||
|
||||
test_flags()
|
||||
{
|
||||
for filename in cpu_exclusive mem_exclusive mem_hardwall \
|
||||
memory_migrate memory_spread_page memory_spread_slab \
|
||||
sched_load_balance memory_pressure_enabled
|
||||
do
|
||||
cfile_name="$filename"
|
||||
while read flags result
|
||||
do
|
||||
base_op_test "$CPUSET/$filename" "$flags" "$result"
|
||||
done <<- EOF
|
||||
NULL 0
|
||||
0 0
|
||||
1 1
|
||||
-1 WRITE_ERROR
|
||||
A WRITE_ERROR
|
||||
2 1
|
||||
EOF
|
||||
# while read flags, result
|
||||
done # for filename in flagfiles
|
||||
}
|
||||
|
||||
test_domain()
|
||||
{
|
||||
cfile_name="sched_relax_domain_level"
|
||||
while read domain_level result
|
||||
do
|
||||
base_op_test "$CPUSET/sched_relax_domain_level" "$domain_level" "$result"
|
||||
done <<- EOF
|
||||
NULL 0
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 WRITE_ERROR
|
||||
-1 -1
|
||||
-2 WRITE_ERROR
|
||||
A WRITE_ERROR
|
||||
EOF
|
||||
# while read domain_level result
|
||||
}
|
||||
|
||||
# attach_task_test <cpus> <mems> <expect>
|
||||
attach_task_test()
|
||||
{
|
||||
local cpus=$1
|
||||
local mems=$2
|
||||
local expect=$3
|
||||
|
||||
local pid=
|
||||
local ret=
|
||||
|
||||
setup
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
cleanup
|
||||
((TST_COUNT++)) #BASHISM
|
||||
return
|
||||
fi
|
||||
|
||||
# create sub cpuset
|
||||
mkdir "$CPUSET/sub_cpuset" > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
cleanup
|
||||
((TST_COUNT++)) # BASHISM
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$cpus" != "NULL" ]; then
|
||||
echo $cpus > "$CPUSET/sub_cpuset/cpus"
|
||||
fi
|
||||
if [ "$mems" != "NULL" ]; then
|
||||
echo $mems > "$CPUSET/sub_cpuset/mems"
|
||||
fi
|
||||
|
||||
cat /dev/zero > /dev/null &
|
||||
pid=$!
|
||||
|
||||
# attach task into the cpuset group
|
||||
echo $pid > "$CPUSET/sub_cpuset/tasks" 2> /dev/null
|
||||
if [ $? -eq $expect ]; then
|
||||
tst_resm TPASS "Attaching Task Test succeeded!!"
|
||||
else
|
||||
tst_resm TFAIL "Attaching Task Test failed!! cpus - \"$cpus\", mems - \"$mems\", Expect - \"$expect\", Fact - \"$ret\". (0 - Attach Success, 1 - Attach Fail)"
|
||||
exit_status=1
|
||||
fi
|
||||
|
||||
/bin/kill $pid &> /dev/null # BASHISM
|
||||
cleanup
|
||||
if [ $? -ne 0 ]; then
|
||||
exit_status=1
|
||||
fi
|
||||
((TST_COUNT++)) # BASHISM
|
||||
}
|
||||
|
||||
|
||||
test_attach_task()
|
||||
{
|
||||
cfile_name="tasks"
|
||||
while read cpus mems expect
|
||||
do
|
||||
attach_task_test "$cpus" "$mems" "$expect"
|
||||
done <<- EOF
|
||||
0 NULL 1
|
||||
0 0 0
|
||||
NULL 0 1
|
||||
EOF
|
||||
# while read cpus mems expect
|
||||
}
|
||||
|
||||
test_readonly_cfiles()
|
||||
{
|
||||
for filename in cpus mems memory_pressure
|
||||
do
|
||||
cfile_name="$filename(READONLY)"
|
||||
base_op_test "$CPUSET/$filename" "0" "WRITE_ERROR"
|
||||
done # for filename in readonly cfiles
|
||||
}
|
||||
|
||||
# Case 1-3
|
||||
test_readonly_cfiles
|
||||
|
||||
# Case 4-19
|
||||
test_cpus
|
||||
|
||||
# Case 20-35
|
||||
test_mems
|
||||
|
||||
# Case 36-83
|
||||
test_flags
|
||||
|
||||
# Case 84-94
|
||||
test_domain
|
||||
|
||||
# Case 95-97
|
||||
test_attach_task
|
||||
|
||||
exit $exit_status
|
10
test/bashisms/unknown-fns.sh.out
Normal file
10
test/bashisms/unknown-fns.sh.out
Normal file
|
@ -0,0 +1,10 @@
|
|||
possible bashism in bashisms/unknown-fns.sh line 100 ('$((n++))' should be '$n; $((n=n+1))'):
|
||||
: $((TST_COUNT++)) #BASHISM
|
||||
possible bashism in bashisms/unknown-fns.sh line 215 ('((' should be '$(('):
|
||||
((TST_COUNT++)) #BASHISM
|
||||
possible bashism in bashisms/unknown-fns.sh line 224 ('((' should be '$(('):
|
||||
((TST_COUNT++)) # BASHISM
|
||||
possible bashism in bashisms/unknown-fns.sh line 247 (should be >word 2>&1):
|
||||
/bin/kill $pid &> /dev/null # BASHISM
|
||||
possible bashism in bashisms/unknown-fns.sh line 252 ('((' should be '$(('):
|
||||
((TST_COUNT++)) # BASHISM
|
5
test/bashisms/unterminated-string.sh
Normal file
5
test/bashisms/unterminated-string.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
CLEAN="'("'"c"'")'"
|
||||
echo "foo
|
||||
bar"
|
5
test/bashisms/unterminated-string2.sh
Normal file
5
test/bashisms/unterminated-string2.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
CLEAN="("'"c"'")"
|
||||
echo "foo
|
||||
bar"
|
Loading…
Add table
Add a link
Reference in a new issue