ULT: Rename Drm2 class name to more descriptive DrmMock

Change-Id: Id02b1d2531610854783ac68905c97b78f4a624b9
This commit is contained in:
Zdanowicz, Zbigniew
2018-03-30 09:00:26 +02:00
committed by sys_ocldev
parent de315db953
commit 420bbd3954
8 changed files with 33 additions and 33 deletions

View File

@ -39,7 +39,7 @@ using namespace OCLRT;
struct DeviceFactoryLinuxTest : public ::testing::Test {
void SetUp() override {
pDrm = new Drm2;
pDrm = new DrmMock;
pDrm->setGtType(GTTYPE_GT2);
pushDrmMock(pDrm);
}
@ -49,5 +49,5 @@ struct DeviceFactoryLinuxTest : public ::testing::Test {
delete pDrm;
}
Drm2 *pDrm;
DrmMock *pDrm;
};

View File

@ -36,13 +36,13 @@ using namespace OCLRT;
static const int mockFd = 33;
// Mock DRM class that responds to DRM_IOCTL_I915_GETPARAMs
class Drm2 : public Drm {
class DrmMock : public Drm {
public:
Drm2() : Drm(mockFd) {
DrmMock() : Drm(mockFd) {
sysFsDefaultGpuPathToRestore = nullptr;
}
~Drm2() {
~DrmMock() {
if (sysFsDefaultGpuPathToRestore != nullptr) {
sysFsDefaultGpuPath = sysFsDefaultGpuPathToRestore;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -32,9 +32,9 @@ namespace OCLRT {
static std::vector<Drm *> drmMockStack;
class DrmMockDefault : public Drm2 {
class DrmMockDefault : public DrmMock {
public:
DrmMockDefault() : Drm2() {
DrmMockDefault() : DrmMock() {
StoredRetVal = 0;
StoredRetValForDeviceID = 0;
StoredRetValForEUVal = 0;

View File

@ -34,7 +34,7 @@ using namespace OCLRT;
using namespace std;
TEST(DrmTest, GetDeviceID) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_NE(nullptr, pDrm);
pDrm->StoredDeviceID = 0x1234;
@ -46,7 +46,7 @@ TEST(DrmTest, GetDeviceID) {
}
TEST(DrmTest, GivenConfigFileWithWrongDeviceIDWhenFrequencyIsQueriedThenReturnZero) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_NE(nullptr, pDrm);
pDrm->StoredDeviceID = 0x4321;
@ -60,7 +60,7 @@ TEST(DrmTest, GivenConfigFileWithWrongDeviceIDWhenFrequencyIsQueriedThenReturnZe
}
TEST(DrmTest, GivenConfigFileWithWrongDeviceIDFailIoctlWhenFrequencyIsQueriedThenReturnZero) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_NE(nullptr, pDrm);
pDrm->StoredDeviceID = 0x4321;
@ -78,7 +78,7 @@ TEST(DrmTest, GivenValidConfigFileWhenFrequencyIsQueriedThenValidValueIsReturned
int expectedMaxFrequency = 1000;
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_NE(nullptr, pDrm);
pDrm->StoredDeviceID = 0x1234;
@ -98,7 +98,7 @@ TEST(DrmTest, GivenValidConfigFileWhenFrequencyIsQueriedThenValidValueIsReturned
}
TEST(DrmTest, GivenNoConfigFileWhenFrequencyIsQueriedThenReturnZero) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_NE(nullptr, pDrm);
pDrm->StoredDeviceID = 0x1234;
@ -113,7 +113,7 @@ TEST(DrmTest, GivenNoConfigFileWhenFrequencyIsQueriedThenReturnZero) {
}
TEST(DrmTest, GetRevisionID) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_NE(nullptr, pDrm);
pDrm->StoredDeviceID = 0x1234;
@ -132,7 +132,7 @@ TEST(DrmTest, GetRevisionID) {
}
TEST(DrmTest, GivenMockDrmWhenAskedFor48BitAddressCorrectValueReturned) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
pDrm->StoredPPGTT = 3;
EXPECT_TRUE(pDrm->is48BitAddressRangeSupported());
pDrm->StoredPPGTT = 2;
@ -142,7 +142,7 @@ TEST(DrmTest, GivenMockDrmWhenAskedFor48BitAddressCorrectValueReturned) {
#if defined(I915_PARAM_HAS_PREEMPTION)
TEST(DrmTest, GivenMockDrmWhenAskedForPreemptionCorrectValueReturned) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
pDrm->StoredPreemptionSupport = 1;
EXPECT_TRUE(pDrm->hasPreemption());
pDrm->StoredPreemptionSupport = 0;
@ -151,7 +151,7 @@ TEST(DrmTest, GivenMockDrmWhenAskedForPreemptionCorrectValueReturned) {
}
TEST(DrmTest, GivenMockDrmWhenAskedForContextThatPassedThenValidContextIdsReturned) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_EQ(0u, pDrm->lowPriorityContextId);
pDrm->StoredRetVal = 0;
pDrm->StoredCtxId = 2;
@ -163,7 +163,7 @@ TEST(DrmTest, GivenMockDrmWhenAskedForContextThatPassedThenValidContextIdsReturn
}
TEST(DrmTest, GivenMockDrmWhenAskedForContextThatFailsThenFalseIsReturned) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
pDrm->StoredRetVal = -1;
EXPECT_FALSE(pDrm->contextCreate());
pDrm->StoredRetVal = 0;
@ -171,7 +171,7 @@ TEST(DrmTest, GivenMockDrmWhenAskedForContextThatFailsThenFalseIsReturned) {
}
TEST(DrmTest, GivenMockDrmWhenAskedForContextWithLowPriorityThatFailsThenFalseIsReturned) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_TRUE(pDrm->contextCreate());
pDrm->StoredRetVal = -1;
EXPECT_FALSE(pDrm->setLowPriority());
@ -181,7 +181,7 @@ TEST(DrmTest, GivenMockDrmWhenAskedForContextWithLowPriorityThatFailsThenFalseIs
#endif
TEST(DrmTest, getExecSoftPin) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
int execSoftPin = 0;
int ret = pDrm->getExecSoftPin(execSoftPin);
@ -197,7 +197,7 @@ TEST(DrmTest, getExecSoftPin) {
}
TEST(DrmTest, enableTurboBoost) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
int ret = pDrm->enableTurboBoost();
EXPECT_EQ(0, ret);
@ -206,7 +206,7 @@ TEST(DrmTest, enableTurboBoost) {
}
TEST(DrmTest, getEnabledPooledEu) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
int enabled = 0;
int ret = 0;
@ -239,7 +239,7 @@ TEST(DrmTest, getEnabledPooledEu) {
}
TEST(DrmTest, getMinEuInPool) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
pDrm->StoredMinEUinPool = -1;
int minEUinPool = 0;
@ -272,7 +272,7 @@ TEST(DrmTest, getMinEuInPool) {
}
TEST(DrmTest, givenDrmWhenGetErrnoIsCalledThenErrnoValueIsReturned) {
Drm2 *pDrm = new Drm2;
DrmMock *pDrm = new DrmMock;
EXPECT_NE(nullptr, pDrm);
auto errnoFromDrm = pDrm->getErrno();

View File

@ -70,7 +70,7 @@ void HwInfoConfigTestLinux::SetUp() {
HwInfoConfigTest::SetUp();
osInterface = new OSInterface();
drm = new Drm2();
drm = new DrmMock();
osInterface->get()->setDrm(static_cast<Drm *>(drm));
drm->StoredDeviceID = pOldPlatform->usDeviceID;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -38,7 +38,7 @@ struct HwInfoConfigTestLinux : public HwInfoConfigTest {
OSInterface *osInterface;
Drm2 *drm;
DrmMock *drm;
void (*rt_cpuidex_func)(int *, int, int);
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -95,9 +95,9 @@ void PerformanceCountersFixture::createOsTime() {
osTimeBase = std::unique_ptr<MockOSTimeLinux>(new MockOSTimeLinux(osInterfaceBase.get()));
}
void PerformanceCountersFixture::fillOsInterface() {
osInterfaceBase->get()->setDrm(new Drm2());
osInterfaceBase->get()->setDrm(new DrmMock());
}
void PerformanceCountersFixture::releaseOsInterface() {
delete static_cast<Drm2 *>(osInterfaceBase->get()->getDrm());
delete static_cast<DrmMock *>(osInterfaceBase->get()->getDrm());
}
} // namespace OCLRT

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -35,7 +35,7 @@ struct PerformanceCountersLinuxTest : public PerformanceCountersFixture,
PerformanceCountersFixture::SetUp();
PerfCounterFlagsLinux::resetPerfCountersFlags();
drm = static_cast<Drm2 *>(osInterfaceBase->get()->getDrm());
drm = static_cast<DrmMock *>(osInterfaceBase->get()->getDrm());
osTimeLinux = static_cast<MockOSTimeLinux *>(osTimeBase.get());
}
void TearDown() override {
@ -46,7 +46,7 @@ struct PerformanceCountersLinuxTest : public PerformanceCountersFixture,
performanceCountersLinux = static_cast<MockPerformanceCountersLinux *>(performanceCountersBase.get());
}
Drm2 *drm;
DrmMock *drm;
MockOSTimeLinux *osTimeLinux;
MockPerformanceCountersLinux *performanceCountersLinux;
};