Clean-Up unused code related to GMock

This commit:
- Removes usings e.g. ::testing::Return
- Removes unnecessary gmock inclues
- Replaces Gmock macros (e.g. EXPECT_THAT) with our custom implementations

Related-To: NEO-4941
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski
2022-03-14 10:15:57 +00:00
committed by Compute-Runtime-Automation
parent a23bfbc8ed
commit 3d8effcd69
134 changed files with 520 additions and 544 deletions

View File

@ -16,7 +16,7 @@
#include "opencl/test/unit_test/helpers/raii_hw_helper.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
using namespace NEO;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -47,9 +47,6 @@
using namespace NEO;
using ::testing::_;
using ::testing::Invoke;
using CommandStreamReceiverFlushTaskGmockTests = UltCommandStreamReceiverTest;
HWTEST2_F(CommandStreamReceiverFlushTaskGmockTests,

View File

@ -628,7 +628,7 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCallWaitWithKmdFallback) {
bool forcePowerSavingModePassed = false;
};
auto myMockCsr = std::make_unique<::testing::NiceMock<MyMockCsr>>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto myMockCsr = std::make_unique<MyMockCsr>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto &bcsOsContext = pDevice->getUltCommandStreamReceiver<FamilyType>().getOsContext();
myMockCsr->initializeTagAllocation();
myMockCsr->setupContext(bcsOsContext);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -8,6 +8,7 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_csr.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/helpers/gtest_helpers.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
@ -78,8 +79,8 @@ HWTEST_F(CommandStreamReceiverMtTest, givenDebugPauseThreadWhenSettingFlagProgre
EXPECT_EQ(2u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Press enter to start workload")));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Workload ended, press enter to continue")));
mockCSR->userPauseConfirmation->join();
mockCSR->userPauseConfirmation.reset();
}
@ -121,8 +122,8 @@ HWTEST_F(CommandStreamReceiverMtTest, givenDebugPauseThreadBeforeWalkerOnlyWhenS
EXPECT_EQ(1u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::Not(testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue"))));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Press enter to start workload")));
EXPECT_FALSE(hasSubstr(output, std::string("Debug break: Workload ended, press enter to continue")));
mockCSR->userPauseConfirmation->join();
mockCSR->userPauseConfirmation.reset();
}
@ -164,8 +165,8 @@ HWTEST_F(CommandStreamReceiverMtTest, givenDebugPauseThreadAfterWalkerOnlyWhenSe
EXPECT_EQ(1u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::Not(testing::HasSubstr(std::string("Debug break: Press enter to start workload"))));
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
EXPECT_FALSE(hasSubstr(output, std::string("Debug break: Press enter to start workload")));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Workload ended, press enter to continue")));
mockCSR->userPauseConfirmation->join();
mockCSR->userPauseConfirmation.reset();
}
@ -251,8 +252,8 @@ HWTEST_F(CommandStreamReceiverMtTest, givenDebugPauseThreadOnEachEnqueueWhenSett
EXPECT_EQ(4u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Press enter to start workload")));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Workload ended, press enter to continue")));
mockCSR->userPauseConfirmation->join();
mockCSR->userPauseConfirmation.reset();
}
@ -338,8 +339,8 @@ HWTEST_F(CommandStreamReceiverMtTest, givenDebugPauseThreadOnEachBlitWhenSetting
EXPECT_EQ(4u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Press enter to start workload")));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Workload ended, press enter to continue")));
mockCSR->userPauseConfirmation->join();
mockCSR->userPauseConfirmation.reset();
}
@ -402,8 +403,8 @@ HWTEST_F(CommandStreamReceiverMtTest, givenDebugPauseThreadWhenTerminatingAtSeco
}
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::Not(testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue"))));
EXPECT_TRUE(hasSubstr(output, std::string("Debug break: Press enter to start workload")));
EXPECT_FALSE(hasSubstr(output, std::string("Debug break: Workload ended, press enter to continue")));
EXPECT_EQ(1u, confirmationCounter);
mockCSR->userPauseConfirmation->join();
mockCSR->userPauseConfirmation.reset();