All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Mat Martineau <mathew.j.martineau@linux.intel.com>,
	Matthieu Baerts <matthieu.baerts@tessares.net>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next 3/9] selftests: mptcp: join: option to execute specific tests
Date: Thu, 10 Feb 2022 11:04:01 +0100	[thread overview]
Message-ID: <066bb7a33e8f2128968c4aec5ba57c38b2f2c4cd.camel@redhat.com> (raw)
In-Reply-To: <199e2a26-da9-e79f-53c-50498fda97c@linux.intel.com>

On Wed, 2022-02-09 at 16:36 -0800, Mat Martineau wrote:
> On Wed, 9 Feb 2022, Matthieu Baerts wrote:
> 
> > Often, it is needed to run one specific test.
> > 
> > There are options to run subgroups of tests but when only one fails, no
> > need to run all the subgroup. So far, the solution was to edit the
> > script to comment the tests that are not needed but that's not ideal.
> > 
> > Now, it is possible to run one specific test by giving the ID of the
> > tests that are going to be validated, e.g.
> > 
> >  ./mptcp_join.sh 36 37
> > 
> > This is cleaner and saves time.
> > 
> > Technically, the reset* functions now return 0 if the test can be
> > executed. This naturally creates sections per test in the code which is
> > also helpful to understand what a test is exactly doing.
> > 
> 
> My sense is that this is primarily for development purposes since the test 
> numbers may shift as tests are added or modified. Is it worth the churn 
> when we have the subgroup functionality and could comment out chunks of 
> the test script that are not useful for running specific tests in a loop?
> 
> I'm not set against this change, but hoping to discuss it some more to 
> both understand the benefits (I assume for running CI in a loop?) and to 
> see if anyone has bright ideas for avoiding the whitespace churn.
> 
> ("Include a bash fork in our selftest code that implements 'goto'" seems 
> like overkill :) )

Perhapas something alike the following ?!? Not a complete solution:
- completely not tested
- we will first need to add some wrapper for iptables or even beffer
for ip netns exec, to be more generic
- possibly more 'skip_test && return' needed, but not many, I guess.

I hope should be enough demonstrate the idea...
---
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh
b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 29623d7ad415..4199d7404f10 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -113,6 +113,7 @@ reset()
 
 reset_with_cookies()
 {
+	skip_test && return
 	reset
 
 	for netns in "$ns1" "$ns2";do
@@ -125,6 +126,7 @@ reset_with_add_addr_timeout()
 	local ip="${1:-4}"
 	local tables
 
+	skip_test && return
 	tables="iptables"
 	if [ $ip -eq 6 ]; then
 		tables="ip6tables"
@@ -145,6 +147,7 @@ reset_with_checksum()
 	local ns1_enable=$1
 	local ns2_enable=$2
 
+	skip_test && return
 	reset
 
 	ip netns exec $ns1 sysctl -q
net.mptcp.checksum_enabled=$ns1_enable
@@ -156,6 +159,7 @@ reset_with_allow_join_id0()
 	local ns1_enable=$1
 	local ns2_enable=$2
 
+	skip_test && return
 	reset
 
 	ip netns exec $ns1 sysctl -q
net.mptcp.allow_join_initial_addr_port=$ns1_enable
@@ -295,6 +299,7 @@ pm_nl_set_limits()
 	local addrs=$2
 	local subflows=$3
 
+	skip_test && return
 	if [ $ip_mptcp -eq 1 ]; then
 		ip -n $ns mptcp limits set add_addr_accepted $addrs
subflows $subflows
 	else
@@ -312,6 +317,7 @@ pm_nl_add_endpoint()
 	local id
 	local nr=2
 
+	skip_test && return
 	for p in $@
 	do
 		if [ $p = "flags" ]; then
@@ -689,6 +695,7 @@ run_tests()
 	lret=0
 	oldin=""
 
+	skip_test && return
 	# create the input file for the failure test when
 	# the first failure test run
 	if [ "$test_linkfail" -ne 0 -a -z "$cinfail" ]; then
@@ -732,6 +739,7 @@ chk_csum_nr()
 	local count
 	local dump_stats
 
+	skip_test && return
 	if [ ! -z "$msg" ]; then
 		printf "%02u" "$TEST_COUNT"
 	else
@@ -767,6 +775,7 @@ chk_fail_nr()
 	local count
 	local dump_stats
 
+	skip_test && return
 	printf "%-39s %s" " " "ftx"
 	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx |
awk '{print $2}'`
 	[ -z "$count" ] && count=0
@@ -801,6 +810,7 @@ chk_join_nr()
 	local count
 	local dump_stats
 
+	skip_test && return
 	printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn"
 	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx
| awk '{print $2}'`
 	[ -z "$count" ] && count=0
@@ -855,6 +865,7 @@ chk_stale_nr()
 	local stale_nr
 	local recover_nr
 
+	skip_test && return
 	printf "%-39s %-18s" " " "stale"
 	stale_nr=`ip netns exec $ns nstat -as | grep
MPTcpExtSubflowStale | awk '{print $2}'`
 	[ -z "$stale_nr" ] && stale_nr=0
@@ -893,6 +904,7 @@ chk_add_nr()
 	local count
 	local dump_stats
 
+	skip_test && return
 	printf "%-39s %s" " " "add"
 	count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr |
awk '{print $2}'`
 	[ -z "$count" ] && count=0
@@ -1008,6 +1020,7 @@ chk_rm_nr()
 	local addr_ns
 	local subflow_ns
 
+	skip_test && return
 	if [ -z $invert ]; then
 		addr_ns=$ns1
 		subflow_ns=$ns2
@@ -1048,6 +1061,7 @@ chk_prio_nr()
 	local count
 	local dump_stats
 
+	skip_test && return
 	printf "%-39s %s" " " "ptx"
 	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx |
awk '{print $2}'`
 	[ -z "$count" ] && count=0
@@ -1084,6 +1098,7 @@ chk_link_usage()
 	local tx_rate=$((tx_link * 100 / $tx_total))
 	local tolerance=5
 
+	skip_test && return
 	printf "%-39s %-18s" " " "link usage"
 	if [ $tx_rate -lt $((expected_rate - $tolerance)) -o \
 	     $tx_rate -gt $((expected_rate + $tolerance)) ]; then


  reply	other threads:[~2022-02-10 10:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 21:25 [PATCH mptcp-next 0/9] Refactor mptcp_join.sh Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 1/9] selftests: mptcp: join: allow running -cCi Matthieu Baerts
2022-02-10 14:53   ` Paolo Abeni
2022-02-11 17:30     ` Matthieu Baerts
2022-02-11 18:56       ` Paolo Abeni
2022-02-09 21:25 ` [PATCH mptcp-next 2/9] selftests: mptcp: join: exit after usage() Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 3/9] selftests: mptcp: join: option to execute specific tests Matthieu Baerts
2022-02-10  0:36   ` Mat Martineau
2022-02-10 10:04     ` Paolo Abeni [this message]
2022-02-10 10:42       ` Matthieu Baerts
2022-02-10 15:11         ` Paolo Abeni
2022-02-16 15:50           ` Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 4/9] selftests: mptcp: join: remove unused vars Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 5/9] selftests: mptcp: join: create tmp files only if needed Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 6/9] selftests: mptcp: join: check for tools " Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 7/9] selftests: mptcp: join: clarify local/global vars Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 8/9] selftests: mptcp: join: avoid backquotes Matthieu Baerts
2022-02-09 21:25 ` [PATCH mptcp-next 9/9] selftests: mptcp: join: make it shellcheck compliant Matthieu Baerts
2022-02-10  0:22 ` [PATCH mptcp-next 0/9] Refactor mptcp_join.sh Mat Martineau
2022-02-11 17:34   ` Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=066bb7a33e8f2128968c4aec5ba57c38b2f2c4cd.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=mathew.j.martineau@linux.intel.com \
    --cc=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.