2019-12-26 15:32:37 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2019-05-01 21:54:46 -04:00
|
|
|
|
|
|
|
|
#include "FunctionalTestBase.h"
|
2020-06-23 18:40:00 -04:00
|
|
|
#include "FunctionalTestingModule.h"
|
2019-05-02 15:32:14 -04:00
|
|
|
#include "AutomationControllerSettings.h"
|
2019-05-01 21:54:46 -04:00
|
|
|
|
2024-06-25 18:34:35 -04:00
|
|
|
#if ENABLE_RHI_VALIDATION
|
|
|
|
|
#include "RHIValidationCommon.h"
|
|
|
|
|
#endif
|
2019-05-01 21:54:46 -04:00
|
|
|
|
2020-06-23 18:40:00 -04:00
|
|
|
// statics
|
|
|
|
|
bool FFunctionalTestBase::bIsFunctionalTestRunning;
|
|
|
|
|
FString FFunctionalTestBase::ActiveTestName;
|
|
|
|
|
|
|
|
|
|
|
2019-05-01 21:54:46 -04:00
|
|
|
FFunctionalTestBase::FFunctionalTestBase(const FString& InName, const bool bInComplexTask)
|
|
|
|
|
: FAutomationTestBase(InName, bInComplexTask)
|
|
|
|
|
{
|
|
|
|
|
bSuppressLogs = false;
|
|
|
|
|
bIsFunctionalTestRunning = false;
|
|
|
|
|
// CDO not available at this point
|
2020-06-23 18:40:00 -04:00
|
|
|
bSuppressLogErrors = false;
|
|
|
|
|
bSuppressLogWarnings = false;
|
|
|
|
|
bElevateLogWarningsToErrors = true;
|
2019-05-01 21:54:46 -04:00
|
|
|
}
|
|
|
|
|
|
2024-06-25 18:34:35 -04:00
|
|
|
bool FFunctionalTestBase::SuppressLogs()
|
|
|
|
|
{
|
|
|
|
|
#if ENABLE_RHI_VALIDATION
|
|
|
|
|
if (GRHIValidationEnabled && !bSuppressLogs)
|
|
|
|
|
{
|
|
|
|
|
// While RHI Validation is enabled, do not suppress log unless explicitly enabled
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return bSuppressLogs || !IsFunctionalTestRunning();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FFunctionalTestBase::ShouldCaptureLogCategory(const class FName& Category) const
|
|
|
|
|
{
|
|
|
|
|
#if ENABLE_RHI_VALIDATION
|
|
|
|
|
if (GRHIValidationEnabled && !IsFunctionalTestRunning())
|
|
|
|
|
{
|
|
|
|
|
// If capturing log while functional test is not running, only filter in LogRHI channel.
|
|
|
|
|
return Category == FName(TEXT("LogRHI"));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-01 21:54:46 -04:00
|
|
|
void FFunctionalTestBase::SetLogErrorAndWarningHandlingToDefault()
|
|
|
|
|
{
|
|
|
|
|
// Set to project defaults
|
2019-05-02 15:32:14 -04:00
|
|
|
UAutomationControllerSettings* Settings = UAutomationControllerSettings::StaticClass()->GetDefaultObject<UAutomationControllerSettings>();
|
2020-06-23 18:40:00 -04:00
|
|
|
bSuppressLogErrors = Settings->bSuppressLogErrors;
|
|
|
|
|
bSuppressLogWarnings = Settings->bSuppressLogWarnings;
|
2021-09-15 16:50:42 -04:00
|
|
|
bElevateLogWarningsToErrors = Settings->bElevateLogWarningsToErrors;
|
2020-06-23 18:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Marks us as actively running a functional test
|
|
|
|
|
*/
|
|
|
|
|
void FFunctionalTestBase::SetFunctionalTestRunning(const FString& InName)
|
|
|
|
|
{
|
|
|
|
|
if (bIsFunctionalTestRunning)
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogFunctionalTest, Error, TEXT("A Functional test is already running!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (InName.Len() == 0)
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogFunctionalTest, Error, TEXT("No test name supplied!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bIsFunctionalTestRunning = true;
|
|
|
|
|
ActiveTestName = InName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Marks us as no longer running a test
|
|
|
|
|
*/
|
|
|
|
|
void FFunctionalTestBase::SetFunctionalTestComplete(const FString& InName)
|
|
|
|
|
{
|
|
|
|
|
if (!bIsFunctionalTestRunning)
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogFunctionalTest, Error, TEXT("SetFunctionalComplete() called with no active test"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (InName != ActiveTestName)
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogFunctionalTest, Error, TEXT("SetFunctionalComplete: Complete name %s did not match active name %s"), *InName, *ActiveTestName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bIsFunctionalTestRunning = false;
|
|
|
|
|
ActiveTestName = TEXT("");
|
2019-05-01 21:54:46 -04:00
|
|
|
}
|