Skip to content

Commit 9e86a29

Browse files
matttbedavem330
authored andcommitted
selftests: mptcp: sockopt: format subtests results in TAP
The current selftests infrastructure formats the results in TAP 13. This version doesn't support subtests and only the end result of each selftest is taken into account. It means that a single issue in a subtest of a selftest containing multiple subtests forces the whole selftest to be marked as failed. It also means that subtests results are not tracked by CIs executing selftests. MPTCP selftests run hundreds of various subtests. It is then important to track each of them and not one result per selftest. It is particularly interesting to do that when validating stable kernels with the last version of the test suite: tests might fail because a feature is not supported but the test didn't skip that part. In this case, if subtests are not tracked, the whole selftest will be marked as failed making the other subtests useless because their results are ignored. This patch formats subtests results in TAP in mptcp_sockopt.sh selftest. Link: multipath-tcp/mptcp_net-next#368 Acked-by: Paolo Abeni <[email protected]> Signed-off-by: Matthieu Baerts <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 675d993 commit 9e86a29

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tools/testing/selftests/net/mptcp/mptcp_sockopt.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,13 @@ do_transfer()
183183

184184
local mptcp_connect="./mptcp_connect -r 20"
185185

186-
local local_addr
186+
local local_addr ip
187187
if is_v6 "${connect_addr}"; then
188188
local_addr="::"
189+
ip=ipv6
189190
else
190191
local_addr="0.0.0.0"
192+
ip=ipv4
191193
fi
192194

193195
cmsg="TIMESTAMPNS"
@@ -223,6 +225,8 @@ do_transfer()
223225
echo -e "\nnetns ${connector_ns} socket stat for ${port}:" 1>&2
224226
ip netns exec ${connector_ns} ss -Menita 1>&2 -o "dport = :$port"
225227

228+
mptcp_lib_result_fail "transfer ${ip}"
229+
226230
ret=1
227231
return 1
228232
fi
@@ -236,9 +240,11 @@ do_transfer()
236240
fi
237241

238242
check_transfer $cin $sout "file received by server"
239-
240243
rets=$?
241244

245+
mptcp_lib_result_code "${retc}" "mark ${ip}"
246+
mptcp_lib_result_code "${rets}" "transfer ${ip}"
247+
242248
if [ $retc -eq 0 ] && [ $rets -eq 0 ];then
243249
return 0
244250
fi
@@ -264,6 +270,7 @@ do_mptcp_sockopt_tests()
264270

265271
if ! mptcp_lib_kallsyms_has "mptcp_diag_fill_info$"; then
266272
echo "INFO: MPTCP sockopt not supported: SKIP"
273+
mptcp_lib_result_skip "sockopt"
267274
return
268275
fi
269276

@@ -272,18 +279,22 @@ do_mptcp_sockopt_tests()
272279

273280
if [ $lret -ne 0 ]; then
274281
echo "FAIL: SOL_MPTCP getsockopt" 1>&2
282+
mptcp_lib_result_fail "sockopt v4"
275283
ret=$lret
276284
return
277285
fi
286+
mptcp_lib_result_pass "sockopt v4"
278287

279288
ip netns exec "$ns_sbox" ./mptcp_sockopt -6
280289
lret=$?
281290

282291
if [ $lret -ne 0 ]; then
283292
echo "FAIL: SOL_MPTCP getsockopt (ipv6)" 1>&2
293+
mptcp_lib_result_fail "sockopt v6"
284294
ret=$lret
285295
return
286296
fi
297+
mptcp_lib_result_pass "sockopt v6"
287298
}
288299

289300
run_tests()
@@ -310,10 +321,12 @@ do_tcpinq_test()
310321
if [ $lret -ne 0 ];then
311322
ret=$lret
312323
echo "FAIL: mptcp_inq $@" 1>&2
324+
mptcp_lib_result_fail "TCP_INQ: $*"
313325
return $lret
314326
fi
315327

316328
echo "PASS: TCP_INQ cmsg/ioctl $@"
329+
mptcp_lib_result_pass "TCP_INQ: $*"
317330
return $lret
318331
}
319332

@@ -323,6 +336,7 @@ do_tcpinq_tests()
323336

324337
if ! mptcp_lib_kallsyms_has "mptcp_ioctl$"; then
325338
echo "INFO: TCP_INQ not supported: SKIP"
339+
mptcp_lib_result_skip "TCP_INQ"
326340
return
327341
fi
328342

@@ -367,4 +381,6 @@ if [ $ret -eq 0 ];then
367381
fi
368382

369383
do_tcpinq_tests
384+
385+
mptcp_lib_result_print_all_tap
370386
exit $ret

0 commit comments

Comments
 (0)