map = bpf_object__find_map_by_name(obj, name);
        if (!map) {
-               printf("%s:FAIL:map '%s' not found\n", test, name);
+               fprintf(stdout, "%s:FAIL:map '%s' not found\n", test, name);
                test__fail();
                return -1;
        }
 {
        if (env.verbosity < VERBOSE_VERY && level == LIBBPF_DEBUG)
                return 0;
-       vprintf(format, args);
+       vfprintf(stdout, format, args);
        return 0;
 }
 
        if (!flavor)
                return 0;
        flavor++;
-       printf("Switching to flavor '%s' subdirectory...\n", flavor);
+       fprintf(stdout, "Switching to flavor '%s' subdirectory...\n", flavor);
        return chdir(flavor);
 }
 
                        cleanup_cgroup_environment();
        }
        stdio_restore();
-       printf("Summary: %d/%d PASSED, %d SKIPPED, %d FAILED\n",
-              env.succ_cnt, env.sub_succ_cnt, env.skip_cnt, env.fail_cnt);
+       fprintf(stdout, "Summary: %d/%d PASSED, %d SKIPPED, %d FAILED\n",
+               env.succ_cnt, env.sub_succ_cnt, env.skip_cnt, env.fail_cnt);
 
        free(env.test_selector.blacklist.strs);
        free(env.test_selector.whitelist.strs);
 
        int __save_errno = errno;                                       \
        if (__ret) {                                                    \
                test__fail();                                           \
-               printf("%s:FAIL:%s ", __func__, tag);                   \
-               printf(format);                                         \
+               fprintf(stdout, "%s:FAIL:%s ", __func__, tag);          \
+               fprintf(stdout, ##format);                              \
        } else {                                                        \
-               printf("%s:PASS:%s %d nsec\n",                          \
+               fprintf(stdout, "%s:PASS:%s %d nsec\n",                 \
                       __func__, tag, duration);                        \
        }                                                               \
        errno = __save_errno;                                           \
        int __save_errno = errno;                                       \
        if (__ret) {                                                    \
                test__fail();                                           \
-               printf("%s:FAIL:%d\n", __func__, __LINE__);             \
+               fprintf(stdout, "%s:FAIL:%d\n", __func__, __LINE__);    \
        }                                                               \
        errno = __save_errno;                                           \
        __ret;                                                          \