fix: ocloc - remove memory leaks

Related-To: NEO-7467

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2023-04-06 16:08:51 +00:00
committed by Compute-Runtime-Automation
parent 3459f3a7f6
commit 5576b9e074
15 changed files with 85 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -38,7 +38,7 @@ class MockDecoder : public BinaryDecoder {
using BinaryDecoder::programHeader;
MockDecoder(bool suppressMessages = true) : MockDecoder("", "", "") {
argHelper->getPrinterRef() = MessagePrinter(suppressMessages);
argHelper->getPrinterRef().setSuppressMessages(suppressMessages);
}
MockDecoder(const std::string &file, const std::string &patch, const std::string &dump)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,7 +35,7 @@ class MockEncoder : public BinaryEncoder {
using BinaryEncoder::pathToDump;
MockEncoder(bool suppressMessages = true) : MockEncoder("", "") {
argHelper->getPrinterRef() = MessagePrinter(suppressMessages);
argHelper->getPrinterRef().setSuppressMessages(suppressMessages);
}
MockEncoder(const std::string &dump, const std::string &elf)

View File

@@ -322,7 +322,7 @@ TEST(ZebinManipulatorTests, GivenInvalidSectionsInfoWhenCheckingIfIs64BitZebinTh
template <NEO::Elf::ELF_IDENTIFIER_CLASS numBits>
struct ZebinDecoderFixture {
ZebinDecoderFixture() : argHelper(filesMap), decoder(&argHelper) {
argHelper.messagePrinter = MessagePrinter(true);
argHelper.messagePrinter.setSuppressMessages(true);
};
void setUp() {}
void tearDown() {}
@@ -469,7 +469,7 @@ TEST_F(ZebinDecoderTests, WhenPrintHelpIsCalledThenHelpIsPrinted) {
template <NEO::Elf::ELF_IDENTIFIER_CLASS numBits>
struct ZebinEncoderFixture {
ZebinEncoderFixture() : argHelper(filesMap), encoder(&argHelper) {
argHelper.messagePrinter = MessagePrinter(true);
argHelper.messagePrinter.setSuppressMessages(true);
};
void setUp() {}
void tearDown() {}

View File

@@ -44,6 +44,31 @@ std::string getRunPath() {
return res;
}
void applyWorkarounds() {
{
std::ofstream f;
const std::string fileName("_tmp_");
f.open(fileName, std::ofstream::binary);
f.close();
}
{
std::mutex mtx;
std::unique_lock<std::mutex> stateLock(mtx);
}
{
std::stringstream ss("1");
int val;
ss >> val;
}
{
std::string res("abc");
res = res.substr(0, 2);
}
// intialize rand
srand(static_cast<unsigned int>(time(nullptr)));
}
int main(int argc, char **argv) {
int retVal = 0;
bool useDefaultListener = false;
@@ -58,6 +83,8 @@ int main(int argc, char **argv) {
std::string revId("0");
std::string productConfig("");
applyWorkarounds();
#if defined(__linux__)
if (getenv("CLOC_SELFTEST") == nullptr) {
setenv("CLOC_SELFTEST", "YES", 1);

View File

@@ -89,7 +89,7 @@ TEST(OclocConcatTest, GivenErrorDuringDecodingArWhenConcatenatingThenErrorIsRetu
{"fatBinary2.ar", "!<arch>\nfatBinary2Data"}};
MockOclocArgHelper mockArgHelper{mockArgHelperFilesMap};
auto oclocConcat = MockOclocConcat(&mockArgHelper);
mockArgHelper.messagePrinter = new MessagePrinter(true);
mockArgHelper.messagePrinter.setSuppressMessages(true);
oclocConcat.shouldFailDecodingAr = true;
oclocConcat.fileNamesToConcat = {"fatBinary1.ar",
"fatBinary2.ar"};
@@ -104,7 +104,7 @@ TEST(OclocConcatTest, GivenBinaryFileNonZebinWhenConcatenatingThenErrorIsReturne
{"binary.bin", "NOT Zebin"}};
MockOclocArgHelper mockArgHelper{mockArgHelperFilesMap};
auto oclocConcat = MockOclocConcat(&mockArgHelper);
mockArgHelper.messagePrinter = new MessagePrinter(true);
mockArgHelper.messagePrinter.setSuppressMessages(true);
oclocConcat.fileNamesToConcat = {"binary.bin"};
auto error = oclocConcat.concatenate();
const auto output = mockArgHelper.messagePrinter.getLog().str();
@@ -120,7 +120,7 @@ TEST(OclocConcatTest, GivenZebinWithoutAOTProductConfigWhenConcatenatingThenErro
{"zebin.bin", std::string(reinterpret_cast<const char *>(zebin->data()), zebin->size())}};
MockOclocArgHelper mockArgHelper{mockArgHelperFilesMap};
auto oclocConcat = MockOclocConcat(&mockArgHelper);
mockArgHelper.messagePrinter = new MessagePrinter(true);
mockArgHelper.messagePrinter.setSuppressMessages(true);
oclocConcat.fileNamesToConcat = {"zebin.bin"};
auto error = oclocConcat.concatenate();
const auto output = mockArgHelper.messagePrinter.getLog().str();
@@ -151,7 +151,7 @@ TEST(OclocConcatTest, GivenZebinWithAOTNoteAndFatBinaryWhenConcatenatingThenCorr
{"fatBinary.ar", std::string(reinterpret_cast<const char *>(fatBinary.data()), fatBinary.size())}};
MockOclocArgHelper mockArgHelper{mockArgHelperFilesMap};
mockArgHelper.interceptOutput = true;
mockArgHelper.messagePrinter = new MessagePrinter(true);
mockArgHelper.messagePrinter.setSuppressMessages(true);
auto oclocConcat = MockOclocConcat(&mockArgHelper);
oclocConcat.fileNamesToConcat = {

View File

@@ -307,7 +307,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenClosedRangeTooExtensiveWhenProdu
GTEST_SKIP();
}
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream acronymsString;
acronymsString << enabledAcronyms[0].str() << ":" << enabledAcronyms[1].str() << ":" << enabledAcronyms[2].str();
auto target = acronymsString.str();
@@ -369,7 +369,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfProductsWhenFatBinar
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -406,7 +406,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoVersionsOfProductConfigsWhenF
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -440,7 +440,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsAcronymsWithoutDashesWhe
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -544,7 +544,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfReleasesWhenFatBinar
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -585,7 +585,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenTwoTargetsOfFamiliesWhenFatBinar
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -630,7 +630,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsClosedRangeWhenFatBinary
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -669,7 +669,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenProductsClosedRangeWithoutDashes
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -762,7 +762,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenFamiliesClosedRangeWhenFatBinary
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -796,7 +796,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromProductWhenFatBinar
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -832,7 +832,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromProductWithoutDashe
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -865,7 +865,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToProductWhenFatBinaryB
auto got = NEO::getTargetProductsForFatbinary(acronymsTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -1013,7 +1013,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromReleaseWhenFatBinar
auto got = NEO::getTargetProductsForFatbinary(releasesTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -1057,7 +1057,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToReleaseWhenFatBinaryB
auto got = NEO::getTargetProductsForFatbinary(releasesTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -1243,7 +1243,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeFromFamilyWhenFatBinary
auto got = NEO::getTargetProductsForFatbinary(familiesTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -1285,7 +1285,7 @@ TEST_F(OclocFatBinaryProductAcronymsTests, givenOpenRangeToFamilyWhenFatBinaryBu
auto got = NEO::getTargetProductsForFatbinary(familiesTarget, oclocArgHelperWithoutInput.get());
EXPECT_EQ(got, expected);
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
std::stringstream resString;
std::vector<std::string> argv = {
"ocloc",
@@ -1323,7 +1323,7 @@ TEST_F(OclocFatBinaryTest, givenSpirvInputWhenFatBinaryIsRequestedThenArchiveCon
"-device",
devices};
mockArgHelper.getPrinterRef() = MessagePrinter{true};
mockArgHelper.getPrinterRef().setSuppressMessages(true);
const auto buildResult = buildFatBinary(args, &mockArgHelper);
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
@@ -1426,7 +1426,7 @@ TEST_F(OclocFatBinaryTest, givenBitFlagsWhenBuildingFatbinaryThenFilesInArchiveH
"-device",
devices};
mockArgHelper.getPrinterRef() = MessagePrinter{true};
mockArgHelper.getPrinterRef().setSuppressMessages(true);
const auto buildResult = buildFatBinary(args, &mockArgHelper);
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
@@ -1466,7 +1466,7 @@ TEST_F(OclocFatBinaryTest, givenOutputDirectoryFlagWhenBuildingFatbinaryThenArch
"-device",
devices};
mockArgHelper.getPrinterRef() = MessagePrinter{true};
mockArgHelper.getPrinterRef().setSuppressMessages(true);
const auto buildResult = buildFatBinary(args, &mockArgHelper);
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
@@ -1491,7 +1491,7 @@ TEST_F(OclocFatBinaryTest, givenSpirvInputAndExcludeIrFlagWhenFatBinaryIsRequest
"-device",
devices};
mockArgHelper.getPrinterRef() = MessagePrinter{true};
mockArgHelper.getPrinterRef().setSuppressMessages(true);
const auto buildResult = buildFatBinary(args, &mockArgHelper);
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
@@ -1530,7 +1530,7 @@ TEST_F(OclocFatBinaryTest, givenClInputFileWhenFatBinaryIsRequestedThenArchiveDo
"-device",
devices};
mockArgHelper.getPrinterRef() = MessagePrinter{true};
mockArgHelper.getPrinterRef().setSuppressMessages(true);
const auto buildResult = buildFatBinary(args, &mockArgHelper);
ASSERT_EQ(OclocErrorCode::SUCCESS, buildResult);
ASSERT_EQ(1u, mockArgHelper.interceptedFiles.count(outputArchiveName));
@@ -1589,7 +1589,7 @@ TEST(OclocFatBinaryHelpersTest, givenPreviousCompilationErrorWhenBuildingFatbina
gEnvironment->devicePrefix.c_str()};
MockOfflineCompiler mockOfflineCompiler{};
mockOfflineCompiler.argHelper->getPrinterRef() = MessagePrinter{true};
mockOfflineCompiler.argHelper->getPrinterRef().setSuppressMessages(true);
mockOfflineCompiler.initialize(argv.size(), argv);
// We expect that nothing is done and error is returned.

View File

@@ -28,7 +28,7 @@ class OclocFatBinaryProductAcronymsTests : public OclocEnabledAcronyms {
public:
OclocFatBinaryProductAcronymsTests() {
oclocArgHelperWithoutInput = std::make_unique<OclocArgHelper>();
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{true};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(true);
enabledProducts = oclocArgHelperWithoutInput->productConfigHelper->getDeviceAotInfo();
enabledProductsAcronyms = oclocArgHelperWithoutInput->productConfigHelper->getRepresentativeProductAcronyms();
@@ -66,7 +66,7 @@ struct OclocFatbinaryPerProductTests : public ::testing::TestWithParam<std::tupl
void SetUp() override {
std::tie(release, productFamily) = GetParam();
argHelper = std::make_unique<OclocArgHelper>();
argHelper->getPrinterRef() = MessagePrinter{true};
argHelper->getPrinterRef().setSuppressMessages(true);
}
std::string release;

View File

@@ -17,7 +17,7 @@
TEST(OclocValidate, WhenFileArgIsMissingThenFail) {
std::map<std::string, std::string> files;
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({}, &argHelper);
EXPECT_EQ(-1, res);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
@@ -27,7 +27,7 @@ TEST(OclocValidate, WhenFileArgIsMissingThenFail) {
TEST(OclocValidate, WhenInputFileIsMissingThenFail) {
MockOclocArgHelper::FilesMap files;
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({"-file", "src.gen"}, &argHelper);
EXPECT_EQ(-1, res);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
@@ -37,7 +37,7 @@ TEST(OclocValidate, WhenInputFileIsMissingThenFail) {
TEST(OclocValidate, WhenInputFileIsAvailableThenLogItsSize) {
MockOclocArgHelper::FilesMap files{{"src.gen", "01234567"}};
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({"-file", "src.gen"}, &argHelper);
EXPECT_NE(0, res);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
@@ -47,7 +47,7 @@ TEST(OclocValidate, WhenInputFileIsAvailableThenLogItsSize) {
TEST(OclocValidate, WhenInputFileIsNotZebinThenFail) {
MockOclocArgHelper::FilesMap files{{"src.gen", "01234567"}};
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({"-file", "src.gen"}, &argHelper);
EXPECT_EQ(-2, res);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
@@ -59,7 +59,7 @@ TEST(OclocValidate, WhenInputIsValidZebinThenReturnSucceed) {
MockOclocArgHelper::FilesMap files{{"src.gen", MockOclocArgHelper::FileData(reinterpret_cast<const char *>(zebin.storage.data()),
reinterpret_cast<const char *>(zebin.storage.data()) + zebin.storage.size())}};
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({"-file", "src.gen"}, &argHelper);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
EXPECT_EQ(0, res) << oclocStdout;
@@ -70,7 +70,7 @@ TEST(OclocValidate, WhenInputIsValid32BitZebinThenReturnSucceed) {
MockOclocArgHelper::FilesMap files{{"src.gen", MockOclocArgHelper::FileData(reinterpret_cast<const char *>(zebin.storage.data()),
reinterpret_cast<const char *>(zebin.storage.data()) + zebin.storage.size())}};
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({"-file", "src.gen"}, &argHelper);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
EXPECT_EQ(0, res) << oclocStdout;
@@ -83,7 +83,7 @@ TEST(OclocValidate, WhenWarningsEmitedThenRedirectsThemToStdout) {
MockOclocArgHelper::FilesMap files{{"src.gen", MockOclocArgHelper::FileData(reinterpret_cast<const char *>(zebin.storage.data()),
reinterpret_cast<const char *>(zebin.storage.data()) + zebin.storage.size())}};
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({"-file", "src.gen"}, &argHelper);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
EXPECT_EQ(0, res) << oclocStdout;
@@ -98,7 +98,7 @@ TEST(OclocValidate, WhenErrorsEmitedThenRedirectsThemToStdout) {
MockOclocArgHelper::FilesMap files{{"src.gen", MockOclocArgHelper::FileData(reinterpret_cast<const char *>(zebin.storage.data()),
reinterpret_cast<const char *>(zebin.storage.data()) + zebin.storage.size())}};
MockOclocArgHelper argHelper{files};
argHelper.getPrinterRef() = MessagePrinter(true);
argHelper.getPrinterRef().setSuppressMessages(true);
int res = Ocloc::validate({"-file", "src.gen"}, &argHelper);
std::string oclocStdout = argHelper.getPrinterRef().getLog().str();
EXPECT_EQ(static_cast<int>(NEO::DecodeError::InvalidBinary), res) << oclocStdout;

View File

@@ -1071,7 +1071,7 @@ TEST_F(OfflineCompilerTests, givenDeviceIdHexValueWhenInitHwInfoThenItHasCorrect
auto deviceId = deviceAotInfo[0].deviceIds->front();
deviceString << "0x" << std::hex << deviceId;
mockOfflineCompiler.argHelper->getPrinterRef() = MessagePrinter{true};
mockOfflineCompiler.argHelper->getPrinterRef().setSuppressMessages(true);
mockOfflineCompiler.initHardwareInfo(deviceString.str());
EXPECT_EQ(mockOfflineCompiler.hwInfo.platform.usDeviceID, deviceId);
}
@@ -1096,7 +1096,7 @@ TEST_F(OfflineCompilerTests, givenProperDeviceIdHexAsDeviceArgumentThenSuccessIs
"-device",
deviceString.str()};
oclocArgHelperWithoutInput->getPrinterRef() = MessagePrinter{false};
oclocArgHelperWithoutInput->getPrinterRef().setSuppressMessages(false);
testing::internal::CaptureStdout();
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
EXPECT_EQ(pOfflineCompiler->getHardwareInfo().platform.usDeviceID, deviceId);