From 2d86fe6b1242654d573b6802d1bbf53d50b10811 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 7 Jan 2025 13:04:51 +0000 Subject: [PATCH] Ensure log output is clean when listing available demos --- util/test/demos/main.cpp | 2 ++ util/test/demos/test_common.cpp | 10 ++++++++++ util/test/demos/test_common.h | 1 + 3 files changed, 13 insertions(+) diff --git a/util/test/demos/main.cpp b/util/test/demos/main.cpp index 4067a5c102..605d5c7f13 100644 --- a/util/test/demos/main.cpp +++ b/util/test/demos/main.cpp @@ -454,6 +454,8 @@ Usage: %s Test_Name [test_options] if(argc >= 2 && !strcmp(argv[1], "--list-raw")) { + SetDebugLogEnabled(false); + check_tests(argc, argv); // output TSV diff --git a/util/test/demos/test_common.cpp b/util/test/demos/test_common.cpp index 7f55a5aac3..a345cc4a50 100644 --- a/util/test/demos/test_common.cpp +++ b/util/test/demos/test_common.cpp @@ -158,8 +158,18 @@ static FILE *logFile = NULL; #include #endif +static bool debugLogEnabled = true; + +void SetDebugLogEnabled(bool enabled) +{ + debugLogEnabled = enabled; +} + void DebugPrint(const char *fmt, ...) { + if(!debugLogEnabled) + return; + va_list args; va_start(args, fmt); diff --git a/util/test/demos/test_common.h b/util/test/demos/test_common.h index 23e43917be..a541040f85 100644 --- a/util/test/demos/test_common.h +++ b/util/test/demos/test_common.h @@ -333,6 +333,7 @@ std::string strlower(const std::string &str); std::string strupper(const std::string &str); std::string trim(const std::string &str); +void SetDebugLogEnabled(bool enabled); void DebugPrint(const char *fmt, ...); #define TEST_ASSERT(cond, fmt, ...) \