From 9ddc4f5f2e9bc6bc7585658b50214be598b7f394 Mon Sep 17 00:00:00 2001 From: "Mrozek, Michal" Date: Thu, 4 Jul 2019 14:13:25 +0200 Subject: [PATCH] Improve NonDefault flag dumping. - Do not require PrintDebugMessages to have information messages. Change-Id: I5fcf8dee73ca193f40ac33d2f68190a22ff60e97 Signed-off-by: Mrozek, Michal --- runtime/os_interface/debug_settings_manager.cpp | 2 +- unit_tests/os_interface/debug_settings_manager_tests.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/os_interface/debug_settings_manager.cpp b/runtime/os_interface/debug_settings_manager.cpp index 32a7f894f6..3dab029993 100644 --- a/runtime/os_interface/debug_settings_manager.cpp +++ b/runtime/os_interface/debug_settings_manager.cpp @@ -170,7 +170,7 @@ template void DebugSettingsManager::dumpNonDefaultFlag(const char *variableName, const DataType &variableValue, const DataType &defaultValue) { if (variableValue != defaultValue) { const auto variableStringValue = std::to_string(variableValue); - printDebugString(DebugManager.flags.PrintDebugMessages.get(), stdout, "Non-default value of debug variable: %s = %s\n", variableName, variableStringValue.c_str()); + printDebugString(true, stdout, "Non-default value of debug variable: %s = %s\n", variableName, variableStringValue.c_str()); } } diff --git a/unit_tests/os_interface/debug_settings_manager_tests.cpp b/unit_tests/os_interface/debug_settings_manager_tests.cpp index 9dca084af5..63cb3ba455 100644 --- a/unit_tests/os_interface/debug_settings_manager_tests.cpp +++ b/unit_tests/os_interface/debug_settings_manager_tests.cpp @@ -866,6 +866,7 @@ TEST(DebugSettingsManager, givenReaderImplInDebugManagerWhenSettingDifferentRead } TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledWhenCallingDumpFlagsThenFlagsAreWrittenToDumpFile) { + testing::internal::CaptureStdout(); FullyEnabledTestDebugManager debugManager; debugManager.flags.PrintDebugSettings.set(true); debugManager.flags.LoopAtPlatformInitialize.set(true); @@ -884,6 +885,13 @@ TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledWhenCallingDumpFlagsThe #include "debug_variables.inl" #undef DECLARE_DEBUG_VARIABLE std::remove(FullyEnabledTestDebugManager::settingsDumpFileName); + std::string output = testing::internal::GetCapturedStdout(); + ASSERT_NE(0u, output.size()); + + EXPECT_NE(std::string::npos, output.find("Non-default value of debug variable: TbxServer = 192.168.0.1")); + EXPECT_NE(std::string::npos, output.find("Non-default value of debug variable: LoopAtPlatformInitialize = 1")); + EXPECT_NE(std::string::npos, output.find("Non-default value of debug variable: PrintDebugSettings = 1")); + EXPECT_NE(std::string::npos, output.find("Non-default value of debug variable: Enable64kbpages = 1")); } struct AllocationTypeTestCase {