Skip to content

Commit 9bbad6d

Browse files
ytcoodeanakryiko
authored andcommitted
selftests/bpf: Fix cd_flavor_subdir() of test_progs
Currently, when we run test_progs with just executable file name, for example 'PATH=. test_progs-no_alu32', cd_flavor_subdir() will not check if test_progs is running as a flavored test runner and switch into corresponding sub-directory. This will cause test_progs-no_alu32 executed by the 'PATH=. test_progs-no_alu32' command to run in the wrong directory and load the wrong BPF objects. Signed-off-by: Yuntao Wang <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent f6d60fa commit 9bbad6d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/testing/selftests/bpf/test_progs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,10 @@ int cd_flavor_subdir(const char *exec_name)
761761
const char *flavor = strrchr(exec_name, '/');
762762

763763
if (!flavor)
764-
return 0;
765-
flavor++;
764+
flavor = exec_name;
765+
else
766+
flavor++;
767+
766768
flavor = strrchr(flavor, '-');
767769
if (!flavor)
768770
return 0;

0 commit comments

Comments
 (0)