From a9aa928629654642bb76bd930b2967b2130a0e1e Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Tue, 17 Dec 2024 20:41:27 -0500 Subject: [PATCH] tests: Prefer tf_printf. --- src/ssb.tests.c | 9 ++++----- src/tests.c | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ssb.tests.c b/src/ssb.tests.c index 246b0bb7..9e4fa1a8 100644 --- a/src/ssb.tests.c +++ b/src/ssb.tests.c @@ -902,8 +902,7 @@ static void _write_file(const char* path, const char* contents) FILE* file = fopen(path, "w"); if (!file) { - printf("Unable to write %s: %s.\n", path, strerror(errno)); - fflush(stdout); + tf_printf("Unable to write %s: %s.\n", path, strerror(errno)); abort(); } fputs(contents, file); @@ -933,7 +932,7 @@ void tf_ssb_test_encrypt(const tf_test_options_t* options) int result = system(command); (void)result; assert(WIFEXITED(result)); - printf("returned %d\n", WEXITSTATUS(result)); + tf_printf("returned %d\n", WEXITSTATUS(result)); assert(WEXITSTATUS(result) == 0); } @@ -1028,13 +1027,13 @@ void tf_ssb_test_publish(const tf_test_options_t* options) int result = system(command); (void)result; assert(WIFEXITED(result)); - printf("returned %d\n", WEXITSTATUS(result)); + tf_printf("returned %d\n", WEXITSTATUS(result)); assert(WEXITSTATUS(result) == 0); snprintf(command, sizeof(command), "%s publish -d out/test_db0.sqlite -u :admin -i %s -c '{\"type\": \"post\", \"text\": \"Two.\"}'", executable, id); result = system(command); assert(WIFEXITED(result)); - printf("returned %d\n", WEXITSTATUS(result)); + tf_printf("returned %d\n", WEXITSTATUS(result)); assert(WEXITSTATUS(result) == 0); uv_run(&loop, UV_RUN_DEFAULT); diff --git a/src/tests.c b/src/tests.c index 87f622ee..d496ac91 100644 --- a/src/tests.c +++ b/src/tests.c @@ -40,8 +40,7 @@ static void _write_file(const char* path, const char* contents) FILE* file = fopen(path, "w"); if (!file) { - printf("Unable to write %s: %s.\n", path, strerror(errno)); - fflush(stdout); + tf_printf("Unable to write %s: %s.\n", path, strerror(errno)); abort(); } fputs(contents, file);