From 5c5694ed73f8a3a097f68d9fa032cbc95a7dca04 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Wed, 13 Sep 2023 00:12:32 +0200 Subject: [PATCH] tests: Simplify test No more caching issues. --- tests/nvapi_d3d12.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/tests/nvapi_d3d12.cpp b/tests/nvapi_d3d12.cpp index 0a04a71b..7e587280 100644 --- a/tests/nvapi_d3d12.cpp +++ b/tests/nvapi_d3d12.cpp @@ -432,23 +432,8 @@ TEST_CASE("D3D12 methods succeed", "[.d3d12]") { } SECTION("Launch CuBIN without ID3D12GraphicsCommandListExt1 returns OK") { - D3D12Vkd3dGraphicsCommandListMock commandList0; - ALLOW_CALL(commandList0, QueryInterface(__uuidof(ID3D12GraphicsCommandList1), _)) - .LR_SIDE_EFFECT(*_2 = static_cast(&commandList0)) - .LR_SIDE_EFFECT(commandListRefCount++) - .RETURN(S_OK); - ALLOW_CALL(commandList0, QueryInterface(ID3D12GraphicsCommandListExt::guid, _)) - .LR_SIDE_EFFECT(*_2 = static_cast(&commandList0)) - .LR_SIDE_EFFECT(commandListRefCount++) - .RETURN(S_OK); - ALLOW_CALL(commandList0, QueryInterface(ID3D12GraphicsCommandListExt1::guid, _)) + ALLOW_CALL(commandList, QueryInterface(ID3D12GraphicsCommandListExt1::guid, _)) .RETURN(E_NOINTERFACE); - ALLOW_CALL(commandList0, AddRef()) - .LR_SIDE_EFFECT(commandListRefCount++) - .RETURN(commandListRefCount); - ALLOW_CALL(commandList0, Release()) - .LR_SIDE_EFFECT(commandListRefCount--) - .RETURN(commandListRefCount); auto shaderHandle = reinterpret_cast(0xbadcf00d); auto blockX = 1U; @@ -456,13 +441,12 @@ TEST_CASE("D3D12 methods succeed", "[.d3d12]") { auto blockZ = 3U; const void* params = nullptr; auto paramSize = 4U; - - REQUIRE_CALL(commandList0, LaunchCubinShader(shaderHandle, blockX, blockY, blockZ, params, paramSize)) + REQUIRE_CALL(commandList, LaunchCubinShader(shaderHandle, blockX, blockY, blockZ, params, paramSize)) .RETURN(S_OK) .TIMES(1); - FORBID_CALL(commandList0, LaunchCubinShaderEx(_, _, _, _, _, _, _, _, _)); + FORBID_CALL(commandList, LaunchCubinShaderEx(_, _, _, _, _, _, _, _, _)); - REQUIRE(NvAPI_D3D12_LaunchCubinShader(static_cast(&commandList0), reinterpret_cast(shaderHandle), blockX, blockY, blockZ, params, paramSize) == NVAPI_OK); + REQUIRE(NvAPI_D3D12_LaunchCubinShader(static_cast(&commandList), reinterpret_cast(shaderHandle), blockX, blockY, blockZ, params, paramSize) == NVAPI_OK); REQUIRE(deviceRefCount == 0); REQUIRE(commandListRefCount == 0); }