Add interface to allow disabling global AZ Core test environment trace bus suppression (#5594)
* Add interface to allow disabling global AZ Core test environment trace bus suppression Update BaseAssetManagerTest class to disable the suppression by default Update specific asset manager tests that rely on the trace bus suppression to ReEnable it Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Remove nodiscard Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Remove unique_ptr for disable token Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Fix move operator Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Switch to having individual flags for suppression of each type of output Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com> * Add cvar to force stacktrace output. Clean up whitespace Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
@@ -608,24 +608,9 @@ namespace UnitTest
|
||||
AZ::Data::AssetData::AssetStatus expected_base_status = AZ::Data::AssetData::AssetStatus::Ready;
|
||||
EXPECT_EQ(baseStatus, expected_base_status);
|
||||
}
|
||||
|
||||
struct DebugListener : AZ::Interface<IDebugAssetEvent>::Registrar
|
||||
{
|
||||
void AssetStatusUpdate(AZ::Data::AssetId id, AZ::Data::AssetData::AssetStatus status) override
|
||||
{
|
||||
AZ::Debug::Trace::Output(
|
||||
"", AZStd::string::format("Status %s - %d\n", id.ToString<AZStd::string>().c_str(), static_cast<int>(status)).c_str());
|
||||
}
|
||||
void ReleaseAsset(AZ::Data::AssetId id) override
|
||||
{
|
||||
AZ::Debug::Trace::Output(
|
||||
"", AZStd::string::format("Release %s\n", id.ToString<AZStd::string>().c_str()).c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEST_F(AssetJobsFloodTest, RapidAcquireAndRelease)
|
||||
{
|
||||
DebugListener listener;
|
||||
auto assetUuids = {
|
||||
MyAsset1Id,
|
||||
MyAsset2Id,
|
||||
|
||||
@@ -67,7 +67,10 @@ namespace UnitTest
|
||||
{
|
||||
SerializeContextFixture::SetUp();
|
||||
|
||||
SuppressTraceOutput(false);
|
||||
|
||||
AZ::JobManagerDesc jobDesc;
|
||||
|
||||
AZ::JobManagerThreadDesc threadDesc;
|
||||
for (size_t threadCount = 0; threadCount < GetNumJobManagerThreads(); threadCount++)
|
||||
{
|
||||
@@ -111,9 +114,21 @@ namespace UnitTest
|
||||
delete m_jobContext;
|
||||
delete m_jobManager;
|
||||
|
||||
// Reset back to default suppression settings to avoid affecting other tests
|
||||
SuppressTraceOutput(true);
|
||||
|
||||
SerializeContextFixture::TearDown();
|
||||
}
|
||||
|
||||
void BaseAssetManagerTest::SuppressTraceOutput(bool suppress)
|
||||
{
|
||||
UnitTest::TestRunner::Instance().m_suppressAsserts = suppress;
|
||||
UnitTest::TestRunner::Instance().m_suppressErrors = suppress;
|
||||
UnitTest::TestRunner::Instance().m_suppressWarnings = suppress;
|
||||
UnitTest::TestRunner::Instance().m_suppressPrintf = suppress;
|
||||
UnitTest::TestRunner::Instance().m_suppressOutput = suppress;
|
||||
}
|
||||
|
||||
void BaseAssetManagerTest::WriteAssetToDisk(const AZStd::string& assetName, [[maybe_unused]] const AZStd::string& assetIdGuid)
|
||||
{
|
||||
AZStd::string assetFileName = GetTestFolderPath() + assetName;
|
||||
|
||||
@@ -63,6 +63,8 @@ namespace UnitTest
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
static void SuppressTraceOutput(bool suppress);
|
||||
|
||||
// Helper methods to create and destroy actual assets on the disk for true end-to-end asset loading.
|
||||
void WriteAssetToDisk(const AZStd::string& assetName, const AZStd::string& assetIdGuid);
|
||||
void DeleteAssetFromDisk(const AZStd::string& assetName);
|
||||
|
||||
Reference in New Issue
Block a user