From b1ca45db6d9449e66c06e88c086e2ee21c81b74f Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Fri, 18 Jan 2019 07:47:52 -0800 Subject: [PATCH] fixes for ARM32 (dotnet/corefx#34559) * arm fixes * use PassingTestTimeoutMilliseconds instead of hardcoded number Commit migrated from https://github.com/dotnet/corefx/commit/4eccf3ff4e87831de660e6a23b3ba24d55f7bca1 --- .../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/libraries/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs b/src/libraries/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs index 47996113d11dd..d8b2d73efaa8c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.EasyRequest.cs +++ b/src/libraries/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/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs index 6110c423ef932..94d587514e8b9 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs +++ b/src/libraries/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/libraries/System.Net.Http/tests/FunctionalTests/TestHelper.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/TestHelper.cs index 22b267fb413be..ed800d2fd8a2d 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/TestHelper.cs +++ b/src/libraries/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 ? PassingTestTimeoutMilliseconds * 5 : PassingTestTimeoutMilliseconds); } public static Task WhenAllCompletedOrAnyFailedWithTimeout(int timeoutInMilliseconds, params Task[] tasks)