From 3fe4f3f2d8befed9c02b9e4623256bcd81480fce Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Fri, 11 Jan 2019 23:08:22 +0000 Subject: [PATCH 1/2] arm fixes --- .../Net/Http/CurlHandler/CurlHandler.EasyRequest.cs | 4 ++-- .../tests/FunctionalTests/NtAuthTests.cs | 10 +++++++++- .../tests/FunctionalTests/TestHelper.cs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs b/src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs index 47996113d11d..d8b2d73efaa8 100644 --- a/src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs +++ b/src/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs @@ -311,8 +311,8 @@ private void SetMultithreading() private void SetTimeouts() { - // Set timeout limit on the connect phase. - SetCurlOption(CURLoption.CURLOPT_CONNECTTIMEOUT_MS, int.MaxValue); + // Set timeout limit on the connect phase. curl has bug on ARM so use max - 1s. + SetCurlOption(CURLoption.CURLOPT_CONNECTTIMEOUT_MS, int.MaxValue - 1000); // Override the default DNS cache timeout. libcurl defaults to a 1 minute // timeout, but we extend that to match the Windows timeout of 10 minutes. diff --git a/src/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs b/src/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs index 6110c423ef93..94d587514e8b 100644 --- a/src/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs +++ b/src/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs @@ -48,13 +48,21 @@ public NtAuthServer(AuthenticationSchemes authSchemes) { // Ignore. } + catch (ObjectDisposedException) + { + // Ignore. + } + catch (InvalidOperationException) + { + // Ignore. + } }); } public void Dispose() { _listener.Stop(); - _serverTask.Wait(); + _serverTask.Wait(TestHelper.PassingTestTimeoutMilliseconds); } public string BaseUrl { get; private set; } diff --git a/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs b/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs index 22b267fb413b..91ec0e8bed00 100644 --- a/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs +++ b/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs @@ -93,7 +93,7 @@ public static byte[] ComputeMD5Hash(byte[] data) public static Task WhenAllCompletedOrAnyFailed(params Task[] tasks) { - return TaskTimeoutExtensions.WhenAllOrAnyFailed(tasks); + return TaskTimeoutExtensions.WhenAllOrAnyFailed(tasks, PlatformDetection.IsArmProcess || PlatformDetection.IsArm64Process ? 30_000 : 10_000); } public static Task WhenAllCompletedOrAnyFailedWithTimeout(int timeoutInMilliseconds, params Task[] tasks) From 4441d5eb03b6d1c1442d1ccb1b12b65477e19636 Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Mon, 14 Jan 2019 21:23:02 +0000 Subject: [PATCH 2/2] use PassingTestTimeoutMilliseconds instead of hardcoded number --- src/System.Net.Http/tests/FunctionalTests/TestHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs b/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs index 91ec0e8bed00..ed800d2fd8a2 100644 --- a/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs +++ b/src/System.Net.Http/tests/FunctionalTests/TestHelper.cs @@ -93,7 +93,7 @@ public static byte[] ComputeMD5Hash(byte[] data) public static Task WhenAllCompletedOrAnyFailed(params Task[] tasks) { - return TaskTimeoutExtensions.WhenAllOrAnyFailed(tasks, PlatformDetection.IsArmProcess || PlatformDetection.IsArm64Process ? 30_000 : 10_000); + return TaskTimeoutExtensions.WhenAllOrAnyFailed(tasks, PlatformDetection.IsArmProcess || PlatformDetection.IsArm64Process ? PassingTestTimeoutMilliseconds * 5 : PassingTestTimeoutMilliseconds); } public static Task WhenAllCompletedOrAnyFailedWithTimeout(int timeoutInMilliseconds, params Task[] tasks)