Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jp7677/dxvk-nvapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Peters <jp7677@gmail.com>2021-10-15 17:30:58 +0300
committerJens Peters <jp7677@gmail.com>2021-10-15 19:13:41 +0300
commita6225dca2238dd9b1f027f9d6c57cd1059224278 (patch)
tree233a0eb4baab4b5b8d63d0ee765086daeef9c3c1
parent3ef46c384f363b7946dabdb68ecac26b8eece13b (diff)
tests: Add tests for sub-system ID
-rw-r--r--tests/nvapi_sysinfo.cpp21
-rw-r--r--tests/nvapi_sysinfo_mocks.cpp1
-rw-r--r--tests/nvapi_system.cpp8
3 files changed, 26 insertions, 4 deletions
diff --git a/tests/nvapi_sysinfo.cpp b/tests/nvapi_sysinfo.cpp
index f2db1c1..b8dd6a1 100644
--- a/tests/nvapi_sysinfo.cpp
+++ b/tests/nvapi_sysinfo.cpp
@@ -636,9 +636,26 @@ TEST_CASE("Sysinfo methods succeed", "[.sysinfo]") {
ALLOW_CALL(*nvml, DeviceGetHandleByPciBusId_v2(_, _))
.RETURN(NVML_SUCCESS);
+ SECTION("GetPCIIdentifiers returns OK and has sub-system ID when NVML is available") {
+ auto id = 0x88161043;
+ ALLOW_CALL(*nvml, DeviceGetPciInfo_v3(_, _)) // NOLINT(bugprone-use-after-move)
+ .LR_SIDE_EFFECT(_2->pciSubSystemId = id)
+ .RETURN(NVML_SUCCESS);
+
+ SetupResourceFactory(std::move(dxgiFactory), std::move(vulkan), std::move(nvml));
+ REQUIRE(NvAPI_Initialize() == NVAPI_OK);
+
+ NvPhysicalGpuHandle handle;
+ REQUIRE(NvAPI_SYS_GetPhysicalGpuFromDisplayId(0, &handle) == NVAPI_OK);
+
+ NvU32 deviceId, subSystemId, revisionId, extDeviceId;
+ REQUIRE(NvAPI_GPU_GetPCIIdentifiers(handle, &deviceId, &subSystemId, &revisionId, &extDeviceId) == NVAPI_OK);
+ REQUIRE(subSystemId == id);
+ }
+
SECTION("GetVbiosVersionString returns OK") {
auto version = "12.34";
- ALLOW_CALL(*nvml, DeviceGetVbiosVersion(_, _, _))
+ ALLOW_CALL(*nvml, DeviceGetVbiosVersion(_, _, _)) // NOLINT(bugprone-use-after-move)
.LR_SIDE_EFFECT(strcpy(_2, version))
.RETURN(NVML_SUCCESS);
@@ -826,7 +843,7 @@ TEST_CASE("GetHdrCapabilities returns OK", "[.sysinfo]") {
REQUIRE(capabilities.isDolbyVisionSupported == false);
}
-TEST_CASE("GetDisplayViewportsByResolution returns mosaic-ot-active", "[.sysinfo]") {
+TEST_CASE("GetDisplayViewportsByResolution returns mosaic-not-active", "[.sysinfo]") {
NvU8 corrected;
NV_RECT rect[NV_MOSAIC_MAX_DISPLAYS];
REQUIRE(NvAPI_Mosaic_GetDisplayViewportsByResolution(0, 0, 0, rect, &corrected) == NVAPI_MOSAIC_NOT_ACTIVE);
diff --git a/tests/nvapi_sysinfo_mocks.cpp b/tests/nvapi_sysinfo_mocks.cpp
index 63beb12..9f86a34 100644
--- a/tests/nvapi_sysinfo_mocks.cpp
+++ b/tests/nvapi_sysinfo_mocks.cpp
@@ -66,6 +66,7 @@ class NvmlMock : public mock_interface<Nvml> {
IMPLEMENT_CONST_MOCK0(IsAvailable);
IMPLEMENT_CONST_MOCK1(ErrorString);
IMPLEMENT_CONST_MOCK2(DeviceGetHandleByPciBusId_v2);
+ IMPLEMENT_CONST_MOCK2(DeviceGetPciInfo_v3);
IMPLEMENT_CONST_MOCK3(DeviceGetTemperature);
IMPLEMENT_CONST_MOCK2(DeviceGetUtilizationRates);
IMPLEMENT_CONST_MOCK3(DeviceGetVbiosVersion);
diff --git a/tests/nvapi_system.cpp b/tests/nvapi_system.cpp
index 6a778bc..9e6c509 100644
--- a/tests/nvapi_system.cpp
+++ b/tests/nvapi_system.cpp
@@ -128,6 +128,10 @@ TEST_CASE("Sysinfo methods succeed against local system", "[system]") {
NvU32 deviceId, subSystemId, revisionId, extDeviceId;
REQUIRE(nvAPI_GPU_GetPCIIdentifiers(handle, &deviceId, &subSystemId, &revisionId, &extDeviceId) == NVAPI_OK);
std::cout << " Device ID: 0x" << std::setfill('0') << std::setw(8) << std::hex << deviceId << std::endl;
+ std::cout << " Subsystem ID: ";
+ subSystemId != 0
+ ? std::cout << "0x" << std::setfill('0') << std::setw(8) << std::hex << subSystemId << std::endl
+ : std::cout << "N/A" << std::endl;
NvAPI_ShortString fullName;
REQUIRE(nvAPI_GPU_GetFullName(handle, fullName) == NVAPI_OK);
@@ -145,8 +149,8 @@ TEST_CASE("Sysinfo methods succeed against local system", "[system]") {
result = nvAPI_GPU_GetAdapterIdFromPhysicalGpu(handle, static_cast<void*>(&luid));
std::cout << " LUID high part: ";
result == NVAPI_OK
- ? std::cout << "0x" << std::setfill('0') << std::setw(8) << std::hex << luid.HighPart << std::endl
- : std::cout << "N/A" << std::endl;
+ ? std::cout << "0x" << std::setfill('0') << std::setw(8) << std::hex << luid.HighPart << std::endl
+ : std::cout << "N/A" << std::endl;
std::cout << " LUID low part: ";
result == NVAPI_OK