Improve NonDefault flag dumping.

- Do not require PrintDebugMessages to have information messages.

Change-Id: I5fcf8dee73ca193f40ac33d2f68190a22ff60e97
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal
2019-07-04 14:13:25 +02:00
parent ba18b85f1c
commit 9ddc4f5f2e
2 changed files with 9 additions and 1 deletions

View File

@@ -170,7 +170,7 @@ template <typename DataType>
void DebugSettingsManager<DebugLevel>::dumpNonDefaultFlag(const char *variableName, const DataType &variableValue, const DataType &defaultValue) { void DebugSettingsManager<DebugLevel>::dumpNonDefaultFlag(const char *variableName, const DataType &variableValue, const DataType &defaultValue) {
if (variableValue != defaultValue) { if (variableValue != defaultValue) {
const auto variableStringValue = std::to_string(variableValue); 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());
} }
} }

View File

@@ -866,6 +866,7 @@ TEST(DebugSettingsManager, givenReaderImplInDebugManagerWhenSettingDifferentRead
} }
TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledWhenCallingDumpFlagsThenFlagsAreWrittenToDumpFile) { TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledWhenCallingDumpFlagsThenFlagsAreWrittenToDumpFile) {
testing::internal::CaptureStdout();
FullyEnabledTestDebugManager debugManager; FullyEnabledTestDebugManager debugManager;
debugManager.flags.PrintDebugSettings.set(true); debugManager.flags.PrintDebugSettings.set(true);
debugManager.flags.LoopAtPlatformInitialize.set(true); debugManager.flags.LoopAtPlatformInitialize.set(true);
@@ -884,6 +885,13 @@ TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledWhenCallingDumpFlagsThe
#include "debug_variables.inl" #include "debug_variables.inl"
#undef DECLARE_DEBUG_VARIABLE #undef DECLARE_DEBUG_VARIABLE
std::remove(FullyEnabledTestDebugManager::settingsDumpFileName); 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 { struct AllocationTypeTestCase {