diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs index 4707dca62f6bc..7965f9598bfd3 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/EnvironmentTests.cs @@ -584,14 +584,14 @@ public void TestCpuUsage() if (usage.UserTime == TimeSpan.Zero) { // Environment should return 0 for all values - Assert.Equal(TimeSpan.Zero, usage.PrivilegedTime); - Assert.Equal(TimeSpan.Zero, usage.TotalTime); + Assert.True(usage.PrivilegedTime == TimeSpan.Zero, $"Unexpected privileged time: {usage.PrivilegedTime} while having user time: {usage.UserTime}"); + Assert.True(usage.TotalTime == TimeSpan.Zero, $"Unexpected Zero Total while having privileged time: {usage.PrivilegedTime} and user time: {usage.UserTime}"); } else { - // Mobile platforms emulators may return non-zero values - Assert.NotEqual(TimeSpan.Zero, usage.PrivilegedTime); - Assert.Equal(usage.TotalTime, usage.UserTime + usage.PrivilegedTime); + // Mobile platforms emulators may return non-zero values. tvOS is possible returning Zero privileged time though. + Assert.True(PlatformDetection.IstvOS || TimeSpan.Zero != usage.PrivilegedTime, $"Unexpected Zero privileged time while having user time: {usage.UserTime}"); + Assert.True(usage.TotalTime == usage.UserTime + usage.PrivilegedTime, $"Unexpected Total time: {usage.TotalTime} while having privileged time: {usage.PrivilegedTime} and user time: {usage.UserTime}"); } } else