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]
922 lines
30 KiB
C++
922 lines
30 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AutomationControllerPrivatePCH.h"
|
|
#include "JsonObjectConverter.h"
|
|
|
|
#if WITH_EDITOR
|
|
#include "MessageLog.h"
|
|
#endif
|
|
|
|
namespace AutomationControllerConstants
|
|
{
|
|
const FString HistoryConfigSectionName = TEXT("AutomationController.History");
|
|
}
|
|
|
|
void FAutomationControllerManager::RequestAvailableWorkers(const FGuid& SessionId)
|
|
{
|
|
//invalidate previous tests
|
|
++ExecutionCount;
|
|
DeviceClusterManager.Reset();
|
|
|
|
ControllerResetDelegate.Broadcast();
|
|
|
|
// Don't allow reports to be exported
|
|
bTestResultsAvailable = false;
|
|
|
|
//store off active session ID to reject messages that come in from different sessions
|
|
ActiveSessionId = SessionId;
|
|
|
|
//TODO AUTOMATION - include change list, game, etc, or remove when launcher is integrated
|
|
int32 ChangelistNumber = 10000;
|
|
FString ProcessName = TEXT("instance_name");
|
|
|
|
MessageEndpoint->Publish(new FAutomationWorkerFindWorkers(ChangelistNumber, FApp::GetGameName(), ProcessName, SessionId), EMessageScope::Network);
|
|
|
|
// Reset the check test timers
|
|
LastTimeUpdateTicked = FPlatformTime::Seconds();
|
|
CheckTestTimer = 0.f;
|
|
}
|
|
|
|
void FAutomationControllerManager::RequestTests()
|
|
{
|
|
//invalidate incoming results
|
|
ExecutionCount++;
|
|
//reset the number of responses we have received
|
|
RefreshTestResponses = 0;
|
|
|
|
ReportManager.Empty();
|
|
|
|
for (int32 ClusterIndex = 0; ClusterIndex < DeviceClusterManager.GetNumClusters(); ++ClusterIndex)
|
|
{
|
|
int32 DevicesInCluster = DeviceClusterManager.GetNumDevicesInCluster(ClusterIndex);
|
|
if (DevicesInCluster > 0)
|
|
{
|
|
FMessageAddress MessageAddress = DeviceClusterManager.GetDeviceMessageAddress(ClusterIndex, 0);
|
|
|
|
ResetIntermediateTestData();
|
|
|
|
//issue tests on appropriate platforms
|
|
MessageEndpoint->Send(new FAutomationWorkerRequestTests(bDeveloperDirectoryIncluded, RequestedTestFlags), MessageAddress);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::RunTests( const bool bInIsLocalSession )
|
|
{
|
|
ExecutionCount++;
|
|
CurrentTestPass = 0;
|
|
ReportManager.SetCurrentTestPass(CurrentTestPass);
|
|
ClusterDistributionMask = 0;
|
|
bTestResultsAvailable = false;
|
|
TestRunningArray.Empty();
|
|
bIsLocalSession = bInIsLocalSession;
|
|
|
|
// Reset the check test timers
|
|
LastTimeUpdateTicked = FPlatformTime::Seconds();
|
|
CheckTestTimer = 0.f;
|
|
|
|
#if WITH_EDITOR
|
|
FMessageLog AutomationTestingLog("AutomationTestingLog");
|
|
FString NewPageName = FString::Printf(TEXT("-----Test Run %d----"), ExecutionCount);
|
|
FText NewPageNameText = FText::FromString(*NewPageName);
|
|
AutomationTestingLog.Open();
|
|
AutomationTestingLog.NewPage(NewPageNameText);
|
|
AutomationTestingLog.Info(NewPageNameText);
|
|
#endif
|
|
//reset all tests
|
|
ReportManager.ResetForExecution(NumTestPasses);
|
|
|
|
for (int32 ClusterIndex = 0; ClusterIndex < DeviceClusterManager.GetNumClusters(); ++ClusterIndex)
|
|
{
|
|
//enable each device cluster
|
|
ClusterDistributionMask |= (1<<ClusterIndex);
|
|
|
|
//for each device in this cluster
|
|
for (int32 DeviceIndex = 0; DeviceIndex < DeviceClusterManager.GetNumDevicesInCluster(ClusterIndex); ++DeviceIndex)
|
|
{
|
|
//mark the device as idle
|
|
DeviceClusterManager.SetTest(ClusterIndex, DeviceIndex, NULL);
|
|
|
|
// Send command to reset tests (delete local files, etc)
|
|
FMessageAddress MessageAddress = DeviceClusterManager.GetDeviceMessageAddress(ClusterIndex, DeviceIndex);
|
|
MessageEndpoint->Send(new FAutomationWorkerResetTests(), MessageAddress);
|
|
}
|
|
}
|
|
|
|
// Inform the UI we are running tests
|
|
if (ClusterDistributionMask != 0)
|
|
{
|
|
SetControllerStatus( EAutomationControllerModuleState::Running );
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::StopTests()
|
|
{
|
|
bTestResultsAvailable = false;
|
|
ClusterDistributionMask = 0;
|
|
|
|
ReportManager.StopRunningTests();
|
|
|
|
// Inform the UI we have stopped running tests
|
|
if (DeviceClusterManager.HasActiveDevice())
|
|
{
|
|
SetControllerStatus( EAutomationControllerModuleState::Ready );
|
|
}
|
|
else
|
|
{
|
|
SetControllerStatus( EAutomationControllerModuleState::Disabled );
|
|
}
|
|
|
|
TestRunningArray.Empty();
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::Init()
|
|
{
|
|
AutomationTestState = EAutomationControllerModuleState::Disabled;
|
|
bTestResultsAvailable = false;
|
|
bScreenshotsEnabled = true;
|
|
bSendAnalytics = FParse::Param(FCommandLine::Get(), TEXT("SendAutomationAnalytics"));
|
|
|
|
// Update the ini with the settings
|
|
bTrackHistory = false;
|
|
GConfig->GetBool(*AutomationControllerConstants::HistoryConfigSectionName, TEXT("bTrackHistory"), bTrackHistory, GEngineIni);
|
|
|
|
// Default num of items to track
|
|
NumberOfHistoryItemsTracked = 5;
|
|
GConfig->GetInt(*AutomationControllerConstants::HistoryConfigSectionName, TEXT("NumberOfHistoryItemsTracked"), NumberOfHistoryItemsTracked, GEngineIni);
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::RequestLoadAsset( const FString& InAssetName )
|
|
{
|
|
MessageEndpoint->Publish(new FAssetEditorRequestOpenAsset(InAssetName), EMessageScope::Process);
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::Tick()
|
|
{
|
|
ProcessAvailableTasks();
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::ProcessAvailableTasks()
|
|
{
|
|
// Distribute tasks
|
|
if( ClusterDistributionMask != 0)
|
|
{
|
|
// For each device cluster
|
|
for( int32 ClusterIndex = 0; ClusterIndex < DeviceClusterManager.GetNumClusters(); ++ClusterIndex )
|
|
{
|
|
bool bAllTestsComplete = true;
|
|
|
|
// If any of the devices were valid
|
|
if( ( ClusterDistributionMask & ( 1<< ClusterIndex ) ) && DeviceClusterManager.GetNumDevicesInCluster( ClusterIndex ) > 0 )
|
|
{
|
|
ExecuteNextTask( ClusterIndex, bAllTestsComplete );
|
|
}
|
|
|
|
//if we're all done running our tests
|
|
if ( bAllTestsComplete )
|
|
{
|
|
//we don't need to test this cluster anymore
|
|
ClusterDistributionMask &= ~( 1<<ClusterIndex );
|
|
|
|
if ( ClusterDistributionMask == 0 )
|
|
{
|
|
ProcessResults();
|
|
//Notify the graphical layout we are done processing results.
|
|
TestsCompleteDelegate.Broadcast();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (bIsLocalSession == false)
|
|
{
|
|
// Update the test status for timeouts if this is not a local session
|
|
UpdateTests();
|
|
}
|
|
}
|
|
|
|
void FAutomationControllerManager::ReportTestResults()
|
|
{
|
|
GLog->Logf(TEXT("Test Pass Results:"));
|
|
for (int i = 0; i < OurPassResults.TestInformation.Num(); i++)
|
|
{
|
|
GLog->Logf(TEXT("%s: %s"), *OurPassResults.TestInformation[i].TestName, *OurPassResults.TestInformation[i].TestResult);
|
|
}
|
|
}
|
|
|
|
void FAutomationControllerManager::CollectTestNotes(FString TestName, const FAutomationWorkerRunTestsReply& Message)
|
|
{
|
|
for (int i = 0; i < OurPassResults.TestInformation.Num(); i++)
|
|
{
|
|
if (OurPassResults.TestInformation[i].TestName == TestName)
|
|
{
|
|
OurPassResults.TestInformation[i].TestInfo = Message.Logs;
|
|
OurPassResults.TestInformation[i].TestWarnings = Message.Warnings;
|
|
for (int j = 0; j < Message.Errors.Num(); j++)
|
|
{
|
|
OurPassResults.TestInformation[i].TestErrors.Add(Message.Errors[j].Message);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
void FAutomationControllerManager::UpdateTestResultValue(FString TestName, EAutomationState::Type TestResult)
|
|
{
|
|
for (int i = 0; i < OurPassResults.TestInformation.Num(); i++)
|
|
{
|
|
if (OurPassResults.TestInformation[i].TestName == TestName)
|
|
{
|
|
OurPassResults.TestInformation[i].TestResult = EAutomationState::ToString(TestResult);
|
|
switch (TestResult)
|
|
{
|
|
case EAutomationState::Success:
|
|
OurPassResults.NumSucceeded++;
|
|
break;
|
|
case EAutomationState::Fail:
|
|
OurPassResults.NumFailed++;
|
|
break;
|
|
default:
|
|
OurPassResults.NumNotRun++;
|
|
break;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
void FAutomationControllerManager::GenerateJsonTestPassSummary()
|
|
{
|
|
if (!OurPassResults.TestInformation.Num())
|
|
{
|
|
return;
|
|
}
|
|
const FAutomatedTestPassResults SerializedPassResults = OurPassResults;
|
|
TSharedPtr<FJsonObject> ReportJson = FJsonObjectConverter::UStructToJsonObject(SerializedPassResults);
|
|
if (ReportJson.IsValid())
|
|
{
|
|
FString ReportFileName = FString::Printf(TEXT("%s/AutomationReport-%d-%s.json"), *FPaths::AutomationLogDir(), FEngineVersion::Current().GetChangelist(), *FDateTime::Now().ToString());
|
|
FArchive* ReportFileWriter = IFileManager::Get().CreateFileWriter(*ReportFileName);
|
|
if (ReportFileWriter != nullptr)
|
|
{
|
|
TSharedRef<TJsonWriter<> > JsonWriter = TJsonWriterFactory<>::Create(ReportFileWriter, 0);
|
|
FJsonSerializer::Serialize(ReportJson.ToSharedRef(), JsonWriter);
|
|
|
|
delete ReportFileWriter;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GLog->Logf(ELogVerbosity::Error, TEXT("Test Report Json is invalid - report not generated."));
|
|
}
|
|
}
|
|
|
|
void FAutomationControllerManager::ExecuteNextTask( int32 ClusterIndex, OUT bool& bAllTestsCompleted )
|
|
{
|
|
bool bTestThatRequiresMultiplePraticipantsHadEnoughParticipants = false;
|
|
TArray< IAutomationReportPtr > TestsRunThisPass;
|
|
|
|
// For each device in this cluster
|
|
int32 NumDevicesInCluster = DeviceClusterManager.GetNumDevicesInCluster( ClusterIndex );
|
|
for( int32 DeviceIndex = 0; DeviceIndex < NumDevicesInCluster; ++DeviceIndex )
|
|
{
|
|
// If this device is idle
|
|
if( !DeviceClusterManager.GetTest( ClusterIndex, DeviceIndex ).IsValid() && DeviceClusterManager.DeviceEnabled( ClusterIndex, DeviceIndex ) )
|
|
{
|
|
// Get the next test that should be worked on
|
|
TSharedPtr< IAutomationReport > NextTest = ReportManager.GetNextReportToExecute( bAllTestsCompleted, ClusterIndex,CurrentTestPass, NumDevicesInCluster );
|
|
if( NextTest.IsValid() )
|
|
{
|
|
// Get the status of the test
|
|
EAutomationState::Type TestState = NextTest->GetState( ClusterIndex,CurrentTestPass );
|
|
if( TestState == EAutomationState::NotRun )
|
|
{
|
|
// Reserve this device for the test
|
|
DeviceClusterManager.SetTest( ClusterIndex, DeviceIndex, NextTest );
|
|
TestsRunThisPass.Add( NextTest );
|
|
|
|
// Register this as a test we'll need to report on.
|
|
FAutomatedTestResult tempresult;
|
|
tempresult.TestName = NextTest->GetDisplayName();
|
|
OurPassResults.TestInformation.Add(tempresult);
|
|
|
|
// If we now have enough devices reserved for the test, run it!
|
|
TArray<FMessageAddress> DeviceAddresses = DeviceClusterManager.GetDevicesReservedForTest( ClusterIndex, NextTest );
|
|
if( DeviceAddresses.Num() == NextTest->GetNumParticipantsRequired() )
|
|
{
|
|
// Send it to each device
|
|
for (int32 AddressIndex = 0; AddressIndex < DeviceAddresses.Num(); ++AddressIndex)
|
|
{
|
|
FAutomationTestResults TestResults;
|
|
|
|
GLog->Logf(ELogVerbosity::Display, TEXT("Running Automation: '%s' (Class Name: '%s')"), *TestsRunThisPass[AddressIndex]->GetDisplayName(), *TestsRunThisPass[AddressIndex]->GetCommand());
|
|
TestResults.State = EAutomationState::InProcess;
|
|
|
|
TestResults.GameInstance = DeviceClusterManager.GetClusterDeviceName( ClusterIndex, DeviceIndex );
|
|
NextTest->SetResults( ClusterIndex,CurrentTestPass, TestResults );
|
|
NextTest->ResetNetworkCommandResponses();
|
|
|
|
// Mark the device as busy
|
|
FMessageAddress DeviceAddress = DeviceAddresses[AddressIndex];
|
|
|
|
// Send the test to the device for execution!
|
|
MessageEndpoint->Send(new FAutomationWorkerRunTests(ExecutionCount, AddressIndex, NextTest->GetCommand(), NextTest->GetDisplayName(), bScreenshotsEnabled, bSendAnalytics), DeviceAddress);
|
|
|
|
// Add a test so we can check later if the device is still active
|
|
TestRunningArray.Add( FTestRunningInfo( DeviceAddress ) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// At least one device is still working
|
|
bAllTestsCompleted = false;
|
|
}
|
|
}
|
|
|
|
// Ensure any tests we have attempted to run on this pass had enough participants to successfully run.
|
|
for( int32 TestIndex = 0; TestIndex < TestsRunThisPass.Num(); TestIndex++ )
|
|
{
|
|
IAutomationReportPtr CurrentTest = TestsRunThisPass[ TestIndex ];
|
|
|
|
if( CurrentTest->GetNumDevicesRunningTest() != CurrentTest->GetNumParticipantsRequired() )
|
|
{
|
|
if( GetNumDevicesInCluster( ClusterIndex ) < CurrentTest->GetNumParticipantsRequired() )
|
|
{
|
|
float EmptyDuration = 0.0f;
|
|
TArray<FString> EmptyStringArray;
|
|
TArray<FString> AutomationsWarnings;
|
|
AutomationsWarnings.Add( FString::Printf( TEXT( "Needed %d devices to participate, Only had %d available." ), CurrentTest->GetNumParticipantsRequired(), DeviceClusterManager.GetNumDevicesInCluster( ClusterIndex ) ) );
|
|
|
|
FAutomationTestResults TestResults;
|
|
TestResults.State = EAutomationState::NotEnoughParticipants;
|
|
TestResults.GameInstance = DeviceClusterManager.GetClusterDeviceName(ClusterIndex, 0);
|
|
TestResults.Warnings.Append( AutomationsWarnings );
|
|
|
|
CurrentTest->SetResults( ClusterIndex,CurrentTestPass, TestResults );
|
|
DeviceClusterManager.ResetAllDevicesRunningTest( ClusterIndex, CurrentTest );
|
|
}
|
|
}
|
|
}
|
|
|
|
//Check to see if we finished a pass
|
|
if( bAllTestsCompleted && CurrentTestPass < NumTestPasses - 1 )
|
|
{
|
|
CurrentTestPass++;
|
|
ReportManager.SetCurrentTestPass(CurrentTestPass);
|
|
bAllTestsCompleted = false;
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::Startup()
|
|
{
|
|
MessageEndpoint = FMessageEndpoint::Builder("FAutomationControllerModule")
|
|
.Handling<FAutomationWorkerFindWorkersResponse>(this, &FAutomationControllerManager::HandleFindWorkersResponseMessage)
|
|
.Handling<FAutomationWorkerPong>(this, &FAutomationControllerManager::HandlePongMessage)
|
|
.Handling<FAutomationWorkerRequestNextNetworkCommand>(this, &FAutomationControllerManager::HandleRequestNextNetworkCommandMessage)
|
|
.Handling<FAutomationWorkerRequestTestsReply>(this, &FAutomationControllerManager::HandleRequestTestsReplyMessage)
|
|
.Handling<FAutomationWorkerRequestTestsReplyComplete>(this, &FAutomationControllerManager::HandleRequestTestsReplyCompleteMessage)
|
|
.Handling<FAutomationWorkerRunTestsReply>(this, &FAutomationControllerManager::HandleRunTestsReplyMessage)
|
|
.Handling<FAutomationWorkerScreenImage>(this, &FAutomationControllerManager::HandleReceivedScreenShot)
|
|
.Handling<FAutomationWorkerWorkerOffline>(this, &FAutomationControllerManager::HandleWorkerOfflineMessage);
|
|
|
|
if (MessageEndpoint.IsValid())
|
|
{
|
|
MessageEndpoint->Subscribe<FAutomationWorkerWorkerOffline>();
|
|
}
|
|
|
|
ClusterDistributionMask = 0;
|
|
ExecutionCount = 0;
|
|
bDeveloperDirectoryIncluded = false;
|
|
RequestedTestFlags = EAutomationTestFlags::SmokeFilter | EAutomationTestFlags::EngineFilter | EAutomationTestFlags::ProductFilter | EAutomationTestFlags::PerfFilter;
|
|
|
|
NumOfTestsToReceive = 0;
|
|
NumTestPasses = 1;
|
|
|
|
//Default to machine name
|
|
DeviceGroupFlags = 0;
|
|
ToggleDeviceGroupFlag(EAutomationDeviceGroupTypes::MachineName);
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::Shutdown()
|
|
{
|
|
MessageEndpoint.Reset();
|
|
ShutdownDelegate.Broadcast();
|
|
RemoveCallbacks();
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::RemoveCallbacks()
|
|
{
|
|
ShutdownDelegate.Clear();
|
|
TestsAvailableDelegate.Clear();
|
|
TestsRefreshedDelegate.Clear();
|
|
TestsCompleteDelegate.Clear();
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::SetTestNames( const FMessageAddress& AutomationWorkerAddress )
|
|
{
|
|
int32 DeviceClusterIndex = INDEX_NONE;
|
|
int32 DeviceIndex = INDEX_NONE;
|
|
|
|
// Find the device that requested these tests
|
|
if( DeviceClusterManager.FindDevice( AutomationWorkerAddress, DeviceClusterIndex, DeviceIndex ) )
|
|
{
|
|
// Sort tests by display name
|
|
struct FCompareAutomationTestInfo
|
|
{
|
|
FORCEINLINE bool operator()(const FAutomationTestInfo& A,const FAutomationTestInfo& B) const
|
|
{
|
|
return A.GetDisplayName() < B.GetDisplayName();
|
|
}
|
|
};
|
|
|
|
TestInfo.Sort(FCompareAutomationTestInfo());
|
|
|
|
// Add each test to the collection
|
|
for( int32 TestIndex = 0; TestIndex < TestInfo.Num(); ++TestIndex )
|
|
{
|
|
// Ensure our test exists. If not, add it
|
|
ReportManager.EnsureReportExists( TestInfo[TestIndex], DeviceClusterIndex, NumTestPasses );
|
|
}
|
|
|
|
// Clear any intermediate data we had associated with the tests whilst building the full list of tests
|
|
ResetIntermediateTestData();
|
|
}
|
|
else
|
|
{
|
|
//todo automation - make sure to report error if the device was not discovered correctly
|
|
}
|
|
|
|
// Note the response
|
|
RefreshTestResponses++;
|
|
|
|
// If we have received all the responses we expect to
|
|
if (RefreshTestResponses == DeviceClusterManager.GetNumClusters())
|
|
{
|
|
TestsRefreshedDelegate.Broadcast();
|
|
|
|
// Update the tests with tracking details
|
|
ReportManager.TrackHistory(bTrackHistory, NumberOfHistoryItemsTracked);
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::ProcessResults()
|
|
{
|
|
bHasErrors = false;
|
|
bHasWarning = false;
|
|
bHasLogs = false;
|
|
|
|
TArray< TSharedPtr< IAutomationReport > >& TestReports = GetReports();
|
|
|
|
if (TestReports.Num())
|
|
{
|
|
bTestResultsAvailable = true;
|
|
|
|
for (int32 Index = 0; Index < TestReports.Num(); Index++)
|
|
{
|
|
CheckChildResult(TestReports[Index ]);
|
|
}
|
|
}
|
|
|
|
// Write our the report of our automation pass to JSON. Then clean our array for the next pass.
|
|
GenerateJsonTestPassSummary();
|
|
OurPassResults.ClearAllEntries();
|
|
|
|
|
|
SetControllerStatus( EAutomationControllerModuleState::Ready );
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::CheckChildResult(TSharedPtr<IAutomationReport> InReport)
|
|
{
|
|
TArray<TSharedPtr<IAutomationReport> >& ChildReports = InReport->GetChildReports();
|
|
|
|
if (ChildReports.Num() > 0)
|
|
{
|
|
for (int32 Index = 0; Index < ChildReports.Num(); Index++)
|
|
{
|
|
CheckChildResult(ChildReports[Index]);
|
|
}
|
|
}
|
|
else if ((bHasErrors && bHasWarning && bHasLogs ) == false && InReport->IsEnabled())
|
|
{
|
|
for (int32 ClusterIndex = 0; ClusterIndex < GetNumDeviceClusters(); ++ClusterIndex)
|
|
{
|
|
FAutomationTestResults TestResults = InReport->GetResults( ClusterIndex,CurrentTestPass );
|
|
|
|
if (TestResults.Errors.Num())
|
|
{
|
|
bHasErrors = true;
|
|
}
|
|
if (TestResults.Warnings.Num())
|
|
{
|
|
bHasWarning = true;
|
|
}
|
|
if (TestResults.Logs.Num())
|
|
{
|
|
bHasLogs = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::SetControllerStatus( EAutomationControllerModuleState::Type InAutomationTestState )
|
|
{
|
|
if (InAutomationTestState != AutomationTestState)
|
|
{
|
|
// Inform the UI if the test state has changed
|
|
AutomationTestState = InAutomationTestState;
|
|
TestsAvailableDelegate.Broadcast(AutomationTestState);
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::RemoveTestRunning( const FMessageAddress& TestAddressToRemove )
|
|
{
|
|
for ( int32 Index = 0; Index < TestRunningArray.Num(); Index++ )
|
|
{
|
|
if ( TestRunningArray[ Index ].OwnerMessageAddress == TestAddressToRemove )
|
|
{
|
|
TestRunningArray.RemoveAt( Index );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::AddPingResult( const FMessageAddress& ResponderAddress )
|
|
{
|
|
for ( int32 Index = 0; Index < TestRunningArray.Num(); Index++ )
|
|
{
|
|
if ( TestRunningArray[ Index ].OwnerMessageAddress == ResponderAddress )
|
|
{
|
|
TestRunningArray[ Index ].LastPingTime = 0;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::UpdateTests( )
|
|
{
|
|
static const float CheckTestInterval = 1.0f;
|
|
static const float GameInstanceLostTimer = 200.0f;
|
|
|
|
CheckTestTimer += FPlatformTime::Seconds() - LastTimeUpdateTicked;
|
|
LastTimeUpdateTicked = FPlatformTime::Seconds();
|
|
if ( CheckTestTimer > CheckTestInterval )
|
|
{
|
|
for ( int32 Index = 0; Index < TestRunningArray.Num(); Index++ )
|
|
{
|
|
TestRunningArray[ Index ].LastPingTime += CheckTestTimer;
|
|
|
|
if ( TestRunningArray[ Index ].LastPingTime > GameInstanceLostTimer )
|
|
{
|
|
// Find the game session instance info
|
|
int32 ClusterIndex;
|
|
int32 DeviceIndex;
|
|
verify( DeviceClusterManager.FindDevice( TestRunningArray[ Index ].OwnerMessageAddress, ClusterIndex, DeviceIndex ) );
|
|
//verify this device thought it was busy
|
|
TSharedPtr <IAutomationReport> Report = DeviceClusterManager.GetTest(ClusterIndex, DeviceIndex);
|
|
check (Report.IsValid());
|
|
// A dummy array used to report the result
|
|
|
|
TArray<FString> EmptyStringArray;
|
|
TArray<FString> ErrorStringArray;
|
|
ErrorStringArray.Add( FString( TEXT( "Failed" ) ) );
|
|
bHasErrors = true;
|
|
GLog->Logf(ELogVerbosity::Display, TEXT("Timeout hit. Nooooooo."));
|
|
|
|
FAutomationTestResults TestResults;
|
|
TestResults.State = EAutomationState::Fail;
|
|
TestResults.GameInstance = DeviceClusterManager.GetClusterDeviceName(ClusterIndex, DeviceIndex);
|
|
|
|
// Set the results
|
|
Report->SetResults(ClusterIndex,CurrentTestPass, TestResults );
|
|
bTestResultsAvailable = true;
|
|
|
|
// Disable the device in the cluster so it is not used again
|
|
DeviceClusterManager.DisableDevice( ClusterIndex, DeviceIndex );
|
|
|
|
// Remove the running test
|
|
TestRunningArray.RemoveAt( Index-- );
|
|
|
|
// If there are no more devices, set the module state to disabled
|
|
if ( DeviceClusterManager.HasActiveDevice() == false )
|
|
{
|
|
GLog->Logf(ELogVerbosity::Display, TEXT("Module disabled"));
|
|
SetControllerStatus( EAutomationControllerModuleState::Disabled );
|
|
ClusterDistributionMask = 0;
|
|
}
|
|
else
|
|
{
|
|
GLog->Logf(ELogVerbosity::Display, TEXT("Module not disabled. Keep looking."));
|
|
// Remove the cluster from the mask if there are no active devices left
|
|
if ( DeviceClusterManager.GetNumActiveDevicesInCluster( ClusterIndex ) == 0 )
|
|
{
|
|
ClusterDistributionMask &= ~( 1<<ClusterIndex );
|
|
}
|
|
if ( TestRunningArray.Num() == 0 )
|
|
{
|
|
SetControllerStatus( EAutomationControllerModuleState::Ready );
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageEndpoint->Send(new FAutomationWorkerPing(), TestRunningArray[Index].OwnerMessageAddress);
|
|
}
|
|
}
|
|
CheckTestTimer = 0.f;
|
|
}
|
|
}
|
|
|
|
|
|
const bool FAutomationControllerManager::ExportReport( uint32 FileExportTypeMask )
|
|
{
|
|
return ReportManager.ExportReport( FileExportTypeMask, GetNumDeviceClusters() );
|
|
}
|
|
|
|
|
|
bool FAutomationControllerManager::IsTestRunnable( IAutomationReportPtr InReport ) const
|
|
{
|
|
bool bIsRunnable = false;
|
|
|
|
for( int32 ClusterIndex = 0; ClusterIndex < GetNumDeviceClusters(); ++ClusterIndex )
|
|
{
|
|
if( InReport->IsSupported( ClusterIndex ) )
|
|
{
|
|
if( GetNumDevicesInCluster( ClusterIndex ) >= InReport->GetNumParticipantsRequired() )
|
|
{
|
|
bIsRunnable = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return bIsRunnable;
|
|
}
|
|
|
|
/* FAutomationControllerModule callbacks
|
|
*****************************************************************************/
|
|
|
|
void FAutomationControllerManager::HandleFindWorkersResponseMessage( const FAutomationWorkerFindWorkersResponse& Message, const IMessageContextRef& Context )
|
|
{
|
|
if (Message.SessionId == ActiveSessionId)
|
|
{
|
|
DeviceClusterManager.AddDeviceFromMessage(Context->GetSender(), Message, DeviceGroupFlags);
|
|
}
|
|
|
|
RequestTests();
|
|
|
|
SetControllerStatus( EAutomationControllerModuleState::Ready );
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::HandlePongMessage( const FAutomationWorkerPong& Message, const IMessageContextRef& Context )
|
|
{
|
|
AddPingResult(Context->GetSender());
|
|
}
|
|
|
|
void FAutomationControllerManager::HandleReceivedScreenShot( const FAutomationWorkerScreenImage& Message, const IMessageContextRef& Context )
|
|
{
|
|
// Forward the screen shot on to listeners
|
|
FAutomationWorkerScreenImage* ImageMessage = new FAutomationWorkerScreenImage(Message);
|
|
MessageEndpoint->Publish(ImageMessage, EMessageScope::Network);
|
|
|
|
//// TODO Automation Why are we doing this???? It's not actually storing them, that's handled by the ScreenShotManager.cpp
|
|
//{
|
|
// // Save the screen shot locally (assuming that the controller manager is running on PC/Mac)
|
|
// const bool bTree = true;
|
|
// IFileManager::Get().MakeDirectory(*FPaths::GetPath(Message.ScreenShotName), bTree);
|
|
// FFileHelper::SaveArrayToFile(Message.ScreenImage, *Message.ScreenShotName);
|
|
|
|
// // TODO Automation There is identical code in, Engine\Source\Runtime\AutomationWorker\Private\AutomationWorkerModule.cpp,
|
|
// // need to move this code into common area.
|
|
|
|
// TSharedPtr<FJsonObject> MetadataJson = FJsonObjectConverter::UStructToJsonObject(Message.Metadata);
|
|
|
|
// if ( MetadataJson.IsValid() )
|
|
// {
|
|
// FString MetadataPath = FPaths::ChangeExtension(Message.ScreenShotName, TEXT("json"));
|
|
// FArchive* MetadataWriter = IFileManager::Get().CreateFileWriter(*MetadataPath);
|
|
|
|
// if ( MetadataWriter != nullptr )
|
|
// {
|
|
// TSharedRef<TJsonWriter<> > JsonWriter = TJsonWriterFactory<>::Create(MetadataWriter, 0);
|
|
// FJsonSerializer::Serialize(MetadataJson.ToSharedRef(), JsonWriter);
|
|
|
|
// delete MetadataWriter;
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
|
|
void FAutomationControllerManager::HandleRequestNextNetworkCommandMessage( const FAutomationWorkerRequestNextNetworkCommand& Message, const IMessageContextRef& Context )
|
|
{
|
|
// Harvest iteration of running the tests this result came from (stops stale results from being committed to subsequent runs)
|
|
if (Message.ExecutionCount == ExecutionCount)
|
|
{
|
|
// Find the device id for the address
|
|
int32 ClusterIndex;
|
|
int32 DeviceIndex;
|
|
|
|
verify(DeviceClusterManager.FindDevice(Context->GetSender(), ClusterIndex, DeviceIndex));
|
|
|
|
// Verify this device thought it was busy
|
|
TSharedPtr <IAutomationReport> Report = DeviceClusterManager.GetTest(ClusterIndex, DeviceIndex);
|
|
check (Report.IsValid());
|
|
|
|
// Increment network command responses
|
|
bool bAllResponsesReceived = Report->IncrementNetworkCommandResponses();
|
|
|
|
// Test if we've accumulated all responses AND this was the result for the round of test running AND we're still running tests
|
|
if (bAllResponsesReceived && (ClusterDistributionMask & (1<<ClusterIndex)))
|
|
{
|
|
// Reset the counter
|
|
Report->ResetNetworkCommandResponses();
|
|
|
|
// For every device in this networked test
|
|
TArray<FMessageAddress> DeviceAddresses = DeviceClusterManager.GetDevicesReservedForTest(ClusterIndex, Report);
|
|
check (DeviceAddresses.Num() == Report->GetNumParticipantsRequired());
|
|
|
|
// Send it to each device
|
|
for (int32 AddressIndex = 0; AddressIndex < DeviceAddresses.Num(); ++AddressIndex)
|
|
{
|
|
//send "next command message" to worker
|
|
MessageEndpoint->Send(new FAutomationWorkerNextNetworkCommandReply(), DeviceAddresses[AddressIndex]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::HandleRequestTestsReplyMessage(const FAutomationWorkerRequestTestsReply& Message, const IMessageContextRef& Context)
|
|
{
|
|
FAutomationTestInfo NewTest = Message.GetTestInfo();
|
|
TestInfo.Add(NewTest);
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::HandleRequestTestsReplyCompleteMessage(const FAutomationWorkerRequestTestsReplyComplete& Message, const IMessageContextRef& Context)
|
|
{
|
|
SetTestNames(Context->GetSender());
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::HandleRunTestsReplyMessage( const FAutomationWorkerRunTestsReply& Message, const IMessageContextRef& Context )
|
|
{
|
|
// If we should commit these results
|
|
if (Message.ExecutionCount == ExecutionCount)
|
|
{
|
|
FAutomationTestResults TestResults;
|
|
|
|
TestResults.State = Message.Success ? EAutomationState::Success : EAutomationState::Fail;
|
|
TestResults.Duration = Message.Duration;
|
|
|
|
// Mark device as back on the market
|
|
int32 ClusterIndex;
|
|
int32 DeviceIndex;
|
|
|
|
verify(DeviceClusterManager.FindDevice(Context->GetSender(), ClusterIndex, DeviceIndex));
|
|
|
|
TestResults.GameInstance = DeviceClusterManager.GetClusterDeviceName(ClusterIndex, DeviceIndex);
|
|
for ( auto& Error : Message.Errors )
|
|
{
|
|
TestResults.Errors.Add(Error.ToAutomationEvent());
|
|
}
|
|
TestResults.Logs = Message.Logs;
|
|
TestResults.Warnings = Message.Warnings;
|
|
|
|
// Verify this device thought it was busy
|
|
TSharedPtr <IAutomationReport> Report = DeviceClusterManager.GetTest(ClusterIndex, DeviceIndex);
|
|
check(Report.IsValid());
|
|
|
|
Report->SetResults(ClusterIndex,CurrentTestPass, TestResults);
|
|
|
|
|
|
// Gather all of the data relevant to this test for our json reporting.
|
|
CollectTestNotes(Report->GetDisplayName(), Message);
|
|
UpdateTestResultValue(Report->GetDisplayName(), TestResults.State);
|
|
|
|
|
|
#if WITH_EDITOR
|
|
FMessageLog AutomationTestingLog("AutomationTestingLog");
|
|
AutomationTestingLog.Open();
|
|
#endif
|
|
|
|
for ( TArray<FAutomationEvent>::TConstIterator ErrorIter(TestResults.Errors); ErrorIter; ++ErrorIter )
|
|
{
|
|
// FAutomationTestFramework::Get().LogTestMessage(**ErrorIter, ELogVerbosity::Error);
|
|
GLog->Logf(ELogVerbosity::Error, TEXT("%s"), *( *ErrorIter ).ToString());
|
|
#if WITH_EDITOR
|
|
AutomationTestingLog.Error(FText::FromString(( *ErrorIter ).ToString()));
|
|
#endif
|
|
}
|
|
for (TArray<FString>::TConstIterator WarningIter(Message.Warnings); WarningIter; ++WarningIter)
|
|
{
|
|
GLog->Logf(ELogVerbosity::Warning, TEXT("%s"), **WarningIter);
|
|
#if WITH_EDITOR
|
|
AutomationTestingLog.Warning(FText::FromString(*WarningIter));
|
|
#endif
|
|
}
|
|
for (TArray<FString>::TConstIterator LogItemIter(Message.Logs); LogItemIter; ++LogItemIter)
|
|
{
|
|
GLog->Logf(ELogVerbosity::Log, TEXT("%s"), **LogItemIter);
|
|
#if WITH_EDITOR
|
|
AutomationTestingLog.Info(FText::FromString(*LogItemIter));
|
|
#endif
|
|
}
|
|
|
|
if (TestResults.State == EAutomationState::Success)
|
|
{
|
|
FString SuccessString = FString::Printf(TEXT("...Automation Test Succeeded (%s)"), *Report->GetDisplayName());
|
|
GLog->Logf(ELogVerbosity::Log, *SuccessString);
|
|
#if WITH_EDITOR
|
|
AutomationTestingLog.Info(FText::FromString(*SuccessString));
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
FString FailureString = FString::Printf(TEXT("...Automation Test Failed (%s)"), *Report->GetDisplayName());
|
|
GLog->Logf(ELogVerbosity::Log, *FailureString);
|
|
#if WITH_EDITOR
|
|
AutomationTestingLog.Error(FText::FromString(*FailureString));
|
|
#endif
|
|
//FAutomationTestFramework::Get().Lo
|
|
}
|
|
|
|
// const bool TestSucceeded = (TestResults.State == EAutomationState::Success);
|
|
//FAutomationTestFramework::Get().LogEndTestMessage(Report->GetDisplayName(), TestSucceeded);
|
|
|
|
// Device is now good to go
|
|
DeviceClusterManager.SetTest(ClusterIndex, DeviceIndex, NULL);
|
|
}
|
|
|
|
// Remove the running test
|
|
RemoveTestRunning(Context->GetSender());
|
|
}
|
|
|
|
|
|
void FAutomationControllerManager::HandleWorkerOfflineMessage( const FAutomationWorkerWorkerOffline& Message, const IMessageContextRef& Context )
|
|
{
|
|
FMessageAddress DeviceMessageAddress = Context->GetSender();
|
|
DeviceClusterManager.Remove(DeviceMessageAddress);
|
|
}
|
|
|
|
bool FAutomationControllerManager::IsDeviceGroupFlagSet( EAutomationDeviceGroupTypes::Type InDeviceGroup ) const
|
|
{
|
|
const uint32 FlagMask = 1 << InDeviceGroup;
|
|
return (DeviceGroupFlags & FlagMask) > 0;
|
|
}
|
|
|
|
void FAutomationControllerManager::ToggleDeviceGroupFlag( EAutomationDeviceGroupTypes::Type InDeviceGroup )
|
|
{
|
|
const uint32 FlagMask = 1 << InDeviceGroup;
|
|
DeviceGroupFlags = DeviceGroupFlags ^ FlagMask;
|
|
}
|
|
|
|
void FAutomationControllerManager::UpdateDeviceGroups( )
|
|
{
|
|
DeviceClusterManager.ReGroupDevices( DeviceGroupFlags );
|
|
|
|
// Update the reports in case the number of clusters changed
|
|
int32 NumOfClusters = DeviceClusterManager.GetNumClusters();
|
|
ReportManager.ClustersUpdated(NumOfClusters);
|
|
}
|
|
|
|
void FAutomationControllerManager::TrackReportHistory(const bool bShouldTrack, const int32 NumReportsToTrack)
|
|
{
|
|
bTrackHistory = bShouldTrack;
|
|
NumberOfHistoryItemsTracked = NumReportsToTrack;
|
|
|
|
// Update the ini with the settings
|
|
GConfig->SetBool(*AutomationControllerConstants::HistoryConfigSectionName, TEXT("bTrackHistory"), bTrackHistory, GEngineIni);
|
|
GConfig->SetInt(*AutomationControllerConstants::HistoryConfigSectionName, TEXT("NumberOfHistoryItemsTracked"), NumberOfHistoryItemsTracked, GEngineIni);
|
|
|
|
ReportManager.TrackHistory(bTrackHistory, NumberOfHistoryItemsTracked);
|
|
}
|
|
|
|
const bool FAutomationControllerManager::IsTrackingHistory() const
|
|
{
|
|
return bTrackHistory;
|
|
}
|
|
|
|
const int32 FAutomationControllerManager::GetNumberHistoryItemsTracking() const
|
|
{
|
|
return NumberOfHistoryItemsTracked;
|
|
} |