Files
UnrealEngineUWP/Engine/Source/Developer/LowLevelTestsRunner/Private/TestCommon/Initialization.cpp
chris constantinescu cd0c323c11 LLT options: Stub platform file and mock some default engine resources for low level tests that run with the engine.
- bUsePlatformFileStub = true replaces the default platform file. The default PF is saved and can be reused at any time.
The side effect is lots of warnings for missing files and object loading errors which is acceptable for low level tests.
- bMockEngineDefaults = true sets some mandatory engine defaults (materials, fonts etc) that can only be loaded from cooked assets.
#jira UE-178194
#rb Ryan.Gerleve
#preflight 63f8e7051206d91a2bd8b0cd

[CL 24407283 by chris constantinescu in ue5-main branch]
2023-02-24 15:27:37 -05:00

87 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "TestCommon/Initialization.h"
#include "TestCommon/CoreUtilities.h"
#include "TestCommon/CoreUObjectUtilities.h"
#include "TestCommon/EngineUtilities.h"
#include "GenericPlatform/GenericPlatformFile.h"
#include "HAL/PlatformFileManager.h"
#include "Misc/DelayedAutoRegister.h"
static IPlatformFile* DefaultPlatformFile;
void InitAllThreadPoolsEditorEx(bool MultiThreaded)
{
#if WITH_EDITOR
InitEditorThreadPools();
#endif // WITH_EDITOR
InitAllThreadPools(MultiThreaded);
}
void InitStats()
{
#if STATS
FThreadStats::StartThread();
#endif // #if STATS
FDelayedAutoRegisterHelper::RunAndClearDelayedAutoRegisterDelegates(EDelayedRegisterRunPhase::StatSystemReady);
}
void UsePlatformFileStubIfRequired()
{
#if WITH_ENGINE && UE_LLT_USE_PLATFORM_FILE_STUB
if (IPlatformFile* WrapperFile = FPlatformFileManager::Get().GetPlatformFile(TEXT("PlatformFileStub")))
{
IPlatformFile* CurrentPlatformFile = &FPlatformFileManager::Get().GetPlatformFile();
WrapperFile->Initialize(CurrentPlatformFile, TEXT(""));
FPlatformFileManager::Get().SetPlatformFile(*WrapperFile);
}
#endif // WITH_ENGINE && UE_LLT_USE_PLATFORM_FILE_STUB
}
void SaveDefaultPlatformFile()
{
DefaultPlatformFile = &FPlatformFileManager::Get().GetPlatformFile();
}
void UseDefaultPlatformFile()
{
FPlatformFileManager::Get().SetPlatformFile(*DefaultPlatformFile);
}
void InitAll(bool bAllowLogging, bool bMultithreaded)
{
SaveDefaultPlatformFile();
UsePlatformFileStubIfRequired();
InitAllThreadPools(bMultithreaded);
#if WITH_ENGINE
InitAsyncQueues();
#endif // WITH_ENGINE
InitTaskGraph();
#if WITH_ENGINE
InitGWarn();
InitEngine();
#endif // WITH_ENGINE
#if WITH_EDITOR
InitDerivedDataCache();
InitSlate();
InitForWithEditorOnlyData();
InitEditor();
#endif // WITH_EDITOR
#if WITH_COREUOBJECT
InitCoreUObject();
#endif
}
void CleanupAll()
{
#if WITH_ENGINE
CleanupEngine();
#endif
#if WITH_COREUOBJECT
CleanupCoreUObject();
#endif
CleanupAllThreadPools();
CleanupTaskGraph();
}