mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
fix parsing in debug file reader
Change-Id: I6812a2ea0336152a9f5d1bc9d95f30a91392cf79
This commit is contained in:

committed by
sys_ocldev

parent
f217c9198c
commit
95bd4a3d3a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -62,6 +62,7 @@ SettingsFileReader::SettingsFileReader(const char *filePath) {
|
||||
settingStringMap.insert(pair<string, string>(key, tempStringValue));
|
||||
}
|
||||
|
||||
ss.str(string()); // for reset string inside stringstream
|
||||
ss.clear();
|
||||
key.clear();
|
||||
}
|
||||
@ -96,4 +97,4 @@ std::string SettingsFileReader::getSetting(const char *settingName, const std::s
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
};
|
||||
}; // namespace OCLRT
|
@ -21,3 +21,4 @@
|
||||
*/
|
||||
|
||||
DECLARE_DEBUG_VARIABLE(std::string, StringTestKey, "DefaultTestValue", "TestDescription")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, IntTestKey, 1, "TestDescription")
|
||||
|
@ -1 +1,2 @@
|
||||
StringTestKey = TestValue
|
||||
IntTestKey = 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2018, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -129,6 +129,21 @@ TEST(SettingsFileReader, GetStringSettingFromFile) {
|
||||
#undef DECLARE_DEBUG_VARIABLE
|
||||
}
|
||||
|
||||
TEST(SettingsFileReader, givenDebugFileSettingInWhichStringIsFollowedByIntegerWhenItIsParsedThenProperValuesAreObtained) {
|
||||
std::unique_ptr<TestSettingsFileReader> reader(new TestSettingsFileReader(TestSettingsFileReader::stringTestPath));
|
||||
ASSERT_NE(nullptr, reader.get());
|
||||
|
||||
int32_t retValue = 0;
|
||||
int32_t returnedIntValue = reader->getSetting("IntTestKey", retValue);
|
||||
|
||||
EXPECT_EQ(1, returnedIntValue);
|
||||
|
||||
string retValueString;
|
||||
string returnedStringValue = reader->getSetting("StringTestKey", retValueString);
|
||||
|
||||
EXPECT_STREQ(returnedStringValue.c_str(), "TestValue");
|
||||
}
|
||||
|
||||
TEST(SettingsFileReader, GetSettingWhenNotInFile) {
|
||||
|
||||
// Use test settings file
|
||||
|
Reference in New Issue
Block a user