mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 10:26:29 +08:00
Do not test global platform.
- change the test to use locally allocated object Change-Id: Ie0818a4791d03d8f9004aba312f58fa0746c608b
This commit is contained in:
committed by
sys_ocldev
parent
8672360766
commit
77ad97d2c5
@@ -33,26 +33,13 @@ extern bool getDevicesResult;
|
|||||||
|
|
||||||
struct PlatformNegativeTest : public ::testing::Test {
|
struct PlatformNegativeTest : public ::testing::Test {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
pPlatform = platform();
|
pPlatform.reset(new Platform());
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform *pPlatform = nullptr;
|
std::unique_ptr<Platform> pPlatform;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(PlatformNegativeTest, GivenPlatformWhenGetDevicesFailedThenFalseIsReturned) {
|
TEST_F(PlatformNegativeTest, GivenPlatformWhenGetDevicesFailedThenFalseIsReturned) {
|
||||||
class PlatformShutdown {
|
|
||||||
public:
|
|
||||||
PlatformShutdown(Platform *pPlatform) : pPlatform(pPlatform) {
|
|
||||||
pPlatform->shutdown();
|
|
||||||
}
|
|
||||||
~PlatformShutdown() {
|
|
||||||
pPlatform->shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Platform *pPlatform = nullptr;
|
|
||||||
} a(pPlatform);
|
|
||||||
|
|
||||||
VariableBackup<decltype(getDevicesResult)> bkp(&getDevicesResult, false);
|
VariableBackup<decltype(getDevicesResult)> bkp(&getDevicesResult, false);
|
||||||
|
|
||||||
auto ret = pPlatform->initialize();
|
auto ret = pPlatform->initialize();
|
||||||
|
|||||||
@@ -34,14 +34,9 @@
|
|||||||
using namespace OCLRT;
|
using namespace OCLRT;
|
||||||
|
|
||||||
struct PlatformTest : public ::testing::Test {
|
struct PlatformTest : public ::testing::Test {
|
||||||
PlatformTest() {}
|
void SetUp() override { pPlatform.reset(new Platform()); }
|
||||||
|
|
||||||
void SetUp() override { pPlatform = platform(); }
|
|
||||||
|
|
||||||
void TearDown() override {}
|
|
||||||
|
|
||||||
cl_int retVal = CL_SUCCESS;
|
cl_int retVal = CL_SUCCESS;
|
||||||
Platform *pPlatform = nullptr;
|
std::unique_ptr<Platform> pPlatform;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(PlatformTest, getDevices) {
|
TEST_F(PlatformTest, getDevices) {
|
||||||
|
|||||||
Reference in New Issue
Block a user