https://mc.dot.net/#/user/dotnet-bot/pr~2Fdotnet~2Fcorefx~2Frefs~2Fpull~2F37996~2Fmerge/test~2Ffunctional~2Fcli~2Finnerloop~2F/20190528.42/workItem/System.Runtime.Extensions.Tests/wilogs
Discovering: System.Runtime.Extensions.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Runtime.Extensions.Tests (found 805 of 887 test cases)
Starting: System.Runtime.Extensions.Tests (parallel test collections = on, max threads = 4)
System.Tests.EnvironmentTests.GetFolderPath_UapExistAndAccessible [SKIP]
Condition(s) not met: "IsWindows10Version1709OrGreater", "IsInAppContainer"
System.Tests.EnvironmentTests.GetFolderPath_UapNotEmpty [SKIP]
Condition(s) not met: "IsWindows10Version1709OrGreater", "IsInAppContainer"
Assertion failed: (cpuUtilization >= 0 && cpuUtilization <= 100), function SystemNative_GetCpuUtilization, file /Users/vsts/agent/2.150.3/work/1/s/src/Native/Unix/System.Native/pal_time.c, line 200.
./RunTests.sh: line 175: 51998 Abort trap: 6 (core dumped) "$RUNTIME_PATH/dotnet" xunit.console.dll System.Runtime.Extensions.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=nonnetcoreapptests -notrait category=nonosxtests -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing $RSP_FILE
Good sleuthing @anipik
I considered it, but this method is really just a compat implementation and performance here is not critical, and as such I preferred to just use the existing function that does a bit of unnecessary work rather than carry around additional code that also needs to be maintained.
Great, that makes more sense. Thanks for tracking it down 😃
There are a couple of issues. The way we are using the interop here is not correct https://github.com/dotnet/corefx/blob/master/src/Common/src/CoreLib/System/AppDomain.Unix.cs#L14
The native function tells amount of cpu utilization by the process from the last recorded time(which could be previous call to this function or the process start time) to the current time. here the input cpuinfo ref is zero. We need to correct this implementation.
The other problem is an overflow problem https://github.com/dotnet/corefx/blob/master/src/Native/Unix/System.Native/pal_time.c#L172 the multiplication operation is leading to an overflow here.
We are using this code for polling in runtime. so we only care about difference there. The overflow code could be a recent bug as well.
@tannergooding can you take a look if you missed any scenario in your recent changes to this api ?