mirror of
https://github.com/curl/curl.git
synced 2026-08-25 12:03:39 +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
|
|
@ -268,7 +268,7 @@ static int ProcessRequest(struct httprequest *req)
|
|||
|
||||
if(!stream) {
|
||||
int error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
logmsg("fopen() failed with error (%d) %s", error, strerror(error));
|
||||
logmsg("Couldn't open test file %ld", req->testno);
|
||||
req->open = FALSE; /* closes connection */
|
||||
return 1; /* done */
|
||||
|
|
@ -288,7 +288,7 @@ static int ProcessRequest(struct httprequest *req)
|
|||
int error = getpart(&cmd, &cmdsize, "reply", "servercmd", stream);
|
||||
fclose(stream);
|
||||
if(error) {
|
||||
logmsg("getpart() failed with error: %d", error);
|
||||
logmsg("getpart() failed with error (%d)", error);
|
||||
req->open = FALSE; /* closes connection */
|
||||
return 1; /* done */
|
||||
}
|
||||
|
|
@ -593,7 +593,7 @@ static void storerequest(char *reqbuf, size_t totalsize)
|
|||
dump = fopen(dumpfile, "ab");
|
||||
} while(!dump && ((error = errno) == EINTR));
|
||||
if(!dump) {
|
||||
logmsg("Error opening file %s error: %d %s",
|
||||
logmsg("Error opening file %s error (%d) %s",
|
||||
dumpfile, error, strerror(error));
|
||||
logmsg("Failed to write request input to %s", dumpfile);
|
||||
return;
|
||||
|
|
@ -612,7 +612,7 @@ static void storerequest(char *reqbuf, size_t totalsize)
|
|||
if(writeleft == 0)
|
||||
logmsg("Wrote request (%zu bytes) input to %s", totalsize, dumpfile);
|
||||
else if(writeleft > 0) {
|
||||
logmsg("Error writing file %s error: %d %s",
|
||||
logmsg("Error writing file %s error (%d) %s",
|
||||
dumpfile, error, strerror(error));
|
||||
logmsg("Wrote only (%zu bytes) of (%zu bytes) request input to %s",
|
||||
totalsize-writeleft, totalsize, dumpfile);
|
||||
|
|
@ -622,7 +622,7 @@ storerequest_cleanup:
|
|||
|
||||
res = fclose(dump);
|
||||
if(res)
|
||||
logmsg("Error closing file %s error: %d %s",
|
||||
logmsg("Error closing file %s error (%d) %s",
|
||||
dumpfile, errno, strerror(errno));
|
||||
}
|
||||
|
||||
|
|
@ -689,7 +689,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
|
|||
}
|
||||
else if(got < 0) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("recv() returned error: (%d) %s", error, sstrerror(error));
|
||||
logmsg("recv() returned error (%d) %s", error, sstrerror(error));
|
||||
fail = 1;
|
||||
}
|
||||
if(fail) {
|
||||
|
|
@ -836,7 +836,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
|||
msnprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
logmsg("fopen() failed with error (%d) %s", error, strerror(error));
|
||||
logmsg("Couldn't open test file");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -844,7 +844,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
|||
error = getpart(&ptr, &count, "reply", partbuf, stream);
|
||||
fclose(stream);
|
||||
if(error) {
|
||||
logmsg("getpart() failed with error: %d", error);
|
||||
logmsg("getpart() failed with error (%d)", error);
|
||||
return 0;
|
||||
}
|
||||
buffer = ptr;
|
||||
|
|
@ -859,7 +859,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
|||
stream = test2fopen(req->testno, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
logmsg("fopen() failed with error (%d) %s", error, strerror(error));
|
||||
logmsg("Couldn't open test file");
|
||||
free(ptr);
|
||||
return 0;
|
||||
|
|
@ -869,7 +869,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
|||
error = getpart(&cmd, &cmdsize, "reply", "postcmd", stream);
|
||||
fclose(stream);
|
||||
if(error) {
|
||||
logmsg("getpart() failed with error: %d", error);
|
||||
logmsg("getpart() failed with error (%d)", error);
|
||||
free(ptr);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -899,9 +899,9 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
|||
dump = fopen(responsedump, "ab");
|
||||
if(!dump) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
logmsg("Error opening file: %s", responsedump);
|
||||
logmsg("couldn't create logfile: %s", responsedump);
|
||||
logmsg("fopen() failed with error (%d) %s", error, strerror(error));
|
||||
logmsg("Error opening file '%s'", responsedump);
|
||||
logmsg("couldn't create logfile '%s'", responsedump);
|
||||
free(ptr);
|
||||
free(cmd);
|
||||
return -1;
|
||||
|
|
@ -955,7 +955,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
|||
|
||||
res = fclose(dump);
|
||||
if(res)
|
||||
logmsg("Error closing file %s error: %d %s",
|
||||
logmsg("Error closing file %s error (%d) %s",
|
||||
responsedump, errno, strerror(errno));
|
||||
|
||||
if(got_exit_signal) {
|
||||
|
|
@ -995,7 +995,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
|||
if(res) {
|
||||
/* should not happen */
|
||||
error = errno;
|
||||
logmsg("wait_ms() failed with error: (%d) %s",
|
||||
logmsg("wait_ms() failed with error (%d) %s",
|
||||
error, strerror(error));
|
||||
break;
|
||||
}
|
||||
|
|
@ -1142,7 +1142,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if(CURL_SOCKET_BAD == sock) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error creating socket: (%d) %s", error, sstrerror(error));
|
||||
logmsg("Error creating socket (%d) %s", error, sstrerror(error));
|
||||
goto server_cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -1150,7 +1150,7 @@ int main(int argc, char *argv[])
|
|||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error: (%d) %s",
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
goto server_cleanup;
|
||||
}
|
||||
|
|
@ -1175,7 +1175,7 @@ int main(int argc, char *argv[])
|
|||
#endif /* USE_IPV6 */
|
||||
if(0 != rc) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("Error binding socket on port %hu: (%d) %s",
|
||||
logmsg("Error binding socket on port %hu (%d) %s",
|
||||
port, error, sstrerror(error));
|
||||
goto server_cleanup;
|
||||
}
|
||||
|
|
@ -1196,7 +1196,7 @@ int main(int argc, char *argv[])
|
|||
memset(&localaddr.sa, 0, (size_t)la_size);
|
||||
if(getsockname(sock, &localaddr.sa, &la_size) < 0) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("getsockname() failed with error: (%d) %s",
|
||||
logmsg("getsockname() failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
sclose(sock);
|
||||
goto server_cleanup;
|
||||
|
|
@ -1229,7 +1229,7 @@ int main(int argc, char *argv[])
|
|||
rc = listen(sock, 5);
|
||||
if(0 != rc) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("listen() failed with error: (%d) %s",
|
||||
logmsg("listen() failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
goto server_cleanup;
|
||||
}
|
||||
|
|
@ -1256,7 +1256,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
if(CURL_SOCKET_BAD == msgsock) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("MAJOR ERROR: accept() failed with error: (%d) %s",
|
||||
logmsg("MAJOR ERROR, accept() failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue