dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.25k stars 4.73k forks source link

Test Failure: readytorun.r2rdump.FrameworkTests.R2RDumpTests #107622

Open SzpejnaDawid opened 1 month ago

SzpejnaDawid commented 1 month ago

According to the change of Microsoft.NETCore.App version from 9.0.0 to 10.0.0 the test readytorun.r2rdump.FrameworkTests.R2RDumpTests fails with result:

BEGIN EXECUTION
/runtime/artifacts/tests/coreclr/linux.riscv64.Checked/Tests/Core_Root/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false -p System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true R2RDumpTests.dll ''
TID 58edd: TraceGC is not turned onYou must install or update .NET to run this application.

App: /runtime/artifacts/tests/coreclr/linux.riscv64.Checked/Tests/Core_Root/R2RDump/R2RDump.dll
Architecture: riscv64
Framework: 'Microsoft.NETCore.App', version '9.0.0-preview.7.24405.7' (riscv64)
.NET location: /runtime/artifacts/bin/testhost/net9.0-linux-Checked-riscv64/

The following frameworks were found:
  10.0.0 at [/runtime/artifacts/bin/testhost/net9.0-linux-Checked-riscv64/shared/Microsoft.NETCore.App]

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=9.0.0-preview.7.24405.7&arch=riscv64&rid=linux-riscv64&os=ubuntu.22.04
The process terminated with exit code 150

Xunit.Sdk.TrueException: Assert.True() Failure
Expected: True
Actual:   False
   at Xunit.Assert.True(Nullable`1 condition, String userMessage) in /_/src/Microsoft.DotNet.XUnitAssert/src/BooleanAsserts.cs:line 146
   at Xunit.Assert.True(Boolean condition) in /_/src/Microsoft.DotNet.XUnitAssert/src/BooleanAsserts.cs:line 97
   at R2RDumpTests.R2RDumpTester.DumpCoreLib() in /runtime/src/tests/readytorun/r2rdump/FrameworkTests/R2RDumpTester.cs:line 74
   at __GeneratedMainWrapper.Main() in /runtime/artifacts/tests/coreclr/obj/linux.riscv64.Checked/Managed/readytorun/r2rdump/FrameworkTests/R2RDumpTests/XUnitWrapperGenerator/XUnitWrapperGenerator.XUnitWrapperGenerator/SimpleRunner.g.cs:line 7
Expected: 100
Actual: 101
END EXECUTION - FAILED

I don't know how to fix it because the possible fix, which I see, would be related with changing the versions of json files in the runtime. It would be too invasive file operation. I checked this error on x64 and riscv64.

cc @dotnet/samsung

ivdiazsa commented 1 month ago

Hi @SzpejnaDawid! You mentioned you could also see the error on x64. I tried reproducing it on my Linux machine but to no avail. The test ran well. However, there is something that caught my attention from your repro. It's marking your dotnet installation as a 10.0.0 version, located in the testhost path of your artifacts.

How did you build the repo and the tests to get it to be configured like that? I tried my usual workflow and when running the test, it used my local dotnet installation, which is .NET 9 Preview 7. I also tried removing all references to dotnet from my PATH and DOTNET_ROOT, so as to make the repo think I don't have any version installed, and it pulled its own, which is also 9.0.0-preview.7.24405.7.

SzpejnaDawid commented 1 month ago

So, I downloaded dotnet/runtime and then set CORE_ROOT environment variable to /runtime/artifacts/tests/coreclr/linux.riscv64.Checked/Tests/Core_Root. When it comes to build runtime with tests I used

// Build runtime
./build.sh --clang-18 -c Release -s libs
./build.sh --clang-18 -c Checked -s clr+libs+host

// Build tests
./src/tests/build.sh --clang-18 -Checked -priority1 -p:UseLocalAppHostPack=true

When it comes to running test I used a bash script.

// In directory /runtime/artifacts/tests/coreclr/linux.x64.Checked/readytorun/r2rdump/FrameworkTests/R2RDumpTests
./R2RDumpTests.sh

I have tested this test a moment ago (using the newest runtime) and it still fails.

ivdiazsa commented 1 month ago

Thanks for the details. Let me give it a shot following your workflow.

ivdiazsa commented 1 month ago

@SzpejnaDawid Can you try again with a clean clone of the repo on the latest commit? I've been going on about most of the day and I can't get my builds to reproduce the issue. No matter how I build, it never picks the artifacts/bin/testhost path as the framework to use, hence the version mismatch doesn't happen. Maybe something fixed it recently?

SzpejnaDawid commented 1 month ago

I forgot to mention about this variable __TestDotNetCmd=/runtime/artifacts/bin/testhost/net9.0-linux-Checked-x64/dotnet. Could you try to run the test with that variable? THX

ivdiazsa commented 1 month ago

I forgot to mention about this variable __TestDotNetCmd=/runtime/artifacts/bin/testhost/net9.0-linux-Checked-x64/dotnet. Could you try to run the test with that variable? THX

This worked. I'm able to reproduce it with this setting.

SzpejnaDawid commented 1 month ago

I had similar problems with 10.0.0 version in tests:

readytorun.tests.genericsload.callgenericctor.callgenericctor
readytorun.tests.genericsload.usegenericfield.usegenericfield
readytorun.GenericCycleDetection.Depth3Test.Depth3Test
readytorun.GenericCycleDetection.Depth1Test.Depth1Test
readytorun.GenericCycleDetection.Breadth1Test.Breadth1Test
readytorun.crossgen2.crossgen2smoke.crossgen2smoke
readytorun.fieldlayout.fieldlayout.fieldlayout
baseservices.TieredCompilation.BasicTest_QuickJitForLoopsOn_R2r.BasicTest_QuickJitForLoopsOn_R2r
baseservices.TieredCompilation.BasicTest_QuickJitOff_R2r.BasicTest_QuickJitOff_R2r
baseservices.TieredCompilation.BasicTest_QuickJitOn_R2r.BasicTest_QuickJitOn_R2r
baseservices.TieredCompilation.BasicTest_QuickJitForLoopsOff_R2r.BasicTest_QuickJitForLoopsOff_R2r
baseservices.TieredCompilation.BasicTest_DefaultMode_R2r.BasicTest_DefaultMode_R2r
Regressions.coreclr.GitHub_49826.test49826.test49826
Regressions.coreclr.GitHub_49982.test49982.test49982
Regressions.coreclr.GitHub_61104.test61104.test61104
ivdiazsa commented 1 month ago

I had similar problems with 10.0.0 version in tests:

readytorun.tests.genericsload.callgenericctor.callgenericctor
readytorun.tests.genericsload.usegenericfield.usegenericfield
readytorun.GenericCycleDetection.Depth3Test.Depth3Test
readytorun.GenericCycleDetection.Depth1Test.Depth1Test
readytorun.GenericCycleDetection.Breadth1Test.Breadth1Test
readytorun.crossgen2.crossgen2smoke.crossgen2smoke
readytorun.fieldlayout.fieldlayout.fieldlayout
baseservices.TieredCompilation.BasicTest_QuickJitForLoopsOn_R2r.BasicTest_QuickJitForLoopsOn_R2r
baseservices.TieredCompilation.BasicTest_QuickJitOff_R2r.BasicTest_QuickJitOff_R2r
baseservices.TieredCompilation.BasicTest_QuickJitOn_R2r.BasicTest_QuickJitOn_R2r
baseservices.TieredCompilation.BasicTest_QuickJitForLoopsOff_R2r.BasicTest_QuickJitForLoopsOff_R2r
baseservices.TieredCompilation.BasicTest_DefaultMode_R2r.BasicTest_DefaultMode_R2r
Regressions.coreclr.GitHub_49826.test49826.test49826
Regressions.coreclr.GitHub_49982.test49982.test49982
Regressions.coreclr.GitHub_61104.test61104.test61104

As I was looking into it yesterday, I also found out it's only certain tests that fail, but didn't jot them down together. So, thanks for providing this list.