Skip to contentSkip to conversation

selftests: bpf: test_kmod.sh: fix passing arguments via function

PATCH Applied Yauheni Kaliuta 2 participants 2 messages Sep 26, 2022 – Sep 27, 2022

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

PATCH 1/1 selftests: bpf: test_kmod.sh: fix passing arguments via function

Since the tests are run in a function $@ there actually contains function arguments, not the script ones.

Pass "$@" to the function as well.

Fixes 272d1f4cfa3c ("selftests: bpf: test_kmod.sh: Pass parameters to the module")

---

I have to admit that I messed up with testing of the last test_kmod.sh patch and it paid immediatly. Feeling really ashamed.

---
 tools/testing/selftests/bpf/test_kmod.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/test_kmod.sh +5 -4
index d4a4279c0181..50dca53ac536 100755
@@ -29,6 +29,7 @@ test_run()
 	sysctl -w net.core.bpf_jit_harden=$2 2>&1 > /dev/null
 
 	echo "[ JIT enabled:$1 hardened:$2 ]"
+	shift 2
 	dmesg -C
 	if [ -f ${OUTPUT}/lib/test_bpf.ko ]; then
 		insmod ${OUTPUT}/lib/test_bpf.ko "$@" 2> /dev/null
@@ -64,9 +65,9 @@ test_restore()
 
 rc=0
 test_save
-test_run 0 0
-test_run 1 0
-test_run 1 1
-test_run 1 2
+test_run 0 0 "$@"
+test_run 1 0 "$@"
+test_run 1 1 "$@"
+test_run 1 2 "$@"
 test_restore
 exit $rc
Signature · 1 line
2.37.3
#1 lore raw
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 9 lines · On Mon, 26 Sep 2022 12:23:20 +0300 you wrote:

Since the tests are run in a function $@ there actually contains function arguments, not the script ones.

Pass "$@" to the function as well.

Fixes 272d1f4cfa3c ("selftests: bpf: test_kmod.sh: Pass parameters to the module")

[...]

Here is the summary with links:
- [bpf-next] selftests: bpf: test_kmod.sh: fix passing arguments via function

    https://git.kernel.org/bpf/bpf-next/c/2702c789996d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html