Skip to content

Commit 9cc1edc

Browse files
committed
Fix expected output comparison with newer versions of libcurl
1 parent 60dd34d commit 9cc1edc

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

azure-pipelines/end-to-end-tests-dir/asset-caching.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Throw-IfNotFailed
5959
$expected = @(
6060
"A suitable version of cmake was not found \(required v[0-9.]+\)\.",
6161
"Trying to download cmake-[0-9.]+-[^.]+\.(zip|tar\.gz) using asset cache file://$assetCacheRegex/[0-9a-z]+",
62-
"error: curl operation failed with error code 37 \(Couldn't read a file:\/\/ file\)\.",
62+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:\/\/ file\)\.",
6363
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+"
6464
"error: there were no asset cache hits, and x-block-origin blocks trying the authoritative source https://github\.com/Kitware/CMake/releases/download/[^ ]+",
6565
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
@@ -112,7 +112,7 @@ if (-not ($actual -match $expected)) {
112112
Refresh-TestRoot
113113
$expected = @(
114114
"^Downloading https://localhost:1234/foobar\.html -> example3\.html",
115-
"error: curl operation failed with error code 7 \(Couldn't connect to server\)\.",
115+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
116116
"error: Not a transient network error, won't retry download from https://localhost:1234/foobar\.html",
117117
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
118118
"Possible causes are:",
@@ -136,10 +136,10 @@ if (-not ($actual -match $expected)) {
136136
Refresh-TestRoot
137137
$expected = @(
138138
"^Downloading example3\.html, trying https://localhost:1234/foobar\.html",
139-
"error: curl operation failed with error code 7 \(Couldn't connect to server\)\.",
139+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
140140
"error: Not a transient network error, won't retry download from https://localhost:1234/foobar\.html",
141141
"Trying https://localhost:1235/baz\.html",
142-
"error: curl operation failed with error code 7 \(Couldn't connect to server\)\.",
142+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
143143
"error: Not a transient network error, won't retry download from https://localhost:1235/baz\.html",
144144
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
145145
"Possible causes are:",
@@ -195,7 +195,7 @@ if (-not ($actual -match $expected)) {
195195
Refresh-TestRoot
196196
$expected = @(
197197
"^Downloading example3\.html, trying https://nonexistent\.example\.com",
198-
"error: curl operation failed with error code 6 \(Couldn't resolve host name\)\.",
198+
"error: curl operation failed with error code 6 \((Couldn't|Could not) resolve host name\)\.",
199199
"error: Not a transient network error, won't retry download from https://nonexistent\.example\.com",
200200
"Trying https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt"
201201
"Successfully downloaded example3\.html",
@@ -229,9 +229,9 @@ Refresh-TestRoot
229229
$expected = @(
230230
"^Trying to download example3\.html using asset cache file://$assetCacheRegex/[0-9a-z]+",
231231
"Asset cache miss; trying authoritative source https://localhost:1234/foobar\.html",
232-
"error: curl operation failed with error code 37 \(Couldn't read a file:// file\)\.",
232+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:// file\)\.",
233233
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+",
234-
"error: curl operation failed with error code 7 \(Couldn't connect to server\)\.",
234+
"error: curl operation failed with error code 7 \((Couldn't|Could not) connect to server\)\.",
235235
"error: Not a transient network error, won't retry download from https://localhost:1234/foobar\.html",
236236
"note: If you are using a proxy, please ensure your proxy settings are correct\.",
237237
"Possible causes are:",
@@ -291,7 +291,7 @@ if (-not ($actual -match $expected)) {
291291
$expected = @(
292292
"^Trying to download example3\.html using asset cache file://$assetCacheRegex/[0-9a-z]+",
293293
"Asset cache miss; trying authoritative source https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt",
294-
"error: curl operation failed with error code 37 \(Couldn't read a file:// file\)\.",
294+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:// file\)\.",
295295
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+",
296296
"[^\n]+example3\.html\.\d+\.part: error: download from https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt had an unexpected hash",
297297
"note: Expected: d06b93c883f8126a04589937a884032df031b05518eed9d433efb6447834df2596aebd500d69b8283e5702d988ed49655ae654c1683c7a4ae58bfa6b92f2b73b",
@@ -354,7 +354,7 @@ if (-not ($actual -match $expected)) {
354354
Refresh-TestRoot
355355
$expected = @(
356356
"^Trying to download example3\.html using asset cache file://$assetCacheRegex/[0-9a-z]+",
357-
"error: curl operation failed with error code 37 \(Couldn't read a file:// file\)\.",
357+
"error: curl operation failed with error code 37 \((Couldn't|Could not) read a file:// file\)\.",
358358
"error: Not a transient network error, won't retry download from file://$assetCacheRegex/[0-9a-z]+",
359359
"error: there were no asset cache hits, and x-block-origin blocks trying the authoritative source https://raw\.githubusercontent\.com/microsoft/vcpkg-tool/1767aaee7b229c609f7ad5cf2f57b6a6cc309fb8/LICENSE\.txt",
360360
"note: or https://alternate\.example\.com",

src/vcpkg-test/downloads.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ TEST_CASE ("download_files", "[downloads]")
134134
std::vector<std::string> headers;
135135
auto results = download_files_no_cache(bdc, test_downloads, headers);
136136
REQUIRE(results == std::vector<int>{-1, -1});
137-
auto all_errors = bdc.to_string();
138-
REQUIRE(all_errors == "error: curl operation failed with error code 1 (Unsupported protocol).\n"
139-
"error: curl operation failed with error code 7 (Couldn't connect to server).");
137+
auto all_errors = Strings::split(bdc.to_string(), '\n');
138+
REQUIRE(all_errors[0] == "error: curl operation failed with error code 1 (Unsupported protocol).");
139+
// Old versions of libcurl use "Couldn't" on error messages
140+
REQUIRE((all_errors[1] == "error: curl operation failed with error code 7 (Could not connect to server)." ||
141+
all_errors[1] == "error: curl operation failed with error code 7 (Couldn't connect to server)."));
140142
}
141143

142144
TEST_CASE ("try_parse_curl_max5_size", "[downloads]")

0 commit comments

Comments
 (0)