Commit b58f3f0e authored by Jiri Olsa's avatar Jiri Olsa Committed by Alexei Starovoitov

selftests/bpf: Do not unload bpf_testmod in load_bpf_testmod

Do not unload bpf_testmod in load_bpf_testmod, instead call
unload_bpf_testmod separatelly.

This way we will be able use un/load_bpf_testmod functions
in other tests that un/load bpf_testmod module.
Acked-by: default avatarDavid Vernet <void@manifault.com>
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20230515133756.1658301-6-jolsa@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent d18decca
...@@ -1657,10 +1657,15 @@ int main(int argc, char **argv) ...@@ -1657,10 +1657,15 @@ int main(int argc, char **argv)
env.stderr = stderr; env.stderr = stderr;
env.has_testmod = true; env.has_testmod = true;
if (!env.list_test_names && load_bpf_testmod(verbose())) { if (!env.list_test_names) {
/* ensure previous instance of the module is unloaded */
unload_bpf_testmod(verbose());
if (load_bpf_testmod(verbose())) {
fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n"); fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n");
env.has_testmod = false; env.has_testmod = false;
} }
}
/* initializing tests */ /* initializing tests */
for (i = 0; i < prog_test_cnt; i++) { for (i = 0; i < prog_test_cnt; i++) {
......
...@@ -359,9 +359,6 @@ int load_bpf_testmod(bool verbose) ...@@ -359,9 +359,6 @@ int load_bpf_testmod(bool verbose)
{ {
int fd; int fd;
/* ensure previous instance of the module is unloaded */
unload_bpf_testmod(verbose);
if (verbose) if (verbose)
fprintf(stdout, "Loading bpf_testmod.ko...\n"); fprintf(stdout, "Loading bpf_testmod.ko...\n");
......
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