Skip to content

Commit

Permalink
Fix a few issues with merged wrappers uncovered by local testing (#67211
Browse files Browse the repository at this point in the history
)

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
  • Loading branch information
trylek authored Mar 28, 2022
1 parent afc175f commit 019bc7f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);";
}
}
6 changes: 6 additions & 0 deletions src/tests/Common/mergedrunner.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<Project>
<Target Name="_ValidateNoTestProjectsDroppedByConflictResolution" AfterTargets="ResolveReferences">

<MSBuild Projects="@(ProjectReference)" Targets="GetProjectsWithDisabledBuild" SkipNonexistentTargets="true">
<Output TaskParameter="TargetOutputs" ItemName="_ReferenceWithDisabledBuild" />
</MSBuild>

<ItemGroup>
<_ProjectReferencesUsedByReferencePaths Include="@(ReferencePath->Metadata('ProjectReferenceOriginalItemSpec'))" />
<_ProjectAssemblyReferences Include="@(ProjectReference)" Condition="'%(ProjectReference.OutputItemType)' == ''" />
<_ProjectAssemblyReferences Remove="@(_ReferenceWithDisabledBuild->Metadata('OriginalItemSpec'))" />
<_ProjectReferencesRemovedDueToConflictResolution Include="@(_ProjectAssemblyReferences)" Exclude="@(_ProjectReferencesUsedByReferencePaths)" />
</ItemGroup>
<!--
Expand Down
6 changes: 6 additions & 0 deletions src/tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@

</Target>

<Target Name="GetProjectsWithDisabledBuild" Returns="@(ProjectWithDisabledBuild)">
<ItemGroup Condition="'$(_WillCLRTestProjectBuild)' != 'true'">
<ProjectWithDisabledBuild Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
</Target>

<Target Name="GetRequiresProcessIsolation" Returns="@(ProjectRequiringProcessIsolation)">
<ItemGroup Condition="'$(RequiresProcessIsolation)' == 'true'">
<ProjectRequiringProcessIsolation Include="$(MSBuildProjectFullPath)" />
Expand Down

0 comments on commit 019bc7f

Please sign in to comment.