Page MenuHomeFreeBSD

D29054.id85117.diff
No OneTemporary

D29054.id85117.diff

Index: tests/sys/netgraph/ng_macfilter_test.sh
===================================================================
--- tests/sys/netgraph/ng_macfilter_test.sh
+++ tests/sys/netgraph/ng_macfilter_test.sh
@@ -45,7 +45,7 @@
loaded_modules=''
load_modules () {
- for kmod in $*; do
+ for kmod in "$@"; do
if ! kldstat -q -m $kmod; then
test_comment "Loading $kmod..."
kldload $kmod
@@ -96,16 +96,16 @@
TSTFAILS=0
TSTSUCCS=0
-_test_next () { TSTNR=$(($TSTNR + 1)); }
-_test_succ () { TSTSUCCS=$(($TSTSUCCS + 1)); }
-_test_fail () { TSTFAILS=$(($TSTFAILS + 1)); }
+_test_next () { TSTNR=$((TSTNR + 1)); }
+_test_succ () { TSTSUCCS=$((TSTSUCCS + 1)); }
+_test_fail () { TSTFAILS=$((TSTFAILS + 1)); }
test_cnt () { echo "1..${1:-$TSTNR}"; }
test_title () {
local msg="$1"
printf '### %s ' "$msg"
- printf '#%.0s' `seq $((80 - ${#msg} - 5))`
+ printf '#%.0s' $(seq $((80 - ${#msg} - 5)))
printf "\n"
}
test_comment () { echo "# $1"; }
@@ -229,7 +229,8 @@
created_hooks=$(gethooks)
rc=0
-test_cnt
+# Update this number when adding new tests
+test_cnt 46
################################################################################
@@ -244,12 +245,12 @@
################################################################################
test_title "Test: Add and remove hooks"
-ngctl connect MF: O2M: xxx1 many$(($HOOKS + 1))
-test_success "connect MF:xxx1 to O2M:many$(($HOOKS + 1))"
-ngctl connect MF: O2M: xxx2 many$(($HOOKS + 2))
-test_success "connect MF:xxx2 to O2M:many$(($HOOKS + 2))"
-ngctl connect MF: O2M: xxx3 many$(($HOOKS + 3))
-test_success "connect MF:xxx3 to O2M:many$(($HOOKS + 3))"
+ngctl connect MF: O2M: xxx1 many$((HOOKS + 1))
+test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))"
+ngctl connect MF: O2M: xxx2 many$((HOOKS + 2))
+test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))"
+ngctl connect MF: O2M: xxx3 many$((HOOKS + 3))
+test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))"
hooks=$(gethooks)
test_eq $created_hooks:xxx1:xxx2:xxx3 $hooks 'hooks after adding xxx1-3'
@@ -273,7 +274,7 @@
added_hooks=""
for i in $(seq 10 1 $HOOKSADD); do
added_hooks="$added_hooks:xxx$i"
- ngctl connect MF: O2M: xxx$i many$(($HOOKS + $i))
+ ngctl connect MF: O2M: xxx$i many$((HOOKS + i))
done
hooks=$(gethooks)
test_eq $created_hooks$added_hooks $hooks 'hooks after adding many hooks'
@@ -291,21 +292,21 @@
test_title "Test: Adding many MACs..."
I=1
for i in $(seq $ITERATIONS | sort -R); do
- test_comment "Iteration $I/$iterations..."
+ test_comment "Iteration $I/$ITERATIONS..."
for j in $(seq 0 1 $SUBITERATIONS); do
test $i = 2 && edge='out2' || edge='out1'
ether=$(genmac $j $i)
ngctl msg MF: 'direct' "{ hookname=\"$edge\" ether=$ether }"
done
- I=$(($I + 1))
+ I=$((I + 1))
done
n=$(countmacs out1)
-n2=$(( ( $ITERATIONS - 1 ) * ( $SUBITERATIONS + 1 ) ))
+n2=$(( ( ITERATIONS - 1 ) * ( SUBITERATIONS + 1 ) ))
test_eq $n $n2 'MACs in table for out1'
n=$(countmacs out2)
-n2=$(( 1 * ( $SUBITERATIONS + 1 ) ))
+n2=$(( 1 * ( SUBITERATIONS + 1 ) ))
test_eq $n $n2 'MACs in table for out2'
n=$(countmacs out3)
n2=0
@@ -324,10 +325,10 @@
done
n=$(countmacs out1)
-n2=$(( ( $ITERATIONS - 1 ) * ( $SUBITERATIONS + 1 - 1 ) ))
+n2=$(( ( ITERATIONS - 1 ) * ( SUBITERATIONS + 1 - 1 ) ))
test_eq $n $n2 'MACs in table for out1'
n=$(countmacs out2)
-n2=$(( 1 * ( $SUBITERATIONS + 1 - 1 ) ))
+n2=$(( 1 * ( SUBITERATIONS + 1 - 1 ) ))
test_eq $n $n2 'MACs in table for out2'
n=$(countmacs out3)
n2=$ITERATIONS
@@ -340,7 +341,7 @@
test_title "Test: Removing all MACs one by one..."
I=1
for i in $(seq $ITERATIONS | sort -R); do
- test_comment "Iteration $I/$iterations..."
+ test_comment "Iteration $I/$ITERATIONS..."
for j in $(seq 0 1 $SUBITERATIONS | sort -R); do
edge="default"
ether=$(genmac $j $i)
@@ -360,7 +361,7 @@
test_title "Test: Randomly adding MACs on random hooks..."
rm -f $entries_lst
for i in $(seq $ITERATIONS); do
- test_comment "Iteration $i/$iterations..."
+ test_comment "Iteration $i/$ITERATIONS..."
for j in $(seq 0 1 $SUBITERATIONS | sort -R); do
edge=$(randomedge)
ether=$(genmac $j $i)
@@ -390,7 +391,7 @@
test_title "Test: Randomly changing MAC assignments..."
rm -f $entries2_lst
for i in $(seq $ITERATIONS); do
- test_comment "Iteration $i/$iterations..."
+ test_comment "Iteration $i/$ITERATIONS..."
cat $entries_lst | while read ether edge; do
edge2=$(randomedge)
@@ -425,6 +426,5 @@
################################################################################
-test_cnt
exit 0

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 8:24 PM (18 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30841188
Default Alt Text
D29054.id85117.diff (4 KB)

Event Timeline