Skip to content

Commit

Permalink
Ensure log output is clean when listing available demos
Browse files Browse the repository at this point in the history
  • Loading branch information
baldurk committed Jan 7, 2025
1 parent 4d4fbdc commit 2d86fe6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions util/test/demos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions util/test/demos/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,18 @@ static FILE *logFile = NULL;
#include <android/log.h>
#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);

Expand Down
1 change: 1 addition & 0 deletions util/test/demos/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...) \
Expand Down

0 comments on commit 2d86fe6

Please sign in to comment.