dotnet / runtime

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

How to run `GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh` on linux ? #74333

Open shushanhf opened 1 year ago

shushanhf commented 1 year ago

How to run the artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh on x64-linux ?

There is only the command on the windows https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/coreclr/gc-stress-run-readme.md .

If setting RunningLongGCTests=1 and running the artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh, there will be a error (the following is the runtime6.0.8):

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.IO.FileNotFoundException: Could not load file or assembly '/home/qiao/work_qiao/dotnet-runtime-loongarch/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/Tests/Microsoft.Win32.Primitives.dll'. The system cannot find the file specified.
ghost commented 1 year ago

Tagging subscribers to this area: @hoyosjs See info in area-owners.md if you want to be subscribed.

Issue Details
How to run the `artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh` on x64-linux ? There is only the command on the windows `https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/coreclr/gc-stress-run-readme.md` . If setting `RunningLongGCTests=1` and running the `artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh`, there will be a error (the following is the runtime6.0.8): ```shell System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. File name: 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load file or assembly '/home/qiao/work_qiao/dotnet-runtime-loongarch/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/Tests/Microsoft.Win32.Primitives.dll'. The system cannot find the file specified. ```
Author: shushanhf
Assignees: -
Labels: `area-Infrastructure-coreclr`
Milestone: -
ghost commented 1 year ago

Tagging subscribers to this area: @dotnet/gc See info in area-owners.md if you want to be subscribed.

Issue Details
How to run the `artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh` on x64-linux ? There is only the command on the windows `https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/coreclr/gc-stress-run-readme.md` . If setting `RunningLongGCTests=1` and running the `artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh`, there will be a error (the following is the runtime6.0.8): ```shell System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. File name: 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load file or assembly '/home/qiao/work_qiao/dotnet-runtime-loongarch/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/Tests/Microsoft.Win32.Primitives.dll'. The system cannot find the file specified. ```
Author: shushanhf
Assignees: -
Labels: `question`, `GCStress`, `area-GC-coreclr`, `untriaged`
Milestone: -
mangod9 commented 1 year ago

@cshung, I know you had run this recently. Do we have instructions?

cshung commented 1 year ago

These commands should work, I just tested them on the latest main branch.

cd ~/git/runtime
./build.sh -s clr
./build.sh -c release -s libs
./src/test/build.sh generatelayoutonly
cd ./src/tests/GC/Stress/Framework
 ~/git/runtime/dotnet.sh build
cd ~/git/runtime
export CORE_ROOT=~/git/runtime/artifacts/tests/coreclr/Linux.x64.Debug/Tests/Core_Root
export RunningLongGCTests=1
~/git/runtime/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh
shushanhf commented 1 year ago

These commands should work, I just tested them on the latest main branch.

cd ~/git/runtime
./build.sh -s clr
./build.sh -c release -s libs
./src/test/build.sh generatelayoutonly
cd ./src/tests/GC/Stress/Framework
 ~/git/runtime/dotnet.sh build
cd ~/git/runtime
export CORE_ROOT=~/git/runtime/artifacts/tests/coreclr/Linux.x64.Debug/Tests/Core_Root
export RunningLongGCTests=1
~/git/runtime/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh

Thanks

I will test it on the latest main branch.

But the branch6.0 on the tag 6.0.8, the debug is not ok which liking the errors within the descrition. Why?

shushanhf commented 1 year ago

These commands should work, I just tested them on the latest main branch.

cd ~/git/runtime
./build.sh -s clr
./build.sh -c release -s libs
./src/test/build.sh generatelayoutonly
cd ./src/tests/GC/Stress/Framework
 ~/git/runtime/dotnet.sh build
cd ~/git/runtime
export CORE_ROOT=~/git/runtime/artifacts/tests/coreclr/Linux.x64.Debug/Tests/Core_Root
export RunningLongGCTests=1
~/git/runtime/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh

I had tested by these commands, it's only ok for the latest main branch but still error for branch6.0 with the tag6.0.8.

the latest main branch: (tests are running....)

qiao@X64:~/work_qiao/runtime$ bash /home/qiao/work_qiao/runtime/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh 
BEGIN EXECUTION
/home/qiao/work_qiao/runtime/artifacts/tests/coreclr/Linux.x64.Debug/Tests/Core_Root/corerun ReliabilityFramework.dll '-unittest'
Using config file: /home/qiao/work_qiao/runtime/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/testmix_gc_ci.config
NUMBER_OF_PROCESSORS environment variable not supplied, falling back to Environment
test is 573277.dll
test is allocationwithpins.dll
test is b115557.dll
test is bestfit-finalize.dll
test is concurrentspin2.dll
test is doubLinkStay.dll
test is ExpandHeap.dll
test is GCQueue.dll
test is GCSimulator.dll
test is GCVariant.dll
test is LeakGenThrd.dll
test is MulDimJagAry.dll
test is pinstress.dll
test is plug.dll
test is PlugGaps.dll
test is SingLinkStay.dll
test is StressAllocator.dll
test is StressAllocator.dll
test is ThdTreeGrowingObj.dll
Loading all tests: ...................

but the release6.0 with tag6.0.8 is error:

Loaded System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from /home/qiao/work_qiao/dotnet-runtime-loongarch/artifacts/tests/coreclr/Linux.x64.Debug/Tests/Core_Root/System.Runtime.dll
.
Process terminated. Test failed
   at System.Environment.FailFast(System.String, System.Exception)
   at ReliabilityFramework+<>c__DisplayClass35_0.<StartTestWorker>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task+<>c.<.cctor>b__272_0(System.Object)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
   at System.Threading.Tasks.Task.ExecuteEntryUnsafe(System.Threading.Thread)
   at System.Threading.Tasks.Task.ExecuteFromThreadPool(System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'Microsoft.Win32.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.IO.FileNotFoundException: Could not load file or assembly '/home/qiao/work_qiao/dotnet-runtime-loongarch/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/Tests/Microsoft.Win32.Primitives.dll'. The system cannot find the file specified.

File name: '/home/qiao/work_qiao/dotnet-runtime-loongarch/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/Tests/Microsoft.Win32.Primitives.dll'
   at System.Reflection.AssemblyName.nGetFileInformation(String s)
   at System.Reflection.AssemblyName.GetFileInformationCore(String assemblyFile)
   at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
   at System.Runtime.Loader.AssemblyLoadContext.GetAssemblyName(String assemblyPath)
   at CustomAssemblyResolver.Load(AssemblyName assemblyName) in /home/qiao/work_qiao/dotnet-runtime-loongarch/src/tests/GC/Stress/Framework/ReliabilityFramework.cs:line 85
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.ConsolePal.EnsureInitializedCore()
   at System.ConsolePal.Write(SafeFileHandle fd, ReadOnlySpan`1 buffer, Boolean mayChangeCursorPosition) in /home/qiao/work_qiao/dotnet-runtime-loongarch/src/libraries/System.Console/src/System/ConsolePal.Unix.cs:line 1267
   at System.ConsolePal.UnixConsoleStream.Write(ReadOnlySpan`1 buffer) in /home/qiao/work_qiao/dotnet-runtime-loongarch/src/libraries/System.Console/src/System/ConsolePal.Unix.cs:line 1468
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.WriteLine(String value)
   at System.IO.TextWriter.SyncTextWriter.WriteLine(String value)
   at System.Console.WriteLine(String value) in /home/qiao/work_qiao/dotnet-runtime-loongarch/src/libraries/System.Console/src/System/Console.cs:line 807
   at Test.Main(String[] args) in /home/qiao/work_qiao/dotnet-runtime-loongarch/src/tests/GC/Stress/Tests/PlugGaps.cs:line 114
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at ReliabilityFramework.<>c__DisplayClass35_0.<StartTestWorker>b__0() in /home/qiao/work_qiao/dotnet-runtime-loongarch/src/tests/GC/Stress/Framework/ReliabilityFramework.cs:line 1213/home/qiao/work_qiao/dotnet-runtime-loongarch/artifacts/tests/coreclr/Linux.x64.Debug/GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh:行 348:  4989 已放弃               $LAUNCHER $ExePath "${CLRTestExecutionArguments[@]}"
Expected: 100
Actual: 134
END EXECUTION - FAILED
shushanhf commented 1 year ago

run_ReliabilityFramework.log

anthonycanino commented 9 months ago

Hi, I have followed the commands above, but when the tests finish running, I see the following error...

image

It seems like this is an issue where that library is windows only.

Do we know if there is a stable way to run these tasks on linux, (I am running .NET 8 from a locally built repo).

cshung commented 9 months ago

@anthonycanino, can you debug why we try to load kernel32 on Linux? It might simply be somewhere we forget to #if WINDOWS.

anthonycanino commented 9 months ago

Looking into it

anthonycanino commented 9 months ago

Looks like there is some platform dependent code in some of the debug break setup: https://github.com/dotnet/runtime/blob/main/src/tests/GC/Stress/Framework/ReliabilityFramework.cs#L509-L516

Locally, I have placed if directives around https://github.com/dotnet/runtime/blob/main/src/tests/GC/Stress/Framework/ReliabilityFramework.cs#L538-L542 and it seems to work now.

I am not sure how you'd like to handle, I can open up a PR for that change, though that wouldn't offer the same level of feature on Linux.

cshung commented 9 months ago

Looks like there is some platform-dependent code in some of the debug break setup:

Can you replace those with these APIs?

These should be cross-platform friendly.

@dotnet/dotnet-diag on potential functional differences.