Skip to content

Commit ecb3c1e

Browse files
pmachatadavem330
authored andcommitted
selftests: rtnetlink: Make the set of tests to run configurable
Extract the list of all tests into a variable, ALL_TESTS. Then assume the environment variable TESTS holds the list of tests to actually run, falling back to ALL_TESTS if TESTS is empty. This is the same interface that forwarding selftests use to make the set of tests to run configurable. In addition to this, allow setting the value explicitly through a command line option "-t" along the lines of what fib_nexthops.sh does. Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5c4a9aa commit ecb3c1e

File tree

1 file changed

+48
-42
lines changed

1 file changed

+48
-42
lines changed

tools/testing/selftests/net/rtnetlink.sh

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@
44
#
55
# set -e
66

7+
ALL_TESTS="
8+
kci_test_polrouting
9+
kci_test_route_get
10+
kci_test_addrlft
11+
kci_test_promote_secondaries
12+
kci_test_tc
13+
kci_test_gre
14+
kci_test_gretap
15+
kci_test_ip6gretap
16+
kci_test_erspan
17+
kci_test_ip6erspan
18+
kci_test_bridge
19+
kci_test_addrlabel
20+
kci_test_ifalias
21+
kci_test_vrf
22+
kci_test_encap
23+
kci_test_macsec
24+
kci_test_ipsec
25+
kci_test_ipsec_offload
26+
kci_test_fdb_get
27+
kci_test_neigh_get
28+
kci_test_bridge_parent_id
29+
"
30+
731
devdummy="test-dummy0"
832

933
# Kselftest framework requirement - SKIP code is 4.
@@ -1227,60 +1251,34 @@ kci_test_bridge_parent_id()
12271251

12281252
kci_test_rtnl()
12291253
{
1254+
local current_test
12301255
local ret=0
1256+
12311257
kci_add_dummy
12321258
if [ $ret -ne 0 ];then
12331259
echo "FAIL: cannot add dummy interface"
12341260
return 1
12351261
fi
12361262

1237-
kci_test_polrouting
1238-
check_err $?
1239-
kci_test_route_get
1240-
check_err $?
1241-
kci_test_addrlft
1242-
check_err $?
1243-
kci_test_promote_secondaries
1244-
check_err $?
1245-
kci_test_tc
1246-
check_err $?
1247-
kci_test_gre
1248-
check_err $?
1249-
kci_test_gretap
1250-
check_err $?
1251-
kci_test_ip6gretap
1252-
check_err $?
1253-
kci_test_erspan
1254-
check_err $?
1255-
kci_test_ip6erspan
1256-
check_err $?
1257-
kci_test_bridge
1258-
check_err $?
1259-
kci_test_addrlabel
1260-
check_err $?
1261-
kci_test_ifalias
1262-
check_err $?
1263-
kci_test_vrf
1264-
check_err $?
1265-
kci_test_encap
1266-
check_err $?
1267-
kci_test_macsec
1268-
check_err $?
1269-
kci_test_ipsec
1270-
check_err $?
1271-
kci_test_ipsec_offload
1272-
check_err $?
1273-
kci_test_fdb_get
1274-
check_err $?
1275-
kci_test_neigh_get
1276-
check_err $?
1277-
kci_test_bridge_parent_id
1278-
check_err $?
1263+
for current_test in ${TESTS:-$ALL_TESTS}; do
1264+
$current_test
1265+
check_err $?
1266+
done
12791267

12801268
kci_del_dummy
12811269
return $ret
12821270
}
12831271

1272+
usage()
1273+
{
1274+
cat <<EOF
1275+
usage: ${0##*/} OPTS
1276+
1277+
-t <test> Test(s) to run (default: all)
1278+
(options: $(echo $ALL_TESTS))
1279+
EOF
1280+
}
1281+
12841282
#check for needed privileges
12851283
if [ "$(id -u)" -ne 0 ];then
12861284
echo "SKIP: Need root privileges"
@@ -1295,6 +1293,14 @@ for x in ip tc;do
12951293
fi
12961294
done
12971295

1296+
while getopts t:h o; do
1297+
case $o in
1298+
t) TESTS=$OPTARG;;
1299+
h) usage; exit 0;;
1300+
*) usage; exit 1;;
1301+
esac
1302+
done
1303+
12981304
kci_test_rtnl
12991305

13001306
exit $?

0 commit comments

Comments
 (0)