mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +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 {
|
||||
void SetUp() override {
|
||||
pPlatform = platform();
|
||||
pPlatform.reset(new Platform());
|
||||
}
|
||||
|
||||
Platform *pPlatform = nullptr;
|
||||
std::unique_ptr<Platform> pPlatform;
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
auto ret = pPlatform->initialize();
|
||||
|
@ -34,14 +34,9 @@
|
||||
using namespace OCLRT;
|
||||
|
||||
struct PlatformTest : public ::testing::Test {
|
||||
PlatformTest() {}
|
||||
|
||||
void SetUp() override { pPlatform = platform(); }
|
||||
|
||||
void TearDown() override {}
|
||||
|
||||
void SetUp() override { pPlatform.reset(new Platform()); }
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
Platform *pPlatform = nullptr;
|
||||
std::unique_ptr<Platform> pPlatform;
|
||||
};
|
||||
|
||||
TEST_F(PlatformTest, getDevices) {
|
||||
|
Reference in New Issue
Block a user