mirror of
https://github.com/curl/curl.git
synced 2026-08-25 22:23:53 +03:00
tests: reformat error messages to avoid tripping MSBuild
Change the format of error messages sent to stderr from tests and test
servers. As a workaround to avoid triggering Visual Studio's MSBuild
tool's built-in regexp matcher, and making it mark builds failed for
reasons we don't want them to hard fail.
Roughly, the pattern to avoid is the word "error" (case-insensitive)
in the same line with a colon `:`.
It affected GHA/windows MSVC CI jobs, causing flakiness:
```
CUSTOMBUILD : fopen() failed with error : 13 Permission denied [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
Error opening file: log/4/smtp_sockfilt.log
[...]
CUSTOMBUILD : fopen() failed with error : 13 Permission denied [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
Error opening file: log/8/imap_sockfilt.log
Msg not logged: 00:18:10.656000 > 178 bytes data, server => client
[...]
TESTDONE: 1629 tests out of 1634 reported OK: 99%
Building Custom Rule D:/a/curl/curl/tests/CMakeLists.txt
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\a\curl\curl\bld\CMakeFiles\621f80ddbb0fa48179f056ca77842ff0\test-ci.rule;D:\a\curl\curl\tests\CMakeLists.txt' exited with code -1. [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
Error: Process completed with exit code 1.
```
Ref: https://github.com/curl/curl/actions/runs/13643149623/job/38137076210?pr=16490#step:14:3125
Ref: https://github.com/curl/curl/actions/runs/13688765792/job/38277961720?pr=16582#step:14:1717
The `IgnoreStandardErrorWarningFormat="true"` MSBuild Exec option
controls this behavior:
https://learn.microsoft.com/visualstudio/msbuild/exec-task#parameters
I couldn't figure out a way to apply it to CMake builds.
MSBuid pattern matching rules:
353c0f3d37/src/Shared/CanonicalError.cs
https://learn.microsoft.com/visualstudio/msbuild/msbuild-diagnostic-format-for-tasks
Note: There may be further error messages output from runtests scripts,
that use this format, which are not explicitly fatal. They may need
future fixes.
Thanks-to: Dion Williams
Ref: https://github.com/curl/curl/discussions/14854#discussioncomment-12382190
Ref: https://github.com/curl/curl/discussions/14854#discussioncomment-12395224
Closes #16583
This commit is contained in:
parent
8537a5b0bc
commit
9463769f2e
14 changed files with 130 additions and 130 deletions
|
|
@ -70,11 +70,11 @@ CURLcode test(char *URL)
|
|||
|
||||
ret = run(hnd, 1, 2);
|
||||
if(ret)
|
||||
fprintf(stderr, "error %d: %s\n", ret, buffer);
|
||||
fprintf(stderr, "error (%d) %s\n", ret, buffer);
|
||||
|
||||
ret = run(hnd, 12000, 1);
|
||||
if(ret != CURLE_OPERATION_TIMEDOUT)
|
||||
fprintf(stderr, "error %d: %s\n", ret, buffer);
|
||||
fprintf(stderr, "error (%d) %s\n", ret, buffer);
|
||||
else
|
||||
ret = CURLE_OK;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ CURLcode test(char *URL)
|
|||
|
||||
hd_src = fopen(libtest_arg2, "rb");
|
||||
if(!hd_src) {
|
||||
fprintf(stderr, "fopen failed with error: %d %s\n",
|
||||
fprintf(stderr, "fopen failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */
|
||||
}
|
||||
|
||||
|
|
@ -70,15 +70,15 @@ CURLcode test(char *URL)
|
|||
#endif
|
||||
if(hd == -1) {
|
||||
/* can't open file, bail out */
|
||||
fprintf(stderr, "fstat() failed with error: %d %s\n",
|
||||
fprintf(stderr, "fstat() failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "ERROR: cannot open file %s\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
fclose(hd_src);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
if(!file_info.st_size) {
|
||||
fprintf(stderr, "ERROR: file %s has zero size!\n", libtest_arg2);
|
||||
fprintf(stderr, "File %s has zero size!\n", libtest_arg2);
|
||||
fclose(hd_src);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ CURLcode test(char *URL)
|
|||
|
||||
hd_src = fopen(libtest_arg2, "rb");
|
||||
if(!hd_src) {
|
||||
fprintf(stderr, "fopen failed with error: %d (%s)\n",
|
||||
fprintf(stderr, "fopen failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
return TEST_ERR_FOPEN;
|
||||
}
|
||||
|
||||
|
|
@ -70,9 +70,9 @@ CURLcode test(char *URL)
|
|||
#endif
|
||||
if(hd == -1) {
|
||||
/* can't open file, bail out */
|
||||
fprintf(stderr, "fstat() failed with error: %d (%s)\n",
|
||||
fprintf(stderr, "fstat() failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "ERROR: cannot open file (%s)\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
fclose(hd_src);
|
||||
return TEST_ERR_FSTAT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ static int socket_action(CURLM *curl, curl_socket_t s, int evBitmask,
|
|||
int numhandles = 0;
|
||||
CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
|
||||
if(result != CURLM_OK) {
|
||||
fprintf(stderr, "Curl error on %s: %i (%s)\n",
|
||||
fprintf(stderr, "Curl error on %s (%i) %s\n",
|
||||
info, result, curl_multi_strerror(result));
|
||||
}
|
||||
return (int)result;
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ CURLcode test(char *URL)
|
|||
|
||||
hd_src = fopen(libtest_arg2, "rb");
|
||||
if(!hd_src) {
|
||||
fprintf(stderr, "fopen failed with error: %d %s\n",
|
||||
fprintf(stderr, "fopen failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
return (CURLcode)-2; /* if this happens things are major weird */
|
||||
}
|
||||
|
||||
|
|
@ -62,15 +62,15 @@ CURLcode test(char *URL)
|
|||
#endif
|
||||
if(hd == -1) {
|
||||
/* can't open file, bail out */
|
||||
fprintf(stderr, "fstat() failed with error: %d %s\n",
|
||||
fprintf(stderr, "fstat() failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "ERROR: cannot open file %s\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
fclose(hd_src);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
||||
if(!file_info.st_size) {
|
||||
fprintf(stderr, "ERROR: file %s has zero size!\n", libtest_arg2);
|
||||
fprintf(stderr, "File %s has zero size!\n", libtest_arg2);
|
||||
fclose(hd_src);
|
||||
return TEST_ERR_MAJOR_BAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ static void notifyCurl(CURLM *curl, curl_socket_t s, int evBitmask,
|
|||
int numhandles = 0;
|
||||
CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
|
||||
if(result != CURLM_OK) {
|
||||
fprintf(stderr, "Curl error on %s: %i (%s)\n",
|
||||
fprintf(stderr, "Curl error on %s (%i) %s\n",
|
||||
info, result, curl_multi_strerror(result));
|
||||
}
|
||||
}
|
||||
|
|
@ -249,9 +249,9 @@ CURLcode test(char *URL)
|
|||
|
||||
hd_src = fopen(libtest_arg2, "rb");
|
||||
if(!hd_src) {
|
||||
fprintf(stderr, "fopen() failed with error: %d (%s)\n",
|
||||
fprintf(stderr, "fopen() failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
return TEST_ERR_FOPEN;
|
||||
}
|
||||
|
||||
|
|
@ -263,9 +263,9 @@ CURLcode test(char *URL)
|
|||
#endif
|
||||
if(hd == -1) {
|
||||
/* can't open file, bail out */
|
||||
fprintf(stderr, "fstat() failed with error: %d (%s)\n",
|
||||
fprintf(stderr, "fstat() failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "ERROR: cannot open file (%s)\n", libtest_arg2);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg2);
|
||||
fclose(hd_src);
|
||||
return TEST_ERR_FSTAT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ CURLcode test(char *URL)
|
|||
|
||||
upload = fopen(libtest_arg3, "rb");
|
||||
if(!upload) {
|
||||
fprintf(stderr, "fopen() failed with error: %d (%s)\n",
|
||||
fprintf(stderr, "fopen() failed with error (%d) %s\n",
|
||||
errno, strerror(errno));
|
||||
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg3);
|
||||
fprintf(stderr, "Error opening file '%s'\n", libtest_arg3);
|
||||
return TEST_ERR_FOPEN;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue