mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Update SettingsFileReader tests
Fail when value is present in file but not in code. Change-Id: I03bd9b11c4d2c0c69c2511b53926010c1f89f055 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
d3c928189f
commit
74649d3f40
@ -70,7 +70,7 @@ PrintProgramBinaryProcessingTime = 0
|
||||
PrintRelocations = 0
|
||||
WddmResidencyLogger = 0
|
||||
PrintDriverDiagnostics = -1
|
||||
PrintSubmissionsDeviceAndEngineIDs = 0
|
||||
PrintDeviceAndEngineIdOnSubmission = 0
|
||||
EnableDirectSubmission = -1
|
||||
DirectSubmissionBufferPlacement = -1
|
||||
DirectSubmissionSemaphorePlacement = -1
|
||||
|
@ -18,8 +18,11 @@ TEST(SettingsFileReader, givenTestFileWithDefaultValuesWhenTheyAreQueriedThenDef
|
||||
ASSERT_NE(nullptr, reader);
|
||||
|
||||
size_t debugVariableCount = 0;
|
||||
bool variableFound = false;
|
||||
bool compareSuccessful = false;
|
||||
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \
|
||||
variableFound = reader->hasSetting(#variableName); \
|
||||
EXPECT_TRUE(variableFound) << #variableName; \
|
||||
compareSuccessful = (defaultValue == reader->getSetting(#variableName, defaultValue)); \
|
||||
EXPECT_TRUE(compareSuccessful) << #variableName; \
|
||||
debugVariableCount++;
|
||||
@ -29,23 +32,3 @@ TEST(SettingsFileReader, givenTestFileWithDefaultValuesWhenTheyAreQueriedThenDef
|
||||
size_t mapCount = reader->getStringSettingsCount();
|
||||
EXPECT_EQ(mapCount, debugVariableCount);
|
||||
}
|
||||
|
||||
TEST(SettingsFileReader, GetSetting) {
|
||||
|
||||
// Use test settings file
|
||||
std::unique_ptr<TestSettingsFileReader> reader =
|
||||
std::unique_ptr<TestSettingsFileReader>(new TestSettingsFileReader(TestSettingsFileReader::testPath));
|
||||
ASSERT_NE(nullptr, reader);
|
||||
|
||||
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \
|
||||
{ \
|
||||
dataType defaultData = defaultValue; \
|
||||
dataType tempData = reader->getSetting(#variableName, defaultData); \
|
||||
\
|
||||
if (tempData == defaultData) { \
|
||||
EXPECT_TRUE(true); \
|
||||
} \
|
||||
}
|
||||
#include "debug_variables.inl"
|
||||
#undef DECLARE_DEBUG_VARIABLE
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ class TestSettingsFileReader : public SettingsFileReader {
|
||||
~TestSettingsFileReader() override {
|
||||
}
|
||||
|
||||
bool hasSetting(const char *settingName) {
|
||||
std::map<std::string, std::string>::iterator it = settingStringMap.find(std::string(settingName));
|
||||
return (it != settingStringMap.end());
|
||||
}
|
||||
|
||||
size_t getStringSettingsCount() {
|
||||
return settingStringMap.size();
|
||||
}
|
||||
|
Reference in New Issue
Block a user