diff mbox series

[net-next] selftests/net: change the shebang of unicast_extensions.sh to bash

Message ID 20231225072109.3835503-1-yujie.liu@intel.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] selftests/net: change the shebang of unicast_extensions.sh to bash | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 3 maintainers not CCed: shuah@kernel.org edumazet@google.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: Commit log lines starting with '#' are dropped by git as comments
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

kernel test robot Dec. 25, 2023, 7:21 a.m. UTC
The patch set [1] added a general lib.sh in net selftests, and converted
several test scripts to source the lib.sh.

The shebang of unicast_extensions.sh is /bin/sh which may point to various
shells in different distributions, but "source" is only available in some
of them. For example, "source" is a built-it function in bash, but it
cannot be used in dash.

Refer to other scripts that were converted together, simply change the
shebang to bash to suppress the following errors when the default /bin/sh
points to other shells.

# selftests: net: unicast_extensions.sh
# ./unicast_extensions.sh: 31: source: not found
# ###########################################################################
# Unicast address extensions tests (behavior of reserved IPv4 addresses)
# ###########################################################################
# TEST: assign and ping within 240/4 (1 of 2) (is allowed)            [FAIL]
# TEST: assign and ping within 240/4 (2 of 2) (is allowed)            [FAIL]
# TEST: assign and ping within 0/8 (1 of 2) (is allowed)              [FAIL]
# TEST: assign and ping within 0/8 (2 of 2) (is allowed)              [FAIL]
# TEST: assign and ping inside 255.255/16 (is allowed)                [FAIL]
# TEST: assign and ping inside 255.255.255/24 (is allowed)            [FAIL]
# TEST: route between 240.5.6/24 and 255.1.2/24 (is allowed)          [FAIL]
# TEST: route between 0.200/16 and 245.99/16 (is allowed)             [FAIL]
# TEST: assign and ping lowest address (/24)                          [FAIL]
# TEST: assign and ping lowest address (/26)                          [FAIL]
# TEST: routing using lowest address                                  [FAIL]
# TEST: assigning 0.0.0.0 (is forbidden)                              [ OK ]
# TEST: assigning 255.255.255.255 (is forbidden)                      [ OK ]
# TEST: assign and ping inside 127/8 (is forbidden)                   [ OK ]
# TEST: assign and ping class D address (is forbidden)                [ OK ]
# TEST: routing using class D (is forbidden)                          [ OK ]
# TEST: routing using 127/8 (is forbidden)                            [ OK ]
not ok 51 selftests: net: unicast_extensions.sh # exit=1

Link: https://lore.kernel.org/all/20231202020110.362433-1-liuhangbin@gmail.com/ [1]
Fixes: 0f4765d0b48d ("selftests/net: convert unicast_extensions.sh to run it in unique namespace")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Yujie Liu <yujie.liu@intel.com>
---
 tools/testing/selftests/net/unicast_extensions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hangbin Liu Dec. 25, 2023, 12:39 p.m. UTC | #1
On Mon, Dec 25, 2023 at 03:21:09PM +0800, Yujie Liu wrote:
> The patch set [1] added a general lib.sh in net selftests, and converted
> several test scripts to source the lib.sh.

Oh, I didn't know dash doesn't support "source". Thanks for the fix.
Would you please also help fix the pmtu.sh, which has the same issue?

BTW, you can change the "source ./lib.sh" to "source lib.sh" to consistent
with other tests.

Thanks
Hangbin
kernel test robot Dec. 26, 2023, 8:43 a.m. UTC | #2
Hi Hangbin,

On Mon, Dec 25, 2023 at 08:39:09PM +0800, Hangbin Liu wrote:
> On Mon, Dec 25, 2023 at 03:21:09PM +0800, Yujie Liu wrote:
> > The patch set [1] added a general lib.sh in net selftests, and converted
> > several test scripts to source the lib.sh.
> 
> Oh, I didn't know dash doesn't support "source". Thanks for the fix.
> Would you please also help fix the pmtu.sh, which has the same issue?

It looks like pmtu.sh was not converted in patch set [1], so it doesn't
have "source lib.sh" yet. The cover letter of [1] mentions that the
whole process of conversion will be split into several parts. Not sure
if pmtu.sh will be converted in the subsequent parts soon? If so, would
you like to change the shebang of pmtu.sh when converting it later, or
change it together in this patch? Thanks.

BTW, in addition to pmtu.sh, I noticed that there are several other
scripts in net selftests which have "/bin/sh" shebang:

linux/tools/testing/selftests/net$ grep -rF '#!/bin/sh'
openvswitch/openvswitch.sh:#!/bin/sh
in_netns.sh:#!/bin/sh
netdevice.sh:#!/bin/sh
test_bpf.sh:#!/bin/sh
test_blackhole_dev.sh:#!/bin/sh
vlan_hw_filter.sh:#!/bin/sh
run_netsocktests:#!/bin/sh
pmtu.sh:#!/bin/sh
bareudp.sh:#!/bin/sh
l2_tos_ttl_inherit.sh:#!/bin/sh
veth.sh:#!/bin/sh
ipv6_flowlabel.sh:#!/bin/sh
unicast_extensions.sh:#!/bin/sh
reuseport_addr_any.sh:#!/bin/sh
run_afpackettests:#!/bin/sh
ip_local_port_range.sh:#!/bin/sh
amt.sh:#!/bin/sh
udpgso.sh:#!/bin/sh
ip_defrag.sh:#!/bin/sh
rps_default_mask.sh:#!/bin/sh

> BTW, you can change the "source ./lib.sh" to "source lib.sh" to consistent
> with other tests.

Sure, will respin a v2 with this change added.

Thanks,
Yujie
Hangbin Liu Dec. 26, 2023, 12:51 p.m. UTC | #3
On Tue, Dec 26, 2023 at 04:43:18PM +0800, Yujie Liu wrote:
> Hi Hangbin,
> 
> On Mon, Dec 25, 2023 at 08:39:09PM +0800, Hangbin Liu wrote:
> > On Mon, Dec 25, 2023 at 03:21:09PM +0800, Yujie Liu wrote:
> > > The patch set [1] added a general lib.sh in net selftests, and converted
> > > several test scripts to source the lib.sh.
> > 
> > Oh, I didn't know dash doesn't support "source". Thanks for the fix.
> > Would you please also help fix the pmtu.sh, which has the same issue?
> 
> It looks like pmtu.sh was not converted in patch set [1], so it doesn't
> have "source lib.sh" yet. The cover letter of [1] mentions that the
> whole process of conversion will be split into several parts. Not sure
> if pmtu.sh will be converted in the subsequent parts soon? If so, would
> you like to change the shebang of pmtu.sh when converting it later, or
> change it together in this patch? Thanks.

The pmtu.sh update is in this patch set.
https://lore.kernel.org/all/20231219094856.1740079-1-liuhangbin@gmail.com/

It would be good to fix these 2 tests together.

> 
> BTW, in addition to pmtu.sh, I noticed that there are several other
> scripts in net selftests which have "/bin/sh" shebang:

Yes, but the other tests don't use "source".

> 
> linux/tools/testing/selftests/net$ grep -rF '#!/bin/sh'
> openvswitch/openvswitch.sh:#!/bin/sh
> in_netns.sh:#!/bin/sh
> netdevice.sh:#!/bin/sh
> test_bpf.sh:#!/bin/sh
> test_blackhole_dev.sh:#!/bin/sh
> vlan_hw_filter.sh:#!/bin/sh
> run_netsocktests:#!/bin/sh
> pmtu.sh:#!/bin/sh
> bareudp.sh:#!/bin/sh
> l2_tos_ttl_inherit.sh:#!/bin/sh
> veth.sh:#!/bin/sh
> ipv6_flowlabel.sh:#!/bin/sh
> unicast_extensions.sh:#!/bin/sh
> reuseport_addr_any.sh:#!/bin/sh
> run_afpackettests:#!/bin/sh
> ip_local_port_range.sh:#!/bin/sh
> amt.sh:#!/bin/sh
> udpgso.sh:#!/bin/sh
> ip_defrag.sh:#!/bin/sh
> rps_default_mask.sh:#!/bin/sh
> 
> > BTW, you can change the "source ./lib.sh" to "source lib.sh" to consistent
> > with other tests.
> 
> Sure, will respin a v2 with this change added.

Thanks
Hangbin
kernel test robot Dec. 29, 2023, 1:34 p.m. UTC | #4
On Tue, Dec 26, 2023 at 08:51:43PM +0800, Hangbin Liu wrote:
> On Tue, Dec 26, 2023 at 04:43:18PM +0800, Yujie Liu wrote:
> > Hi Hangbin,
> > 
> > On Mon, Dec 25, 2023 at 08:39:09PM +0800, Hangbin Liu wrote:
> > > On Mon, Dec 25, 2023 at 03:21:09PM +0800, Yujie Liu wrote:
> > > > The patch set [1] added a general lib.sh in net selftests, and converted
> > > > several test scripts to source the lib.sh.
> > > 
> > > Oh, I didn't know dash doesn't support "source". Thanks for the fix.
> > > Would you please also help fix the pmtu.sh, which has the same issue?
> > 
> > It looks like pmtu.sh was not converted in patch set [1], so it doesn't
> > have "source lib.sh" yet. The cover letter of [1] mentions that the
> > whole process of conversion will be split into several parts. Not sure
> > if pmtu.sh will be converted in the subsequent parts soon? If so, would
> > you like to change the shebang of pmtu.sh when converting it later, or
> > change it together in this patch? Thanks.
> 
> The pmtu.sh update is in this patch set.
> https://lore.kernel.org/all/20231219094856.1740079-1-liuhangbin@gmail.com/
> 
> It would be good to fix these 2 tests together.

Sorry for the late reply due to recent holiday. v2 patch has been sent at: 
https://lore.kernel.org/all/20231229131931.3961150-1-yujie.liu@intel.com/
Please kindly review.

Thanks,
Yujie

> > 
> > BTW, in addition to pmtu.sh, I noticed that there are several other
> > scripts in net selftests which have "/bin/sh" shebang:
> 
> Yes, but the other tests don't use "source".
> 
> > 
> > linux/tools/testing/selftests/net$ grep -rF '#!/bin/sh'
> > openvswitch/openvswitch.sh:#!/bin/sh
> > in_netns.sh:#!/bin/sh
> > netdevice.sh:#!/bin/sh
> > test_bpf.sh:#!/bin/sh
> > test_blackhole_dev.sh:#!/bin/sh
> > vlan_hw_filter.sh:#!/bin/sh
> > run_netsocktests:#!/bin/sh
> > pmtu.sh:#!/bin/sh
> > bareudp.sh:#!/bin/sh
> > l2_tos_ttl_inherit.sh:#!/bin/sh
> > veth.sh:#!/bin/sh
> > ipv6_flowlabel.sh:#!/bin/sh
> > unicast_extensions.sh:#!/bin/sh
> > reuseport_addr_any.sh:#!/bin/sh
> > run_afpackettests:#!/bin/sh
> > ip_local_port_range.sh:#!/bin/sh
> > amt.sh:#!/bin/sh
> > udpgso.sh:#!/bin/sh
> > ip_defrag.sh:#!/bin/sh
> > rps_default_mask.sh:#!/bin/sh
> > 
> > > BTW, you can change the "source ./lib.sh" to "source lib.sh" to consistent
> > > with other tests.
> > 
> > Sure, will respin a v2 with this change added.
> 
> Thanks
> Hangbin
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/unicast_extensions.sh b/tools/testing/selftests/net/unicast_extensions.sh
index b7a2cb9e7477..2766990c2b78 100755
--- a/tools/testing/selftests/net/unicast_extensions.sh
+++ b/tools/testing/selftests/net/unicast_extensions.sh
@@ -1,4 +1,4 @@ 
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 #
 # By Seth Schoen (c) 2021, for the IPv4 Unicast Extensions Project