Fix read of 64bit enviroment variables

change atoi to atoll

Signed-off-by: Cencelewska, Katarzyna <katarzyna.cencelewska@intel.com>
This commit is contained in:
Cencelewska, Katarzyna
2022-09-09 13:19:21 +00:00
committed by Compute-Runtime-Automation
parent 69c9a4e86c
commit 9b19014cf1
5 changed files with 28 additions and 4 deletions

View File

@ -70,6 +70,14 @@ TEST_F(RegistryReaderTest, givenRegistryReaderWhenEnvironmentIntVariableExistsTh
EXPECT_EQ(1234, registryReader.getSetting(envVar, value));
}
TEST_F(RegistryReaderTest, givenRegistryReaderWhenEnvironmentInt64VariableExistsThenReturnCorrectValue) {
const char *envVar = "TestedEnvironmentInt64Variable";
int64_t expectedValue = 9223372036854775807;
int64_t defaultValue = 0;
TestedRegistryReader registryReader("");
EXPECT_EQ(expectedValue, registryReader.getSetting(envVar, defaultValue));
}
struct DebugReaderWithRegistryAndEnvTest : ::testing::Test {
VariableBackup<uint32_t> openRegCountBackup{&SysCalls::regOpenKeySuccessCount};
VariableBackup<uint32_t> queryRegCountBackup{&SysCalls::regQueryValueSuccessCount};

View File

@ -27,6 +27,8 @@ class TestedRegistryReader : public RegistryReader {
return "TestedEnvironmentVariableValue";
} else if (strcmp(envVar, "TestedEnvironmentIntVariable") == 0) {
return "1234";
} else if (strcmp(envVar, "TestedEnvironmentInt64Variable") == 0) {
return "9223372036854775807";
} else if (strcmp(envVar, "settingSourceString") == 0) {
return "environment";
} else if (strcmp(envVar, "settingSourceInt") == 0) {