diff mbox series

[bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh

Message ID 20210205170950.145042-1-bjorn.topel@gmail.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series [bpf] selftests/bpf: use bash instead of sh in test_xdp_redirect.sh | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf
netdev/subject_prefix success Link
netdev/cc_maintainers warning 11 maintainers not CCed: shuah@kernel.org davem@davemloft.net songliubraving@fb.com linux-kselftest@vger.kernel.org andrii@kernel.org hawk@kernel.org kpsingh@kernel.org john.fastabend@gmail.com kuba@kernel.org kafai@fb.com yhs@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Björn Töpel Feb. 5, 2021, 5:09 p.m. UTC
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(-)


base-commit: 6183f4d3a0a2ad230511987c6c362ca43ec0055f

Comments

William Tu Feb. 5, 2021, 5:30 p.m. UTC | #1
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>
Randy Dunlap Feb. 5, 2021, 5:39 p.m. UTC | #2
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>
>
Björn Töpel Feb. 6, 2021, 7:46 a.m. UTC | #3
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
diff mbox series

Patch

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