-
Notifications
You must be signed in to change notification settings - Fork 375
Open
Description
Arcade testing infrastructure allows projects to set TestArchitectures
property. This property can have multiple values semicolon-separated, and it will cause RunTests
target to run for each architecture.
- VSTest.targets
- Always used by NUnit.targets
- Used by MSTest.targets only if not MTP
- Used by XUnit.targets and XUnitV3.targets when UseVSTestRunner is true.
- It does the following:
<_TestRunnerCommand>"$(DotNetTool)" test $(_TestAssembly) --logger:"console%3Bverbosity=normal" --logger:"trx%3BLogFileName=$(_TestResultTrxFileName)" --logger:"html%3BLogFileName=$(_TestResultHtmlFileName)" "--ResultsDirectory:$(_TestResultDirectory)" "--Framework:%(TestToRun.TargetFrameworkIdentifier),Version=%(TestToRun.TargetFrameworkVersion)"</_TestRunnerCommand>
- It looks like the architecture is completely unused. So a test project specifying
<TestArchitectures>x64;x86</TestArchitecture>
is likely to end up running the tests twice for x64 and not for x86 at all.
- XUnit.Runner.targets
- Used by XUnit.targets (xunit 2) when UseVSTestRunner isn't true.
- On netfx, it runs either xunit.console.x86.exe (if x86) or the x64 xunit.console.exe otherwise, which is good.
- On Core, we load xunit.console.dll in dotnet.exe.
- If architecture is x86, we try to run with dotnet.exe that is x86 (we fallback to
$(DotNetTool)
if x86 dotnet.exe isn't found! We should error instead!) - Otherwise, we don't care about the specified architecture and always use
$(DotNetTool)
which might not be correct.
- If architecture is x86, we try to run with dotnet.exe that is x86 (we fallback to
- XUnitV3.Runner.targets
- Used by XUnitV3.targets when UseVSTestRunner isn't true.
- We simply have an executable to run. And we use
RunCommand
to find the exe and we passRunArguments
and that is it. This cannot work correctly with architectures and the value is completely ignored. - Should we somehow detect when multiple architectures are specified, or even when a single architecture isn't matching the produced apphost architecture, and then fallback to using the right
dotnet.exe
+ dll? Or is there a way to produce multiple apphosts during build for each of the specified architectures?
- Microsoft.Testing.Platform.targets
- Used either directly by specifying
<TestRunnerName>Microsoft.Testing.Platform</TestRunnerName>
(most repos don't need that), or it's also used by MSTest.targets when MTP is enabled. - It has the exact same flow as
XUnitV3.Runner.targets
- In future we will want to even refactor it to share as much between MTP.targets and XUnitV3.Runner.targets but that's a different discussion unrelated to the architecture-related issues we have today.
- Used either directly by specifying
Moreover, this usage of PlatformTarget
is suspicious:
arcade/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets
Lines 30 to 33 in e2fed65
<PropertyGroup Condition="'$(IsTestProject)' == 'true' and '$(TestArchitectures)' == ''"> | |
<TestArchitectures>$(PlatformTarget)</TestArchitectures> | |
<TestArchitectures Condition="'$(PlatformTarget)' == '' or '$(PlatformTarget)' == 'AnyCpu'">x64</TestArchitectures> | |
</PropertyGroup> |
- On .NET Framework, the value is unusable during evaluation.
- On .NET Core, this property should never be read.
@agocke @jaredpar @ViktorHofer What do you think here please?
FYI @nohwnd @Evangelink
Evangelink
Metadata
Metadata
Assignees
Labels
No labels