netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh
@ 2021-02-05 17:09 Björn Töpel
  2021-02-05 17:30 ` William Tu
  0 siblings, 1 reply; 4+ messages in thread
From: Björn Töpel @ 2021-02-05 17:09 UTC (permalink / raw)
  To: ast, daniel, netdev, bpf; +Cc: Björn Töpel, u9012063

From: Björn Töpel <bjorn.topel@intel.com>

The test_xdp_redirect.sh script uses some bash-features, such as
'&>'. On systems that use dash as the sh implementation this will not
work as intended. Change the shebang to use bash instead.

Also remove the 'set -e' since the script actually relies on that the
return value can be used to determine pass/fail of the test.

Fixes: 996139e801fd ("selftests: bpf: add a test for XDP redirect")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
---
 tools/testing/selftests/bpf/test_xdp_redirect.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_xdp_redirect.sh b/tools/testing/selftests/bpf/test_xdp_redirect.sh
index dd80f0c84afb..db35e40947ff 100755
--- a/tools/testing/selftests/bpf/test_xdp_redirect.sh
+++ b/tools/testing/selftests/bpf/test_xdp_redirect.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Create 2 namespaces with two veth peers, and
 # forward packets in-between using generic XDP
 #
@@ -72,7 +72,6 @@ test_xdp_redirect()
 	cleanup
 }
 
-set -e
 trap cleanup 2 3 6 9
 
 test_xdp_redirect xdpgeneric

base-commit: 6183f4d3a0a2ad230511987c6c362ca43ec0055f
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh
  2021-02-05 17:09 [PATCH bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh Björn Töpel
@ 2021-02-05 17:30 ` William Tu
  2021-02-05 17:39   ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: William Tu @ 2021-02-05 17:30 UTC (permalink / raw)
  To: Björn Töpel
  Cc: Alexei Starovoitov, Daniel Borkmann,
	Linux Kernel Network Developers, bpf, Björn Töpel

On Fri, Feb 5, 2021 at 9:09 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
>
> From: Björn Töpel <bjorn.topel@intel.com>
>
> The test_xdp_redirect.sh script uses some bash-features, such as
> '&>'. On systems that use dash as the sh implementation this will not
> work as intended. Change the shebang to use bash instead.
>
> Also remove the 'set -e' since the script actually relies on that the
> return value can be used to determine pass/fail of the test.
>
> Fixes: 996139e801fd ("selftests: bpf: add a test for XDP redirect")
> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
> ---
LGTM, thanks.
Acked-by: William Tu <u9012063@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh
  2021-02-05 17:30 ` William Tu
@ 2021-02-05 17:39   ` Randy Dunlap
  2021-02-06  7:46     ` Björn Töpel
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2021-02-05 17:39 UTC (permalink / raw)
  To: William Tu, Björn Töpel
  Cc: Alexei Starovoitov, Daniel Borkmann,
	Linux Kernel Network Developers, bpf, Björn Töpel

On 2/5/21 9:30 AM, William Tu wrote:
> On Fri, Feb 5, 2021 at 9:09 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
>>
>> From: Björn Töpel <bjorn.topel@intel.com>
>>
>> The test_xdp_redirect.sh script uses some bash-features, such as
>> '&>'. On systems that use dash as the sh implementation this will not
>> work as intended. Change the shebang to use bash instead.

Hi,
In general we (kernel, maybe not bpf) try to move away from bash to a more
"standard" sh shell, so things like "&>" would be converted to ">file 2>&1"
or whatever is needed.

>> Also remove the 'set -e' since the script actually relies on that the
>> return value can be used to determine pass/fail of the test.
>>
>> Fixes: 996139e801fd ("selftests: bpf: add a test for XDP redirect")
>> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
>> ---
> LGTM, thanks.
> Acked-by: William Tu <u9012063@gmail.com>
> 


-- 
~Randy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh
  2021-02-05 17:39   ` Randy Dunlap
@ 2021-02-06  7:46     ` Björn Töpel
  0 siblings, 0 replies; 4+ messages in thread
From: Björn Töpel @ 2021-02-06  7:46 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: William Tu, Alexei Starovoitov, Daniel Borkmann,
	Linux Kernel Network Developers, bpf, Björn Töpel

On Fri, 5 Feb 2021 at 18:39, Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 2/5/21 9:30 AM, William Tu wrote:
> > On Fri, Feb 5, 2021 at 9:09 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
> >>
> >> From: Björn Töpel <bjorn.topel@intel.com>
> >>
> >> The test_xdp_redirect.sh script uses some bash-features, such as
> >> '&>'. On systems that use dash as the sh implementation this will not
> >> work as intended. Change the shebang to use bash instead.
>
> Hi,
> In general we (kernel, maybe not bpf) try to move away from bash to a more
> "standard" sh shell, so things like "&>" would be converted to ">file 2>&1"
> or whatever is needed.
>

Ok! I'll respin!

Björn

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-06  7:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 17:09 [PATCH bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh Björn Töpel
2021-02-05 17:30 ` William Tu
2021-02-05 17:39   ` Randy Dunlap
2021-02-06  7:46     ` Björn Töpel

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).