[PATCH mptcp-next 0/6] selftests: mptcp: fix shellcheck warnings

Matthieu Baerts (NGI0) posted 6 patches 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20240222-selftests-mptcp-shellcheck-v1-0-fed8ba9e6ca6@kernel.org
tools/testing/selftests/net/mptcp/diag.sh          | 14 ++--
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 76 +++++++++++++---------
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 14 ++--
tools/testing/selftests/net/mptcp/pm_netlink.sh    | 14 ++--
tools/testing/selftests/net/mptcp/simult_flows.sh  | 10 ++-
tools/testing/selftests/net/mptcp/userspace_pm.sh  | 29 ++++-----
6 files changed, 98 insertions(+), 59 deletions(-)
[PATCH mptcp-next 0/6] selftests: mptcp: fix shellcheck warnings
Posted by Matthieu Baerts (NGI0) 2 months ago
shellcheck recently helped to prevent issues. It is then good to fix the
other harmless issues in order to spot "real" ones later.

Note that 3 scripts were already compliant: mptcp_join.sh, mptcp_lib.sh,
and userspace_pm.sh. mptcp_lib.sh was compliant from the beginning.

The modifications are minor, mainly because SC2086 has been ignored:
Double quote to prevent globbing and word splitting. This is
recommended, but the current usage is correct and there is no need to do
all these modifications to be compliant with this rule. New files, like
mptcp-lib.sh, should not have that rule ideally. Ideally new code other
existing files should use double quotes when needed.

Once applied, I'm planning to add a check on the CI side to catch new
issues, not to have to check that manually and report issues when
applying patches, like I had to do a few times very recently.

The last patch is not related to shellcheck, but I found this while
looking at the scripts: in userspace_pm.sh, we launch 'pm_nl_ctl events'
once, then kill it, then relaunch it using the same temp files.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Matthieu Baerts (NGI0) (6):
      selftests: mptcp: diag: fix shellcheck warnings
      selftests: mptcp: connect: fix shellcheck warnings
      selftests: mptcp: sockopt: fix shellcheck warnings
      selftests: mptcp: pm netlink: fix shellcheck warnings
      selftests: mptcp: simult flows: fix shellcheck warnings
      selftests: userspace pm: avoid relaunching pm events

 tools/testing/selftests/net/mptcp/diag.sh          | 14 ++--
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 76 +++++++++++++---------
 tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 14 ++--
 tools/testing/selftests/net/mptcp/pm_netlink.sh    | 14 ++--
 tools/testing/selftests/net/mptcp/simult_flows.sh  | 10 ++-
 tools/testing/selftests/net/mptcp/userspace_pm.sh  | 29 ++++-----
 6 files changed, 98 insertions(+), 59 deletions(-)
---
base-commit: 482712b4b5fc44b30dcd54409cbab4ec7e405294
change-id: 20240222-selftests-mptcp-shellcheck-80338a0300c5

Best regards,
-- 
Matthieu Baerts (NGI0) <matttbe@kernel.org>
Re: [PATCH mptcp-next 0/6] selftests: mptcp: fix shellcheck warnings
Posted by Mat Martineau 2 months ago
On Thu, 22 Feb 2024, Matthieu Baerts (NGI0) wrote:

> shellcheck recently helped to prevent issues. It is then good to fix the
> other harmless issues in order to spot "real" ones later.
>
> Note that 3 scripts were already compliant: mptcp_join.sh, mptcp_lib.sh,
> and userspace_pm.sh. mptcp_lib.sh was compliant from the beginning.
>
> The modifications are minor, mainly because SC2086 has been ignored:
> Double quote to prevent globbing and word splitting. This is
> recommended, but the current usage is correct and there is no need to do
> all these modifications to be compliant with this rule. New files, like
> mptcp-lib.sh, should not have that rule ideally. Ideally new code other
> existing files should use double quotes when needed.
>
> Once applied, I'm planning to add a check on the CI side to catch new
> issues, not to have to check that manually and report issues when
> applying patches, like I had to do a few times very recently.
>
> The last patch is not related to shellcheck, but I found this while
> looking at the scripts: in userspace_pm.sh, we launch 'pm_nl_ctl events'
> once, then kill it, then relaunch it using the same temp files.
>

Regarding your note in patch 6, I don't think it's a big enough issue to 
backport it.

> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> Matthieu Baerts (NGI0) (6):
>      selftests: mptcp: diag: fix shellcheck warnings
>      selftests: mptcp: connect: fix shellcheck warnings
>      selftests: mptcp: sockopt: fix shellcheck warnings
>      selftests: mptcp: pm netlink: fix shellcheck warnings
>      selftests: mptcp: simult flows: fix shellcheck warnings
>      selftests: userspace pm: avoid relaunching pm events
>
> tools/testing/selftests/net/mptcp/diag.sh          | 14 ++--
> tools/testing/selftests/net/mptcp/mptcp_connect.sh | 76 +++++++++++++---------
> tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 14 ++--
> tools/testing/selftests/net/mptcp/pm_netlink.sh    | 14 ++--
> tools/testing/selftests/net/mptcp/simult_flows.sh  | 10 ++-
> tools/testing/selftests/net/mptcp/userspace_pm.sh  | 29 ++++-----
> 6 files changed, 98 insertions(+), 59 deletions(-)
> ---
> base-commit: 482712b4b5fc44b30dcd54409cbab4ec7e405294
> change-id: 20240222-selftests-mptcp-shellcheck-80338a0300c5

Series LGTM:

Reviewed-by: Mat Martineau <martineau@kernel.org>
Re: [PATCH mptcp-next 0/6] selftests: mptcp: fix shellcheck warnings
Posted by Matthieu Baerts 2 months ago
Hi Mat,

On 22/02/2024 9:01 pm, Mat Martineau wrote:
> On Thu, 22 Feb 2024, Matthieu Baerts (NGI0) wrote:
> 
>> shellcheck recently helped to prevent issues. It is then good to fix the
>> other harmless issues in order to spot "real" ones later.
>>
>> Note that 3 scripts were already compliant: mptcp_join.sh, mptcp_lib.sh,
>> and userspace_pm.sh. mptcp_lib.sh was compliant from the beginning.
>>
>> The modifications are minor, mainly because SC2086 has been ignored:
>> Double quote to prevent globbing and word splitting. This is
>> recommended, but the current usage is correct and there is no need to do
>> all these modifications to be compliant with this rule. New files, like
>> mptcp-lib.sh, should not have that rule ideally. Ideally new code other
>> existing files should use double quotes when needed.
>>
>> Once applied, I'm planning to add a check on the CI side to catch new
>> issues, not to have to check that manually and report issues when
>> applying patches, like I had to do a few times very recently.
>>
>> The last patch is not related to shellcheck, but I found this while
>> looking at the scripts: in userspace_pm.sh, we launch 'pm_nl_ctl events'
>> once, then kill it, then relaunch it using the same temp files.
>>
> 
> Regarding your note in patch 6, I don't think it's a big enough issue to
> backport it.

Good, easier not to backport it.

>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>> ---
>> Matthieu Baerts (NGI0) (6):
>>      selftests: mptcp: diag: fix shellcheck warnings
>>      selftests: mptcp: connect: fix shellcheck warnings
>>      selftests: mptcp: sockopt: fix shellcheck warnings
>>      selftests: mptcp: pm netlink: fix shellcheck warnings
>>      selftests: mptcp: simult flows: fix shellcheck warnings
>>      selftests: userspace pm: avoid relaunching pm events
>>
>> tools/testing/selftests/net/mptcp/diag.sh          | 14 ++--
>> tools/testing/selftests/net/mptcp/mptcp_connect.sh | 76
>> +++++++++++++---------
>> tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 14 ++--
>> tools/testing/selftests/net/mptcp/pm_netlink.sh    | 14 ++--
>> tools/testing/selftests/net/mptcp/simult_flows.sh  | 10 ++-
>> tools/testing/selftests/net/mptcp/userspace_pm.sh  | 29 ++++-----
>> 6 files changed, 98 insertions(+), 59 deletions(-)
>> ---
>> base-commit: 482712b4b5fc44b30dcd54409cbab4ec7e405294
>> change-id: 20240222-selftests-mptcp-shellcheck-80338a0300c5
> 
> Series LGTM:
> 
> Reviewed-by: Mat Martineau <martineau@kernel.org>

Thank you for the review!

Now in our tree (feat. for next):

New patches for t/upstream:
- 235be4449155: selftests: mptcp: diag: fix shellcheck warnings
- 07f49a9477f8: selftests: mptcp: connect: fix shellcheck warnings
- a20c511f445b: selftests: mptcp: sockopt: fix shellcheck warnings
- e2f73e8be7b1: selftests: mptcp: pm netlink: fix shellcheck warnings
- 581e384d1545: selftests: mptcp: simult flows: fix shellcheck warnings
- 46330f024779: selftests: userspace pm: avoid relaunching pm events
- Results: 80144e8d21c6..7f64b53905ca (export)

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.