From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:36:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43A2457F400; Fri, 12 Mar 2021 17:36:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DxtK769S7z4Zw3; Fri, 12 Mar 2021 17:36:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D97861BD0C; Fri, 12 Mar 2021 17:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12CHaOFX052655; Fri, 12 Mar 2021 17:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHaOkI052654; Fri, 12 Mar 2021 17:36:24 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:36:24 GMT Message-Id: <202103121736.12CHaOkI052654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 65f4ff4e68af - main - tests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65f4ff4e68afc3867781dfc8cd4faf2a8be1c74f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:36:31 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=65f4ff4e68afc3867781dfc8cd4faf2a8be1c74f commit 65f4ff4e68afc3867781dfc8cd4faf2a8be1c74f Author: Alex Richardson AuthorDate: 2021-03-12 17:35:24 +0000 Commit: Alex Richardson CommitDate: 2021-03-12 17:35:26 +0000 tests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output This should allow the test to pass in Jenkins. Testing it locally now reports "passed" instead of "invalid TAP data". While touching this file also fix some shellcheck warnings that were pointed out by my IDE. Reviewed By: lwhsu, afedorov Differential Revision: https://reviews.freebsd.org/D29054 --- tests/sys/netgraph/ng_macfilter_test.sh | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/sys/netgraph/ng_macfilter_test.sh b/tests/sys/netgraph/ng_macfilter_test.sh index 56e201094bcc..269de3e130aa 100755 --- a/tests/sys/netgraph/ng_macfilter_test.sh +++ b/tests/sys/netgraph/ng_macfilter_test.sh @@ -45,7 +45,7 @@ find_iface () { 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 @@ TSTNR=0 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 @@ trap 'cleanup' EXIT created_hooks=$(gethooks) rc=0 -test_cnt +# Update this number when adding new tests +test_cnt 46 ################################################################################ @@ -244,12 +245,12 @@ test_failure "duplicate connect of default hook" ################################################################################ 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 @@ test_title "Test: Add many hooks" 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_bail_on_fail 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 @@ for i in $(seq $ITERATIONS); do 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_bail_on_fail 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_bail_on_fail 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_bail_on_fail 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_bail_on_fail ################################################################################ -test_cnt exit 0