Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/netgraph/ng_macfilter_test.sh
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | cleanup () { | ||||
rm -f $entries_lst $entries2_lst | rm -f $entries_lst $entries2_lst | ||||
} | } | ||||
TSTNR=0 | TSTNR=0 | ||||
TSTFAILS=0 | TSTFAILS=0 | ||||
TSTSUCCS=0 | TSTSUCCS=0 | ||||
_test_next () { TSTNR=$(($TSTNR + 1)); } | _test_next () { TSTNR=$((TSTNR + 1)); } | ||||
_test_succ () { TSTSUCCS=$(($TSTSUCCS + 1)); } | _test_succ () { TSTSUCCS=$(($TSTSUCCS + 1)); } | ||||
_test_fail () { TSTFAILS=$(($TSTFAILS + 1)); } | _test_fail () { TSTFAILS=$(($TSTFAILS + 1)); } | ||||
test_cnt () { echo "1..${1:-$TSTNR}"; } | test_cnt () { echo "1..${1:-$TSTNR}"; } | ||||
test_title () { | test_title () { | ||||
local msg="$1" | local msg="$1" | ||||
printf '### %s ' "$msg" | printf '### %s ' "$msg" | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | |||||
configure_nodes | configure_nodes | ||||
trap 'exit 99' 1 2 3 13 14 15 | trap 'exit 99' 1 2 3 13 14 15 | ||||
trap 'cleanup' EXIT | trap 'cleanup' EXIT | ||||
created_hooks=$(gethooks) | created_hooks=$(gethooks) | ||||
rc=0 | rc=0 | ||||
test_cnt | # Update this number when adding new tests | ||||
test_cnt 46 | |||||
lwhsu: I feel this is easy to be forgot, but also not easy to change. The better approach might be… | |||||
################################################################################ | ################################################################################ | ||||
### Tests ###################################################################### | ### Tests ###################################################################### | ||||
################################################################################ | ################################################################################ | ||||
################################################################################ | ################################################################################ | ||||
test_title "Test: Duplicate default hook" | test_title "Test: Duplicate default hook" | ||||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | |||||
ngctl msg MF: reset | ngctl msg MF: reset | ||||
test_success "**** reset failed" | test_success "**** reset failed" | ||||
test_eq $(countmacs) 0 'MACs in table' | test_eq $(countmacs) 0 'MACs in table' | ||||
test_bail_on_fail | test_bail_on_fail | ||||
################################################################################ | ################################################################################ | ||||
test_cnt | |||||
exit 0 | exit 0 |
I feel this is easy to be forgot, but also not easy to change. The better approach might be migrating the test cases to use atf-sh.