Files
UnrealEngineUWP/Engine/Source/Developer/AutomationController/Private/AutomationControllerManger.cpp
Nick Darnell 924baec97b Copying //UE4/Dev-Editor to //UE4/Dev-Main (Source: //UE4/Dev-Editor @ 3341527)
#lockdown Nick.Penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 3280282 on 2017/01/31 by Matt.Kuhlenschmidt

	GitHub 3171 : fix 'memoreport -full' causes ensure condition fail on particle object

Change 3281111 on 2017/02/01 by Michael.Dupuis

	#jira UE-36318 : was'nt notifying that we changed the current level in the case where you add/create new level in the Level window

Change 3281225 on 2017/02/01 by Jamie.Dale

	Several improvements to culture switching and LocRes files

	 - LocRes files now de-duplicate translations when they're generated, which can result in smaller LocRes files.
	 - The localization compilation step now produces a LocNat file, which contains meta-data specifying the native culture during compile, and where the native LocRes file can be found.
	 - Changing cultures now loads the native localization data prior to loading the non-native translations to ensure that translations are always applied to a consistent base.
	 - The "leet" culture (available when localization testing is enabled) is now always applied against the native translation, and correctly restores non-translated text when switching away from the "leet" culture.
	 - "-culture=leet" now works correctly on the command line ("-leet" also works).
	 - LoadLocalizationResourcesForCulture is no longer called multiple times during initialization of the text localization manager.
	 - General clean-up of localization code to favor using LocKeyFuncs with maps and sets, rather than rolling their own key funcs.

Change 3281291 on 2017/02/01 by Alexis.Matte

	Make sure the sections material slot assignation is persist correctly for staticmesh and for skeletal mesh
	#jira UE-39639

Change 3281718 on 2017/02/01 by Michael.Dupuis

	#jira UE-34186: invert processing order of special character, to take into account that key name could be considered a special character and would cause the assumption done to no longer be valid

Change 3281861 on 2017/02/01 by Alexis.Matte

	Fix import of morph target when there is no animation
	#jira UE-41383

Change 3282791 on 2017/02/02 by Chris.Wood

	Split crash analytics methods to fix comment parsing issues.
	[UE-32787] - Document Crash Report Client analytics events in code

Change 3283316 on 2017/02/02 by Alexis.Matte

	Make sure we do not import more then the maximum allowed node
	#jira UE-41405

Change 3283349 on 2017/02/02 by Jamie.Dale

	Updated Portal to stage its .locnat files

Change 3283927 on 2017/02/02 by Matt.Kuhlenschmidt

	Fix component/actor selection becoming out of sync after undo/redo

	#jira UE-41416

Change 3284061 on 2017/02/02 by Alexis.Matte

	Fix the scene importer front x axis import
	#jira UE-41318

Change 3284280 on 2017/02/02 by Alex.Delesky

	#jira UE-41060 - Placing blocking volumes in the level via the Content Menu's "Place Actor" command will now place a blocking volume in the level and not generate an empty warning in the output log

Change 3285053 on 2017/02/03 by Michael.Dupuis

	#jira UE-33777: Handle the global landscape editor ui command  list so specified shortcut will be treated

Change 3285444 on 2017/02/03 by Jamie.Dale

	Updated FastDecimalFormat to support the correct 0-9 numerals for the current locale

	These are typically still Latin, but Middle Eastern languages have some variants.

	This addresses an inconsistency between FText formatting of numbers and dates (since numbers always used Latin, but dates used the culture correct numerals).

Change 3287422 on 2017/02/06 by Michael.Dupuis

	#jira UE-36580: Improved the whole word algo to take into consideration localisation

Change 3287455 on 2017/02/06 by Alexis.Matte

	When swaping the mesh point by the mesh component, we noe clean up the override material instead of empty it.
	#jira UE-41397

Change 3287745 on 2017/02/06 by Alexis.Matte

	Merge from orion dev-general cl:3286668
	Fix a crash when importing a LOD containing different material with less sections

Change 3287996 on 2017/02/06 by Michael.Dupuis

	#jira UE-37290: fixed naming to be "move to level" instead of "move level"

Change 3288090 on 2017/02/06 by Jamie.Dale

	Fixing missing include breaking the FText natvis

Change 3288105 on 2017/02/06 by Jamie.Dale

	FTextStringHelper::ReadFromString_ComplexText now only looks at the start of the buffer when matching the complex text macros

Change 3288150 on 2017/02/06 by Jamie.Dale

	Fixing display names for tutorial categories so that they can be localized

	They were already FText, but the config wasn't defining them in a localizable way.

	#jira UE-37926

Change 3288469 on 2017/02/06 by Alex.Delesky

	#jira UE-35464 - Enables the editor to parse SubRip Subtitles files to create subtitle assets.

	This also introduces the Subtitles module.

Change 3288540 on 2017/02/06 by Alex.Delesky

	Backing out changelist 3288469 due to build issue with module includes

	#jira none

Change 3289074 on 2017/02/06 by Alex.Delesky

	Back out changelist 3288540 - reintroducing Subtitles module to parse SubRip Subtitles files

	#jira UE-35464

Change 3289753 on 2017/02/07 by Michael.Dupuis

	#jira UE-34599: Take into consideration UMaterialExpressionMaterialFunctionCall when getting the GUID

Change 3290097 on 2017/02/07 by Nick.Darnell

	Automation - The automation framework no longer buckets errors, warnings and log statements into a seperate set of buckets.  There is now only one log, and all entries go into it to provide some context when things fail.  Continued working on the styling of the reports.

Change 3290182 on 2017/02/07 by Michael.Trepka

	Added missing initialization for SWindow::bIsMirrorWindow

Change 3290472 on 2017/02/07 by Michael.Dupuis

	#jira UE-37358: Add reference list in the dialog for all delete type

Change 3290513 on 2017/02/07 by Michael.Dupuis

	#jira UE-37958: was testing the trailing number 0 twice and never testing the 1

Change 3290543 on 2017/02/07 by Michael.Dupuis

	#jira UE-35931: Refresh detail panel on selection lost

Change 3290581 on 2017/02/07 by Michael.Dupuis

	Fixed possible crash if we have no level blueprint specified (was crashing during the delete of an actor)

Change 3290721 on 2017/02/07 by Michael.Dupuis

	#jira UE-40360: Pass the custom spawning struct which contain the level override into to the spawn function

Change 3291958 on 2017/02/08 by Alexis.Matte

	Back out revision 26 from //UE4/Dev-Editor/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp

Change 3292017 on 2017/02/08 by Alexis.Matte

	Add some fbx automation tests to validate material re-import

Change 3292030 on 2017/02/08 by Michael.Dupuis

	#jira UE-37958: was testing the trailing number 0 twice and never testing the 1

Change 3293062 on 2017/02/08 by Jamie.Dale

	Reduced the number of allocations that happen when rebuilding text

	This change removes the wasteful FTextHistory::ToText function and replaces it with two more specialized functions; FTextHistory::BuildLocalizedDisplayString and FTextHistory::BuildInvariantDisplayString.

	These new functions return an FString (for the display string), rather than an FText (which was simply mined for its display string). Simply avoiding going via an FText saves at least two allocations per-rebuild.

	Changes:
	 - Removed FTextHistory::ToText and replaced it with FTextHistory::BuildLocalizedDisplayString and FTextHistory::BuildInvariantDisplayString.
	 - Moved the localization aware chronological and transformation implementations into FTextChronoFormatter and FTextTransformer. These return an FString which avoids an FText allocation during rebuild, and is simply passed into an FText during normal FText usage.
	 - Moved FText::AsDate, FText::AsDateTime, FText::AsTime, FText::ToUpper, and FText::ToLower into Text.cpp, and these now use FTextChronoFormatter and FTextTransformer from the common text implementation.
	 - Moved FText::AsTimespan into Text.cpp. This had no dependency on ICU, so this is now the common text implementation.
	 - Added FTextFormatter::FormatStr variants. FTextFormatter::Format calls these FTextFormatter::FormatStr versions internally, and they're also used during text rebuilding (saving not only an FText allocation, but also a container copy).
	 - Removed FText::CreateNumericalText and FText::CreateChronologicalText as they were mostly superfluous.
	 - General update from using MakeShareable to MakeShared (saving 1 allocation).
	 - General clean-up of L10N/I18N class friendship.

	#jira UE-41533

Change 3293292 on 2017/02/08 by Alex.Delesky

	Performing some cleanup in the Subtitles module, and creating a SubtitlesEditor module for the subtitles asset factories since it causes issue in client builds.

Change 3293477 on 2017/02/08 by Jamie.Dale

	Fixed TProperty::InitializeValueInternal and TProperty::DestroyValueInternal mismatch when dealing with fixed size arrays

	#jira UE-41007

Change 3293571 on 2017/02/08 by Matt.Kuhlenschmidt

	Fix lots of outline data being added to the font cache due to wrongly hashing outline material and color data.

Change 3293572 on 2017/02/08 by Matt.Kuhlenschmidt

	Fix details panel categories in the static mesh editor

Change 3294216 on 2017/02/09 by Michael.Dupuis

	#jira UE-40609: manually position the window based on it'S max possible size
	#3128 GitHub

Change 3294430 on 2017/02/09 by Jamie.Dale

	Kerning-only text shaping no longer draws characters to get their metrics

	It now goes via the low-level FT caches like HarfBuzz does.

Change 3294588 on 2017/02/09 by Alexis.Matte

	If we remove a LODGroup from baseengine.ini, the fbx importer UI will now be able to recover in case the last fbx import was done with the just removed LODGroup

Change 3294847 on 2017/02/09 by Matt.Kuhlenschmidt

	Merging //UE4/Dev-Main to Dev-Editor (//UE4/Dev-Editor)

Change 3295093 on 2017/02/09 by Arciel.Rekman

	Linux: fix Setup.sh not working in paths with space (UE-41819).

Change 3295205 on 2017/02/09 by Matt.Kuhlenschmidt

	Fix material UV's no longer working om 9 slice elements

Change 3295816 on 2017/02/09 by Arciel.Rekman

	Linux: fix starting programs from a path with space.

Change 3296129 on 2017/02/09 by Arciel.Rekman

	Linux i686: changes necessary to compile BlankProgram.

	- Added new architecture to UBT.
	- Fixed system headers.
	- Added third party libs for i686:
	  - jemalloc
	  - elftoolchain
	  - zlib
	  - SDL2
	  - libc++

Change 3296564 on 2017/02/10 by Jamie.Dale

	Cleaned up PO comment preservation

Change 3296694 on 2017/02/10 by Jamie.Dale

	AllocateNameEntry now takes TCharType* rather than void* and cast

Change 3296744 on 2017/02/10 by Jamie.Dale

	Moved the PO DOM from UnrealEd to Internationalization

Change 3297250 on 2017/02/10 by Jamie.Dale

	Split the PO import/export pipeline out of the commandlet

Change 3297420 on 2017/02/10 by Alexis.Matte

	Add Isolate and highlight feature for the material panel in the staticmesh and the skeletal editor.
	#jira UE-38985

Change 3297594 on 2017/02/10 by Alexis.Matte

	When importing from fbx a static mesh with find material anywhere, the next LODs import by the user will create new material entries instead of using the existing one.

Change 3297752 on 2017/02/10 by Arciel.Rekman

	i686 support: more third party libs.

	- libcurl
	- OpenSSL
	- libpng
	- libvorbis
	- libogg
	- libopus

Change 3297754 on 2017/02/10 by Arciel.Rekman

	i686 support: PhysX

Change 3297922 on 2017/02/10 by Alexis.Matte

	When importing a new LOD to a staticmesh, the data source file is not anymore wipe or change to the last fbx import filename.

Change 3298330 on 2017/02/10 by Arciel.Rekman

	i686: missing libcurl.

Change 3298620 on 2017/02/11 by Jamie.Dale

	FLocTextHelper improvements

	- It can now support non-standard target layouts (where the native and foreign cultures are in different locations - see FLocTextTargetPaths).
	- The XForeignArchive functions are now more strict, and *only* accept foreign cultures (use the XArchive functions instead if you're using both native and foreign cultures as parameters).

Change 3299293 on 2017/02/13 by Matt.Kuhlenschmidt

	PR #3241: UE-41870: Add quotes when passing through the directory path (Contributed by projectgheist)

Change 3299299 on 2017/02/13 by Matt.Kuhlenschmidt

	PR #3224: Git plugin: fix git autodetection and add error message (Contributed by SRombauts)

Change 3299391 on 2017/02/13 by Matt.Kuhlenschmidt

	Fix material instances being marked dirty when opening

	#jira UE-41721, UE-41719

Change 3299441 on 2017/02/13 by Nick.Darnell

	PR #3243: Fix bug that UWidget::GetOwningPlayer doesn't return (Contributed by yeonseok-yi)

Change 3299567 on 2017/02/13 by Nick.Darnell

	Slate - The Checkbox no longer just passes visibility down to the internal widgets it creates, that prevents future changes to effect it if it starts collapsed.

	#jira UE-41904

Change 3299870 on 2017/02/13 by Jamie.Dale

	Added cycle counters for font rendering/shaping

Change 3300116 on 2017/02/13 by Michael.Dupuis

	#jira UE-41866: Update cache when performing an undo

Change 3300178 on 2017/02/13 by Alexis.Matte

	Fix a crash when re-importing a LOD with more sections then the base LOD

Change 3300191 on 2017/02/13 by Alexis.Matte

	Make sure we do not loose castshadow and recomputetangents section flags when we re-import a skeletal mesh.

Change 3300351 on 2017/02/13 by Alexis.Matte

	Remove the clean up of unused material for the staticmesh editor. Unused material can be delete manually in the UI
	#jira UE-39639

Change 3302138 on 2017/02/14 by Nick.Darnell

	Automation - Adding support for -DeveloperReportOutputPath and -DeveloperReportUrl to permit local runs of the automation tool to generate reports on the report server, and launch the browser window to view them.

Change 3302139 on 2017/02/14 by Nick.Darnell

	UMG - Additional fixes to the way we migrate changes from the preview to the serialized version of the widget tree.  This fixes several issues with edit-inline objects on UWidgets.

Change 3302281 on 2017/02/14 by Nick.Darnell

	Slate - Bringing over changes to the invalidation panel from one of the game streams.  This fixes issues with animations in volatile widgets, as well as some issues with cache relative offset, and offers a method for enabling a different caching method to preserve batching through a commandline, but at the cost of not being able to use GPU buffers, possibly a better option on mobile in some cases.

Change 3302415 on 2017/02/14 by Nick.Darnell

	Disabling the open asset editor test.

Change 3302976 on 2017/02/14 by Nick.Darnell

	Automation - Updating one of the tests to open 70 different known asset types, and ensure that they open without dirtying the package.  AutomationTestSettings are now defaultengine, not sure why they setup to be user specific previously.  Most of these settings need to be removed, or split off into the modules that own them, rather than being in Engine.  TODO.

Change 3303724 on 2017/02/15 by Matt.Kuhlenschmidt

	Removed hard coded list of thumbnails, preventing objects with valid thumbnails from showing up.  Thumbnails are now shown by default.  Use meta=(DisplayThumbnail=false) to remove

	#jira UE-41958

Change 3303729 on 2017/02/15 by Matt.Kuhlenschmidt

	PR #3253: UE-34539: (Bugfix) Allow binary files in git stored via git-fat, git-lfs, etc to be diffed (take 2) (Contributed by rpav)

Change 3303733 on 2017/02/15 by Matt.Kuhlenschmidt

	PR #3248: Fix for TAssetSubClassOf properties reset on undo. (Contributed by StefanoProsperi)

Change 3303823 on 2017/02/15 by Nick.Darnell

	Automation - Continued improvements on screenshots.  Added some fixes to turn off the tonemapper when visualizing buffers.  Fixed several screenshots due to this change.  Adding lightboxes to the reports.  Adding some styling to make things sweeter.

Change 3303937 on 2017/02/15 by Matt.Kuhlenschmidt

	Fix build error

Change 3303982 on 2017/02/15 by Nick.Darnell

	Automation - Making the opening of the image no longer threaded, not really helpful for the IO operation and just makes it harder to follow.

Change 3304058 on 2017/02/15 by Matt.Kuhlenschmidt

	Fix build attempt #2 (not reproducible locally)

Change 3304393 on 2017/02/15 by Matt.Barnes

	Submitting test content for UEQATC-3548

Change 3304517 on 2017/02/15 by Nick.Darnell

	Slate - Making some fixes to the automatic disabling of the pixel snapping code with render transforms.  Sometimes it gets confused, we may want to move to a seperate transform stack for layout and render, and make sure the element drawer has access to both.

Change 3304560 on 2017/02/15 by Nick.Darnell

	UMG - SA fix.

Change 3304890 on 2017/02/15 by Matt.Kuhlenschmidt

	PR #3220: UE-41243: Force resolution in standalone if large than primary workin. (Contributed by projectgheist)

Change 3305360 on 2017/02/15 by Arciel.Rekman

	Linux: fix crash on exit (UE-41907).

	- It is not safe to dereference UAnimGraphNode_PoseDriver::StaticClass during the final shutdown sequence since the instance has already been destroyed in StaticExit().

Change 3306023 on 2017/02/16 by Nick.Darnell

	Paper2D - Adding a method to create SlateBrushes from PaperSprites the same way we can for materials and textures in blueprints.

Change 3306030 on 2017/02/16 by Nick.Darnell

	Slate - Making some additional fixes to invalidation panels from a game branch.  Adding a RoundToVector function to FVector2D, fixing the 3 places we defined a RoundToInt (which wasn't a great name since the convention wasn't meant to be used that way).

Change 3306031 on 2017/02/16 by Nick.Darnell

	Slate - Retainer widgets no longer tick using PreTick on SlateApplication, they now paint during their normal paint.

Change 3306046 on 2017/02/16 by Nick.Darnell

	UMG - Adding CanEditChange to WidgetComponent to gray out the CylinderArcAngle property unless you select the right geometry mode.

Change 3308887 on 2017/02/17 by Matt.Kuhlenschmidt

	Fix crash if blurs are rotated

	#jira UE-42037

Change 3309114 on 2017/02/17 by Jamie.Dale

	Unifying non-shaped text to use the same atlas cache as shaped text

Change 3310044 on 2017/02/17 by Matt.Kuhlenschmidt

	Outline color on text elements is now inherited properly

	#jira UE-40691

Change 3310268 on 2017/02/17 by Matt.Kuhlenschmidt

	Guard against rendering MIDs with potentially no parent in slate.

	#jira UE-42047

Change 3311531 on 2017/02/20 by Michael.Dupuis

	#jira UETOOL-1100:
	Add the possibility to have dynamic min/max slider value
	Synchonize all Color vector together when changing the min/max slider value

Change 3311534 on 2017/02/20 by Michael.Dupuis

	incremental build fix

Change 3311535 on 2017/02/20 by Michael.Dupuis

	incremental build fix take 2...

Change 3311743 on 2017/02/20 by Michael.Dupuis

	buildfix lunix incremental

Change 3312496 on 2017/02/20 by Arciel.Rekman

	Linux: fix PhysX crash in i686.

	- Changed layout to one that works.

Change 3313127 on 2017/02/20 by Jamie.Dale

	Fixed crash when performing a non-async cooked package save

	It isn't safe to call TotalSize on the BulkArchive when it's not a FBufferArchive (as used during async save) once the archive has been closed.

Change 3313990 on 2017/02/21 by Nick.Darnell

	Automation - Added a summary area at the top of the report.

Change 3314034 on 2017/02/21 by Jamie.Dale

	Fixed crash when deleting a streamed font

Change 3314942 on 2017/02/21 by Nick.Darnell

	Automation - More templating styling work.

Change 3315080 on 2017/02/21 by Nick.Darnell

	Automation - Providing a way for users to remove explict events from the event log when automated tests run.  Needed for other systems linked into the automation system like google mock.

Change 3315452 on 2017/02/21 by Nick.Darnell

	Json - Adding support for Map and Set properties to the JsonObjectConverter.  Can now save out map and sets.  No support for loading them yet.

Change 3315614 on 2017/02/21 by Nick.Darnell

	Json - Adding support for loading sets and map json data.

Change 3315924 on 2017/02/21 by Arciel.Rekman

	Vulkan: edigrating various Linux fixes by Josh.

	- This is to make Linux Vulkan work in Dev-Editor easier (for the contractor and myself).

	Original descriptions:

	CL 3313445
	- Various Vulkan fixes:
	  - Compiles in Linux
	  - Many cubemap bugs squashed
	  - Changed the scratch reflection cubemap clear to SetRenderTargestsAndClear, instead of SetRenderTarget() / Clear()
	  - Added compute fences

	CL 3314152
	- Fixed compile error on Mac, but I am pretty sure we can just remote VulkanRHI from Mac building entirely, but needs to be tested.

Change 3316741 on 2017/02/22 by Jamie.Dale

	Ensure that enums used by BP nodes have been PostLoaded so they have the correct display names

	#jira UE-42253

Change 3316800 on 2017/02/22 by Matt.Kuhlenschmidt

	Merging //UE4/Dev-Main to Dev-Editor (//UE4/Dev-Editor)

Change 3317058 on 2017/02/22 by Alexis.Matte

	Fix the scene importer to support correctly the obj file format
	#jira UE-35606

Change 3318039 on 2017/02/22 by Arciel.Rekman

	i686 support: added missing libwebsockets.

Change 3318095 on 2017/02/22 by Arciel.Rekman

	i686 support: Oodle.

Change 3319002 on 2017/02/23 by Michael.Dupuis

	#jira UE-41794 : Do not exit the landscape mode when doing undo from the creation of the landscape

Change 3319012 on 2017/02/23 by Alexis.Matte

	PR #3066: Improve asset import by permitted relative paths and easing editing of mapped mount points. (Contributed by paulevans)
	#jira UE-40039

Change 3319035 on 2017/02/23 by Nick.Darnell

	UMG - Adding a note about the font sizes in UE4 in Slate, using 96 dpi.

	#jira UE-42170

Change 3319040 on 2017/02/23 by Matt.Kuhlenschmidt

	PR #3278: Git plugin: fix revision number for blueprint diff menu (Contributed by SRombauts)

	#jira UE-42129

Change 3319072 on 2017/02/23 by Michael.Dupuis

	#jira UETOOL-1101: Add support for DetailGroup reset to default
	Right now it's only enable for the color grading

Change 3319077 on 2017/02/23 by Nick.Darnell

	Automation - Moving away from most of the templating being done in C++.  Moving to dust.js to just do it in the browser window.  The json report file is now the actual source of the information we use to template the resulting report html.  Maaay have to move to doing the templating server side in the future to stream it to the client better, but avoiding that so we don't have to ship a server.  Disabling several places we were taking editor screenshots, none of that code was actually comparing screenshots, it was a hold-over from earlier days.

	PhysX - Fixing a problem with Physx FillInlinePxShapeArray.  Deprecating it, adding FillInlinePxShapeArray_AssumesLocked, and locking places we were assuming it was already locked in the landscape component.

Change 3319088 on 2017/02/23 by Nick.Darnell

	PR #3245: UE-41707: Re-order includes correctly (Contributed by projectgheist)

	#jira UE-41914

Change 3319104 on 2017/02/23 by Michael.Dupuis

	fix incremental build

Change 3319146 on 2017/02/23 by Matt.Kuhlenschmidt

	PR #3292: Git plugin: fix update status on directories broken since UE4.12 (Contributed by SRombauts)

	#jira UE-42272

Change 3319252 on 2017/02/23 by Michael.Dupuis

	fix warning with missing #undef LOCTEXT_NAMESPACE

Change 3319298 on 2017/02/23 by Alex.Delesky

	Removing the Subtitles and SubtitlesEditor modules (it'll eventually be brought back as the Overlay and OverlayEditor modules)

Change 3319388 on 2017/02/23 by Alexis.Matte

	Fbx Importer now find collision model under fbx LOD Group
	#jira UE-42141

Change 3319528 on 2017/02/23 by Michael.Dupuis

	Fixed Undo/Redo to be consistent with other vector modifcation behavior

Change 3319583 on 2017/02/23 by Alexis.Matte

	Fix the sample rate to use the least common multiplier of all keys
	#jira UE-42012

Change 3319705 on 2017/02/23 by Nick.Darnell

	Static Analysis - Fixing sonobjectconverter.cpp(460) : warning C6011: Dereferencing NULL pointer 'ArrayProperty'.

Change 3319711 on 2017/02/23 by Nick.Darnell

	Editor - Adding some checks to make sure the struct we're accessing is still a valid handle.

	#jira UE-42262

Change 3319736 on 2017/02/23 by Alex.Delesky

	Adding Subtitles and SubtitlesEditor to the JunkManifest file.

Change 3319919 on 2017/02/23 by Nick.Darnell

	Automation - Fixing an issue with moving a location that doesn't exist.

Change 3319932 on 2017/02/23 by Alexis.Matte

	Fbx importer, do not apply more then one time the transform option to the scene node.
	#jira UE-42277

Change 3320105 on 2017/02/23 by Nick.Darnell

	Editor - Adding some additional checks to the margin customization.

	#jira UE-42262

Change 3321577 on 2017/02/24 by Jamie.Dale

	Moving Internationalization module from Runtime to Developer

Change 3321625 on 2017/02/24 by Jamie.Dale

	Moving InternationalizationSettings module from Developer to Editor

Change 3321642 on 2017/02/24 by Jamie.Dale

	Moving SCulturePicker from the Localization module to the InternationalizationSettings module

Change 3321734 on 2017/02/24 by Alexis.Matte

	PR #2979: Fix extra root bone for Blender exported FBX. (Contributed by manmohanbishnoi)
	We fix the extra root only when the file creator is from blender and the root node is named armature. We cannot simply remove all dummy node, since this is use by the rigid mesh workflow.

	#jira UE-39050

Change 3321912 on 2017/02/24 by Jamie.Dale

	Split LocalizationCommandletExecution out of the Localization module to remove some editor dependencies

Change 3322274 on 2017/02/24 by Jamie.Dale

	Moving Localization module from Editor to Developer, and merging the Internationalization module into it

	Removed hard-dependency between Engine and Localization/Internationalization via an interface.

Change 3322774 on 2017/02/25 by Jamie.Dale

	Unifying LocRes and LocNat file format between generation and loading

	This lets the code in Core be shared by Localization, and allows some code that was proxying via archives (due to the code being logically identical, but different C++ types) to use these new types directly.

	#tests Built Debug, Shipping, and Editor. Verified that LocNat and LocRes generation and loading worked as before.

Change 3322795 on 2017/02/25 by Jamie.Dale

	Fixing mismatch between SOURCE_CONTROL_WITH_SLATE and its .Build.cs file

	The define was set to disable Slate for Linux program targets only, but the .Build.cs disabled Slate for all Linux targets.

	Since the define was touched most recently (CL# 2534983), I updated the .Build.cs file to match its logic, and moved the definition of the define to the .Build.cs file so that they stay in sync with one another.

Change 3322853 on 2017/02/25 by Jamie.Dale

	Moved the conflict and word count reporting to FLocTextHelper

Change 3323089 on 2017/02/26 by Jamie.Dale

	Added functions to get the target name and path from FLocTextHelper

Change 3323391 on 2017/02/27 by Ben.Cosh

	This fixes an issue with blueprint config variables having their value destroyed by CDO serialization
	#Jira UE-40586 Blueprint variable defaults set from config files value are overwritten by CDO serialization
	#Proj Engine, CoreUObject

Change 3323406 on 2017/02/27 by Ben.Cosh

	Fixed a problem that caused UK2Node::ExpandSplitPin to destroy pins it didn't own in when expanding a collapsed graph during compilation.
	#jira UE-41211 - Crash when splitting a UDS pin on a collapsed graph
	#Proj BlueprintGraph

Change 3323572 on 2017/02/27 by Nick.Darnell

	Automation - Continued itteration on the style of the automation reports, now with attentional info, like where the log came from.

	Automation - Fixing a bug in the functional actor tests, navigating to the actors sometimes opened other objects in the package, now it only opens the map.  Also improved the way we focus the actor so that the level editor is also brought to the foreground.

	Automation - Fixing a bug in how the automation system was registering for capturing logging.  It was swapping out GWarn for its own version, but GWarn isn't called for anything that isn't an error or warning, meaning that none of the Display/Logging or analytics capture attempts were actually working.  Suddenly a flood of informations started being captured during tests.  For now - only going to capture 'Display' logs instead of 'Log' level.

	Automation - Successful comparisons now print more information so that the automation logs do a better job of tracking the flow of the test.

	Automation - The screenshot comparison test now prints more information even during successful comparisons.

	Editor - The message log no longer emits a SetSelection, just because the selection is updated the categoriry view model.  This was causing things like the automation tool, which sets the selection every time (which may itself be an issue) to completely rebuild the message log every time a new automation message was emited.  The message log now checks if the selection would actually change the viewstate before it does it.

	Domino Test - Adding an arrow to visualize the state of the up vector the test is looking for; playing with idea for test visualizers that may help with debugging in the future.

Change 3323580 on 2017/02/27 by Michael.Trepka

	Fixed some Xcode 8.3 compile errors

Change 3323634 on 2017/02/27 by Nick.Darnell

	Build - Fix incremental build.

Change 3323740 on 2017/02/27 by Jamie.Dale

	Adding #error if the SOURCE_CONTROL_WITH_SLATE define is missing

Change 3323865 on 2017/02/27 by Nick.Darnell

	Automation - Disabling the screenshot from the small editor icons test, until the editor screenshot method starts comparing things, and the screenshots we take are better / more scoped.

Change 3324228 on 2017/02/27 by Jamie.Dale

	Can no longer name assets or folders with a leading underscore

	#jira UE-40541

Change 3324429 on 2017/02/27 by Jamie.Dale

	Removing FLocTextTargetPaths

	It was added to support something that I'm now going to do a different way.

Change 3324473 on 2017/02/27 by Jamie.Dale

	Moved the GatherText SCC utils into the Localization module

Change 3324481 on 2017/02/27 by Jamie.Dale

	Moving the localized asset utils out of GatherText base

Change 3324485 on 2017/02/27 by Jamie.Dale

	Cleaning up some includes now that the localization SCC is no longer in GatherText

Change 3324910 on 2017/02/28 by Nick.Darnell

	Slate - Moving the SlateRotatedRect into its own file, and removing FSlateRotatedClipRectType, since there's no longer a difference and we only use FSlateRotatedRect.

Change 3325329 on 2017/02/28 by Michael.Dupuis

	#jira UE-42083: Removed various Modify(true) that would force user to save the levels even if they did'nt really modified them
	Replace TMap<TLazyObjectPtr,...> as it would dirty the level at every Find performed

Change 3325410 on 2017/02/28 by Michael.Dupuis

	missing include for incremental build

Change 3325415 on 2017/02/28 by Nick.Darnell

	UMG - Adding some setters and getters for RedrawTime to the WidgetComponent.

Change 3325418 on 2017/02/28 by Nick.Darnell

	Automation  - Fixing the warnings on startup about smoke tests taking longer than 2s.  Had to add an option to disable capturing the callstack when running smokes, it adds a bit too much overhead during startup.

Change 3325698 on 2017/02/28 by Alexis.Matte

	Put back the code to isolate material versus section in the skeletal mesh. The code was override by a temporary hack done in paragon branch

Change 3325790 on 2017/02/28 by Michael.Trepka

	Copy of CL 3319588

	Fixed address sanitizer support in MacToolChain (Apple changed the name of the env variable Xcode uses to enable it) and added support for thread sanitizer

Change 3326118 on 2017/02/28 by Alexis.Matte

	Add LOD settings LOD distances to fbx import dialog option. The option are not supported yet by the scene importer
	#jira UE-41291

Change 3326183 on 2017/02/28 by Alexis.Matte

	PR #3298: Import SpecularFactor for Roughness and Shininess for Metallic textures (Contributed by VladimirPobedinskiy)

	#jira UE-42301

Change 3326196 on 2017/02/28 by Jamie.Dale

	Force the correct package localization ID when duplicating a BP for nativization

Change 3327037 on 2017/03/01 by Michael.Dupuis

	fixed fortnite mac non editor build

Change 3327483 on 2017/03/01 by Jamie.Dale

	Renaming LocNat to LocMeta

Change 3327486 on 2017/03/01 by Jamie.Dale

	Renaming LocNat to LocMeta

Change 3327541 on 2017/03/01 by Michael.Trepka

	Removed Mac OpenGL RHI files and disabled building of OpenGL RHI on Mac

Change 3328000 on 2017/03/01 by Nick.Darnell

	Automation - Noisy rendering features are now disabled by default when taking screenshots.

Change 3328323 on 2017/03/01 by Michael.Trepka

	Copy of CL 3307526

	Fixed mouse position issues in fullscreen mode on Mac

Change 3328410 on 2017/03/01 by Alexis.Matte

	Remove unwanted option when importing skeletal mesh
	Make the FBX tests uptodate with the new ImportUI options

	#jira UE-41291

Change 3329586 on 2017/03/02 by Jamie.Dale

	Adding missing includes when running with bUseMallocProfiler enabled

Change 3329999 on 2017/03/02 by Nick.Darnell

	UMG - Removing a deprecated 4.8 function to get the label on UWidget.

Change 3330004 on 2017/03/02 by Nick.Darnell

	UMG - Adding TargetPlatform to the dependencies of UMGEditor module.

Change 3330021 on 2017/03/02 by Nick.Darnell

	UMG - Adding TargetPlatform to the private include path of the UMG module.

Change 3330041 on 2017/03/02 by Nick.Darnell

	Engine - Adding a comment to the PreLoadMap call so people know what the string being passed in is.

Change 3330048 on 2017/03/02 by Nick.Darnell

	Editor - Don't allow querying the cursor in the editor viewport while saving packages.  Depending upon the code that gets triggered, it may cause packages to load, or things to be initialized while saving is occuring.

Change 3330602 on 2017/03/02 by mason.seay

	Map for Functional Screenshot Test Bug

Change 3330632 on 2017/03/02 by Alexis.Matte

	Fix fbx crash when there is only one UVChannel but using the naming convention to place it further then the first index

Change 3330862 on 2017/03/02 by Jamie.Dale

	Adding FPaths::SetExtension

	This is like FPaths::ChangeExtension, but also applies the extension if the file doesn't have one.

Change 3331491 on 2017/03/03 by Nick.Darnell

	Automation - Fixing a threading issue in the SAsyncImage, it was accessing potentially bogus memory if the Widget had been deleted before the task ran.

Change 3331498 on 2017/03/03 by Nick.Darnell

	Build - Fixing a build warning.

Change 3331807 on 2017/03/03 by Nick.Darnell

	Automation - Making the Disable Noisy Rendering Features more robust, disabling a few more markers.  Adding a better way of rolling back the changes.

Change 3331999 on 2017/03/03 by Michael.Trepka

	Fixed a memory leak on texture creation with BulkData in OpenGLTexture.cpp

Change 3332481 on 2017/03/03 by Arciel.Rekman

	Fix building lighting in commandlet (UE-42551).

	- Process task graph while running as commandlet.
	- Also, if for any reason - like the lack of -messaging - local swarm interface fails to initialize or takes too much time to send the message, bail out.

Change 3332606 on 2017/03/04 by Jamie.Dale

	Fixing crash reporting loc word counts when the report is starting empty

Change 3332614 on 2017/03/04 by Jamie.Dale

	Fixed text namespaces being treated as case-insensitive when export to JSON manifests and archives

Change 3332619 on 2017/03/04 by Jamie.Dale

	Fixing CIS error

Change 3333000 on 2017/03/06 by Matt.Kuhlenschmidt

	PR #3295: Non-editable FStringAssetReference using VisibleAnywhere (Contributed by projectgheist)

	#jira UE-42284

Change 3333039 on 2017/03/06 by Alexis.Matte

	Make custom ui for FbxSceneImportData object
	#jira UE-37896

Change 3333047 on 2017/03/06 by Nick.Darnell

	UMG - Removing an extra assignment in WidgetSwitcher.

Change 3333056 on 2017/03/06 by Alexis.Matte

	Build fix

Change 3333073 on 2017/03/06 by Matt.Kuhlenschmidt

	Added more logging for when window creation fails due to too many windows.

	#jira UE-42478

Change 3333081 on 2017/03/06 by Matt.Kuhlenschmidt

	PR #3327: Git Plugin: fix RunDumpToFile() to check git ReturnCode (Contributed by SRombauts)

	#jira UE-42535

Change 3333103 on 2017/03/06 by Matt.Kuhlenschmidt

	PR #3336: UE-42407: using GetWindowMode instead of switching on IsFullscreenViewport (Contributed by stefanzimecki)

	#jira UE-42407, UE-42565

Change 3333142 on 2017/03/06 by Jamie.Dale

	Added a way to view/copy a list references (including those that aren't loaded) to the reference viewer

Change 3333443 on 2017/03/06 by Matt.Kuhlenschmidt

	Eliminate the usage of SWebBrowser to show viewport controls in level viewports. There is an non-trivial startup cost initializing CEF and is not worth paying that cost on editor startup for one tiny control.  The button now opens a web page on click.

	#jira UE-42461
	PR #3314: Drop UE4Editor -> CEF dependency to 2x speedup Linux UE4Editor startup (Contributed by slonopotamus)

Change 3333914 on 2017/03/06 by Matt.Kuhlenschmidt

	Remove double middle mouse click to change to perspective view

	#jira UE-42444

Change 3333936 on 2017/03/06 by Matt.Kuhlenschmidt

	Fixed excessive fname initialization in these files

Change 3334063 on 2017/03/06 by Alexis.Matte

	fix build linux

Change 3334166 on 2017/03/06 by Jamie.Dale

	Adding Data Table export/import support for TMap and TSet

	#jira UE-42415

Change 3334459 on 2017/03/06 by Alexis.Matte

	PR #3334: Respect bForceFrontXAxis option when exporting to FBX (Contributed by rajkosto)

	#jira UE-42563

Change 3335132 on 2017/03/07 by Jamie.Dale

	Fixing typo

Change 3335140 on 2017/03/07 by Jamie.Dale

	Fixing CSV import warnings in GameplayEffects test

Change 3335164 on 2017/03/07 by Alexis.Matte

	Avoid selecting skeletal mesh section in the level when high light them in persona editor
	#jira UE-20151

Change 3335186 on 2017/03/07 by Jamie.Dale

	Fixed CSV parser missing empty cells at the end of the string

Change 3335218 on 2017/03/07 by Arciel.Rekman

	SDL2: delete unused project/build files.

Change 3335222 on 2017/03/07 by Arciel.Rekman

	SDL2: delete more unused project/build files.

Change 3335230 on 2017/03/07 by Matt.Kuhlenschmidt

	Additional fixes for blur and blur slot not propagating padding to each other

	#jira UE-42553

Change 3335896 on 2017/03/07 by Jamie.Dale

	ToolTips and Engine were double gathering the same meta-data

	#jira UE-36480

Change 3336009 on 2017/03/07 by Matt.Kuhlenschmidt

	Fix details panels becoming unusable if "Show only Modified Properties" is enabled and there are no modified properties

Change 3336247 on 2017/03/07 by Jamie.Dale

	Selection height is now the max of the line height and text height to account for negative line scaling

	#jira UE-40673

Change 3336253 on 2017/03/07 by Jamie.Dale

	Added a setting to control whether we should use the font metrics or the bounding box when laying out a font

	#jira UE-41074

Change 3336303 on 2017/03/07 by Arciel.Rekman

	Refactor of OS memory allocation functions.

	- Bring PageSize/OSAllocationGranularity in line with the established definitions.
	  - PageSize is a hardware mapping granularity that is also used for PageProtect() and any other functions that involve setting virtual memory properties.
	  - OSAllocationGranularity is a virtual address allocation granularity that on some platforms may be applied on top of that (notably VirtualAlloc in Windows only returns addresses that are 16 page aligned).
	  - BinnedPageSize and BinnedAllocationGranularity are the values expected by Binned and Binned2 for size and the alignment of OS allocations.

	- Disable the logic in CachedOSPageAllocator that allowed buffers larger than the requested size to be returned.
	   - This caused wrong allocation size to be passed in BinnedFreeToOS() from Binned2.

	- Make Binned2 work on Linux
	    - Addresses returned from BinnedAllocFromOS() need to be BinnedPageSize (minimum 64KB) aligned for Binned2 to work. This results in the need to artificially align mmap()'d addresses, at some performance cost.
	    - The same function can be used on other systems with mmap()/munmap() (Mac, Android, iOS)

	- Switch Linux to Binned2 by default.

	- Add ability to sanity-check OS memory allocations.
	   - Debug and Development build will store a descriptor to check that values passed to BinnedFreeToOS() are the same (mmap-based allocation only).

Change 3337098 on 2017/03/08 by Michael.Dupuis

	#jira UE-42589: Added a guard if the mesh component is not attached, this can happen when moving a component out of the screen

Change 3337183 on 2017/03/08 by Matt.Kuhlenschmidt

	Hide the preview toolbar button, it is not being used

Change 3337801 on 2017/03/08 by Michael.Trepka

	Fixed some module dependencies to make sure we don't build OpenGLDrv on Mac

Change 3338373 on 2017/03/08 by Joe.Graf

	Fixed external plugin cooking and deployment by remapping plugin directories upon cook & deployment
	Tested directory structures:
	    D:\SomePluginDir
	    D:\UE4\AnotherPluginDir
	    D:\UE4\Engine\Plugins
	    D:\UE4\MyProject\Plugins

Change 3338482 on 2017/03/08 by Alexis.Matte

	Remove "BlueprinReadOnly" flag on "WITH_EDITORONLY_DATA" class variable

Change 3338679 on 2017/03/08 by Matt.Kuhlenschmidt

	Fixed arrow keys not working to navigate between elements in the details panel

Change 3339086 on 2017/03/09 by Dmitriy.Dyomin

	Added: Mobile friendly slate settings

Change 3339366 on 2017/03/09 by Nick.Darnell

	Build - Attempting to fix build.

	#jira UE-42675

Change 3339506 on 2017/03/09 by Jamie.Dale

	Fixing Linux Server build error

	#jira UE-42675

Change 3340450 on 2017/03/09 by Cody.Albert

	Ensure that the hittest grid is valid before trying to find a focusable widget

Change 3340492 on 2017/03/09 by Arciel.Rekman

	Fix IOS compile error (UE-42695).

Change 3340565 on 2017/03/09 by Arciel.Rekman

	Fix another compile error (UE-42695).

Change 3341527 on 2017/03/10 by Alexis.Matte

	Fix crash when dragging a re-import scene and there is new asset created
	#jira UE-42766

[CL 3341914 by Nick Darnell in Main branch]
2017-03-10 15:37:02 -05:00

1113 lines
37 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "HAL/FileManager.h"
#include "Misc/CommandLine.h"
#include "Misc/Paths.h"
#include "Misc/ConfigCacheIni.h"
#include "Misc/AutomationTest.h"
#include "Misc/App.h"
#include "Interfaces/IAutomationReport.h"
#include "AutomationWorkerMessages.h"
#include "IMessageContext.h"
#include "Helpers/MessageEndpoint.h"
#include "Modules/ModuleManager.h"
#include "Helpers/MessageEndpointBuilder.h"
#include "AssetEditorMessages.h"
#include "ImageComparer.h"
#include "AutomationControllerManager.h"
#include "Interfaces/IScreenShotToolsModule.h"
#include "Serialization/JsonSerializer.h"
#include "JsonObjectConverter.h"
#include "Misc/EngineVersion.h"
#include "Misc/FileHelper.h"
#include "PlatformHttp.h"
#if WITH_EDITOR
#include "Logging/MessageLog.h"
#endif
FAutomationControllerManager::FAutomationControllerManager()
{
CheckpointFile = nullptr;
if ( !FParse::Value(FCommandLine::Get(), TEXT("ReportOutputPath="), ReportOutputPath, false) )
{
if ( FParse::Value(FCommandLine::Get(), TEXT("DeveloperReportOutputPath="), ReportOutputPath, false) )
{
ReportOutputPath = ReportOutputPath / TEXT("dev") / FString(FPlatformProcess::UserName()).ToLower();
}
}
if ( FParse::Value(FCommandLine::Get(), TEXT("DeveloperReportUrl="), DeveloperReportUrl, false) )
{
DeveloperReportUrl = DeveloperReportUrl / TEXT("dev") / FString(FPlatformProcess::UserName()).ToLower() / TEXT("index.html");
}
}
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;
//EAutomationTestFlags::FilterMask
//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;
IScreenShotToolsModule& ScreenShotModule = FModuleManager::LoadModuleChecked<IScreenShotToolsModule>("ScreenShotComparisonTools");
ScreenshotManager = ScreenShotModule.GetScreenShotManager();
}
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()
{
extern void EmptyLinkFunctionForStaticInitializationAutomationExecCmd();
EmptyLinkFunctionForStaticInitializationAutomationExecCmd();
AutomationTestState = EAutomationControllerModuleState::Disabled;
bTestResultsAvailable = false;
bScreenshotsEnabled = true;
bSendAnalytics = FParse::Param(FCommandLine::Get(), TEXT("SendAutomationAnalytics"));
}
void FAutomationControllerManager::RequestLoadAsset(const FString& InAssetName)
{
MessageEndpoint->Publish(new FAssetEditorRequestOpenAsset(InAssetName), EMessageScope::Process);
}
void FAutomationControllerManager::Tick()
{
ProcessAvailableTasks();
ProcessComparisonQueue();
}
void FAutomationControllerManager::ProcessComparisonQueue()
{
TSharedPtr<FComparisonEntry> Entry;
if ( ComparisonQueue.Peek(Entry) )
{
if ( Entry->PendingComparison.IsReady() )
{
const bool Dequeued = ComparisonQueue.Dequeue(Entry);
check(Dequeued);
FImageComparisonResult Result = Entry->PendingComparison.Get();
// Send the message back to the automation worker letting it know the results of the comparison test.
{
FAutomationWorkerImageComparisonResults* Message = new FAutomationWorkerImageComparisonResults(
Result.IsNew(), Result.AreSimilar(), Result.MaxLocalDifference, Result.GlobalDifference, Result.ErrorMessage.ToString());
MessageEndpoint->Send(Message, Entry->Sender);
}
// Find the game session instance info
int32 ClusterIndex;
int32 DeviceIndex;
verify(DeviceClusterManager.FindDevice(Entry->Sender, ClusterIndex, DeviceIndex));
// Get the current test.
TSharedPtr<IAutomationReport> Report = DeviceClusterManager.GetTest(ClusterIndex, DeviceIndex);
check(Report.IsValid());
// Record the artifacts for the test.
FString ApprovedFolder = ScreenshotManager->GetLocalApprovedFolder();
FString UnapprovedFolder = ScreenshotManager->GetLocalUnapprovedFolder();
FString ComparisonFolder = ScreenshotManager->GetLocalComparisonFolder();
TMap<FString, FString> LocalFiles;
LocalFiles.Add(TEXT("approved"), ApprovedFolder / Result.ApprovedFile);
LocalFiles.Add(TEXT("unapproved"), UnapprovedFolder / Result.IncomingFile);
LocalFiles.Add(TEXT("difference"), ComparisonFolder / Result.ComparisonFile);
Report->AddArtifact(ClusterIndex, CurrentTestPass, FAutomationArtifact(Entry->Name, EAutomationArtifactType::Comparison, LocalFiles));
}
}
}
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 ( int32 i = 0; i < OurPassResults.Tests.Num(); i++ )
{
GLog->Logf(TEXT("%s: %s"), *OurPassResults.Tests[i].TestDisplayName, ToString(OurPassResults.Tests[i].State));
}
}
void FAutomationControllerManager::CollectTestResults(TSharedPtr<IAutomationReport> Report, const FAutomationTestResults& Results)
{
// TODO This is slow, change to a map.
for ( int32 i = 0; i < OurPassResults.Tests.Num(); i++ )
{
FAutomatedTestResult& ReportResult = OurPassResults.Tests[i];
if ( ReportResult.FullTestPath == Report->GetFullTestPath() )
{
ReportResult.SetEvents(Results.GetEvents(), Results.GetWarningTotal(), Results.GetErrorTotal());
ReportResult.State = Results.State;
ReportResult.Artifacts = Results.Artifacts;
switch ( Results.State )
{
case EAutomationState::Success:
if ( Results.GetWarningTotal() > 0 )
{
OurPassResults.SucceededWithWarnings++;
}
else
{
OurPassResults.Succeeded++;
}
break;
case EAutomationState::Fail:
OurPassResults.Failed++;
break;
default:
OurPassResults.NotRun++;
break;
}
OurPassResults.TotalDuration += Results.Duration;
return;
}
}
}
void FAutomationControllerManager::GenerateJsonTestPassSummary(const FAutomatedTestPassResults& SerializedPassResults, FDateTime Timestamp)
{
FString Json;
if ( FJsonObjectConverter::UStructToJsonObjectString(SerializedPassResults, Json) )
{
FString ReportFileName = FString::Printf(TEXT("%s/index.json"), *ReportOutputPath);
FFileHelper::SaveStringToFile(Json, *ReportFileName, FFileHelper::EEncodingOptions::ForceUTF8);
}
else
{
GLog->Logf(ELogVerbosity::Error, TEXT("Test Report Json is invalid - report not generated."));
}
}
void FAutomationControllerManager::GenerateHtmlTestPassSummary(const FAutomatedTestPassResults& SerializedPassResults, FDateTime Timestamp)
{
FString ReportTemplate;
const bool bLoadedResult = FFileHelper::LoadFileToString(ReportTemplate, *( FPaths::EngineContentDir() / TEXT("Automation/Report-Template.html") ));
if ( bLoadedResult )
{
FString ReportFileName = FString::Printf(TEXT("%s/index.html"), *ReportOutputPath);
if ( !FFileHelper::SaveStringToFile(ReportTemplate, *ReportFileName, FFileHelper::EEncodingOptions::ForceUTF8) )
{
GLog->Logf(ELogVerbosity::Error, TEXT("Test Report Html is invalid - report not generated."));
}
}
else
{
GLog->Logf(ELogVerbosity::Error, TEXT("Test Report Html is invalid - report not generated."));
}
}
FString FAutomationControllerManager::SlugString(const FString& DisplayString) const
{
FString GeneratedName = DisplayString;
// Convert the display label, which may consist of just about any possible character, into a
// suitable name for a UObject (remove whitespace, certain symbols, etc.)
{
for ( int32 BadCharacterIndex = 0; BadCharacterIndex < ARRAY_COUNT(INVALID_OBJECTNAME_CHARACTERS) - 1; ++BadCharacterIndex )
{
const TCHAR TestChar[2] = { INVALID_OBJECTNAME_CHARACTERS[BadCharacterIndex], 0 };
const int32 NumReplacedChars = GeneratedName.ReplaceInline(TestChar, TEXT(""));
}
}
return GeneratedName;
}
FString FAutomationControllerManager::CopyArtifact(const FString& DestFolder, const FString& SourceFile) const
{
FString ArtifactFile = FString(TEXT("artifacts")) / FGuid::NewGuid().ToString(EGuidFormats::Digits) + FPaths::GetExtension(SourceFile, true);
FString ArtifactDestination = DestFolder / ArtifactFile;
IFileManager::Get().Copy(*ArtifactDestination, *SourceFile, true, true);
return ArtifactFile;
}
FString FAutomationControllerManager::GetReportOutputPath() const
{
return ReportOutputPath;
}
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 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.Test = NextTest;
tempresult.TestDisplayName = NextTest->GetDisplayName();
tempresult.FullTestPath = NextTest->GetFullTestPath();
OurPassResults.Tests.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]->GetFullTestPath(), *TestsRunThisPass[AddressIndex]->GetCommand());
TestResults.State = EAutomationState::InProcess;
if (CheckpointFile)
{
WriteLineToCheckpointFile(NextTest->GetFullTestPath());
}
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() )
{
FAutomationTestResults TestResults;
TestResults.State = EAutomationState::NotEnoughParticipants;
TestResults.GameInstance = DeviceClusterManager.GetClusterDeviceName(ClusterIndex, 0);
TestResults.AddEvent(FAutomationEvent(EAutomationEventType::Warning, FString::Printf(TEXT("Needed %d devices to participate, Only had %d available."), CurrentTest->GetNumParticipantsRequired(), DeviceClusterManager.GetNumDevicesInCluster(ClusterIndex))));
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();
}
}
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]);
}
}
if ( !ReportOutputPath.IsEmpty() )
{
FDateTime Timestamp = FDateTime::Now();
if ( IFileManager::Get().DirectoryExists(*ReportOutputPath) )
{
// Clear the old report folder. Why move it first? Because RemoveDirectory
// is actually an async call that is not immediately carried out by the Windows OS; Moving a directory on the other hand, is sync.
// So we move, to a temporary location, then delete it.
FString TempDirectory = FPaths::GetPath(ReportOutputPath) + TEXT("\\") + FGuid::NewGuid().ToString(EGuidFormats::DigitsWithHyphens);
IFileManager::Get().Move(*TempDirectory, *ReportOutputPath);
IFileManager::Get().DeleteDirectory(*TempDirectory, false, true);
}
FScreenshotExportResults ExportResults = ScreenshotManager->ExportComparisonResultsAsync(ReportOutputPath).Get();
FAutomatedTestPassResults SerializedPassResults = OurPassResults;
SerializedPassResults.ComparisonExported = ExportResults.Success;
SerializedPassResults.ComparisonExportDirectory = ExportResults.ExportPath;
{
SerializedPassResults.Tests.StableSort([] (const FAutomatedTestResult& A, const FAutomatedTestResult& B) {
if ( A.GetErrorTotal() > 0 )
{
if ( B.GetErrorTotal() > 0 )
return ( A.FullTestPath < B.FullTestPath );
else
return true;
}
else if ( B.GetErrorTotal() > 0 )
{
return false;
}
if ( A.GetWarningTotal() > 0 )
{
if ( B.GetWarningTotal() > 0 )
return ( A.FullTestPath < B.FullTestPath );
else
return true;
}
else if ( B.GetWarningTotal() > 0 )
{
return false;
}
return A.FullTestPath < B.FullTestPath;
});
for ( FAutomatedTestResult& Test : SerializedPassResults.Tests )
{
for ( FAutomationArtifact& Artifact : Test.Artifacts )
{
for ( const auto& Entry : Artifact.LocalFiles )
{
Artifact.Files.Add(Entry.Key, CopyArtifact(ReportOutputPath, Entry.Value));
}
}
}
}
// Generate Json
GenerateJsonTestPassSummary(SerializedPassResults, Timestamp);
// Generate Html
GenerateHtmlTestPassSummary(SerializedPassResults, Timestamp);
if ( !DeveloperReportUrl.IsEmpty() )
{
FPlatformProcess::LaunchURL(*DeveloperReportUrl, nullptr, nullptr);
}
}
// Then clean our array for the next pass.
OurPassResults.ClearAllEntries();
CleanUpCheckpointFile();
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.GetErrorTotal() > 0 )
{
bHasErrors = true;
}
if ( TestResults.GetWarningTotal() )
{
bHasWarning = true;
}
if ( TestResults.GetLogTotal() )
{
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)
{
FString ScreenshotIncomingFolder = FPaths::GameSavedDir() / TEXT("Automation/Incoming/");
bool bTree = true;
FString FileName = ScreenshotIncomingFolder / Message.ScreenShotName;
IFileManager::Get().MakeDirectory(*FPaths::GetPath(FileName), bTree);
FFileHelper::SaveArrayToFile(Message.ScreenImage, *FileName);
// TODO Automation There is identical code in, Engine\Source\Runtime\AutomationWorker\Private\AutomationWorkerModule.cpp,
// need to move this code into common area.
FString Json;
if ( FJsonObjectConverter::UStructToJsonObjectString(Message.Metadata, Json) )
{
FString MetadataPath = FPaths::ChangeExtension(FileName, TEXT("json"));
FFileHelper::SaveStringToFile(Json, *MetadataPath, FFileHelper::EEncodingOptions::ForceUTF8WithoutBOM);
}
TSharedRef<FComparisonEntry> Comparison = MakeShareable(new FComparisonEntry());
Comparison->Sender = Context->GetSender();
Comparison->Name = Message.Metadata.Name;
Comparison->PendingComparison = ScreenshotManager->CompareScreensotAsync(Message.ScreenShotName);
ComparisonQueue.Enqueue(Comparison);
}
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);
TestResults.SetEvents(Message.Events, Message.WarningTotal, Message.ErrorTotal);
// Verify this device thought it was busy
TSharedPtr<IAutomationReport> Report = DeviceClusterManager.GetTest(ClusterIndex, DeviceIndex);
check(Report.IsValid());
Report->SetResults(ClusterIndex, CurrentTestPass, TestResults);
const FAutomationTestResults& FinalResults = Report->GetResults(ClusterIndex, CurrentTestPass);
// Gather all of the data relevant to this test for our json reporting.
CollectTestResults(Report, FinalResults);
#if WITH_EDITOR
FMessageLog AutomationTestingLog("AutomationTestingLog");
AutomationTestingLog.Open();
#endif
for ( const FAutomationEvent& Event : TestResults.GetEvents() )
{
switch ( Event.Type )
{
case EAutomationEventType::Info:
GLog->Logf(ELogVerbosity::Log, TEXT("%s"), *Event.ToString());
#if WITH_EDITOR
AutomationTestingLog.Info(FText::FromString(Event.ToString()));
#endif
break;
case EAutomationEventType::Warning:
GLog->Logf(ELogVerbosity::Warning, TEXT("%s"), *Event.ToString());
#if WITH_EDITOR
AutomationTestingLog.Warning(FText::FromString(Event.ToString()));
#endif
break;
case EAutomationEventType::Error:
GLog->Logf(ELogVerbosity::Error, TEXT("%s"), *Event.ToString());
#if WITH_EDITOR
AutomationTestingLog.Error(FText::FromString(Event.ToString()));
#endif
break;
}
}
if ( TestResults.State == EAutomationState::Success )
{
FString SuccessString = FString::Printf(TEXT("...Automation Test Succeeded (%s)"), *Report->GetDisplayName());
GLog->Logf(ELogVerbosity::Log, TEXT("%s"), *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, TEXT("%s"), *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);
}
TArray<FString> FAutomationControllerManager::GetCheckpointFileContents()
{
TestsRun.Empty();
FString CheckpointFileName = FString::Printf(TEXT("%sautomationcheckpoint.txt"), *FPaths::AutomationDir());
if (IFileManager::Get().FileExists(*CheckpointFileName))
{
FString FileData;
FFileHelper::LoadFileToString(FileData, *CheckpointFileName);
FileData.ParseIntoArrayLines(TestsRun);
}
return TestsRun;
}
FArchive* FAutomationControllerManager::GetCheckpointFileForWrite()
{
if (!CheckpointFile)
{
FString CheckpointFileName = FString::Printf(TEXT("%sautomationcheckpoint.txt"), *FPaths::AutomationDir());
CheckpointFile = IFileManager::Get().CreateFileWriter(*CheckpointFileName, 8);
}
return CheckpointFile;
}
void FAutomationControllerManager::CleanUpCheckpointFile()
{
if (CheckpointFile)
{
CheckpointFile->Close();
CheckpointFile = nullptr;
}
FString CheckpointFileName = FString::Printf(TEXT("%sautomationcheckpoint.txt"), *FPaths::AutomationDir());
if (IFileManager::Get().FileExists(*CheckpointFileName))
{
IFileManager::Get().Delete(*CheckpointFileName);
}
}
void FAutomationControllerManager::WriteLoadedCheckpointDataToFile()
{
GetCheckpointFileForWrite();
for (int i = 0; i < TestsRun.Num(); i++)
{
FString LineToWrite = FString::Printf(TEXT("%s\n"), *TestsRun[i]);
CheckpointFile->Serialize(TCHAR_TO_ANSI(*LineToWrite), LineToWrite.Len());
}
}
void FAutomationControllerManager::WriteLineToCheckpointFile(FString StringToWrite)
{
GetCheckpointFileForWrite();
if (CheckpointFile)
{
FString LineToWrite = FString::Printf(TEXT("%s\n"), *StringToWrite);
CheckpointFile->Serialize(TCHAR_TO_ANSI(*LineToWrite), LineToWrite.Len());
CheckpointFile->Flush();
}
}