Files
UnrealEngine/Engine/Build/LowLevelTests.xml
2025-05-18 13:04:45 +08:00

319 lines
20 KiB
XML

<?xml version='1.0' ?>
<BuildGraph xmlns="http://www.epicgames.com/BuildGraph" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.epicgames.com/BuildGraph ./Graph/Schema.xsd" >
<EnvVar Name="UE_HORDE_JOBID"/>
<Property Name="TestNames" Value=""/>
<Property Name="AllTestablePlatforms" Value="Win64;Mac;Linux;LinuxArm64;Android;IOS"/>
<Property Name="MobilePlatforms" Value="Android;IOS"/>
<Property Name="BuildPlatforms" Value="Win64;Mac;Linux"/>
<Property Name="PlatformsBuiltFromWin64" Value="Win64;Android"/>
<Property Name="PlatformsBuiltFromMac" Value="Mac;IOS"/>
<Property Name="PlatformsBuiltFromLinux" Value="Linux;LinuxArm64"/>
<Property Name="AlternateDevicePoolPlatformsProperty" Value=""/>
<Property Name="AdbKeysPath" Value=""/>
<Option Name="UseCompileAgents" DefaultValue="false" Description="Targets compile agents instead of regular agents for Build Platforms"/>
<Macro Name="SelectAdbKeysPath" Arguments="BuildPlatform">
<!-- Extend this macro and set AdbKeysPath -->
</Macro>
<!-- Platform specific macros -->
<Macro Name="Catch2BuildAppendExtraCMakeArgsPlatform" Arguments="Platform"/>
<Macro Name="Catch2BuildAppendExtraCMakeArgs" Arguments="ExtraArgValue">
<Property Name="CMakeAdditionalArgs" Value="$(CMakeAdditionalArgs) $(ExtraArgValue)"/>
</Macro>
<Macro Name="SelectBuildPlatformAndAgentType" Arguments="Platform">
<Do If="'$(Platform)' == 'Linux' Or '$(Platform)' == 'LinuxArm64'">
<Property Name="AgentType" Value="Linux"/>
<Property Name="BuildPlatform" Value="Linux"/>
</Do>
<Do If="'$(Platform)' == 'Mac' Or '$(Platform)' == 'iOS'">
<Property Name="AgentType" Value="Mac"/>
<Property Name="AgentType" Value="MacCompile" If="$(UseCompileAgents)"/>
<Property Name="BuildPlatform" Value="Mac"/>
</Do>
<Do If="'$(Platform)' == 'Win64' Or '$(Platform)' == 'Android'">
<Property Name="AgentType" Value="Win64"/>
<Property Name="AgentType" Value="Win64Compile" If="$(UseCompileAgents)"/>
<Property Name="BuildPlatform" Value="Win64"/>
</Do>
</Macro>
<Macro Name ="SetupAllPlatformProperties"/>
<Macro Name="SetupPlatformProperties" Arguments="Platform;BuildPlatform" OptionalArguments="AlternateDevicePool">
<Property Name="AllTestablePlatforms" Value="$(AllTestablePlatforms);$(Platform)"/>
<Do If="'$(BuildPlatform)' == 'Win64'">
<Property Name="PlatformsBuiltFromWin64" Value="$(PlatformsBuiltFromWin64);$(Platform)"/>
</Do>
<Do If="'$(BuildPlatform)' == 'Mac'">
<Property Name="PlatformsBuiltFromMac" Value="$(PlatformsBuiltFromMac);$(Platform)"/>
</Do>
<Do If="'$(BuildPlatform)' == 'Linux'">
<Property Name="PlatformsBuiltFromLinux" Value="$(PlatformsBuiltFromLinux);$(Platform)"/>
</Do>
<Do If="'$(AlternateDevicePool)' != ''">
<Property Name="AlternateDevicePoolPlatformsProperty" Value="$(AlternateDevicePoolPlatformsProperty);$(AlternateDevicePool)"/>
</Do>
</Macro>
<Macro Name="RunAllTests"/>
<Option Name="BuildCatch2Libs" DefaultValue="false" Description="True if building Catch2 static libraries"/>
<Option Name="TestCatch2Libs" DefaultValue="false" Description="True if additionally building Catch2 with extras and tests"/>
<Option Name="Catch2LibVariation" DefaultValue="VS2019" Description="Catch2 library variation, e.g. VS2022"/>
<Option Name="SubmitBuiltCatch2Libs" DefaultValue="false" Description="True if submitting the built Catch2 static libraries"/>
<Option Name="BuildProject" DefaultValue="" Description="Root relative path to Unreal Project used for build."/>
<Property Name="Catch2LatestVersion" Value="v3.4.0"/>
<Option Name="Catch2VersionBuild" DefaultValue="$(Catch2LatestVersion)" Description="Which version of Catch2 to build" />
<!-- Check if this is a release branch -->
<Option Name="IsReleaseBranch" DefaultValue="false" Description="True if release branch, false otherwise"/>
<Option Name="PreflightChange" DefaultValue="" Description="Preflight CL number if preflight, empty otherwise"/>
<!-- Test Options -->
<Option Name="RunAllTests" DefaultValue="true" Description="Run All Available Tests (except Foundation)"/>
<Option Name="DryRun" DefaultValue="false" Description="Dry Run"/>
<!-- Additional Compile Options -->
<Option Name="WithUBA" DefaultValue="true" Description="Use UBA for compile task"/>
<!-- Platform Options -->
<Option Name="TestAllSupportedPlatforms" DefaultValue="true" Description="Test All Supported Platforms"/>
<Option Name="TestPlatformWin64" DefaultValue="false" Description="Test Platform Win64"/>
<Option Name="TestPlatformLinux" DefaultValue="false" Description="Test Platform Linux"/>
<Option Name="TestPlatformLinuxArm64" DefaultValue="false" Description="Test Platform LinuxArm64"/>
<Option Name="TestPlatformMac" DefaultValue="false" Description="Test Platform Mac"/>
<Option Name="TestPlatformAndroid" DefaultValue="false" Description="Test Platform Android"/>
<Option Name="TestPlatformIOS" DefaultValue="false" Description="Test Platform IOS"/>
<Option Name="ArchitectureWin64" DefaultValue="x64" Description="Architecture to use for Win64. x64 or arm64"/>
<!-- If we set one of the TestPlatform* option we don't want to run on all the platforms, just the selected ones. -->
<Property Name="TestsAllSupportedPlatforms" Value="$(TestAllSupportedPlatforms)"/>
<ForEach Name="Platform" Values="$(AllTestablePlatforms)">
<Property Name="TestsAllSupportedPlatforms" Value="false" If="$(TestPlatform$(Platform))"/>
</ForEach>
<Option Name="TestArgs" DefaultValue="" Description="Initial test arguments, applies to all tests."/>
<Option Name="GauntletDevicePool" DefaultValue="UE4" Description="Gauntlet Device Pool to use to run target platform tests"/>
<Option Name="AlternateGauntletDevicePool" DefaultValue="UE5" Description="Alternate Gauntlet Device Pool to use to run target platform tests"/>
<Option Name="AlternateDevicePoolPlatforms" DefaultValue="$(AlternateDevicePoolPlatformsProperty)" Description="Platforms that need to use the Alternate Gauntlet Device Pool"/>
<Option Name="Device" DefaultValue="" Description="Device address to run tests on"/>
<Option Name="Configuration" DefaultValue="Development" Description="Configuration type: development, debug, test, shipping etc."/>
<Option Name="AttachToDebugger" DefaultValue="false" Description="Wait for debugger to attach."/>
<Option Name="EnableDeviceLoginVerification" DefaultValue="$(IsBuildMachine)" Description="Verify a user is logged in on Devices that supports it, try to sign in if not."/>
<!-- Get shared properties -->
<Include Script="Graph/Tasks/Inc/SharedProperties.xml" />
<Property Name="TestNodes" Value=""/>
<Property Name="AfterTestNodes" Value=""/>
<Property Name="Catch2BuildNodes" Value=""/>
<!-- Override build tags -->
<Option Name="OverrideTags" DefaultValue="" Description="Override default tags for all tests, used for special types of tests"/>
<!-- Special test configs -->
<Option Name="PerTestTimeout" DefaultValue="0" Description="Individual test timeout (not for entire test run). 0 means no timeout is captured."/>
<!-- After Steps -->
<Option Name="RunAfterSteps" DefaultValue="false" Description="If set RunAfterSteps is True then we should run aftersteps for this run."/>
<!-- If this is NOT a Preflight (with $(PreflightChange) set) OR if the user explictly requested, then Run After Steps -->
<Property Name="CheckedRunAfterStep" Value="false"/>
<Property Name="CheckedRunAfterStep" Value="True" If="'$(PreflightChange)' == '' OR $(RunAfterSteps)"/>
<Macro Name="TestAfterStep" Arguments="Platform;TestName;ShortName">
<Node Name="$(TestName) AfterStep $(Platform)">
<Expand Name="$(TestName)AfterSteps" Platform="$(Platform)" If="!$(DryRun)"/>
</Node>
<Label Category="After" Name="$(ShortName) After $(Platform)" Requires="$(TestName) AfterStep $(Platform)"/>
<Property Name="TestRuns" Value="($(RunsAllTests) and ('$(Run$(TestName)Tests)' != 'false')) or (!$(RunsAllTests) and ('$(Run$(TestName)Tests)' == 'true'))"/>
<Property Name="TestRuns" Value="$(TestRuns) and ($(TestsAllSupportedPlatforms) or $(TestPlatform$(Platform)))"/>
<Do If="$(TestRuns)">
<Property Name="AfterTestNodes" Value="$(AfterTestNodes);$(TestName) AfterStep $(Platform)"/>
</Do>
</Macro>
<Macro Name="BuildAndStageTest" Arguments="Platform;TestName;StagesWithProjectFile;TargetName;ExtraCompilationArgs">
<Property Name="LocalAchiveDirectory" Value="$(RootDir)/$(TargetName)"/>
<Property Name="ExtraCompilationArgsFinal" Value="$(ExtraCompilationArgs)"/>
<Do If="'$(StagesWithProjectFile)' == 'True'">
<Do If="'$(BuildProject)' != ''">
<Property Name="ExtraCompilationArgsFinal" Value="$(ExtraCompilationArgs) -projectprogramoverride=$(RootDir)/$(BuildProject)"/>
</Do>
<Property Name="ExtraCompilationArgsFinal" Value="$(ExtraCompilationArgsFinal) -ubtargs=&quot;-UBA &quot;" If="$(WithUBA)"/>
<Property Name="BuildCookRunArgs" Value="-Build -NoBootstrapExe -NoCodeSign -SkipCook -SkipBuildEditor=True -Stage -NoSubmit -Archive -ArchiveDirectory=$(LocalAchiveDirectory) -project=$(TargetName) -configuration=$(Configuration) -platform=$(Platform) $(ExtraCompilationArgsFinal)"/>
<Property Name="BuildCookRunArgs" Value="$(BuildCookRunArgs) -package" If="'$(BuildPlatform)' == 'Mac'"/>
<Command Name="BuildCookRun" Arguments="$(BuildCookRunArgs)" If="!$(DryRun)"/>
</Do>
<Do If="'$(StagesWithProjectFile)' != 'True'">
<Property Name="ExtraCompilationArgsFinal" Value="$(ExtraCompilationArgsFinal) -UBA" If="$(WithUBA)"/>
<Do If="'$(BuildProject)' != ''">
<Property Name="ExtraCompilationArgsFinal" Value="$(ExtraCompilationArgs) -Project=$(RootDir)/$(BuildProject)"/>
</Do>
<Compile Target="$(TargetName)" Configuration="$(Configuration)" Platform="$(Platform)" Arguments="-Mode=Test $(ExtraCompilationArgsFinal)" If="!$(DryRun)"/>
</Do>
</Macro>
<!-- Deploy and run test, one agent per test per platform -->
<Macro Name="DeployAndTest" Arguments="TestName;ShortName;TargetName;BinaryRelativePath;Platform;ReportType" OptionalArguments="Deactivated;StagesWithProjectFile;Tags;PlatformExtraArgs;ExtraArgs;GauntletArgs;PlatformGauntletArgs;RunUnsupported;HasAfterSteps;UsesCatch2;RunContainerized;ExtraCompilationArgs">
<Do If="'$(Deactivated)' == 'True'">
<Warning Message="Test $(TestName) set as deactivated, will build but will not run."/>
</Do>
<Property Name="AgentType" Value=""/>
<Property Name="BuildPlatform" Value=""/>
<Expand Name="SelectBuildPlatformAndAgentType" Platform="$(Platform)"/>
<Property Name="TestRuns" Value="($(RunsAllTests) and ('$(Run$(TestName)Tests)' != 'false')) or (!$(RunsAllTests) and ('$(Run$(TestName)Tests)' == 'true'))"/>
<Property Name="TestRuns" Value="$(TestRuns) and ($(TestsAllSupportedPlatforms) or $(TestPlatform$(Platform)))"/>
<Agent Name="Low Level Tests $(Platform)" Type="$(AgentType)">
<Property Name="TestRequirements" Value=""/>
<Do If="$(BuildCatch2Libs)">
<Property Name="TestRequirements" Value="$(TestRequirements);Catch2 Build Library $(Platform)"/>
</Do>
<Node Name="$(ShortName) Tests $(Platform)" Requires="$(TestRequirements)">
<Do If="'$(Deactivated)' == '' and $(TestRuns)">
<Expand Name="BuildAndStageTest" TestName="$(TestName)" Platform="$(Platform)" TargetName="$(TargetName)" StagesWithProjectFile="$(StagesWithProjectFile)" ExtraCompilationArgs="$(ExtraCompilationArgs)"/>
</Do>
<Do If="'$(RunUnsupported)' == '' and '$(Deactivated)' == '' and $(TestRuns)">
<Property Name="PlatformStageDirName" Value="$(Platform)"/>
<Property Name="PlatformStageDirName" Value="Windows" If="'$(Platform)' == 'Win64'"/>
<Property Name="DevicePool" Value="$(GauntletDevicePool)" />
<Property Name="DevicePool" Value="$(AlternateGauntletDevicePool)" If="ContainsItem('$(AlternateDevicePoolPlatforms)', '$(Platform)', ';')" />
<Property Name="TestArgsExt" Value="$(TestArgs)"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -deviceurl=$(GauntletDeviceService) -devicepool=$(DevicePool)" If="'$(GauntletDeviceService)' != ''"/>
<Property Name="TestModeSuffix" Value=""/>
<Property Name="TestTags" Value=""/>
<Property Name="TestTags" Value="$(Tags)" If="'$(Tags)' != ''"/>
<Property Name="TestTags" Value="$(OverrideTags)" If="'$(OverrideTags)' != ''"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -fullclean -no-play-protect" If="'$(Platform)' == 'Android'"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -tags=&quot;$(TestTags)&quot;"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) --buildmachine" If="$(IsBuildMachine)"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -timeout=$(PerTestTimeout)"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) $(GauntletArgs)" If="'$(GauntletArgs)' != ''"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) $(PlatformGauntletArgs)" If="'$(PlatformGauntletArgs)' != ''"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -extra-args=&quot;$(ExtraArgs)&quot;" If="'$(ExtraArgs)' != ''"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) $(PlatformExtraArgs)" If="'$(PlatformExtraArgs)' != ''"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -VerifyLogin" If="$(EnableDeviceLoginVerification)"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -device=$(Device) " If="'$(Device)' != ''"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -AttachToDebugger " If="'$(AttachToDebugger)' != 'False'"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -ReportType=$(ReportType)" If="'$(ReportType)' != ''"/>
<Do If="'$(UsesCatch2)' != ''">
<Property Name="TestArgsExt" Value=""/>
</Do>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -SkipStage -Build=&quot;$(RootDir)\$(TargetName)\$(PlatformStageDirName)&quot;" If="'$(StagesWithProjectFile)' == 'True'"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -build=&quot;$(BinaryRelativePath)/$(Platform)/$(TargetName)$(TestModeSuffix)&quot;" If="'$(StagesWithProjectFile)' != 'True'"/>
<Property Name="AppRunsContainerized" Value="$(RunContainerized)"/>
<Do If="'$(AppRunsContainerized)' == 'True'">
<Property Name="TestTargetLowercase" Value=""/>
<StringOp Input="$(TargetName)" Method="ToLower" Output="TestTargetLowercase"/>
<Property Name="BinariesRelativeForwardSlash" Value=""/>
<StringOp Input="$(BinaryRelativePath)" Method="Replace" Arguments="\;/" Output="BinariesRelativeForwardSlash"/>
<!-- Builds docker image -->
<Expand Name="$(Platform)DockerCleanup" AppNameLowercase="$(TestTargetLowercase)" If="!$(DryRun)"/>
<Expand Name="$(Platform)DockerSetup" AppNameLowercase="$(TestTargetLowercase)" AppDir="$(BinariesRelativeForwardSlash)/$(Platform)/$(TargetName)$(TestModeSuffix)" If="!$(DryRun)"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -containerized"/>
</Do>
<Do If="'$(Platform)' == 'Android'">
<Expand Name="SelectAdbKeysPath" BuildPlatform="$(BuildPlatform)"/>
<Property Name="TestArgsExt" Value="$(TestArgsExt) -adbkeys=$(AdbKeysPath) -captureoutput"/>
</Do>
<Command Name="RunLowLevelTests"
Arguments="-test=LowLevelTests -testapp=$(TargetName)$(TestModeSuffix) -platform=$(Platform) -configuration=$(Configuration) $(TestArgsExt) -VeryVerbose" If="!$(DryRun) and '$(RunUnsupported)' == ''"/>
<Do If="'$(AppRunsContainerized)' == 'True'">
<Property Name="TestTargetLowercase" Value=""/>
<StringOp Input="$(TargetName)" Method="ToLower" Output="TestTargetLowercase"/>
<!-- Stop any running docker container and remove image -->
<Expand Name="$(Platform)DockerCleanup" AppNameLowercase="$(TestTargetLowercase)" If="!$(DryRun)"/>
</Do>
</Do>
</Node>
<Label Category="Tests" Name="$(ShortName) $(Platform)" Requires="$(ShortName) Tests $(Platform)"/>
<Trace Message="$(ShortName) runs because $(TestRuns)" If="$(TestRuns) and $(DryRun)"/>
<Do If="$(TestRuns)">
<Property Name="TestNodes" Value="$(TestNodes);$(ShortName) Tests $(Platform)"/>
</Do>
<Do If="'$(CheckedRunAfterStep)' == 'True' AND '$(HasAfterSteps)' == 'True'">
<Expand Name="TestAfterStep" TestName="$(TestName)" ShortName="$(ShortName)" Platform="$(Platform)"/>
</Do>
</Agent>
</Macro>
<!-- Catch2 build targets -->
<ForEach Name="BuildPlatform" Values="$(BuildPlatforms)">
<ForEach Name="Platform" Values="$(PlatformsBuiltFrom$(BuildPlatform))">
<Property Name="AgentType" Value="$(BuildPlatform)"/>
<Expand Name="SelectBuildPlatformAndAgentType" Platform="$(Platform)" />
<Agent Name="Catch2 Build $(Platform)" Type="$(AgentType)">
<Node Name="Catch2 Build Library $(Platform)">
<Property Name="Generator" Value="Makefile"/>
<Property Name="TargetConfigs" Value="debug+release"/>
<Property Name="ExtraCMakeArgs" Value=""/>
<Property Name="CMakeAdditionalArgs" Value=""/>
<Property Name="TargetPlatform" Value="$(Platform)"/>
<Property Name="CommonExtraCmakeArgs" Value=""/>
<Property Name="CommonExtraCmakeArgs" Value="$(CommonExtraCmakeArgs) -DCATCH_DEVELOPMENT_BUILD=ON -DBUILD_TESTING=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_ENABLE_CONFIGURE_TESTS=ON" If="$(TestCatch2Libs)"/>
<Do If="'$(Platform)' == 'Android'">
<Property Name="ExtraCMakeArgs" Value="$(ExtraCMakeArgs) -TargetArchitecture=arm64"/>
</Do>
<Do If="'$(Platform)' == 'Linux'">
<Property Name="ExtraCMakeArgs" Value="$(ExtraCMakeArgs) -TargetArchitecture=x86_64-unknown-linux-gnu"/>
</Do>
<Do If="'$(Platform)' == 'LinuxArm64'">
<Property Name="TargetPlatform" Value="Linux"/>
<Property Name="ExtraCMakeArgs" Value="$(ExtraCMakeArgs) -TargetArchitecture=aarch64-unknown-linux-gnueabi"/>
</Do>
<Do If="'$(Platform)' == 'Win64'">
<Property Name="Generator" Value="VS2019"/>
<Do If="'$(Catch2LibVariation)' == 'VS2022'">
<Property Name="Generator" Value="VS2022"/>
</Do>
<Property Name="ExtraCMakeArgs" Value="$(ExtraCMakeArgs) -TargetArchitecture=$(ArchitectureWin64)"/>
</Do>
<Expand Name="Catch2BuildAppendExtraCMakeArgsPlatform" Platform="$(Platform)"/>
<Do If="'$(BuildPlatform)' == 'Mac'">
<Property Name="Generator" Value="Xcode"/>
<Property Name="TargetConfigs" Value="Debug+Release"/>
<Property Name="CMakeAdditionalArgs" Value="$(CMakeAdditionalArgs) -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"/>
</Do>
<Command Name="BuildCMakeLib"
Arguments="-CMakeGenerator=$(Generator) -MakeTarget=Catch2 -TargetLib=Catch2 -TargetLibVersion=$(Catch2VersionBuild) -BinOutputPath=Binaries -LibOutputPath=lib -TargetPlatform=$(TargetPlatform) -TargetConfigs=$(TargetConfigs) -SkipCreateChangelist $(ExtraCMakeArgs) -CMakeAdditionalArguments=&quot;$(CommonExtraCmakeArgs) $(CMakeAdditionalArgs)&quot;"/>
</Node>
<Property Name="Catch2BuildNodes" Value="$(Catch2BuildNodes);Catch2 Build Library $(Platform)"/>
</Agent>
</ForEach>
</ForEach>
<!-- All test metadata scripts along with platform specific versions for both public and internal paths -->
<Include Script="LowLevelTests/*.xml"/>
<Include Script="../Platforms/*/Build/LowLevelTests/*.xml"/>
<Include Script="../Restricted/NotForLicensees/Build/LowLevelTests/*.xml"/>
<Include Script="../Restricted/NotForLicensees/Platforms/*/Build/LowLevelTests/*.xml"/>
<!-- If we set one of the Run*Tests option we don't want to run all the tests, just the selected ones. -->
<Property Name="RunsAllTests" Value="$(RunAllTests)"/>
<Expand Name="RunAllTests"/>
<Aggregate Name="Run Low Level Tests" Requires="$(TestNodes);$(AfterTestNodes)"/>
<Aggregate Name="Build Catch2 Libraries" Requires="$(Catch2BuildNodes)"/>
</BuildGraph>