@@ -1592,9 +1592,14 @@ int main(int argc, char **argv)
env.stderr = stderr;
env.has_testmod = true;
- if (!env.list_test_names && load_bpf_testmod(verbose())) {
- fprintf(env.stderr, "WARNING! Selftests relying on bpf_testmod.ko will be skipped.\n");
- env.has_testmod = false;
+ 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");
+ env.has_testmod = false;
+ }
}
/* initializing tests */
@@ -262,9 +262,6 @@ int load_bpf_testmod(bool verbose)
{
int fd;
- /* ensure previous instance of the module is unloaded */
- unload_bpf_testmod(verbose);
-
if (verbose)
fprintf(stdout, "Loading bpf_testmod.ko...\n");