From 115f18fcdc54753dfae542bcd0d79c5cf0a10a66 Mon Sep 17 00:00:00 2001 From: amzn-sj Date: Mon, 24 May 2021 12:24:46 -0700 Subject: [PATCH] Fix Linux test failures --- Code/Framework/Tests/AssetCatalog.cpp | 7 ++++++ Code/Framework/Tests/BehaviorEntityTests.cpp | 7 ++++++ Code/Framework/Tests/ComponentAddRemove.cpp | 7 ++++++ Code/Framework/Tests/FileFunc.cpp | 7 ++++++ Code/Framework/Tests/FileTagTests.cpp | 8 ++++++ .../Tests/GenericComponentWrapperTest.cpp | 13 ++++++++++ Code/Framework/Tests/Slices.cpp | 7 ++++++ .../tests/applicationManagerTests.cpp | 6 +++++ Code/Tools/AssetBundler/tests/tests_main.cpp | 25 ++++++++++++------- .../platformconfigurationtests.cpp | 5 ++++ .../Tools/DeltaCataloger/Tests/tests_main.cpp | 7 ++++++ .../Code/Tests/Builders/LevelBuilderTest.cpp | 7 ++++++ .../Code/Tests/Builders/LuaBuilderTests.cpp | 7 ++++++ .../Tests/Builders/MaterialBuilderTests.cpp | 7 ++++++ .../Code/Tests/Builders/SeedBuilderTests.cpp | 7 ++++++ .../SceneBuilder/SceneBuilderPhasesTests.cpp | 7 ++++++ .../Tests/SceneBuilder/SceneBuilderTests.cpp | 7 ++++++ 17 files changed, 132 insertions(+), 9 deletions(-) diff --git a/Code/Framework/Tests/AssetCatalog.cpp b/Code/Framework/Tests/AssetCatalog.cpp index 8a89ba349c..42df712713 100644 --- a/Code/Framework/Tests/AssetCatalog.cpp +++ b/Code/Framework/Tests/AssetCatalog.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -301,6 +302,12 @@ namespace UnitTest { AZ::AllocatorInstance::Create(); + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.reset(aznew AzFramework::Application()); AZ::ComponentApplication::Descriptor desc; desc.m_useExistingAllocator = true; diff --git a/Code/Framework/Tests/BehaviorEntityTests.cpp b/Code/Framework/Tests/BehaviorEntityTests.cpp index 5a4116a23b..398d472d6b 100644 --- a/Code/Framework/Tests/BehaviorEntityTests.cpp +++ b/Code/Framework/Tests/BehaviorEntityTests.cpp @@ -12,6 +12,7 @@ #include "FrameworkApplicationFixture.h" #include +#include #include #include @@ -88,6 +89,12 @@ class BehaviorEntityTest protected: void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_appDescriptor.m_enableScriptReflection = true; FrameworkApplicationFixture::SetUp(); diff --git a/Code/Framework/Tests/ComponentAddRemove.cpp b/Code/Framework/Tests/ComponentAddRemove.cpp index 4fd6db7dde..f635a5ee3b 100644 --- a/Code/Framework/Tests/ComponentAddRemove.cpp +++ b/Code/Framework/Tests/ComponentAddRemove.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -572,6 +573,12 @@ namespace UnitTest { AllocatorsTestFixture::SetUp(); + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + AzFramework::Application::Descriptor descriptor; descriptor.m_enableDrilling = false; m_app.Start(descriptor); diff --git a/Code/Framework/Tests/FileFunc.cpp b/Code/Framework/Tests/FileFunc.cpp index d703164582..8db77fd79b 100644 --- a/Code/Framework/Tests/FileFunc.cpp +++ b/Code/Framework/Tests/FileFunc.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -278,6 +279,12 @@ namespace UnitTest { FrameworkApplicationFixture::SetUp(); + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_serializeContext = AZStd::make_unique(); m_jsonRegistrationContext = AZStd::make_unique(); m_jsonSystemComponent = AZStd::make_unique(); diff --git a/Code/Framework/Tests/FileTagTests.cpp b/Code/Framework/Tests/FileTagTests.cpp index 989c811111..d17601ed1c 100644 --- a/Code/Framework/Tests/FileTagTests.cpp +++ b/Code/Framework/Tests/FileTagTests.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,13 @@ namespace UnitTest void SetUp() override { AllocatorsFixture::SetUp(); + + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_data = AZStd::make_unique(); using namespace AzFramework::FileTag; AZ::ComponentApplication::Descriptor desc; diff --git a/Code/Framework/Tests/GenericComponentWrapperTest.cpp b/Code/Framework/Tests/GenericComponentWrapperTest.cpp index b3dac90777..25af10b339 100644 --- a/Code/Framework/Tests/GenericComponentWrapperTest.cpp +++ b/Code/Framework/Tests/GenericComponentWrapperTest.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,12 @@ class WrappedEditorComponentTest protected: void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(AZ::ComponentApplication::Descriptor()); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is @@ -178,6 +185,12 @@ class FindWrappedComponentsTest public: void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(AzFramework::Application::Descriptor()); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is diff --git a/Code/Framework/Tests/Slices.cpp b/Code/Framework/Tests/Slices.cpp index 6a9ce858c0..8a20c43fb5 100644 --- a/Code/Framework/Tests/Slices.cpp +++ b/Code/Framework/Tests/Slices.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -1059,6 +1060,12 @@ namespace UnitTest void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(AzFramework::Application::Descriptor()); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is diff --git a/Code/Tools/AssetBundler/tests/applicationManagerTests.cpp b/Code/Tools/AssetBundler/tests/applicationManagerTests.cpp index 4156a6790d..56d0ef615f 100644 --- a/Code/Tools/AssetBundler/tests/applicationManagerTests.cpp +++ b/Code/Tools/AssetBundler/tests/applicationManagerTests.cpp @@ -57,6 +57,12 @@ namespace AssetBundler UnitTest::ScopedAllocatorSetupFixture::SetUp(); m_data = AZStd::make_unique(); + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_data->m_applicationManager.reset(aznew MockApplicationManagerTest(0, 0)); m_data->m_applicationManager->Start(AzFramework::Application::Descriptor()); diff --git a/Code/Tools/AssetBundler/tests/tests_main.cpp b/Code/Tools/AssetBundler/tests/tests_main.cpp index 5f68e7870b..c530e681da 100644 --- a/Code/Tools/AssetBundler/tests/tests_main.cpp +++ b/Code/Tools/AssetBundler/tests/tests_main.cpp @@ -98,6 +98,22 @@ namespace AssetBundler public: void SetUp() override { + AZ::SettingsRegistryInterface* registry = nullptr; + if (!AZ::SettingsRegistry::Get()) + { + AZ::SettingsRegistry::Register(&m_registry); + registry = &m_registry; + + } + else + { + registry = AZ::SettingsRegistry::Get(); + } + auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_data = AZStd::make_unique(); m_data->m_application.reset(aznew AzToolsFramework::ToolsApplication()); m_data->m_application.get()->Start(AzFramework::Application::Descriptor()); @@ -107,15 +123,6 @@ namespace AssetBundler // in the unit tests. AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize); - if (!AZ::SettingsRegistry::Get()) - { - AZ::SettingsRegistry::Register(&m_registry); - auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) - + "/project_path"; - m_registry.Set(projectPathKey, "AutomatedTesting"); - AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(m_registry); - } - AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath(); if (engineRoot.empty()) { diff --git a/Code/Tools/AssetProcessor/native/tests/platformconfiguration/platformconfigurationtests.cpp b/Code/Tools/AssetProcessor/native/tests/platformconfiguration/platformconfigurationtests.cpp index 31e4996b1e..ceec6a7c36 100644 --- a/Code/Tools/AssetProcessor/native/tests/platformconfiguration/platformconfigurationtests.cpp +++ b/Code/Tools/AssetProcessor/native/tests/platformconfiguration/platformconfigurationtests.cpp @@ -40,6 +40,11 @@ void PlatformConfigurationUnitTests::SetUp() AssetProcessorTest::SetUp(); AssetUtilities::ResetAssetRoot(); + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); } void PlatformConfigurationUnitTests::TearDown() diff --git a/Code/Tools/DeltaCataloger/Tests/tests_main.cpp b/Code/Tools/DeltaCataloger/Tests/tests_main.cpp index 67d6767a17..887889edcb 100644 --- a/Code/Tools/DeltaCataloger/Tests/tests_main.cpp +++ b/Code/Tools/DeltaCataloger/Tests/tests_main.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,12 @@ public: protected: void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + AZ::ComponentApplication::Descriptor desc; desc.m_useExistingAllocator = true; desc.m_enableDrilling = false; // we already created a memory driller for the test (AllocatorsFixture) diff --git a/Gems/LmbrCentral/Code/Tests/Builders/LevelBuilderTest.cpp b/Gems/LmbrCentral/Code/Tests/Builders/LevelBuilderTest.cpp index 58e7e9e093..470a2abff6 100644 --- a/Gems/LmbrCentral/Code/Tests/Builders/LevelBuilderTest.cpp +++ b/Gems/LmbrCentral/Code/Tests/Builders/LevelBuilderTest.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -98,6 +99,12 @@ class LevelBuilderTest protected: void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(m_descriptor); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash diff --git a/Gems/LmbrCentral/Code/Tests/Builders/LuaBuilderTests.cpp b/Gems/LmbrCentral/Code/Tests/Builders/LuaBuilderTests.cpp index b8911738f7..99213484fc 100644 --- a/Gems/LmbrCentral/Code/Tests/Builders/LuaBuilderTests.cpp +++ b/Gems/LmbrCentral/Code/Tests/Builders/LuaBuilderTests.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,12 @@ namespace UnitTest { void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(m_descriptor); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is // shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash diff --git a/Gems/LmbrCentral/Code/Tests/Builders/MaterialBuilderTests.cpp b/Gems/LmbrCentral/Code/Tests/Builders/MaterialBuilderTests.cpp index 8aae0c4790..0868a7f147 100644 --- a/Gems/LmbrCentral/Code/Tests/Builders/MaterialBuilderTests.cpp +++ b/Gems/LmbrCentral/Code/Tests/Builders/MaterialBuilderTests.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,12 @@ protected: { UnitTest::AllocatorsTestFixture::SetUp(); + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.reset(aznew AzToolsFramework::ToolsApplication); m_app->Start(AZ::ComponentApplication::Descriptor()); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is diff --git a/Gems/LmbrCentral/Code/Tests/Builders/SeedBuilderTests.cpp b/Gems/LmbrCentral/Code/Tests/Builders/SeedBuilderTests.cpp index 20dd3db446..49fc06c160 100644 --- a/Gems/LmbrCentral/Code/Tests/Builders/SeedBuilderTests.cpp +++ b/Gems/LmbrCentral/Code/Tests/Builders/SeedBuilderTests.cpp @@ -12,6 +12,7 @@ #include "LmbrCentral_precompiled.h" #include +#include #include #include #include @@ -22,6 +23,12 @@ class SeedBuilderTests { void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(AZ::ComponentApplication::Descriptor()); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is diff --git a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderPhasesTests.cpp b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderPhasesTests.cpp index 5f96353996..2a89911fda 100644 --- a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderPhasesTests.cpp +++ b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderPhasesTests.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -139,6 +140,12 @@ class SceneBuilderPhasesFixture public: void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(AZ::ComponentApplication::Descriptor()); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is diff --git a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp index 66fd717508..2287077c89 100644 --- a/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp +++ b/Gems/SceneProcessing/Code/Tests/SceneBuilder/SceneBuilderTests.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -30,6 +31,12 @@ class SceneBuilderTests protected: void SetUp() override { + AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get(); + auto projectPathKey = + AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path"; + registry->Set(projectPathKey, "AutomatedTesting"); + AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry); + m_app.Start(AZ::ComponentApplication::Descriptor()); AZ::Debug::TraceMessageBus::Handler::BusConnect(); // Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is