Skip to contentSkip to conversation

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

PATCH In review Björn Töpel 3 participants 4 messages Feb 5, 2021 – Feb 6, 2021

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: use bash instead of sh in test_xdp_redirect.sh

From: Björn Töpel <[email protected]>

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")
---
 tools/testing/selftests/bpf/test_xdp_redirect.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/bpf/test_xdp_redirect.sh +1 -2
index dd80f0c84afb..db35e40947ff 100755
@@ -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

Signature · 1 line
2.27.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Björn Töpel

From: Björn Töpel <[email protected]>

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.

Quoted 6 lines

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

---

LGTM, thanks.

#2 lore raw
Quoted 7 lines · William Tu
Quoted 6 lines · Björn Töpel

From: Björn Töpel <[email protected]>

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.

Quoted 9 lines
Quoted 6 lines

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

---

LGTM, thanks.

Signature · 1 line
~Randy
#3 lore raw
Quoted 6 lines · Randy Dunlap
Quoted 4 lines · William Tu
Quoted 3 lines · Björn Töpel

From: Björn Töpel <[email protected]>

Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

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