summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/testing_helpers.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2023-05-15 15:37:50 +0200
committerAlexei Starovoitov <ast@kernel.org>2023-05-16 22:09:23 -0700
commitd18decca69e36480247a73086336f4a44a08e36f (patch)
tree6d0fe35d59c3f20120b76850514069de60d7b420 /tools/testing/selftests/bpf/testing_helpers.c
parent45db310984bfea977177fb5fc0ea23ab430129bd (diff)
selftests/bpf: Use only stdout in un/load_bpf_testmod functions
We are about to use un/load_bpf_testmod functions in couple tests and it's better to print output to stdout, so it's aligned with tests ASSERT macros output, which use stdout as well. Acked-by: David Vernet <void@manifault.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20230515133756.1658301-5-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.c')
-rw-r--r--tools/testing/selftests/bpf/testing_helpers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/testing_helpers.c b/tools/testing/selftests/bpf/testing_helpers.c
index 648c7d3eb319..f73bc88f3eb6 100644
--- a/tools/testing/selftests/bpf/testing_helpers.c
+++ b/tools/testing/selftests/bpf/testing_helpers.c
@@ -341,14 +341,14 @@ static int delete_module(const char *name, int flags)
void unload_bpf_testmod(bool verbose)
{
if (kern_sync_rcu())
- fprintf(stderr, "Failed to trigger kernel-side RCU sync!\n");
+ fprintf(stdout, "Failed to trigger kernel-side RCU sync!\n");
if (delete_module("bpf_testmod", 0)) {
if (errno == ENOENT) {
if (verbose)
fprintf(stdout, "bpf_testmod.ko is already unloaded.\n");
return;
}
- fprintf(stderr, "Failed to unload bpf_testmod.ko from kernel: %d\n", -errno);
+ fprintf(stdout, "Failed to unload bpf_testmod.ko from kernel: %d\n", -errno);
return;
}
if (verbose)
@@ -367,11 +367,11 @@ int load_bpf_testmod(bool verbose)
fd = open("bpf_testmod.ko", O_RDONLY);
if (fd < 0) {
- fprintf(stderr, "Can't find bpf_testmod.ko kernel module: %d\n", -errno);
+ fprintf(stdout, "Can't find bpf_testmod.ko kernel module: %d\n", -errno);
return -ENOENT;
}
if (finit_module(fd, "", 0)) {
- fprintf(stderr, "Failed to load bpf_testmod.ko into the kernel: %d\n", -errno);
+ fprintf(stdout, "Failed to load bpf_testmod.ko into the kernel: %d\n", -errno);
close(fd);
return -EINVAL;
}