mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Extract querying device id and revision to a dedicated method
Related-To: NEO-6999 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
39c1c4d530
commit
4d6169ee8b
@ -38,7 +38,7 @@ class DrmNullDeviceTestsFixture {
|
||||
void TearDown() { // NOLINT(readability-identifier-naming)
|
||||
}
|
||||
|
||||
std::unique_ptr<Drm> drmNullDevice;
|
||||
std::unique_ptr<DrmWrap> drmNullDevice;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
protected:
|
||||
@ -48,10 +48,10 @@ class DrmNullDeviceTestsFixture {
|
||||
typedef Test<DrmNullDeviceTestsFixture> DrmNullDeviceTests;
|
||||
|
||||
TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENcallGetDeviceIdTHENreturnProperDeviceId) {
|
||||
int deviceIdQueried = 0;
|
||||
int ret = drmNullDevice->getDeviceID(deviceIdQueried);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(deviceId, deviceIdQueried);
|
||||
int ret = drmNullDevice->queryDeviceIdAndRevision();
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_EQ(deviceId, drmNullDevice->deviceId);
|
||||
EXPECT_EQ(revisionId, drmNullDevice->revisionId);
|
||||
}
|
||||
|
||||
TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENcallIoctlTHENalwaysSuccess) {
|
||||
|
@ -14,13 +14,18 @@
|
||||
|
||||
class DrmWrap : public NEO::Drm {
|
||||
public:
|
||||
using Drm::deviceId;
|
||||
using Drm::ioctlStatistics;
|
||||
using Drm::queryDeviceIdAndRevision;
|
||||
using Drm::revisionId;
|
||||
using Drm::virtualMemoryIds;
|
||||
|
||||
static std::unique_ptr<NEO::Drm> createDrm(RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
static std::unique_ptr<DrmWrap> createDrm(RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
auto hwDeviceIds = OSInterface::discoverDevices(rootDeviceEnvironment.executionEnvironment);
|
||||
if (!hwDeviceIds.empty()) {
|
||||
return std::unique_ptr<Drm>{NEO::Drm::create(std::unique_ptr<HwDeviceIdDrm>(hwDeviceIds[0].release()->as<HwDeviceIdDrm>()), rootDeviceEnvironment)};
|
||||
return std::unique_ptr<DrmWrap>{static_cast<DrmWrap *>(NEO::Drm::create(std::unique_ptr<HwDeviceIdDrm>(hwDeviceIds[0].release()->as<HwDeviceIdDrm>()), rootDeviceEnvironment))};
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(DrmWrap) == sizeof(NEO::Drm));
|
||||
|
@ -254,16 +254,12 @@ TEST_F(DrmFailedIoctlTests, givenPrintIoctlEntriesWhenCallFailedIoctlThenExpecte
|
||||
}
|
||||
|
||||
TEST_F(DrmSimpleTests, givenPrintIoctlTimesWhenCallIoctlThenStatisticsAreGathered) {
|
||||
struct DrmMock : public Drm {
|
||||
using Drm::ioctlStatistics;
|
||||
};
|
||||
|
||||
constexpr long long initialMin = std::numeric_limits<long long>::max();
|
||||
constexpr long long initialMax = std::numeric_limits<long long>::min();
|
||||
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
auto drm = static_cast<DrmMock *>(DrmWrap::createDrm(*executionEnvironment->rootDeviceEnvironments[0]).release());
|
||||
auto drm = DrmWrap::createDrm(*executionEnvironment->rootDeviceEnvironments[0]).release();
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.PrintIoctlTimes.set(true);
|
||||
|
Reference in New Issue
Block a user