Disable weak references and unit tests for them.

This commit is contained in:
amzn-mike
2021-04-22 15:02:41 -05:00
parent 3907ffc173
commit 35a47932eb
3 changed files with 24 additions and 11 deletions
@@ -141,13 +141,17 @@ namespace AZ::Data::AssetInternal
if (assetData)
{
assetData->AcquireWeak();
// This should be AcquireWeak but we're using strong references for now to disable asset cancellation
// until it is more stable
assetData->Acquire();
m_assetId = assetData->GetId();
}
if (m_assetData)
{
m_assetData->ReleaseWeak();
// This should be ReleaseWeak but we're using strong references for now to disable asset cancellation
// until it is more stable
m_assetData->Release();
}
m_assetData = assetData;
@@ -186,7 +186,8 @@ namespace UnitTest
int GetWeakUseCount() { return m_weakUseCount.load(); }
};
TEST_F(WeakAssetTest, WeakAsset_ConstructionAndDestruction_UpdatesAssetDataWeakRefCount)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(WeakAssetTest, DISABLED_WeakAsset_ConstructionAndDestruction_UpdatesAssetDataWeakRefCount)
{
TestAssetData testData;
EXPECT_EQ(testData.GetWeakUseCount(), 0);
@@ -202,7 +203,8 @@ namespace UnitTest
EXPECT_EQ(testData.GetWeakUseCount(), 0);
}
TEST_F(WeakAssetTest, WeakAsset_MoveOperatorWithDifferentData_UpdatesOldAssetDataWeakRefCount)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(WeakAssetTest, DISABLED_WeakAsset_MoveOperatorWithDifferentData_UpdatesOldAssetDataWeakRefCount)
{
TestAssetData testData;
EXPECT_EQ(testData.GetWeakUseCount(), 0);
@@ -217,7 +219,8 @@ namespace UnitTest
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
}
TEST_F(WeakAssetTest, WeakAsset_MoveOperatorWithSameData_PreservesAssetDataWeakRefCount)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(WeakAssetTest, DISABLED_WeakAsset_MoveOperatorWithSameData_PreservesAssetDataWeakRefCount)
{
TestAssetData testData;
EXPECT_EQ(testData.GetWeakUseCount(), 0);
@@ -234,7 +237,8 @@ namespace UnitTest
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
}
TEST_F(WeakAssetTest, WeakAsset_AssignmentOperator_CopiesDataAndIncrementsWeakRefCount)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(WeakAssetTest, DISABLED_WeakAsset_AssignmentOperator_CopiesDataAndIncrementsWeakRefCount)
{
TestAssetData testData;
EXPECT_EQ(testData.GetWeakUseCount(), 0);
@@ -2677,7 +2677,8 @@ namespace UnitTest
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
TEST_F(AssetManagerCancelTests, DISABLED_CancelLoad_NoReferences_LoadCancels)
#else
TEST_F(AssetManagerCancelTests, CancelLoad_NoReferences_LoadCancels)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(AssetManagerCancelTests, DISABLED_CancelLoad_NoReferences_LoadCancels)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
{
m_assetHandlerAndCatalog->SetArtificialDelayMilliseconds(0, 100);
@@ -2717,7 +2718,8 @@ namespace UnitTest
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
TEST_F(AssetManagerCancelTests, DISABLED_CanceledLoad_CanBeLoadedAgainLater)
#else
TEST_F(AssetManagerCancelTests, CanceledLoad_CanBeLoadedAgainLater)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(AssetManagerCancelTests, DISABLED_CanceledLoad_CanBeLoadedAgainLater)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
{
m_assetHandlerAndCatalog->SetArtificialDelayMilliseconds(0, 50);
@@ -2766,7 +2768,8 @@ namespace UnitTest
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
TEST_F(AssetManagerCancelTests, DISABLED_CancelLoad_InProgressLoad_Continues)
#else
TEST_F(AssetManagerCancelTests, CancelLoad_InProgressLoad_Continues)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(AssetManagerCancelTests, DISABLED_CancelLoad_InProgressLoad_Continues)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
{
m_assetHandlerAndCatalog->SetArtificialDelayMilliseconds(0, 100);
@@ -2988,8 +2991,9 @@ namespace UnitTest
TEST_F(AssetManagerClearAssetReferenceTests,
DISABLED_ContainerLoadTest_AssetLosesAndGainsReferencesDuringLoadAndSuspendedRelease_AssetSuccessfullyFinishesLoading)
#else
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(AssetManagerClearAssetReferenceTests,
ContainerLoadTest_AssetLosesAndGainsReferencesDuringLoadAndSuspendedRelease_AssetSuccessfullyFinishesLoading)
DISABLED_ContainerLoadTest_AssetLosesAndGainsReferencesDuringLoadAndSuspendedRelease_AssetSuccessfullyFinishesLoading)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
{
// Start the load and wait for the dependent asset to hit the loading state.
@@ -3046,7 +3050,8 @@ namespace UnitTest
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
TEST_F(AssetManagerClearAssetReferenceTests, DISABLED_ContainerLoadTest_RootAssetDestroyedWhileContainerLoading_ContainerFinishesLoad)
#else
TEST_F(AssetManagerClearAssetReferenceTests, ContainerLoadTest_RootAssetDestroyedWhileContainerLoading_ContainerFinishesLoad)
// Asset cancellation is temporarily disabled, re-enable this test when cancellation is more stable
TEST_F(AssetManagerClearAssetReferenceTests, DISABLED_ContainerLoadTest_RootAssetDestroyedWhileContainerLoading_ContainerFinishesLoad)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS
{
OnAssetReadyListener assetStatus1(DependentPreloadAssetId, azrtti_typeid<AssetWithAssetReference>());