From 15a486b7bc0f06305edb1d9ef9d9f2c66242b25a Mon Sep 17 00:00:00 2001 From: DMG Date: Thu, 5 Sep 2024 12:35:21 -0700 Subject: [PATCH] Fix: Check for error being EPIPE only if an error actually occurred --- .github/workflows/macos.yaml | 4 ---- tests/http_server_test.cc | 2 ++ tests/tcp_client.h | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index dbda3602c..3d7f6e5b3 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -12,13 +12,9 @@ on: push: branches: - master - - macOSRunner - - ErrnoNotEPIPEServerTest pull_request: branches: - master - - macOSRunner - - ErrnoNotEPIPEServerTest defaults: run: diff --git a/tests/http_server_test.cc b/tests/http_server_test.cc index a094b583f..b57771d27 100644 --- a/tests/http_server_test.cc +++ b/tests/http_server_test.cc @@ -999,6 +999,8 @@ TEST(http_server_test, client_request_timeout_on_delay_in_request_line_send_rais if (send_failed) { // Usually, send does fail; but on macOS occasionally it does not fail + // We workaround that here, since of course we can only check for an + // error code when there is an actual error EXPECT_EQ(client.lastErrno(), EPIPE) << "Errno: " << client.lastErrno(); char recvBuf[1024] = { diff --git a/tests/tcp_client.h b/tests/tcp_client.h index b49ddeff0..2752d885e 100644 --- a/tests/tcp_client.h +++ b/tests/tcp_client.h @@ -16,7 +16,7 @@ // In CLIENT_TRY, note that strerror is allowed to change errno in certain // circumstances, so we must save errno in lastErrno_ BEFORE we call strerror -// +// // Secondly, if errno has not been set at all then we set lastErrno_ = // ECANCELED; the ECANCELED errno is not used in Pistache code as of Aug/2024. static const char * strerror_errstr = "";