mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Unify device id tests
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
4dde9393ad
commit
8c93004937
@ -5,15 +5,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include <array>
|
||||
#include "shared/test/common/fixtures/linux/device_id_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(BdwDeviceIdTest, GivenSupportedDeviceIdThenHardwareInfoIsCorrect) {
|
||||
TEST_F(DeviceIdTests, GivenBdwSupportedDeviceIdThenHardwareInfoIsCorrect) {
|
||||
std::array<DeviceDescriptor, 16> expectedDescriptors = {{
|
||||
{0x1602, &BDW_1x2x6::hwInfo, &BDW_1x2x6::setupHardwareInfo, GTTYPE_GT1},
|
||||
{0x160A, &BDW_1x2x6::hwInfo, &BDW_1x2x6::setupHardwareInfo, GTTYPE_GT1},
|
||||
@ -35,20 +31,5 @@ TEST(BdwDeviceIdTest, GivenSupportedDeviceIdThenHardwareInfoIsCorrect) {
|
||||
{0x162D, &BDW_2x3x8::hwInfo, &BDW_2x3x8::setupHardwareInfo, GTTYPE_GT3},
|
||||
}};
|
||||
|
||||
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
|
||||
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
|
||||
first->setupHardwareInfo == second->setupHardwareInfo && first->eGtType == second->eGtType;
|
||||
};
|
||||
|
||||
size_t startIndex = 0;
|
||||
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
|
||||
deviceDescriptorTable[startIndex].deviceId != 0) {
|
||||
startIndex++;
|
||||
};
|
||||
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
|
||||
|
||||
for (auto &expected : expectedDescriptors) {
|
||||
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
|
||||
startIndex++;
|
||||
}
|
||||
testImpl(expectedDescriptors);
|
||||
}
|
||||
|
Reference in New Issue
Block a user