From 95c290831e8cc2eb4a36bc52bffb124da8ff352d Mon Sep 17 00:00:00 2001 From: "Bernhart, Bryan" Date: Wed, 22 Feb 2023 16:17:46 -0800 Subject: [PATCH] Fix dump test option writing out garbage trace file. --- src/tests/D3D12Test.cpp | 18 +++++++++--------- src/tests/D3D12Test.h | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tests/D3D12Test.cpp b/src/tests/D3D12Test.cpp index 03585e504..8ec102ec4 100644 --- a/src/tests/D3D12Test.cpp +++ b/src/tests/D3D12Test.cpp @@ -112,6 +112,14 @@ namespace gpgmm::d3d12 { << GPGMM_BYTES_TO_GB(mCaps->GetMaxResourceHeapSize()) << " GBs"; DebugLog() << "Creation of non-resident heaps: " << ((mCaps->IsCreateHeapNotResidentSupported()) ? "Supported" : "Not supported"); + + // Format the output trace file as .. + const testing::TestInfo* const testInfoPtr = + ::testing::UnitTest::GetInstance()->current_test_info(); + ASSERT_TRUE(testInfoPtr != nullptr); + + mTraceFile = std::string(std::string(testInfoPtr->test_suite_name()) + "_" + + std::string(testInfoPtr->name()) + ".json"); } void D3D12TestBase::TearDown() { @@ -132,15 +140,7 @@ namespace gpgmm::d3d12 { desc.RecordOptions.Flags |= EventRecordFlags::kAll; desc.MinRecordLevel = desc.MinLogLevel; desc.RecordOptions.UseDetailedTimingEvents = true; - - // Format the output trace file as .. - const testing::TestInfo* const testInfoPtr = - ::testing::UnitTest::GetInstance()->current_test_info(); - ASSERT(testInfoPtr != nullptr); - desc.RecordOptions.TraceFile = - std::string(std::string(testInfoPtr->test_suite_name()) + "_" + - std::string(testInfoPtr->name()) + ".json") - .c_str(); + desc.RecordOptions.TraceFile = mTraceFile.c_str(); } return desc; diff --git a/src/tests/D3D12Test.h b/src/tests/D3D12Test.h index c04aedb7a..e3751dad4 100644 --- a/src/tests/D3D12Test.h +++ b/src/tests/D3D12Test.h @@ -17,6 +17,7 @@ #include "tests/GPGMMTest.h" +#include #include #include @@ -72,6 +73,7 @@ namespace gpgmm::d3d12 { ComPtr mAdapter; ComPtr mDevice; std::unique_ptr mCaps; + std::string mTraceFile; }; } // namespace gpgmm::d3d12