Fix segfault in failing tests on Linux

main
amzn-sj 5 years ago
parent 86932f95d6
commit 090b770d7e

@ -89,15 +89,15 @@ class BehaviorEntityTest
protected:
void SetUp() override
{
m_appDescriptor.m_enableScriptReflection = true;
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_appDescriptor.m_enableScriptReflection = true;
FrameworkApplicationFixture::SetUp();
m_application->RegisterComponentDescriptor(HatComponent::CreateDescriptor());
m_application->RegisterComponentDescriptor(EarComponent::CreateDescriptor());
m_application->RegisterComponentDescriptor(DeactivateDuringActivationComponent::CreateDescriptor());

@ -17,6 +17,7 @@
#include <AzToolsFramework/Application/ToolsApplication.h>
#include <AzToolsFramework/Asset/AssetBundler.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UserSettings/UserSettingsComponent.h>
@ -57,12 +58,22 @@ namespace AssetBundler
UnitTest::ScopedAllocatorSetupFixture::SetUp();
m_data = AZStd::make_unique<StaticData>();
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
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->m_applicationManager.reset(aznew MockApplicationManagerTest(0, 0));
m_data->m_applicationManager->Start(AzFramework::Application::Descriptor());
@ -105,6 +116,7 @@ namespace AssetBundler
};
AZStd::unique_ptr<StaticData> m_data;
AZ::SettingsRegistryImpl m_registry;
};
TEST_F(ApplicationManagerTest, ValidatePlatformFlags_ReadConfigFiles_OK)

@ -35,12 +35,21 @@ PlatformConfigurationUnitTests::PlatformConfigurationUnitTests()
void PlatformConfigurationUnitTests::SetUp()
{
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
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);
using namespace AssetProcessor;
m_qApp = new QCoreApplication(m_argc, m_argv);
AssetProcessorTest::SetUp();

@ -13,6 +13,7 @@
#pragma once
#include <AzTest/AzTest.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <QCoreApplication>
#include "native/tests/AssetProcessorTest.h"
#include "native/unittests/UnitTestRunner.h"
@ -37,6 +38,6 @@ private:
int m_argc;
char** m_argv;
QCoreApplication* m_qApp;
AZ::SettingsRegistryImpl m_registry;
};

@ -16,6 +16,7 @@
#include <AzTest/Utils.h>
#include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzToolsFramework/Application/ToolsApplication.h>
@ -36,9 +37,18 @@ protected:
{
UnitTest::AllocatorsTestFixture::SetUp();
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
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);
@ -128,6 +138,7 @@ protected:
}
AZStd::unique_ptr<AzToolsFramework::ToolsApplication> m_app;
AZ::SettingsRegistryImpl m_registry;
};
TEST_F(MaterialBuilderTests, MaterialBuilder_EmptyFile_ExpectFailure)

Loading…
Cancel
Save