Fix segfault in failing tests on Linux

This commit is contained in:
amzn-sj
2021-05-24 14:01:41 -07:00
parent 86932f95d6
commit 090b770d7e
5 changed files with 47 additions and 14 deletions
@@ -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;
};