From 019bc7f143ae5840fe7d0e8e720e4854b1a91c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Rylek?= Date: Mon, 28 Mar 2022 18:02:58 +0200 Subject: [PATCH] Fix a few issues with merged wrappers uncovered by local testing (#67211) After merging in the last preparatory change (deduplication of tests with the same assembly names) I'm now testing the "final" JIT/Methodical switchover change; this testing uncovered a few previously unseen issues related to the merged wrappers and I'm sending them for a separate PR to decouple them from the big mechanical switchover change. 1) For out-of-process tests, "Method" contains the relative test execution script path; we need to prefix the string with "@" to avoid complaining about backslashes on Windows. 2) Jeremy recently added a consistency check to catch multiple projects producing assemblies with the same simple name; turns out there was a subtle bug where the check blew up on projects with DisableProjectBuild set to true. 3) A similar problem exists for projects with the property CLRTestTargetUnsupported but I haven't added it to the fix; I believe it is healthy to receive this type of error in the build as with the merged wrappers the CLRTestTargetUnsupported clauses need to be removed and replaced with ConditionalFactAttribute annotations, otherwise we could lose part of the conditional code coverage as in the lab the managed tests are build only once on an arbitrary platform so their individual platform-specific exclusions must be postponed to execution time. Thanks Tomas --- src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs | 2 +- src/tests/Common/mergedrunner.targets | 6 ++++++ src/tests/Directory.Build.targets | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs index 89b8cb911f4f1..6559a6db44f5d 100644 --- a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs +++ b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs @@ -354,6 +354,6 @@ public string WrapTestExecutionWithReporting(string testExecutionExpression, ITe public string GenerateSkippedTestReporting(ITestInfo skippedTest) { - return $"{_summaryLocalIdentifier}.ReportSkippedTest({skippedTest.TestNameExpression}, \"{skippedTest.ContainingType}\", \"{skippedTest.Method}\", System.TimeSpan.Zero, string.Empty);"; + return $"{_summaryLocalIdentifier}.ReportSkippedTest({skippedTest.TestNameExpression}, \"{skippedTest.ContainingType}\", @\"{skippedTest.Method}\", System.TimeSpan.Zero, string.Empty);"; } } diff --git a/src/tests/Common/mergedrunner.targets b/src/tests/Common/mergedrunner.targets index 8d67c629d6130..78ccb1dc5dc42 100644 --- a/src/tests/Common/mergedrunner.targets +++ b/src/tests/Common/mergedrunner.targets @@ -1,8 +1,14 @@ + + + + + <_ProjectReferencesUsedByReferencePaths Include="@(ReferencePath->Metadata('ProjectReferenceOriginalItemSpec'))" /> <_ProjectAssemblyReferences Include="@(ProjectReference)" Condition="'%(ProjectReference.OutputItemType)' == ''" /> + <_ProjectAssemblyReferences Remove="@(_ReferenceWithDisabledBuild->Metadata('OriginalItemSpec'))" /> <_ProjectReferencesRemovedDueToConflictResolution Include="@(_ProjectAssemblyReferences)" Exclude="@(_ProjectReferencesUsedByReferencePaths)" />