From f1cd1b6e98b44a26a52e6997d0445feeda1c8e00 Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Tue, 9 Apr 2019 11:00:25 -0700 Subject: [PATCH] Group XUnitWrapper.dll into the same Payloads when submit to Helix (#23476) * Add DisplayNameAttribute to each Fact * Split files under bin/tests folder into groups and specify the corresponding *.XUnitWrapper.dll * Group some of the *.XUnitWrapper.dll files into PayloadGroups and split others into different PayloadGroups if they have more than one TestGroup defined * Add "TestGroup" trait to XUnitWrapper facts * Add Microsoft.DotNet.XUnitConsoleRunner to eng\Versions.props * Overwrite xunit.console.dll with the version coming from Microsoft.DotNet.XUnitConsoleRunner --- eng/Versions.props | 2 + tests/helixpublishwitharcade.proj | 140 ++++++++++++++++++++++++++++------ tests/runtest.proj | 45 ++++++----- tests/testgrouping.proj | 155 ++++++++++++++++++++++++++++++++++++++ tests/xunitconsolerunner.depproj | 13 ++++ 5 files changed, 311 insertions(+), 44 deletions(-) create mode 100644 tests/testgrouping.proj create mode 100644 tests/xunitconsolerunner.depproj diff --git a/eng/Versions.props b/eng/Versions.props index 769d3ca..65cb6bb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -7,6 +7,7 @@ false true + 2.5.1-beta.19179.4 1.0.0-alpha-004 4.6.0-preview5.19208.1 3.0.0-preview5.19208.1 @@ -16,6 +17,7 @@ + Microsoft.DotNet.XUnitConsoleRunner Microsoft.Private.CoreFx.NETCoreApp Microsoft.NETCore.Platforms Microsoft.NETCore.App diff --git a/tests/helixpublishwitharcade.proj b/tests/helixpublishwitharcade.proj index d928269..b421d56 100644 --- a/tests/helixpublishwitharcade.proj +++ b/tests/helixpublishwitharcade.proj @@ -10,10 +10,6 @@ that will run in parallel. --> - - <_Scenarios Include="$(_Scenarios.Split(','))" /> - - @@ -34,9 +30,13 @@ + + + - + <_Scenarios Include="$(_Scenarios.Split(','))" /> + <_ProjectsToBuild Include="$(MSBuildProjectFile)"> $(_PropertiesToPass);Scenario=%(_Scenarios.Identity) @@ -44,41 +44,116 @@ <_BuildInParallel>false - <_BuildInParallel Condition=" '@(_ProjectsToBuild->Count())' > '1' ">true + <_BuildInParallel Condition=" '@(_ProjectsToBuild->Count())' > '1' ">true - - + - $(TestWorkingDir)Tests\Core_Root + $([MSBuild]::NormalizeDirectory($(BinDir))) + $(BinDir)Tests\Core_Root\ + $(BinDir)Payloads\ SetStressModes_$(Scenario).cmd SetStressModes_$(Scenario).sh - - - %(RootDir)%(Directory) - %(FileName)%(Extension) - - + - + + + <_XUnitWrapperDll Include="%(TestGrouping.XUnitWrapperDll)" Condition="Exists('%(XUnitWrapperDll)')"> + %(TestGroup) + + <_XUnitWrapperDll Include="@(XUnitWrapperGrouping)" /> + + + <_XUnitWrapperDll Include="$(BinDir)**\*.XUnitWrapper.dll" Exclude="$(PayloadsRootDirectory)**\*.XUnitWrapper.dll;@(XUnitWrapperGrouping->Metadata('FullPath'))"> + + + + + + <_XUnitWrapperDll Update="@(_XUnitWrapperDll)"> + $([MSBuild]::ValueOrDefault(%(FileName),'').Replace('.XUnitWrapper','')) + + + + + + + <_FileDirectory>%(_XUnitWrapperDll.RootDir)%(Directory) + <_PayloadGroup>%(_XUnitWrapperDll.PayloadGroup) + <_XUnitWrapperDll>%(_XUnitWrapperDll.FullPath) + + + + <_TestGroupingRelevant Include="@(TestGrouping->WithMetadataValue('XUnitWrapperDll',$(_XUnitWrapperDll))->Metadata('FullPath'))" /> + + + + <_TestGroupingExists>@(_TestGroupingRelevant->AnyHaveMetadataValue('TestGroup','$(_PayloadGroup)')) + - + + + <_PayloadFiles Include="$(_FileDirectory)**" Exclude="@(_TestGroupingRelevant)" Condition="'$(_TestGroupingExists)' != 'true'" /> + + <_PayloadFiles Include="@(_TestGroupingRelevant->WithMetadataValue('TestGroup','$(_PayloadGroup)')->DistinctWithCase())" Condition="'$(_TestGroupingExists)' == 'true'" /> + <_PayloadFiles Include="$(_FileDirectory)*" Condition="'$(_TestGroupingExists)' == 'true'" /> + + <_PayloadFiles Update="@(_PayloadFiles)"> + + $(_PayloadGroup)\$([System.IO.Path]::GetRelativePath($(BinDir), %(FullPath))) + + + + + + + + + + + <_XUnitConsoleRunnerFiles Include="$(PackagesDir)$(MicrosoftDotNetXUnitConsoleRunnerPackage.ToLower())\$(MicrosoftDotNetXUnitConsoleRunnerVersion)\**\xunit.console.*" /> + + + + + + + - <_ProjectsToBuild Include=".\testenvironment.proj"> - Scenario=$(Scenario);TestEnvFileName=%(XUnitWrapperDll.FileDirectory)$(TestEnvFileName);TargetsWindows=$(TargetsWindows) + <_PayloadGroups Include="$(PayloadGroups)" /> + <_ProjectsToBuild Include="testenvironment.proj"> + Scenario=$(Scenario);TestEnvFileName=$(PayloadsRootDirectory)%(_PayloadGroups.Identity)\$(TestEnvFileName);TargetsWindows=$(TargetsWindows) + + + <_PayloadGroups>@(_XUnitWrapperDll->Metadata('PayloadGroup')->DistinctWithCase()) + + + + <_Scenario Include="$(_Scenarios.Split(','))" /> + <_ProjectsToBuild Include="$(MSBuildProjectFile)"> + Scenario=%(_Scenario.Identity);PayloadGroups=$(_PayloadGroups) + + + + + + $(PublishTestResults) false @@ -93,7 +168,7 @@ $(BuildOS) $(BuildArch) $(BuildType) $(Scenario) @ $([System.TimeSpan]::FromMinutes($(TimeoutPerTestInMinutes)).TotalMilliseconds) true - -parallel collections -nocolor -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing + -parallel collections -nocolor -noshadow -xml testResults.xml @@ -128,11 +203,26 @@ $CORE_ROOT/xunit.console.dll - - - - %(FileDirectory) - $(CoreRun) $(XUnitRunnerDll) %(File) $(XUnitRunnerArgs) + + + + + + $([MSBuild]::MakeRelative($(PayloadsRootDirectory), %(FullPath))) + %(FullPath) + $([System.String]::Join(' ', $([System.IO.Directory]::GetFiles(%(FullPath), '*.XUnitWrapper.dll', SearchOption.AllDirectories))).Replace($([MSBuild]::EnsureTrailingSlash(%(FullPath))),'')) + + + + %(PayloadGroup) + + + + + + %(PayloadDirectory) + $(CoreRun) $(XUnitRunnerDll) %(XUnitWrapperDlls) $(XUnitRunnerArgs) + $(CoreRun) $(XUnitRunnerDll) %(XUnitWrapperDlls) $(XUnitRunnerArgs) -trait TestGroup=%(TestGroup) $([System.TimeSpan]::FromMinutes($(TimeoutPerTestCollectionInMinutes))) diff --git a/tests/runtest.proj b/tests/runtest.proj index 1adcfc4..20b89a9 100644 --- a/tests/runtest.proj +++ b/tests/runtest.proj @@ -147,6 +147,8 @@ $(_XunitEpilog) + + @@ -215,10 +217,6 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\",""). - - - - testExecutable = testExecutable.Replace("\\", "/")%3B @@ -226,22 +224,31 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\",""). - - - - - <_FactName Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_").Replace("\","_").Replace("-","_")) - <_ClassName Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace("cmd","").Replace(".","_").Replace("\","_").Replace("-","_")) - <_FactName Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_").Replace("/","_").Replace("-","_")) - <_ClassName Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace("sh","").Replace(".","_").Replace("/","_").Replace("-","_")) - - <_XunitFact > + + + + + $(Category) + + + + $([MSBuild]::MakeRelative($(_CMDDIR), %(FullPath))) + + + $([MSBuild]::MakeRelative($(XunitTestBinBase), %(AllCMDs.FullPath))) + _$([MSBuild]::ValueOrDefault(%(AllCMDs.RelativeToCMDDIR),"").Replace(".","_").Replace("\","_").Replace("-","_")) + _$([MSBuild]::ValueOrDefault(%(AllCMDs.RelativeToCMDDIR),"").Replace("cmd","").Replace(".","_").Replace("\","_").Replace("-","_")) + _$([MSBuild]::ValueOrDefault(%(AllCMDs.RelativeToCMDDIR),"").Replace(".","_").Replace("/","_").Replace("-","_")) + _$([MSBuild]::ValueOrDefault(%(AllCMDs.RelativeToCMDDIR), '').Replace('sh','').Replace('.','_').Replace('/','_').Replace('-','_')) + %(AllCMDs.TestGroup) + - + - + diff --git a/tests/testgrouping.proj b/tests/testgrouping.proj new file mode 100644 index 0000000..1ff04a9 --- /dev/null +++ b/tests/testgrouping.proj @@ -0,0 +1,155 @@ + + + + baseservices.threading.generics + $(BinDir)baseservices\threading\baseservices.threading.XUnitWrapper.dll + + + + JIT.jit64.hfa + $(BinDir)JIT\jit64\JIT.jit64.XUnitWrapper.dll + + + + JIT.jit64.mcc + $(BinDir)JIT\jit64\JIT.jit64.XUnitWrapper.dll + + + + JIT.jit64.opt + $(BinDir)JIT\jit64\JIT.jit64.XUnitWrapper.dll + + + + JIT.jit64.valuetypes + $(BinDir)JIT\jit64\JIT.jit64.XUnitWrapper.dll + + + + JIT.Methodical.a-dA-D + $(BinDir)JIT\Methodical\JIT.Methodical.XUnitWrapper.dll + + + + JIT.Methodical.eh + $(BinDir)JIT\Methodical\JIT.Methodical.XUnitWrapper.dll + + + + JIT.Methodical.e-iE-I + $(BinDir)JIT\Methodical\JIT.Methodical.XUnitWrapper.dll + + + + JIT.Methodical.e-iE-I + $(BinDir)JIT\Methodical\JIT.Methodical.XUnitWrapper.dll + + + + JIT.Regression.CLR-x86-JIT.V1-M09-M11 + $(BinDir)JIT\Regression\JIT.Regression.XUnitWrapper.dll + + + + JIT.Regression.CLR-x86-JIT.V1-M12-M13 + $(BinDir)JIT\Regression\JIT.Regression.XUnitWrapper.dll + + + + Loader.classloader.generics + $(BinDir)Loader\classloader\Loader.classloader.XUnitWrapper.dll + + + + Loader.classloader.TypeGeneratorTests.TypeGeneratorTest0-299 + $(BinDir)Loader\classloader\Loader.classloader.XUnitWrapper.dll + + + + Loader.classloader.TypeGeneratorTests.TypeGeneratorTest300-599 + $(BinDir)Loader\classloader\Loader.classloader.XUnitWrapper.dll + + + + Loader.classloader.TypeGeneratorTests.TypeGeneratorTest600-899 + $(BinDir)Loader\classloader\Loader.classloader.XUnitWrapper.dll + + + + Loader.classloader.TypeGeneratorTests.TypeGeneratorTest900-1199 + $(BinDir)Loader\classloader\Loader.classloader.XUnitWrapper.dll + + + + Loader.classloader.TypeGeneratorTests.TypeGeneratorTest1200-1500 + $(BinDir)Loader\classloader\Loader.classloader.XUnitWrapper.dll + + + + PayloadGroup0 + + + + Interop + + + + JIT + + + diff --git a/tests/xunitconsolerunner.depproj b/tests/xunitconsolerunner.depproj new file mode 100644 index 0000000..4d6e724 --- /dev/null +++ b/tests/xunitconsolerunner.depproj @@ -0,0 +1,13 @@ + + + + + + netcoreapp2.0 + + + + + + + -- 2.7.4