netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Yujie Liu <yujie.liu@intel.com>
Cc: netdev@vger.kernel.org, Hangbin Liu <liuhangbin@gmail.com>,
	Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	lkp@intel.com, kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH v2 net-next] selftests/net: change shebang to bash to support "source"
Date: Tue, 2 Jan 2024 12:32:58 +0100	[thread overview]
Message-ID: <ZZP0akFff+nzFhc0@debian> (raw)
In-Reply-To: <ZZPHQF6wL95oSGzK@yujie-X299>

On Tue, Jan 02, 2024 at 04:20:16PM +0800, Yujie Liu wrote:
> On Sun, Dec 31, 2023 at 01:17:11PM +0100, Guillaume Nault wrote:
> > On Fri, Dec 29, 2023 at 09:19:31PM +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.
> > > 
> > > unicast_extensions.sh (converted in [1]) and pmtu.sh (converted in [2])
> > > have a /bin/sh shebang 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 fix the following issues when the default /bin/sh
> > > points to other shells.
> > 
> > Looks like it'd be simpler to just replace the "source" commands with
> > "." and leave the shebang as is (unless there are other bash-specific
> > constructs in these scripts of course).
> > 
> > Generally speaking, I think we should avoid madating a specific shell,
> > unless that really simplifies the test script (which is not the case
> > here).
> 
> Hi Guillaume,
> 
> Thanks for the comments. Actually I also considered replacing "source"
> with "." at first, but finally decided to change the shebang in
> consideration of being consistent with other scripts. We can see that
> there are 140+ scripts in net selftests that have "source lib.sh" and
> "bash" shebang, but none of the selftests has ". lib.sh". If we replace
> "source" with "." and keep the "sh" shebang specifically for
> unicast_extensions.sh and pmtu.sh, we will get only 2 scripts using
> "sh and ." while most other scripts using "bash and source". Maybe it
> would be nice to keep the consistency by changing the shebang as well?
> What do you think? :)

The use of "source" instead of "." is clearly an overlook. Consistency
is desirable only when it brings better quality code.

And it should be easy enough to convert the remaining "source lib.sh"
in a followup patch to make the other shell scripts consistent.


> linux/tools/testing/selftests/net$ grep -rl "source lib.sh" . | xargs grep -F '#!/bin/'
> ./test_vxlan_under_vrf.sh:#!/bin/bash
> ./test_vxlan_nolocalbypass.sh:#!/bin/bash
> ./xfrm_policy.sh:#!/bin/bash
> ./test_vxlan_mdb.sh:#!/bin/bash
> ./test_bridge_backup_port.sh:#!/bin/bash
> ./vrf_route_leaking.sh:#!/bin/bash
> ./l2tp.sh:#!/bin/bash
> ./netns-name.sh:#!/bin/bash
> ./rtnetlink.sh:#!/bin/bash
> ./ioam6.sh:#!/bin/bash
> ./drop_monitor_tests.sh:#!/bin/bash
> ./test_vxlan_vnifiltering.sh:#!/bin/bash
> ./icmp.sh:#!/bin/bash
> ./gre_gso.sh:#!/bin/bash
> ./fib_nexthop_multiprefix.sh:#!/bin/bash
> ./icmp_redirect.sh:#!/bin/bash
> ./vrf-xfrm-tests.sh:#!/bin/bash
> ./vrf_strict_mode_test.sh:#!/bin/bash
> ./fcnal-test.sh:#!/bin/bash
> ./stress_reuseport_listen.sh:#!/bin/bash
> ./srv6_end_dt4_l3vpn_test.sh:#!/bin/bash
> ./test_bridge_neigh_suppress.sh:#!/bin/bash
> ./cmsg_ipv6.sh:#!/bin/bash
> ./arp_ndisc_evict_nocarrier.sh:#!/bin/bash
> ./fib_rule_tests.sh:#!/bin/bash
> ./srv6_end_dt6_l3vpn_test.sh:#!/bin/bash
> ./forwarding/custom_multipath_hash.sh:#!/bin/bash
> ./forwarding/gre_inner_v4_multipath.sh:#!/bin/bash
> ./forwarding/tc_tunnel_key.sh:#!/bin/bash
> ./forwarding/tc_shblocks.sh:#!/bin/bash
> ./forwarding/router_nh.sh:#!/bin/bash
> ./forwarding/skbedit_priority.sh:#!/bin/bash
> ./forwarding/tc_mpls_l2vpn.sh:#!/bin/bash
> ./forwarding/gre_inner_v6_multipath.sh:#!/bin/bash
> ./forwarding/vxlan_symmetric.sh:#!/bin/bash
> ./forwarding/bridge_mdb.sh:#!/bin/bash
> ./forwarding/no_forwarding.sh:#!/bin/bash
> ./forwarding/router_bridge_1d.sh:#!/bin/bash
> ./forwarding/tc_flower_port_range.sh:#!/bin/bash
> ./forwarding/router_multicast.sh:#!/bin/bash
> ./forwarding/bridge_locked_port.sh:#!/bin/bash
> ./forwarding/vxlan_asymmetric_ipv6.sh:#!/bin/bash
> ./forwarding/dual_vxlan_bridge.sh:#!/bin/bash
> ./forwarding/bridge_port_isolation.sh:#!/bin/bash
> ./forwarding/local_termination.sh:#!/bin/bash
> ./forwarding/ipip_flat_gre_keys.sh:#!/bin/bash
> ./forwarding/gre_multipath_nh_res.sh:#!/bin/bash
> ./forwarding/gre_multipath.sh:#!/bin/bash
> ./forwarding/vxlan_bridge_1d_ipv6.sh:#!/bin/bash
> ./forwarding/ip6gre_flat_keys.sh:#!/bin/bash
> ./forwarding/gre_multipath_nh.sh:#!/bin/bash
> ./forwarding/bridge_mld.sh:#!/bin/bash
> ./forwarding/ip6gre_inner_v6_multipath.sh:#!/bin/bash
> ./forwarding/ip6gre_flat_key.sh:#!/bin/bash
> ./forwarding/vxlan_asymmetric.sh:#!/bin/bash
> ./forwarding/tc_flower_router.sh:#!/bin/bash
> ./forwarding/router_bridge_vlan_upper_pvid.sh:#!/bin/bash
> ./forwarding/mirror_gre_vlan_bridge_1q.sh:#!/bin/bash
> ./forwarding/q_in_vni_ipv6.sh:#!/bin/bash
> ./forwarding/mirror_gre_lag_lacp.sh:#!/bin/bash
> ./forwarding/ip6gre_custom_multipath_hash.sh:#!/bin/bash
> ./forwarding/vxlan_bridge_1d.sh:#!/bin/bash
> ./forwarding/ip6gre_hier_key.sh:#!/bin/bash
> ./forwarding/gre_custom_multipath_hash.sh:#!/bin/bash
> ./forwarding/ipip_flat_gre_key.sh:#!/bin/bash
> ./forwarding/mirror_gre_flower.sh:#!/bin/bash
> ./forwarding/router_bridge.sh:#!/bin/bash
> ./forwarding/vxlan_symmetric_ipv6.sh:#!/bin/bash
> ./forwarding/mirror_gre_bridge_1q.sh:#!/bin/bash
> ./forwarding/router_multipath.sh:#!/bin/bash
> ./forwarding/tc_vlan_modify.sh:#!/bin/bash
> ./forwarding/vxlan_bridge_1q.sh:#!/bin/bash
> ./forwarding/bridge_mdb_port_down.sh:#!/bin/bash
> ./forwarding/tc_flower.sh:#!/bin/bash
> ./forwarding/tc_flower_cfm.sh:#!/bin/bash
> ./forwarding/mirror_gre_neigh.sh:#!/bin/bash
> ./forwarding/ethtool_rmon.sh:#!/bin/bash
> ./forwarding/hw_stats_l3_gre.sh:#!/bin/bash
> ./forwarding/router.sh:#!/bin/bash
> ./forwarding/ipip_hier_gre_key.sh:#!/bin/bash
> ./forwarding/tc_police.sh:#!/bin/bash
> ./forwarding/pedit_ip.sh:#!/bin/bash
> ./forwarding/ip6_forward_instats_vrf.sh:#!/bin/bash
> ./forwarding/router_mpath_nh_res.sh:#!/bin/bash
> ./forwarding/mirror_gre_changes.sh:#!/bin/bash
> ./forwarding/hw_stats_l3.sh:#!/bin/bash
> ./forwarding/ipip_hier_gre.sh:#!/bin/bash
> ./forwarding/q_in_vni.sh:#!/bin/bash
> ./forwarding/ip6gre_flat.sh:#!/bin/bash
> ./forwarding/router_bridge_vlan_upper.sh:#!/bin/bash
> ./forwarding/bridge_igmp.sh:#!/bin/bash
> ./forwarding/mirror_gre_nh.sh:#!/bin/bash
> ./forwarding/bridge_mdb_host.sh:#!/bin/bash
> ./forwarding/ipip_hier_gre_keys.sh:#!/bin/bash
> ./forwarding/pedit_dsfield.sh:#!/bin/bash
> ./forwarding/bridge_vlan_mcast.sh:#!/bin/bash
> ./forwarding/mirror_gre_bridge_1d_vlan.sh:#!/bin/bash
> ./forwarding/router_bridge_1d_lag.sh:#!/bin/bash
> ./forwarding/router_bridge_pvid_vlan_upper.sh:#!/bin/bash
> ./forwarding/mirror_gre_bound.sh:#!/bin/bash
> ./forwarding/ip6gre_hier.sh:#!/bin/bash
> ./forwarding/ip6gre_hier_keys.sh:#!/bin/bash
> ./forwarding/ethtool_extended_state.sh:#!/bin/bash
> ./forwarding/router_mpath_nh.sh:#!/bin/bash
> ./forwarding/tc_flower_l2_miss.sh:#!/bin/bash
> ./forwarding/bridge_vlan_unaware.sh:#!/bin/bash
> ./forwarding/router_broadcast.sh:#!/bin/bash
> ./forwarding/bridge_fdb_learning_limit.sh:#!/bin/bash
> ./forwarding/ipip_lib.sh:#!/bin/bash
> ./forwarding/ip6gre_inner_v4_multipath.sh:#!/bin/bash
> ./forwarding/router_vid_1.sh:#!/bin/bash
> ./forwarding/mirror_gre.sh:#!/bin/bash
> ./forwarding/router_bridge_vlan.sh:#!/bin/bash
> ./forwarding/bridge_vlan_aware.sh:#!/bin/bash
> ./forwarding/ethtool.sh:#!/bin/bash
> ./forwarding/loopback.sh:#!/bin/bash
> ./forwarding/bridge_sticky_fdb.sh:#!/bin/bash
> ./forwarding/bridge_mdb_max.sh:#!/bin/bash
> ./forwarding/pedit_l4port.sh:#!/bin/bash
> ./forwarding/tc_actions.sh:#!/bin/bash
> ./forwarding/mirror_vlan.sh:#!/bin/bash
> ./forwarding/sch_red.sh:#!/bin/bash
> ./forwarding/ipip_flat_gre.sh:#!/bin/bash
> ./forwarding/mirror_gre_bridge_1d.sh:#!/bin/bash
> ./forwarding/lib.sh:#!/bin/bash
> ./forwarding/mirror_gre_vlan.sh:#!/bin/bash
> ./forwarding/mirror_gre_bridge_1q_lag.sh:#!/bin/bash
> ./forwarding/ethtool_mm.sh:#!/bin/bash
> ./forwarding/vxlan_bridge_1q_ipv6.sh:#!/bin/bash
> ./forwarding/tc_chains.sh:#!/bin/bash
> ./forwarding/ip6gre_lib.sh:#!/bin/bash
> ./fib_nexthop_nongw.sh:#!/bin/bash
> ./srv6_end_dt46_l3vpn_test.sh:#!/bin/bash
> ./cmsg_so_mark.sh:#!/bin/bash
> ./sctp_vrf.sh:#!/bin/bash
> ./fdb_flush.sh:#!/bin/bash
> ./ndisc_unsolicited_na_test.sh:#!/bin/bash
> ./traceroute.sh:#!/bin/bash
> ./fib-onlink-tests.sh:#!/bin/bash
> ./fib_tests.sh:#!/bin/bash
> ./cmsg_time.sh:#!/bin/bash
> ./arp_ndisc_untracked_subnets.sh:#!/bin/bash
> ./fib_nexthops.sh:#!/bin/bash
> 
> linux/tools/testing/selftests/net$ grep -rF ". lib.sh"
> <-- nothing
> 
> Thanks,
> Yujie
> 


  reply	other threads:[~2024-01-02 11:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29 13:19 [PATCH v2 net-next] selftests/net: change shebang to bash to support "source" Yujie Liu
2023-12-29 15:19 ` Przemek Kitszel
2023-12-30  6:20 ` Hangbin Liu
2023-12-30  6:30 ` Muhammad Usama Anjum
2023-12-31 12:17 ` Guillaume Nault
2024-01-02  5:51   ` Yujie Liu
2024-01-02  6:51     ` Hangbin Liu
2024-01-02  8:20   ` Yujie Liu
2024-01-02 11:32     ` Guillaume Nault [this message]
2023-12-31 16:27 ` Guillaume Nault
2024-01-04  1:10 ` patchwork-bot+netdevbpf

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=ZZP0akFff+nzFhc0@debian \
    --to=gnault@redhat.com \
    --cc=dsahern@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=pabeni@redhat.com \
    --cc=yujie.liu@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).