From 7527d5f7cb8a67821af9d05d278ca5571360545f Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 2 Dec 2021 18:45:43 +0000 Subject: [PATCH 1/3] [wasm] Disable System.Diagnostics.Tests.StopwatchTests.GetTimestamp Issue: https://github.com/dotnet/runtime/issues/62021 --- .../tests/System/Diagnostics/Stopwatch.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs b/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs index 452d59aadbc718..a24f3876b4b831 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs @@ -12,6 +12,7 @@ public static class StopwatchTests private static readonly ManualResetEvent s_sleepEvent = new ManualResetEvent(false); [Fact] + [ActiveIssue("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/dotnet/runtime/issues/62021", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser)] public static void GetTimestamp() { long ts1 = Stopwatch.GetTimestamp(); From 6beccdcb1e6803083fdda2528cdf32ca87db8b5c Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 2 Dec 2021 19:38:53 +0000 Subject: [PATCH 2/3] add missing paren --- .../tests/System/Diagnostics/Stopwatch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs b/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs index a24f3876b4b831..dd2b72bbba5ffe 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs @@ -12,7 +12,7 @@ public static class StopwatchTests private static readonly ManualResetEvent s_sleepEvent = new ManualResetEvent(false); [Fact] - [ActiveIssue("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/dotnet/runtime/issues/62021", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser)] + [ActiveIssue("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/dotnet/runtime/issues/62021", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser))] public static void GetTimestamp() { long ts1 = Stopwatch.GetTimestamp(); From 35e253d81bc71e149938346802ab27b55028358a Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Thu, 2 Dec 2021 21:58:57 +0000 Subject: [PATCH 3/3] [wasm] StopwatchTests.GetTimestamp: sleep for 5ms on browser Issue: https://github.com/dotnet/runtime/issues/62021 --- .../tests/System/Diagnostics/Stopwatch.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs b/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs index dd2b72bbba5ffe..672e6af2f32acf 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Diagnostics/Stopwatch.cs @@ -12,11 +12,18 @@ public static class StopwatchTests private static readonly ManualResetEvent s_sleepEvent = new ManualResetEvent(false); [Fact] - [ActiveIssue("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/dotnet/runtime/issues/62021", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser))] public static void GetTimestamp() { long ts1 = Stopwatch.GetTimestamp(); - Sleep(); + if (PlatformDetection.IsBrowser) + { + // workaround for issue: https://github.com/dotnet/runtime/issues/62021 + Sleep(5); + } + else + { + Sleep(); + } long ts2 = Stopwatch.GetTimestamp(); Assert.NotEqual(ts1, ts2); }