-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Continuation] - Enable the fundamentals behind libraries tests compiled via Crossgen2 #80946
Conversation
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsThis PR is a transfer and continuation from PR #75230. Original Description:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good except for one bit in test.singlefile.targets that looks suspicious to me so I'd welcome a bit of clarification.
and the output is `CppLinker`, because from `SetupOSSpecificProps` onwards, we only use `CppLinker` | ||
(when alternative compiler, i.e. gcc, is not selected) | ||
--> | ||
<Target Name="LocateNativeCompiler" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also undoing #77304? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above.
eng/testing/tests.singlefile.targets
Outdated
<PropertyGroup Condition="'$(TestNativeAot)' == 'true'"> | ||
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath> | ||
<IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath> | ||
<CppCompilerAndLinker Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' and '$(HostOS)' == 'linux' and '$(RuntimeIdentifier)' == 'linux-musl-arm64'">clang-15</CppCompilerAndLinker> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to be undoing #77304. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's odd, those changes shouldn't be modified here. Will restore them in the next iteration.
eng/testing/tests.singlefile.targets
Outdated
<PropertyGroup Condition=""> | ||
<DefineConstants>$(DefineConstants);SINGLE_FILE_TEST_RUNNER</DefineConstants> | ||
</PropertyGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change. We had this line at the top of the file. Now it's moved here with an empty Condition=""
- why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops for some reason, that condition wasn't copied. It has to do with Single File and NativeAOT. Will add it on the next iteration. Thanks for catching this.
eng/testing/tests.singlefile.targets
Outdated
<Target Name="__ReplaceCrossgen2ExecutableWithFreshlyBuiltOne" | ||
BeforeTargets="_PrepareForReadyToRunCompilation"> | ||
<PropertyGroup> | ||
<Crossgen2ArtifactPath>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2'))crossgen2$(ExeSuffix)</Crossgen2ArtifactPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use $(CoreCLRCrossgen2Dir)
instead of recomputing it.
// The current RemoteExecutor implementation is not compatible with the SingleFileTestRunner. | ||
Environment.SetEnvironmentVariable("DOTNET_REMOTEEXECUTOR_SUPPORTED", "0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why the existing users of the SingleFileTestRunner.cs didn't need this line is: dotnet/arcade#6553
It is now redundant. Could you submit a removal of that in Arcade?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By removal do you mean undoing dotnet/arcade#6553's changes, and then removing this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arcade change covers the existing use cases of the single file runner - the single file deployments (where assembly.location is null/empty, like the arcade PR checks).
With this PR, we'll be using the single file runner for non-single file scenarios as well. The line you're adding will disable remote executor for any consumer - single file or not.
Therefore, I think we won't need the arcade part anymore because remote executor will be disabled by this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Then, let me see if I understood correctly. The arcade change and this line help with the same issue for this PR's purposes, so they are redundant in this case. Removing the arcade change while keeping this line will remove that redundancy without breaking other scenarios. Is this the appropriate course of action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Your change is making the arcade part redundant.
@@ -50,5 +50,8 @@ | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</ProjectReference> | |||
<ProjectReference Include="..\System.Diagnostics.FileVersionInfo.TestAssembly\System.Diagnostics.FileVersionInfo.TestAssembly.csproj" Condition="'$(TargetOS)' == 'browser'" /> | |||
<!-- R2R testing does not tolerate the combination of a regular project reference and a content reference. --> | |||
<!-- This is actually a bug in the SDK and ought to be fixed there. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a link to the tracking SDK bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we don't have one. Will have to file it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you file the bug? If so could you add a link here same as we have on line 46 (for a similar issue)?
Building the `libs` subset or any of individual library projects automatically copies product binaries into the testhost folder | ||
in the bin directory. This is where the tests will load the binaries from during the run. However System.Private.CorLib is an | ||
exception - the build does not automatically copy it to the testhost folder. If you [rebuild System.Private.CoreLib](https://github.com/dotnet/runtime/blob/main/docs/workflow/building/libraries/README.md#iterating-on-systemprivatecorelib-changes) you must also build the `libs.pretest` subset to ensure S.P.C is copied before running tests. | ||
Building the `libs` subset or any of individual library projects automatically copies product binaries into the testhost folder in the bin directory. This is where the tests will load the binaries from during the run. However System.Private.CorLib is an exception - the build does not automatically copy it to the testhost folder. If you [rebuild System.Private.CoreLib](https://github.com/dotnet/runtime/blob/main/docs/workflow/building/libraries/README.md#iterating-on-systemprivatecorelib-changes) you must also build the `libs.pretest` subset to ensure S.P.C is copied before running tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please excuse me if I'm mixing things up as it's been a long time since we last talked about. Why do we mention the testhost folder or the libs.pretest subset? I think that we discussed that we want to exercise Crossgen2 testing in self-contained deployment only in the dev innerloop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I regret to say I don't know the answer. This change was just reformatting what was already written there to match the format of most of the repo's Markdown files. @trylek do you have context for Viktor's question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are indeed two facets to this discussion - (a) using Crossgen2-compiled System.Private.CoreLib in library testing and (b) compiling the framework and / or the library tests themselves using Crossgen2. For (a), AFAIK that's always been the case, to my knowledge no testing involves the IL version of SPC. For (b), that's what Ivan is now creating foundations for unless I'm mistaken as at least weekly library lab testing involving Crossgen2 would be very beneficial for improving our test coverage; @davidwrighton also believes Crossgen2 library testing could be used for better regression monitoring of some of our features like the cross-module inlining. Having said that, I'm not sufficiently familiar with library testing to know off the top of my head whether the comment under discussion is actually accurate or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I think we all agree on that we want to have crossgen2 coverage for our libraries testing. What I commented on is that I don't think we want to do framework dependent crossgen2 testing but self-contained deployment testing. We use self-contained deployment for AOT testing, linker testing, single file testing... cc @jkotas for opinions.
For (a), AFAIK that's always been the case, to my knowledge no testing involves the IL version of SPC.
We do use the IL version of SPC for Debug builds or when performing code coverage measurements:
<SwapNativeForIL Condition="'$(SwapNativeForIL)' == '' and ('$(Configuration)' == 'Debug' or '$(Coverage)' == 'true') and '$(RuntimeFlavor)' != 'Mono'">true</SwapNativeForIL> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Viktor for clarifying the usage of IL SPC. For the rest of your comment, so am I right to understand your point is about "Native-AOT compiled self-contained Crossgen2 app" vs. "raw framework-dependent Crossgen2 app produced by CoreCLR build"? I certainly agree with that, we should do our best to test the actual customer-facing product, not some intermediate artifact of our build system (not mentioning the fact that in the past it also identified bugs in NativeAOT). I apologize, I didn't get that from your original PR comment at the top of this thread, in fact it seems you're saying the opposite in
we want to exercise Crossgen2 testing in self-contained deployment only in the dev innerloop
I apologize if I misread or misunderstood one of your responses, in such case please have patience with me being slow on the uptake and clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to do framework dependent crossgen2 testing but self-contained deployment testing.
crossgening the whole framework takes a while. Would self-contained deployment mean that the whole framework needs to be crossgened for each libraries test? It does not look very efficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In CoreCLR, crossgenning the framework takes something like 2~3 minutes. It should certainly be done only once, not in Helix for each test separately, that would be hugely wasteful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crossgening the whole framework takes a while. Would self-contained deployment mean that the whole framework needs to be crossgened for each libraries test? It does not look very efficient.
No. It would mean that we could crossgen the runtime pack that we use for self-contained deployment once, instead of the testhost folder that we use for framework-dependent deployment. It boils down to which app-mode we want to add crossgen validation to. FDD, SCD or both?
eng/testing/tests.singlefile.targets
Outdated
@@ -82,31 +89,33 @@ | |||
</ItemGroup> | |||
</Target> | |||
|
|||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still deleting the comment. Could you make is so that this is not even part of the diff?
Hi @MichalStrehovsky! Is there anything else needed for this PR to be approved and merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good modulo the unaddressed comment.
@@ -50,5 +50,8 @@ | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</ProjectReference> | |||
<ProjectReference Include="..\System.Diagnostics.FileVersionInfo.TestAssembly\System.Diagnostics.FileVersionInfo.TestAssembly.csproj" Condition="'$(TargetOS)' == 'browser'" /> | |||
<!-- R2R testing does not tolerate the combination of a regular project reference and a content reference. --> | |||
<!-- This is actually a bug in the SDK and ought to be fixed there. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you file the bug? If so could you add a link here same as we have on line 46 (for a similar issue)?
…t tracking SDK bug.
This PR is a transfer and continuation from PR #75230.
Original Description: