Files
UnrealEngineUWP/Engine/Source/Developer/LowLevelTestsRunner/Private/TestRunner.cpp
chris constantinescu 911e95a6d0 Low level tests - platform fixes and presubmit default compilation to prevent breaking
- Addressed remaining NDA platform code that was present in public facing folders
- Compile LowLevelTests target by default on presubmits and incremental builds for Main and 5.0
- Add dummy test on LowLevelTetsts and run it on consoles daily - this test is called "Self" and it's a sanity check run for Catch2
- Fixed Switch indefinite hang - Self test run successfully on this console
- Added IRunningStateOptions to control app run state: startup and check running state options
- AudioUnitTests run successfully on XboxOneGDK and XSX
- XSX Self and AudioUnitTests run successfully but XSX reports VideoEscape errors - JIRA UE-131334

#jira UEENGQA-52681, UE-127449
#rb Jerome.Delattre

#ROBOMERGE-AUTHOR: chris.constantinescu
#ROBOMERGE-SOURCE: CL 17830364 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v881-17767770)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 17830380 by chris constantinescu in ue5-release-engine-test branch]
2021-10-15 12:17:53 -04:00

98 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#define CATCH_CONFIG_RUNNER
#include "TestRunner.h"
#include "TestHarness.h"
#include "HAL/PlatformTLS.h"
int RunTests(int argc, const char* argv[])
{
// remember thread id of the main thread
GGameThreadId = FPlatformTLS::GetCurrentThreadId();
GIsGameThreadIdInitialized = true;
#ifdef SLEEP_ON_INIT
// Sleep to allow sync with Gauntlet
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
#endif
Setup();
//Read command-line from file (if any). Some platforms do this earlier.
#ifndef PLATFORM_SKIP_ADDITIONAL_ARGS
int ArgsOverrideNum = 0;
const char** ArgsOverride = ReadAndAppendAdditionalArgs(GetProcessExecutablePath(), &ArgsOverrideNum, argv, argc);
if (ArgsOverride != nullptr && ArgsOverrideNum > 1)
{
argc = ArgsOverrideNum;
argv = ArgsOverride;
}
#endif
int CatchArgc;
TUniquePtr<const char* []> CatchArgv = MakeUnique<const char* []>(argc);
// Everything past a "--" argument, if present, is not sent to the catch test runner.
for (CatchArgc = 0; CatchArgc < argc; ++CatchArgc)
{
if (std::strcmp(argv[CatchArgc], "--") == 0)
{
break;
}
CatchArgv.Get()[CatchArgc] = argv[CatchArgc];
}
// By default don't wait for input
bool bWaitForInputToTerminate = false;
for (int i = CatchArgc; i < argc; ++i)
{
if (std::strcmp(argv[i], "--wait") == 0)
{
bWaitForInputToTerminate = true;
}
else if (std::strcmp(argv[i], "--no-wait") == 0)
{
bWaitForInputToTerminate = false;
}
if (std::strcmp(argv[i], "--no-log") == 0)
{
bGAllowLogging = false;
}
if (std::strcmp(argv[i], "--no-mt") == 0)
{
bMultithreaded = false;
}
}
// Clear after init so that in windows it is actually clear during the test.
if (bGAllowLogging)
{
FCommandLine::Set(TEXT(""));
}
else
{
FCommandLine::Set(TEXT(R"(-LogCmds="global off")"));
FLogSuppressionInterface::Get().ProcessConfigAndCommandLine();
}
int SessionResult = 0;
{
TGuardValue<bool> CatchRunning(bCatchIsRunning, true);
SessionResult = Catch::Session().run(CatchArgc, CatchArgv.Get());
CatchArgv.Reset();
}
Teardown();
#if PLATFORM_DESKTOP
if (bWaitForInputToTerminate)
{
std::cout << "Press enter to exit..." << std::endl;
std::cin.ignore();
}
#endif
return SessionResult;
};