Commit 9bbad6da authored by Yuntao Wang's avatar Yuntao Wang Committed by Andrii Nakryiko

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: default avatarYuntao Wang <ytcoode@gmail.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220403135245.1713283-1-ytcoode@gmail.com
parent f6d60fac
...@@ -761,8 +761,10 @@ int cd_flavor_subdir(const char *exec_name) ...@@ -761,8 +761,10 @@ int cd_flavor_subdir(const char *exec_name)
const char *flavor = strrchr(exec_name, '/'); const char *flavor = strrchr(exec_name, '/');
if (!flavor) if (!flavor)
return 0; flavor = exec_name;
else
flavor++; flavor++;
flavor = strrchr(flavor, '-'); flavor = strrchr(flavor, '-');
if (!flavor) if (!flavor)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment