You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3106449 on 2016/08/30 by Michael.Dupuis #jira UETOOL-229 Added generic command icons used in Edit Menu (including contextual menu) Change 3133997 on 2016/09/21 by Alex.Delesky #jira UE-34079 - FSceneView parameter for FBatchedElements::Draw is no longer an optional parameter. Change 3134132 on 2016/09/21 by Jamie.Dale Added the "unattended" flag when running the localzation commandlets via UAT Change 3134147 on 2016/09/21 by Frank.Fella Core - Add multitouch support to windows. Change 3134349 on 2016/09/21 by Michael.Dupuis #jira UE-36151 Update the title bar to display the branch also Change 3134355 on 2016/09/21 by Michael.Dupuis #jira UE-36041 When initially creating a projet and trying to add everything to source control, also add the uproject file Change 3134447 on 2016/09/21 by Alexis.Matte #jira UE-36064 The SpriteComponent is now properly reused when duplicating a light. Change 3134451 on 2016/09/21 by Alexis.Matte #jira UE-22782 Make sure when we re-import we dont try to match the mesh name if the option bCombineToSingle is true Change 3134457 on 2016/09/21 by Jamie.Dale FInternationalization::Leetify now deals with escape sequences correctly. This also changes it to mark all leetified text with the start and end marker, and the unit tests have been updated accordingly. Change 3134685 on 2016/09/21 by Matt.Kuhlenschmidt Cleaned up some of the UI for the new material slot workflow (part 1) Change 3134743 on 2016/09/21 by Matt.Kuhlenschmidt Fix crash clicking OK to the import mesh dialog in persona when a path is not selected. The OK button is now disabled until a valid path is selected Change 3134760 on 2016/09/21 by Matt.Kuhlenschmidt Guard against cascade crash if cascade was shutdown but there is an old cascade particle system component in the undo buffer that attempts to refresh cascade Change 3134837 on 2016/09/21 by Matt.Kuhlenschmidt Fix static analysis warnings in this file Change 3134939 on 2016/09/21 by Nick.Darnell Automation - Moving the functional testing hooks for the editor into a plugin, the goal is to make it so you don't have to see all the extra stuff automation adds to the editor until the game project needs it. Refactoring the way automation messages are serialized, no longer relying on a comma delimited string to serialize automation data. Improving the filter for automation window so it lets you put in a path, and find it that way. Fixing RunTests from the commandline so that it properly finds the tests, instead of jumping out of the loop as soon as it finds any one match. Change 3134941 on 2016/09/21 by Nick.Darnell Automation - Functional tests now support warnings as errors on a per test basis. Continued itteration on screenshot comparison. Change 3135051 on 2016/09/21 by Matt.Kuhlenschmidt Fixed size of material slots in persona details panel Change 3135076 on 2016/09/21 by Nick.Darnell Automation - Adding a missing file. Change 3135584 on 2016/09/22 by Gareth.Martin Removed unused ULandscapeInfo::BeginDestroy Slight cleanup to FLandscapeEditDataInterface::DeleteLayer Change 3135585 on 2016/09/22 by Gareth.Martin New Count algo Const'd Copy/Accumulate/Transform Change 3135599 on 2016/09/22 by Gareth.Martin Resolve crash if a Landscape Layer Info object is force deleted while it is in use :( #jira UE-35709 Change 3135724 on 2016/09/22 by Michael.Dupuis #jira UE-32662 Remove old migration code that was causing this side effect Change 3135726 on 2016/09/22 by Nick.Darnell Slate - Removing the SLATE_PRE_MULTIPLY macro. Change 3135730 on 2016/09/22 by Nick.Darnell UMG - Exposing the 2D hit location that the WidgetInteractionComponent hit on the WidgetComponent. Change 3135738 on 2016/09/22 by Matt.Kuhlenschmidt Ensure any handles to the backbuffer are released before the backbuffer is resized https://jira.it.epicgames.net/browse/UE-30488 Change 3135810 on 2016/09/22 by Ben.Marsh Build: Compile tools before running automated tests. Change 3135993 on 2016/09/22 by Matt.Kuhlenschmidt Ensure you can unpause after toggling play/pause with a keyboard shortcut. We were processing the keybinding on key down AND up which caused the unpause to instantly pause again https://jira.it.epicgames.net/browse/UE-36276 Change 3136257 on 2016/09/22 by Matt.Kuhlenschmidt Fixed assign of materials to components not working if you multi-select multiple components of a blueprint and assign the material. The construction script was running before all the material had been set on all components. Change 3136318 on 2016/09/22 by Alex.Delesky #jira UE-7405 - Forcing the mouse cursor to show and then clicking inside the viewport will no longer cause the mouse to lose focus Change 3136494 on 2016/09/22 by Matt.Kuhlenschmidt Fix crash restarting a mission in Odin Change 3136741 on 2016/09/22 by Cody.Albert Fixed SButton and SWidget to not multiply color and opacity, since that's already being done by SCompoundWidget #jira UE-36322 Change 3137711 on 2016/09/23 by Matt.Kuhlenschmidt Added guard against slate rendering with deleted materials. In this will now be caught with a looged with the deleted material name. Change 3137713 on 2016/09/23 by Matt.Kuhlenschmidt Removed the pooled draw elements stuff which is not used Change 3137791 on 2016/09/23 by Nick.Darnell MediaPlayer - Removing .png from one of the style files, as that's not required. Was causing warnings to be logged on load. Change 3137793 on 2016/09/23 by Nick.Darnell Localization - Adjusting some log statements to say with instead of w/ Change 3137796 on 2016/09/23 by Nick.Darnell Slate - Adding missing and replacing corrupted style files in the editor. Change 3137864 on 2016/09/23 by Matt.Kuhlenschmidt Fixed "actors are referenced are you sure you want to delete" dialog appearing when you are copying a lot of actors to another level Change 3137876 on 2016/09/23 by Jamie.Dale Added allocation tagging to MProf2 This hooks into the existing FScopeCycleCounterUObject used by the stats system to track object tags (object, package, and class) when an allocation is made. Tags should be in the format "Category:Tag", and the "Tag" part may include "/" to create levels in the tag hierarchy (as shown in the MProf2 tool). #jira UETOOL-950 Change 3137982 on 2016/09/23 by Gareth.Martin Added Invoke() support to CopyIf Change 3137983 on 2016/09/23 by Gareth.Martin Added ULandscapeInfo::ForAllLandscapeProxies to clean up a lot of horrible code - Removed some dependencies on ALandscape and ALandscapeStreamingProxy in the process :) Also made FLandscapeEditorLayerSettings's constructor explicit to clean up some other horrible code Change 3138053 on 2016/09/23 by Matt.Kuhlenschmidt Fixed Child Actor Template properties not visible after changing Child Actor Class Change 3138079 on 2016/09/23 by Jamie.Dale Fixing some Clang warnings Change 3138087 on 2016/09/23 by Jamie.Dale Added GetResourceSizeEx and GetResourceSizeBytes, and deprecated GetResourceSize GetResourceSizeEx populates a struct which reports not only how much memory is allocated, but also which arenas the memory was allocated from. GetResourceSizeBytes just wraps a call to GetResourceSizeEx and returns the total size from all arenas (this has the same behavior as the now deprecated GetResourceSize). Classes that used to override GetResourceSize should instead override GetResourceSizeEx and report their allocations as appropriate. #jira UETOOL-952 Change 3138127 on 2016/09/23 by Gareth.Martin Fixed crash when merging levels containing landscape #jira UE-36267 Change 3138821 on 2016/09/23 by Stephan.Jiang Fixes "Select all input node" doesn't work properly on output node. #jira UE-36335 Change 3138915 on 2016/09/23 by Stephan.Jiang Disable "select all linked nodes" for output nodes in material editor Change 3139341 on 2016/09/25 by Nick.Darnell Automation - Moving the Blueprint Compiler Tests into the RuntimeTests plugin, and making the context client only since that's the only valid place to runt these tests. Change 3139342 on 2016/09/25 by Nick.Darnell Landscape - Fixing some compiler errors on mac. Change 3139345 on 2016/09/25 by Nick.Darnell Automation - Spelling and cleanup. Change 3139346 on 2016/09/25 by Nick.Darnell Engine - Changing a check to an ensure, there's no reason to crash if this happens. Change 3139347 on 2016/09/25 by Nick.Darnell Automation - Making EFunctionalTestResult a BlueprintType Change 3139348 on 2016/09/25 by Nick.Darnell Automation - Adding another test map. Change 3139676 on 2016/09/26 by Michael.Dupuis #jira UE-32335 If we are a config object simply permit the transaction for undo/redo Change 3139702 on 2016/09/26 by Nick.Darnell UMG - Making GetLocalHitLocation on UWidgetComponent virtual. Change 3139760 on 2016/09/26 by Alexis.Matte Make sure we remove override materials from the list when the mesh point by the component has less materials. #jira UE-28845 Change 3139761 on 2016/09/26 by Alex.Delesky Added additional validation code to FPropertyNode to now properly validate TMap value and key nodes. #jira none Change 3139843 on 2016/09/26 by Alex.Delesky #jira UE-36066 - Clearing all options from a ComboBox String when selecting an option will now also clear out the selected text correctly. Change 3139880 on 2016/09/26 by Frank.Fella QAGame - Update multitouch test with less crashy assets? Change 3139908 on 2016/09/26 by Matt.Kuhlenschmidt Fix selections having the potential to be out of sync after undo/redo Change 3139928 on 2016/09/26 by Nick.Darnell Automation - tweaking the test maps some more. Change 3140646 on 2016/09/26 by Matt.Kuhlenschmidt Fix false positive with the test for vaild materials being rendered by slate. Change 3140912 on 2016/09/26 by Frank.Fella Core - Fix multitouch ifdef which was preventing it from actually being enabled.Also update test level blueprint so that it's actually testable. Change 3141218 on 2016/09/27 by Matt.Kuhlenschmidt PR #2798: BP open anim interferes with mouse movement (Contributed by projectgheist) Change 3141223 on 2016/09/27 by Jamie.Dale Updated UTextProperty::Identical to no longer compare display strings all the time It was supposed to compare the identity at runtime as the display string can change at runtime. This was preventing FText properties from being used in TSet/TMap as the hash needs to be consistent. #jira UE-36456 Change 3141242 on 2016/09/27 by Richard.TalbotWatkin Fixed various issues where making changes to components in the Blueprint Editor could cause a crash if there is an active component in the component visualizer. #jira UE-36402 - Editor crash when adding a spline component after having deleted another spline component Duplicated CL 3139370 from //UE4/Release-4.13 Duplicated CL 3139878 from //UE4/Release-4.13 Change 3141323 on 2016/09/27 by Michael.Dupuis #jira UE-35081 Enable bDisplayEngineVersionInBadge by default Change 3141798 on 2016/09/27 by tim.gautier Added UMG_DisplayWidget Change 3143038 on 2016/09/28 by Jamie.Dale Added extra context to FTableRowBase::OnPostDataImport It now takes the owning data table and the row name as parameters. This allows is to do more useful fix-up that depends on the context of where it's used (such as stabilized text keys). Change 3143039 on 2016/09/28 by Jamie.Dale Optimized UTextProperty::Identical to use a pointer comparison rather than read out the identity Only texts which have the same display string pointer can have the same identity, so this is a much faster check. Change 3143098 on 2016/09/28 by Gareth.Martin Fixed crash when loading duplicated landscape levels #jira UE-34890 Change 3143300 on 2016/09/28 by Gareth.Martin Fixed crash when duplicating a level containing a landscape through the content browser #jira UE-34890 Change 3143389 on 2016/09/28 by Jamie.Dale LastResort is no longer staged in shipping builds You can now use the Content/SlateDebug folder to store any Slate resources that shouldn't be used in a shipping build (either for the Engine or for a game). This also removes the old bUsesSlateEditorStyle hack as everything should have migrated away from that now. Change 3143565 on 2016/09/28 by Matt.Kuhlenschmidt Fixed this file Change 3143717 on 2016/09/28 by Michael.Dupuis Fixed lowercase Change 3143798 on 2016/09/28 by Matt.Kuhlenschmidt Fixed StreamingPauseRendering code to not attempt to tick the scene viewport on the slate loading thread while where are blocked on level streaming. The viewport is rendered once and the render target is passed to slate instead of the entire viewport Change 3143820 on 2016/09/28 by Alexis.Matte Use the PersonaToolikit to get the mesh Change 3143833 on 2016/09/28 by Matt.Kuhlenschmidt Added guard for UE-36499 Change 3144144 on 2016/09/28 by Matt.Kuhlenschmidt Fix constructor init order Change 3144821 on 2016/09/29 by Jamie.Dale Fixed feedback loop in FSlateEditableTextLayout::ComputeDesiredSize If the wrapping width is less than the scrollbar width, the scrollbar could constantly re-appear and then disappear. Change 3144867 on 2016/09/29 by Matt.Kuhlenschmidt Added a commandlet to allow command line importing of any asset type the engine supports. - Intermediate checkin Change 3144875 on 2016/09/29 by Nick.Darnell Automation - Adding CornellBox example map, fixing some additional tests, removing the Movement Test. Change 3144975 on 2016/09/29 by Matt.Kuhlenschmidt Disable auto-applying of scalability settings The user will still be asked if the settings should be applied but if they do nothing the notification will just go away without setting stuff. Change 3145274 on 2016/09/29 by Jamie.Dale New asset menu no longer has a scrollbar on most displays Change 3146004 on 2016/09/29 by Matt.Barnes Adding two FBX test files to help facilitate QA coverage on the new material/section workflow. Change 3146377 on 2016/09/30 by Gareth.Martin Fixed landscape rendering errors after using the "change component size" tool - also affected initial import of a landscape+weightmaps #jira UE-34518 Change 3146455 on 2016/09/30 by Jamie.Dale Fixing more menus that had scrollbars due to only being able to use half the vertical resolution Change 3146466 on 2016/09/30 by Gareth.Martin Fixed not being able to erase foliage attached to BSP #jira UE-36297 Change 3146471 on 2016/09/30 by Jamie.Dale Can no longer localize sequences via the Content Browser Change 3146569 on 2016/09/30 by Jamie.Dale Fixed UGatherTextFromSourceCommandlet::ParseSourceText being able to underflow while parsing Change 3147116 on 2016/09/30 by Michael.Dupuis #jira UE-33068 Update selection once after the bulk operation so the AssetContextMenu will have a proper selection, but only perform this if we're not in UserSearchingMode (which mean AssetPicker) Change 3148091 on 2016/10/01 by Matt.Barnes Adding a map and relevant assets to facilitate testing around the new material blueprint nodes - GetMaterialSlotNames, GetMaterialIndex, and SetMaterialByName, respectively Change 3148714 on 2016/10/03 by Nick.Darnell PR #2770: [Git plugin] Fix bug where history and merging do not work if the user has format.pretty settings in their gitconfig (Contributed by SRombauts) #jira UE-35568 Change 3148793 on 2016/10/03 by Nick.Darnell Automation - TPS for SM_Cornellbox Change 3148801 on 2016/10/03 by Nick.Darnell PR #2820: [WidgetBlueprintLibrary] Throwing Essential-Functionality-Understanding PIE Errors when Player Controller ptr not supplied (Contributed by EverNewJoy) #jira UE-36711 Change 3148805 on 2016/10/03 by Nick.Darnell PR #2822: Add missing base includes and forward declarations for UProgressBar and UTextBlock (Contributed by error454) #jira UE-36715 Change 3148813 on 2016/10/03 by Nick.Darnell UMG - The retainer now contains the SVirtualWindow directly in the hierarchy. This should now make it possible to reliably focus elements inside the retainer widget. Change 3148855 on 2016/10/03 by Gareth.Martin Fixed performance regression when importing landscape heightmaps #jira UE-36659 Change 3149482 on 2016/10/03 by Cody.Albert Added link to Support landing page to Help menu #jira UE-36603 Change 3149520 on 2016/10/03 by tim.gautier Edited UMG_Behavior - Collapsed now has a toggleable state to demonstrate functionality. Change 3149945 on 2016/10/04 by Gareth.Martin Fixed invisible landscape components when using tessellation on landscape material #jira UE-35494 Change 3149951 on 2016/10/04 by Gareth.Martin Reduced material update log spam when creating and editing landscapes - Some will remain, landscape fundementally manipulates a lot of material instances #jira UE-34440 Change 3150143 on 2016/10/04 by Matt.Kuhlenschmidt Fix not crashing when trying to clear objects which have a specific class filter in the property settings https://jira.it.epicgames.net/browse/UE-36692 Change 3150614 on 2016/10/04 by Nick.Darnell Git - Disabling some logging in non-debug builds of the git source control plugin. Change 3151647 on 2016/10/05 by Matt.Kuhlenschmidt Fix loc warnings in these files (duplicate loc keys) Change 3151679 on 2016/10/05 by Nick.Darnell Editor - Fixing the build, removing the VREditor module from the dynamically loaded list. Change 3151722 on 2016/10/05 by Gareth.Martin Fix breakage to LandscapeEdModeSplineTools.cpp caused by Dev-VREditor from main integration Change 3151816 on 2016/10/05 by Gareth.Martin Fixed more breakage to Landscape caused by Dev-VREditor from main integration [CL 3152072 by Matt Kuhlenschmidt in Main branch]
1006 lines
28 KiB
C++
1006 lines
28 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AutomationControllerPrivatePCH.h"
|
|
#include "Misc/AutomationTest.h"
|
|
|
|
FAutomationReport::FAutomationReport(FAutomationTestInfo& InTestInfo, bool InIsParent)
|
|
: bEnabled( false )
|
|
, bIsParent(InIsParent)
|
|
, bNodeExpandInUI(false)
|
|
, bSelfPassesFilter(false)
|
|
, SupportFlags(0)
|
|
, TestInfo( InTestInfo )
|
|
, bTrackingHistory(false)
|
|
, NumRecordsToKeep(0)
|
|
{
|
|
// Enable smoke tests
|
|
if ( TestInfo.GetTestFlags() == EAutomationTestFlags::SmokeFilter )
|
|
{
|
|
bEnabled = true;
|
|
}
|
|
|
|
if (!bIsParent)
|
|
{
|
|
LoadHistory();
|
|
}
|
|
}
|
|
|
|
void FAutomationReport::Empty()
|
|
{
|
|
//release references to all child tests
|
|
ChildReports.Empty();
|
|
ChildReportNameHashes.Empty();
|
|
FilteredChildReports.Empty();
|
|
}
|
|
|
|
FString FAutomationReport::GetTestParameter() const
|
|
{
|
|
return TestInfo.GetTestParameter();
|
|
}
|
|
|
|
FString FAutomationReport::GetAssetPath() const
|
|
{
|
|
return TestInfo.GetAssetPath();
|
|
}
|
|
|
|
FString FAutomationReport::GetOpenCommand() const
|
|
{
|
|
return TestInfo.GetOpenCommand();
|
|
}
|
|
|
|
FString FAutomationReport::GetCommand() const
|
|
{
|
|
return TestInfo.GetTestName();
|
|
}
|
|
|
|
const FString& FAutomationReport::GetDisplayName() const
|
|
{
|
|
return TestInfo.GetDisplayName();
|
|
}
|
|
|
|
const FString& FAutomationReport::GetFullTestPath() const
|
|
{
|
|
return TestInfo.GetFullTestPath();
|
|
}
|
|
|
|
FString FAutomationReport::GetDisplayNameWithDecoration() const
|
|
{
|
|
FString FinalDisplayName = TestInfo.GetDisplayName();
|
|
//if this is an internal leaf node and the "decoration" name is being requested
|
|
if (ChildReports.Num())
|
|
{
|
|
int32 NumChildren = GetTotalNumChildren();
|
|
//append on the number of child tests
|
|
return TestInfo.GetDisplayName() + FString::Printf(TEXT(" (%d)"), NumChildren);
|
|
}
|
|
return FinalDisplayName;
|
|
}
|
|
|
|
int32 FAutomationReport::GetTotalNumChildren() const
|
|
{
|
|
int32 Total = 0;
|
|
for (int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex)
|
|
{
|
|
int ChildCount = ChildReports[ChildIndex]->GetTotalNumChildren();
|
|
//Only count leaf nodes
|
|
if (ChildCount == 0)
|
|
{
|
|
Total ++;
|
|
}
|
|
Total += ChildCount;
|
|
}
|
|
return Total;
|
|
}
|
|
|
|
int32 FAutomationReport::GetTotalNumFilteredChildren() const
|
|
{
|
|
int32 Total = 0;
|
|
for ( int32 ChildIndex = 0; ChildIndex < FilteredChildReports.Num(); ++ChildIndex )
|
|
{
|
|
int ChildCount = FilteredChildReports[ChildIndex]->GetTotalNumFilteredChildren();
|
|
//Only count leaf nodes
|
|
if ( ChildCount == 0 )
|
|
{
|
|
Total++;
|
|
}
|
|
Total += ChildCount;
|
|
}
|
|
return Total;
|
|
}
|
|
|
|
void FAutomationReport::GetEnabledTestNames(TArray<FString>& OutEnabledTestNames, FString CurrentPath) const
|
|
{
|
|
//if this is a leaf and this test is enabled
|
|
if ((ChildReports.Num() == 0) && IsEnabled())
|
|
{
|
|
const FString FullTestName = CurrentPath.Len() > 0 ? CurrentPath.AppendChar(TCHAR('.')) + TestInfo.GetDisplayName() : TestInfo.GetDisplayName();
|
|
OutEnabledTestNames.Add(FullTestName);
|
|
}
|
|
else
|
|
{
|
|
if( !CurrentPath.IsEmpty() )
|
|
{
|
|
CurrentPath += TEXT(".");
|
|
}
|
|
CurrentPath += TestInfo.GetDisplayName();
|
|
//recurse through the hierarchy
|
|
for (int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex)
|
|
{
|
|
ChildReports[ChildIndex]->GetEnabledTestNames(OutEnabledTestNames,CurrentPath);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
|
|
void FAutomationReport::SetEnabledTests(const TArray<FString>& InEnabledTests, FString CurrentPath)
|
|
{
|
|
if (ChildReports.Num() == 0)
|
|
{
|
|
//Find of the full name of this test and see if it is in our list
|
|
const FString FullTestName = CurrentPath.Len() > 0 ? CurrentPath.AppendChar(TCHAR('.')) + TestInfo.GetDisplayName() : TestInfo.GetDisplayName();
|
|
const bool bNewEnabled = InEnabledTests.Contains(FullTestName);
|
|
SetEnabled(bNewEnabled);
|
|
}
|
|
else
|
|
{
|
|
if( !CurrentPath.IsEmpty() )
|
|
{
|
|
CurrentPath += TEXT(".");
|
|
}
|
|
CurrentPath += TestInfo.GetDisplayName();
|
|
|
|
//recurse through the hierarchy
|
|
for (int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex)
|
|
{
|
|
ChildReports[ChildIndex]->SetEnabledTests(InEnabledTests,CurrentPath);
|
|
}
|
|
|
|
//Parent nodes should be checked if all of its children are
|
|
const int32 TotalNumChildern = GetTotalNumChildren();
|
|
const int32 EnabledChildren = GetEnabledTestsNum();
|
|
bEnabled = (TotalNumChildern == EnabledChildren);
|
|
}
|
|
}
|
|
|
|
int32 FAutomationReport::GetEnabledTestsNum() const
|
|
{
|
|
int32 Total = 0;
|
|
//if this is a leaf and this test is enabled
|
|
if ((ChildReports.Num() == 0) && IsEnabled())
|
|
{
|
|
Total++;
|
|
}
|
|
else
|
|
{
|
|
//recurse through the hierarchy
|
|
for (int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex)
|
|
{
|
|
Total += ChildReports[ChildIndex]->GetEnabledTestsNum();
|
|
}
|
|
}
|
|
return Total;
|
|
}
|
|
|
|
bool FAutomationReport::IsEnabled() const
|
|
{
|
|
return bEnabled;
|
|
}
|
|
|
|
void FAutomationReport::SetEnabled(bool bShouldBeEnabled)
|
|
{
|
|
bEnabled = bShouldBeEnabled;
|
|
//set children to the same value
|
|
for (int32 ChildIndex = 0; ChildIndex < FilteredChildReports.Num(); ++ChildIndex)
|
|
{
|
|
FilteredChildReports[ChildIndex]->SetEnabled(bShouldBeEnabled);
|
|
}
|
|
}
|
|
|
|
void FAutomationReport::SetSupport(const int32 ClusterIndex)
|
|
{
|
|
SupportFlags |= (1<<ClusterIndex);
|
|
|
|
//ensure there is enough room in the array for status per platform
|
|
for (int32 i = 0; i <= ClusterIndex; ++i)
|
|
{
|
|
//Make sure we have enough results for a single pass
|
|
TArray<FAutomationTestResults> AutomationTestResult;
|
|
AutomationTestResult.Add( FAutomationTestResults() );
|
|
Results.Add( AutomationTestResult );
|
|
}
|
|
}
|
|
|
|
bool FAutomationReport::IsSupported(const int32 ClusterIndex) const
|
|
{
|
|
return (SupportFlags & (1<<ClusterIndex)) ? true : false;
|
|
}
|
|
|
|
|
|
uint32 FAutomationReport::GetTestFlags( ) const
|
|
{
|
|
return TestInfo.GetTestFlags();
|
|
}
|
|
|
|
FString FAutomationReport::GetSourceFile() const
|
|
{
|
|
return TestInfo.GetSourceFile();
|
|
}
|
|
|
|
int32 FAutomationReport::GetSourceFileLine() const
|
|
{
|
|
return TestInfo.GetSourceFileLine();
|
|
}
|
|
|
|
void FAutomationReport::SetTestFlags( const uint32 InTestFlags)
|
|
{
|
|
TestInfo.AddTestFlags( InTestFlags );
|
|
|
|
if ( InTestFlags == EAutomationTestFlags::SmokeFilter )
|
|
{
|
|
bEnabled = true;
|
|
}
|
|
}
|
|
|
|
const bool FAutomationReport::IsParent()
|
|
{
|
|
return bIsParent;
|
|
}
|
|
|
|
const bool FAutomationReport::IsSmokeTest( )
|
|
{
|
|
return GetTestFlags( ) & EAutomationTestFlags::SmokeFilter ? true : false;
|
|
}
|
|
|
|
bool FAutomationReport::SetFilter( TSharedPtr< AutomationFilterCollection > InFilter, const bool ParentPassedFilter )
|
|
{
|
|
//assume that this node and all its children fail to pass the filter test
|
|
bool bSelfOrChildPassedFilter = false;
|
|
|
|
//assume this node should not be expanded in the UI
|
|
bNodeExpandInUI = false;
|
|
|
|
//test for empty search string or matching search string
|
|
bSelfPassesFilter = InFilter->PassesAllFilters( SharedThis( this ) );
|
|
|
|
if ( IsParent() && ParentPassedFilter )
|
|
{
|
|
bSelfPassesFilter = true;
|
|
}
|
|
|
|
//clear the currently filtered tests array
|
|
FilteredChildReports.Empty();
|
|
|
|
//see if any children pass the filter
|
|
for( int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex )
|
|
{
|
|
bool ThisChildPassedFilter = ChildReports[ChildIndex]->SetFilter( InFilter, bSelfPassesFilter );
|
|
|
|
if( ThisChildPassedFilter || bSelfPassesFilter || ParentPassedFilter )
|
|
{
|
|
if ( !ChildReports[ChildIndex]->IsParent() || ChildReports[ChildIndex]->GetFilteredChildren().Num() > 0 )
|
|
{
|
|
FilteredChildReports.Add(ChildReports[ChildIndex]);
|
|
}
|
|
}
|
|
|
|
if ( bNodeExpandInUI == false && ThisChildPassedFilter == true )
|
|
{
|
|
// A child node has passed the filter, so we want to expand this node in the UI
|
|
bNodeExpandInUI = true;
|
|
}
|
|
}
|
|
|
|
//if we passed name, speed, and status tests
|
|
if( bSelfPassesFilter || bNodeExpandInUI )
|
|
{
|
|
//Passed the filter!
|
|
bSelfOrChildPassedFilter = true;
|
|
}
|
|
|
|
return bSelfOrChildPassedFilter;
|
|
}
|
|
|
|
TArray<TSharedPtr<IAutomationReport> >& FAutomationReport::GetFilteredChildren()
|
|
{
|
|
return FilteredChildReports;
|
|
}
|
|
|
|
TArray<TSharedPtr<IAutomationReport> >& FAutomationReport::GetChildReports()
|
|
{
|
|
return ChildReports;
|
|
}
|
|
|
|
void FAutomationReport::ClustersUpdated(const int32 NumClusters)
|
|
{
|
|
TestInfo.ResetNumDevicesRunningTest();
|
|
|
|
//Fixup Support flags
|
|
SupportFlags = 0;
|
|
for (int32 i = 0; i <= NumClusters; ++i)
|
|
{
|
|
SupportFlags |= (1<<i);
|
|
}
|
|
|
|
//Fixup Results array
|
|
if( NumClusters > Results.Num() )
|
|
{
|
|
for( int32 ClusterIndex = Results.Num(); ClusterIndex < NumClusters; ++ClusterIndex )
|
|
{
|
|
//Make sure we have enough results for a single pass
|
|
TArray<FAutomationTestResults> AutomationTestResult;
|
|
AutomationTestResult.Add( FAutomationTestResults() );
|
|
Results.Add( AutomationTestResult );
|
|
}
|
|
}
|
|
else if( NumClusters < Results.Num() )
|
|
{
|
|
Results.RemoveAt(NumClusters, Results.Num() - NumClusters);
|
|
}
|
|
|
|
//recurse to children
|
|
for (int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex)
|
|
{
|
|
ChildReports[ChildIndex]->ClustersUpdated(NumClusters);
|
|
}
|
|
}
|
|
|
|
void FAutomationReport::ResetForExecution(const int32 NumTestPasses)
|
|
{
|
|
TestInfo.ResetNumDevicesRunningTest();
|
|
|
|
//if this test is enabled
|
|
if (IsEnabled())
|
|
{
|
|
for (int32 ClusterIndex = 0; ClusterIndex < Results.Num(); ++ClusterIndex)
|
|
{
|
|
//Make sure we have enough results
|
|
if( NumTestPasses > Results[ClusterIndex].Num() )
|
|
{
|
|
for(int32 PassCount = Results[ClusterIndex].Num(); PassCount < NumTestPasses; ++PassCount)
|
|
{
|
|
Results[ClusterIndex].Add( FAutomationTestResults() );
|
|
}
|
|
}
|
|
else if( NumTestPasses < Results[ClusterIndex].Num() )
|
|
{
|
|
Results[ClusterIndex].RemoveAt(NumTestPasses, Results[ClusterIndex].Num() - NumTestPasses);
|
|
}
|
|
|
|
for( int32 PassIndex = 0; PassIndex < Results[ClusterIndex].Num(); ++PassIndex)
|
|
{
|
|
//reset all stats
|
|
Results[ClusterIndex][PassIndex].State = EAutomationState::NotRun;
|
|
Results[ClusterIndex][PassIndex].Warnings.Empty();
|
|
Results[ClusterIndex][PassIndex].Errors.Empty();
|
|
}
|
|
}
|
|
}
|
|
//recurse to children
|
|
for (int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex)
|
|
{
|
|
ChildReports[ChildIndex]->ResetForExecution(NumTestPasses);
|
|
}
|
|
}
|
|
|
|
void FAutomationReport::TrackHistory(const bool bShouldTrack, const int32 NumReportsToTrack)
|
|
{
|
|
bTrackingHistory = bShouldTrack;
|
|
NumRecordsToKeep = NumReportsToTrack;
|
|
|
|
if (bTrackingHistory && ChildReports.Num() == 0)
|
|
{
|
|
LoadHistory();
|
|
}
|
|
|
|
//recurse to children
|
|
for (auto& NextChildReport : ChildReports)
|
|
{
|
|
NextChildReport->TrackHistory(bTrackingHistory, NumRecordsToKeep);
|
|
}
|
|
}
|
|
|
|
void FAutomationReport::AddToHistory()
|
|
{
|
|
// Dictate the file path we are writing this run as history to.
|
|
const FDateTime FileDate = FDateTime::Now();
|
|
const FString FileName = GetDisplayName() + FileDate.ToString() + TEXT(".log");
|
|
const FString FileLocation = FPaths::ConvertRelativePathToFull(FPaths::AutomationLogDir()) + GetDisplayName();
|
|
const FString FullPath = FPaths::Combine(*FileLocation, *FileName);
|
|
|
|
// Write any Errors and Warnings to the log, if none, then simply report that it was successful.
|
|
if (FArchive* LogFile = IFileManager::Get().CreateFileWriter(*FullPath))
|
|
{
|
|
bool bExportedAnyErrors = false;
|
|
for (int32 ClusterIndex = 0; ClusterIndex < Results.Num(); ++ClusterIndex)
|
|
{
|
|
for (int32 PassIndex = 0; PassIndex < Results[ClusterIndex].Num(); ++PassIndex)
|
|
{
|
|
for (int32 ErrorIndex = 0; ErrorIndex < Results[ClusterIndex][PassIndex].Errors.Num(); ++ErrorIndex)
|
|
{
|
|
if (!bExportedAnyErrors)
|
|
{
|
|
bExportedAnyErrors = true;
|
|
|
|
FString ErrorIdentifier(TEXT("<<ERRORS>>"));
|
|
ErrorIdentifier += LINE_TERMINATOR;
|
|
|
|
LogFile->Serialize(TCHAR_TO_ANSI(*ErrorIdentifier), ErrorIdentifier.Len());
|
|
}
|
|
FString NextError = Results[ClusterIndex][PassIndex].Errors[ErrorIndex].ToString() + LINE_TERMINATOR;
|
|
LogFile->Serialize(TCHAR_TO_ANSI(*NextError), NextError.Len());
|
|
}
|
|
}
|
|
}
|
|
|
|
bool bExportedAnyWarnings = false;
|
|
for (int32 ClusterIndex = 0; ClusterIndex < Results.Num(); ++ClusterIndex)
|
|
{
|
|
for (int32 PassIndex = 0; PassIndex < Results[ClusterIndex].Num(); ++PassIndex)
|
|
{
|
|
for (int32 WarningIndex = 0; WarningIndex < Results[ClusterIndex][PassIndex].Warnings.Num(); ++WarningIndex)
|
|
{
|
|
if (!bExportedAnyWarnings)
|
|
{
|
|
bExportedAnyWarnings = true;
|
|
|
|
FString WarningIdentifier(TEXT("<<WARNINGS>>"));
|
|
WarningIdentifier += LINE_TERMINATOR;
|
|
|
|
LogFile->Serialize(TCHAR_TO_ANSI(*WarningIdentifier), WarningIdentifier.Len());
|
|
}
|
|
const FString NextWarning = Results[ClusterIndex][PassIndex].Warnings[WarningIndex] + LINE_TERMINATOR;
|
|
LogFile->Serialize(TCHAR_TO_ANSI(*NextWarning), NextWarning.Len());
|
|
}
|
|
}
|
|
}
|
|
|
|
if (bExportedAnyErrors == false && bExportedAnyWarnings == false)
|
|
{
|
|
FString SuccessIdentifier(TEXT("<<SUCCESS>>"));
|
|
SuccessIdentifier += LINE_TERMINATOR;
|
|
|
|
LogFile->Serialize(TCHAR_TO_ANSI(*SuccessIdentifier), SuccessIdentifier.Len());
|
|
}
|
|
|
|
LogFile->Close();
|
|
delete LogFile;
|
|
|
|
|
|
// Cache an automation history item for tracking in this session
|
|
TSharedRef<FAutomationHistoryItem> HistoryItem = MakeShareable(new FAutomationHistoryItem);
|
|
HistoryItem->LogLocation = FileName;
|
|
HistoryItem->RunDate = FileDate;
|
|
HistoryItem->RunResult =
|
|
(bExportedAnyErrors ? FAutomationHistoryItem::EAutomationHistoryResult::Errors :
|
|
(bExportedAnyWarnings ? FAutomationHistoryItem::EAutomationHistoryResult::Warnings :
|
|
FAutomationHistoryItem::EAutomationHistoryResult::Successful));
|
|
|
|
HistoryItems.Add(HistoryItem);
|
|
}
|
|
}
|
|
|
|
void FAutomationReport::MaintainHistory(TArray<FString>& InLogFiles)
|
|
{
|
|
// Find all the logs in this reports log location
|
|
const FString LogsLocation = FPaths::ConvertRelativePathToFull(FPaths::AutomationLogDir()) + GetDisplayName();
|
|
|
|
// Sort the logs in reverse chronological order
|
|
struct FLogSortPredicate
|
|
{
|
|
FString DisplayName;
|
|
FLogSortPredicate(const FString& InDisplayName) : DisplayName(InDisplayName) {}
|
|
|
|
/** Sort predicate operator */
|
|
bool operator ()(FString LHS, FString RHS) const
|
|
{
|
|
FString LogExt = TEXT(".log");
|
|
|
|
FString LHSDateStr = LHS.RightChop(DisplayName.Len());
|
|
LHSDateStr = LHSDateStr.LeftChop(LogExt.Len());
|
|
|
|
FDateTime LHSDate;
|
|
FDateTime::Parse(LHSDateStr, LHSDate);
|
|
|
|
FString RHSDateStr = RHS.RightChop(DisplayName.Len());
|
|
RHSDateStr = RHSDateStr.LeftChop(LogExt.Len());
|
|
|
|
FDateTime RHSDate;
|
|
FDateTime::Parse(RHSDateStr, RHSDate);
|
|
|
|
return LHSDate > RHSDate;
|
|
}
|
|
};
|
|
InLogFiles.Sort(FLogSortPredicate(GetDisplayName()));
|
|
|
|
// For logs, we keep the number equal to AutomationReportConstants::MaximumLogsToKeep around.
|
|
// This will mean that we can extend or history to see when changed within the report
|
|
for (int32 LogIndex = InLogFiles.Num() - 1; LogIndex >= AutomationReportConstants::MaximumLogsToKeep; LogIndex--)
|
|
{
|
|
check(IFileManager::Get().Delete(*FPaths::Combine(*LogsLocation, *InLogFiles[LogIndex])));
|
|
}
|
|
|
|
|
|
// Sort the history items in reverse chronological order
|
|
struct FHistorySortPredicate
|
|
{
|
|
FHistorySortPredicate() {}
|
|
|
|
/** Sort predicate operator */
|
|
bool operator ()(const TSharedPtr<FAutomationHistoryItem>& LHS, const TSharedPtr<FAutomationHistoryItem>& RHS) const
|
|
{
|
|
check(LHS.IsValid() && RHS.IsValid());
|
|
return LHS->RunDate > RHS->RunDate;
|
|
}
|
|
};
|
|
HistoryItems.Sort(FHistorySortPredicate());
|
|
|
|
for (int32 ItemIndex = HistoryItems.Num() - 1; ItemIndex >= NumRecordsToKeep; ItemIndex--)
|
|
{
|
|
HistoryItems.RemoveAt(ItemIndex);
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationReport::LoadHistory()
|
|
{
|
|
// Clear out the previous results before we rebuild our list
|
|
HistoryItems.Empty();
|
|
|
|
// Load the logs from this reports automation log location
|
|
const FString LogsLocation = FPaths::ConvertRelativePathToFull(FPaths::AutomationLogDir()) + GetDisplayName();
|
|
|
|
TArray<FString> LogFiles;
|
|
IFileManager::Get().FindFiles(LogFiles, *(LogsLocation / "*.log"), true, false);
|
|
|
|
for (FString& NextLogFile : LogFiles)
|
|
{
|
|
FString FileContents;
|
|
if (FFileHelper::LoadFileToString(FileContents, *FPaths::Combine(*LogsLocation, *NextLogFile)))
|
|
{
|
|
TSharedRef<FAutomationHistoryItem> HistoryItem = MakeShareable(new FAutomationHistoryItem);
|
|
|
|
// Cache the log location
|
|
HistoryItem->LogLocation = NextLogFile;
|
|
|
|
// Parse the date and time from the log name
|
|
{
|
|
FString LogExt = TEXT(".log");
|
|
|
|
FString DateStr = NextLogFile.RightChop(GetDisplayName().Len());
|
|
DateStr = DateStr.LeftChop(LogExt.Len());
|
|
|
|
FDateTime::Parse(DateStr, HistoryItem->RunDate);
|
|
}
|
|
|
|
// Parse whether the previous runs had errors, warnings or were successful
|
|
{
|
|
if (FileContents.StartsWith(TEXT("<<ERRORS>>")))
|
|
{
|
|
HistoryItem->RunResult = FAutomationHistoryItem::EAutomationHistoryResult::Errors;
|
|
}
|
|
else if (FileContents.StartsWith(TEXT("<<WARNINGS>>")))
|
|
{
|
|
HistoryItem->RunResult = FAutomationHistoryItem::EAutomationHistoryResult::Warnings;
|
|
}
|
|
else if (FileContents.StartsWith(TEXT("<<SUCCESS>>")))
|
|
{
|
|
HistoryItem->RunResult = FAutomationHistoryItem::EAutomationHistoryResult::Successful;
|
|
}
|
|
}
|
|
|
|
// Add our log to the tracking
|
|
HistoryItems.Add(HistoryItem);
|
|
}
|
|
}
|
|
|
|
// Do a pass on the existing logs for any we no longer wish to maintain.
|
|
if (LogFiles.Num())
|
|
{
|
|
MaintainHistory(LogFiles);
|
|
}
|
|
}
|
|
|
|
|
|
const TArray<TSharedPtr<FAutomationHistoryItem>>& FAutomationReport::GetHistory() const
|
|
{
|
|
return HistoryItems;
|
|
}
|
|
|
|
|
|
void FAutomationReport::SetResults( const int32 ClusterIndex, const int32 PassIndex, const FAutomationTestResults& InResults )
|
|
{
|
|
//verify this is a platform this test is aware of
|
|
check((ClusterIndex >= 0) && (ClusterIndex < Results.Num()));
|
|
check((PassIndex >= 0) && (PassIndex < Results[ClusterIndex].Num()));
|
|
|
|
if( InResults.State == EAutomationState::InProcess )
|
|
{
|
|
TestInfo.InformOfNewDeviceRunningTest();
|
|
}
|
|
|
|
Results[ ClusterIndex ][ PassIndex ] = InResults;
|
|
// Add an error report if none was received
|
|
if ( InResults.State == EAutomationState::Fail && InResults.Errors.Num() == 0 && InResults.Warnings.Num() == 0 )
|
|
{
|
|
Results[ClusterIndex][PassIndex].Errors.Add( FAutomationEvent("No Report Generated") );
|
|
}
|
|
|
|
// If we are tracking history, then export it.
|
|
if (bTrackingHistory && (InResults.State == EAutomationState::Success || InResults.State == EAutomationState::Fail))
|
|
{
|
|
AddToHistory();
|
|
//Remove find files as it was too expensive. And definitely too expensive for just updating one test
|
|
//MaintainHistory();
|
|
}
|
|
|
|
// While setting the results of the test cause the log of any selected test to refresh
|
|
OnSetResults.ExecuteIfBound(AsShared());
|
|
}
|
|
|
|
|
|
void FAutomationReport::GetCompletionStatus(const int32 ClusterIndex, const int32 PassIndex, FAutomationCompleteState& OutCompletionState)
|
|
{
|
|
//if this test is enabled and a leaf test
|
|
if (IsSupported(ClusterIndex) && (ChildReports.Num()==0))
|
|
{
|
|
EAutomationState::Type CurrentState = Results[ClusterIndex][PassIndex].State;
|
|
//Enabled and In-Process
|
|
if (IsEnabled())
|
|
{
|
|
OutCompletionState.TotalEnabled++;
|
|
if (CurrentState == EAutomationState::InProcess)
|
|
{
|
|
OutCompletionState.NumEnabledInProcess++;
|
|
}
|
|
}
|
|
|
|
//Warnings
|
|
if (Results[ClusterIndex][PassIndex].Warnings.Num() > 0)
|
|
{
|
|
IsEnabled() ? OutCompletionState.NumEnabledTestsWarnings++ : OutCompletionState.NumDisabledTestsWarnings++;
|
|
}
|
|
|
|
//Test results
|
|
if (CurrentState == EAutomationState::Success)
|
|
{
|
|
IsEnabled() ? OutCompletionState.NumEnabledTestsPassed++ : OutCompletionState.NumDisabledTestsPassed++;
|
|
}
|
|
else if (CurrentState == EAutomationState::Fail)
|
|
{
|
|
IsEnabled() ? OutCompletionState.NumEnabledTestsFailed++ : OutCompletionState.NumDisabledTestsFailed++;
|
|
}
|
|
else if( CurrentState == EAutomationState::NotEnoughParticipants )
|
|
{
|
|
IsEnabled() ? OutCompletionState.NumEnabledTestsCouldntBeRun++ : OutCompletionState.NumDisabledTestsCouldntBeRun++;
|
|
}
|
|
}
|
|
//recurse to children
|
|
for (int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex)
|
|
{
|
|
ChildReports[ChildIndex]->GetCompletionStatus(ClusterIndex,PassIndex, OutCompletionState);
|
|
}
|
|
}
|
|
|
|
|
|
EAutomationState::Type FAutomationReport::GetState(const int32 ClusterIndex, const int32 PassIndex) const
|
|
{
|
|
if ((ClusterIndex >= 0) && (ClusterIndex < Results.Num()) &&
|
|
(PassIndex >= 0) && (PassIndex < Results[ClusterIndex].Num()))
|
|
{
|
|
return Results[ClusterIndex][PassIndex].State;
|
|
}
|
|
return EAutomationState::NotRun;
|
|
}
|
|
|
|
|
|
const FAutomationTestResults& FAutomationReport::GetResults( const int32 ClusterIndex, const int32 PassIndex )
|
|
{
|
|
return Results[ClusterIndex][PassIndex];
|
|
}
|
|
|
|
const int32 FAutomationReport::GetNumResults( const int32 ClusterIndex )
|
|
{
|
|
return Results[ClusterIndex].Num();
|
|
}
|
|
|
|
const int32 FAutomationReport::GetCurrentPassIndex( const int32 ClusterIndex )
|
|
{
|
|
int32 PassIndex = 1;
|
|
|
|
if( IsSupported(ClusterIndex) )
|
|
{
|
|
for(; PassIndex < Results[ClusterIndex].Num(); ++PassIndex )
|
|
{
|
|
if( Results[ClusterIndex][PassIndex].State == EAutomationState::NotRun )
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return PassIndex - 1;
|
|
}
|
|
|
|
FString FAutomationReport::GetGameInstanceName( const int32 ClusterIndex )
|
|
{
|
|
return Results[ClusterIndex][0].GameInstance;
|
|
}
|
|
|
|
TSharedPtr<IAutomationReport> FAutomationReport::EnsureReportExists(FAutomationTestInfo& InTestInfo, const int32 ClusterIndex, const int32 NumPasses)
|
|
{
|
|
//Split New Test Name by the first "." found
|
|
FString NameToMatch = InTestInfo.GetDisplayName();
|
|
FString NameRemainder;
|
|
//if this is a leaf test (no ".")
|
|
if (!InTestInfo.GetDisplayName().Split(TEXT("."), &NameToMatch, &NameRemainder))
|
|
{
|
|
NameToMatch = InTestInfo.GetDisplayName();
|
|
}
|
|
|
|
if ( NameRemainder.Len() != 0 )
|
|
{
|
|
// Set the test info name to be the remaining string
|
|
InTestInfo.SetDisplayName( NameRemainder );
|
|
}
|
|
|
|
uint32 NameToMatchHash = GetTypeHash(NameToMatch);
|
|
|
|
TSharedPtr<IAutomationReport> MatchTest;
|
|
//check hash table first to see if it exists yet
|
|
if (ChildReportNameHashes.Contains(NameToMatchHash))
|
|
{
|
|
//go backwards. Most recent event most likely matches
|
|
int32 TestIndex = ChildReports.Num() - 1;
|
|
for (; TestIndex >= 0; --TestIndex)
|
|
{
|
|
//if the name matches
|
|
if (ChildReports[TestIndex]->GetDisplayName() == NameToMatch)
|
|
{
|
|
MatchTest = ChildReports[TestIndex];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//if there isn't already a test like this
|
|
if (!MatchTest.IsValid())
|
|
{
|
|
if ( NameRemainder.Len() == 0 )
|
|
{
|
|
// Create a new leaf node
|
|
MatchTest = MakeShareable(new FAutomationReport(InTestInfo));
|
|
}
|
|
else
|
|
{
|
|
// Create a parent node
|
|
FAutomationTestInfo ParentTestInfo(NameToMatch, TEXT(""), TEXT(""), InTestInfo.GetTestFlags(), InTestInfo.GetNumParticipantsRequired());
|
|
MatchTest = MakeShareable(new FAutomationReport(ParentTestInfo, true));
|
|
}
|
|
//make new test
|
|
ChildReports.Add(MatchTest);
|
|
ChildReportNameHashes.Add(NameToMatchHash, NameToMatchHash);
|
|
|
|
// Sort tests alphabetically
|
|
ChildReports.Sort
|
|
(
|
|
[](const TSharedPtr<IAutomationReport>& ReportA, const TSharedPtr<IAutomationReport>& ReportB)
|
|
{
|
|
bool AIsLeafNode = !ReportA->IsParent();
|
|
bool BIsLeafNode = !ReportB->IsParent();
|
|
|
|
if (AIsLeafNode == BIsLeafNode) // both leaves or both parents => normal comparison
|
|
{
|
|
return ReportA->GetDisplayName() < ReportB->GetDisplayName();
|
|
}
|
|
else // leaf and parent => A is less than B when B is the leaf
|
|
{
|
|
return BIsLeafNode;
|
|
}
|
|
}
|
|
);
|
|
}
|
|
//mark this test as supported on a particular platform
|
|
MatchTest->SetSupport(ClusterIndex);
|
|
|
|
MatchTest->SetTestFlags( InTestInfo.GetTestFlags() );
|
|
MatchTest->SetNumParticipantsRequired( MatchTest->GetNumParticipantsRequired() > InTestInfo.GetNumParticipantsRequired() ? MatchTest->GetNumParticipantsRequired() : InTestInfo.GetNumParticipantsRequired() );
|
|
|
|
TSharedPtr<IAutomationReport> FoundTest;
|
|
//if this is a leaf node
|
|
if (NameRemainder.Len() == 0)
|
|
{
|
|
FoundTest = MatchTest;
|
|
}
|
|
else
|
|
{
|
|
//recurse to add to the proper layer
|
|
FoundTest = MatchTest->EnsureReportExists(InTestInfo, ClusterIndex, NumPasses);
|
|
}
|
|
|
|
return FoundTest;
|
|
}
|
|
|
|
|
|
TSharedPtr<IAutomationReport> FAutomationReport::GetNextReportToExecute(bool& bOutAllTestsComplete, const int32 ClusterIndex, const int32 PassIndex, const int32 NumDevicesInCluster)
|
|
{
|
|
TSharedPtr<IAutomationReport> NextReport;
|
|
//if this is not a leaf node
|
|
if (ChildReports.Num())
|
|
{
|
|
for (int32 ReportIndex = 0; ReportIndex < ChildReports.Num(); ++ReportIndex)
|
|
{
|
|
NextReport = ChildReports[ReportIndex]->GetNextReportToExecute(bOutAllTestsComplete, ClusterIndex, PassIndex, NumDevicesInCluster);
|
|
//if we found one, return it
|
|
if (NextReport.IsValid())
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//consider self
|
|
if (IsEnabled() && IsSupported(ClusterIndex))
|
|
{
|
|
EAutomationState::Type TestState = GetState(ClusterIndex,PassIndex);
|
|
//if any enabled test hasn't been run yet or is in process
|
|
if ((TestState != EAutomationState::Success) && (TestState != EAutomationState::Fail) && (TestState != EAutomationState::NotEnoughParticipants))
|
|
{
|
|
//make sure we announce we are NOT done with all tests
|
|
bOutAllTestsComplete = false;
|
|
}
|
|
if (TestState == EAutomationState::NotRun)
|
|
{
|
|
//Found one to run next
|
|
NextReport = AsShared();
|
|
}
|
|
}
|
|
}
|
|
return NextReport;
|
|
}
|
|
const bool FAutomationReport::HasErrors()
|
|
{
|
|
bool bHasErrors = false;
|
|
for (int32 ClusterIndex = 0; ClusterIndex < Results.Num(); ++ClusterIndex )
|
|
{
|
|
for( int32 PassIndex = 0; PassIndex < Results[ClusterIndex].Num(); ++PassIndex)
|
|
{
|
|
//if we want tests with errors and this test had them OR we want tests warnings and this test had them
|
|
if( Results[ ClusterIndex ][ PassIndex ].Errors.Num() )
|
|
{
|
|
//mark this test as having passed the results filter
|
|
bHasErrors = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return bHasErrors;
|
|
}
|
|
|
|
const bool FAutomationReport::HasWarnings()
|
|
{
|
|
bool bHasWarnings = false;
|
|
for (int32 ClusterIndex = 0; ClusterIndex < Results.Num(); ++ClusterIndex )
|
|
{
|
|
for( int32 PassIndex = 0; PassIndex < Results[ClusterIndex].Num(); ++PassIndex)
|
|
{
|
|
//if we want tests with errors and this test had them OR we want tests warnings and this test had them
|
|
if( Results[ ClusterIndex ][ PassIndex ].Warnings.Num() )
|
|
{
|
|
//mark this test as having passed the results filter
|
|
bHasWarnings = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return bHasWarnings;
|
|
}
|
|
|
|
|
|
const bool FAutomationReport::GetDurationRange(float& OutMinTime, float& OutMaxTime)
|
|
{
|
|
//assume we haven't found any tests that have completed successfully
|
|
OutMinTime = MAX_FLT;
|
|
OutMaxTime = 0.0f;
|
|
bool bAnyResultsFound = false;
|
|
|
|
//keep sum of all child tests
|
|
float ChildTotalMinTime = 0.0f;
|
|
float ChildTotalMaxTime = 0.0f;
|
|
for (int32 ReportIndex = 0; ReportIndex < ChildReports.Num(); ++ReportIndex)
|
|
{
|
|
float ChildMinTime = MAX_FLT;
|
|
float ChildMaxTime = 0.0f;
|
|
if (ChildReports[ReportIndex]->GetDurationRange(ChildMinTime, ChildMaxTime))
|
|
{
|
|
ChildTotalMinTime += ChildMinTime;
|
|
ChildTotalMaxTime += ChildMaxTime;
|
|
bAnyResultsFound = true;
|
|
}
|
|
}
|
|
|
|
//if any child test had valid timings
|
|
if (bAnyResultsFound)
|
|
{
|
|
OutMinTime = ChildTotalMinTime;
|
|
OutMaxTime = ChildTotalMaxTime;
|
|
}
|
|
|
|
for (int32 ClusterIndex = 0; ClusterIndex < Results.Num(); ++ClusterIndex )
|
|
{
|
|
for( int32 PassIndex = 0; PassIndex < Results[ClusterIndex].Num(); ++PassIndex)
|
|
{
|
|
//if we want tests with errors and this test had them OR we want tests warnings and this test had them
|
|
if( Results[ClusterIndex][PassIndex].State == EAutomationState::Success ||
|
|
Results[ClusterIndex][PassIndex].State == EAutomationState::Fail)
|
|
{
|
|
OutMinTime = FMath::Min(OutMinTime, Results[ClusterIndex][PassIndex].Duration );
|
|
OutMaxTime = FMath::Max(OutMaxTime, Results[ClusterIndex][PassIndex].Duration );
|
|
bAnyResultsFound = true;
|
|
}
|
|
}
|
|
}
|
|
return bAnyResultsFound;
|
|
}
|
|
|
|
|
|
const int32 FAutomationReport::GetNumDevicesRunningTest() const
|
|
{
|
|
return TestInfo.GetNumDevicesRunningTest();
|
|
}
|
|
|
|
|
|
const int32 FAutomationReport::GetNumParticipantsRequired() const
|
|
{
|
|
return TestInfo.GetNumParticipantsRequired();
|
|
}
|
|
|
|
|
|
void FAutomationReport::SetNumParticipantsRequired( const int32 NewCount )
|
|
{
|
|
TestInfo.SetNumParticipantsRequired( NewCount );
|
|
}
|
|
|
|
|
|
bool FAutomationReport::IncrementNetworkCommandResponses()
|
|
{
|
|
NumberNetworkResponsesReceived++;
|
|
return (NumberNetworkResponsesReceived == TestInfo.GetNumParticipantsRequired());
|
|
}
|
|
|
|
|
|
void FAutomationReport::ResetNetworkCommandResponses()
|
|
{
|
|
NumberNetworkResponsesReceived = 0;
|
|
}
|
|
|
|
|
|
const bool FAutomationReport::ExpandInUI() const
|
|
{
|
|
return bNodeExpandInUI;
|
|
}
|
|
|
|
|
|
void FAutomationReport::StopRunningTest()
|
|
{
|
|
if( IsEnabled() )
|
|
{
|
|
for( int32 ResultsIndex = 0; ResultsIndex < Results.Num(); ++ResultsIndex )
|
|
{
|
|
for( int32 PassIndex = 0; PassIndex < Results[ResultsIndex].Num(); ++PassIndex)
|
|
{
|
|
if( Results[ResultsIndex][PassIndex].State == EAutomationState::InProcess )
|
|
{
|
|
Results[ResultsIndex][PassIndex].State = EAutomationState::NotRun;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Recurse to children
|
|
for( int32 ChildIndex = 0; ChildIndex < ChildReports.Num(); ++ChildIndex )
|
|
{
|
|
ChildReports[ChildIndex]->StopRunningTest();
|
|
}
|
|
} |