-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Windows compilation of test sources #10822
Fix Windows compilation of test sources #10822
Conversation
- Remove erroneous test from PR #9964 - Test macro missing the second argument (for test name), causing compilation on Windows to fail. It appears to have no purpose, copy-paste error? - more involved compilation failures in test sources are excluded with skip_on_windows tag - involving tests to do with features that don't exist for windows (signals, etc.) - sh_test rules do not currently work on Windows, waiting on a Bazel fix - Individually exclude tests in non-compiling extensions with skip_on_windows - subset of failing tests tagged with fails_on_windows - tests that time out - tests that are known to fail - non-exhaustive list, additional failing tests will be fixed/tagged in subsequent efforts - various fixes for Windows compilation - fix os_fd_t type in mocks - ensure consistent integer types - proliferate use of OsSysCalls in tests - exclude signals tests - add _set_invalid_parameter_handler to test main to ensure runtime does not abort when functions are called with invalid parameters - print warning about tcpdump not currently being enabled on Windows - matchers_test.cc: do not return address of literal - test/extensions/filters/network/direct_response/BUILD: skip test with constructor+lambda that does not compile on Windows - codec_impl_test.cc: MSVC pre-processing does not like the multline string passed to EXPECT_EQ macro, pull into intermediate variable Co-authored-by: Sunjay Bhatia <[email protected]> Co-authored-by: William A Rowe Jr <[email protected]> Signed-off-by: Sunjay Bhatia <[email protected]> Signed-off-by: William A Rowe Jr <[email protected]>
This did not belong to the test/... changes for Windows and breaks the unix build, because 10542 introduced WINDOWS_SKIP_TARGETS. This logic applies to the build schema for Windows, not specific windows test fixes and exclusions. Signed-off-by: William A Rowe Jr <[email protected]> Co-authored-by: William A Rowe Jr <[email protected]> Co-authored-by: Sunjay Bhatia <[email protected]>
/retest |
🔨 rebuilding |
Signed-off-by: William A Rowe Jr <[email protected]>
Ready for review and merge. As we noted in PR 10542;
Any coverage and macos regressions indicate new problems on master or issues with the CI build environments themselves, not this specific patch. |
/retest |
🔨 rebuilding |
Signed-off-by: William A Rowe Jr <[email protected]>
…lation Pick up possible fixes to coverage Signed-off-by: William A Rowe Jr <[email protected]>
…lation Signed-off-by: William A Rowe Jr <[email protected]>
os_fd_t pipe_fds[2] = {0, 0}; | ||
auto& os_sys_calls = Api::OsSysCallsSingleton::get(); | ||
#ifdef WIN32 | ||
ASSERT_EQ(os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use socketpair for linux tests as well and avoid ifdefing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a question of whether we are trying to test tcp or unix domain sockets in the linux implementation. Even though we have resolved that we can have AF_UNIX sockets on windows, a nameless pipe still isn't available. We can stub that in later, but this is the shortest-path to a working test compilation.
So if there are a couple +1's to switching this to os_sys_calls.socketpair, we are fine with that, or we can leave it as-is. A very final step of this integration will be revisiting all of the ifdef/defined() WIN32 to evaluate whether or not they should remain (some of them predate our involvement.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think as all of these tests are buffer tests and not network tests, having them all use socket pair seems fine to me so let's just do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracking this suggestion in issue #10871, which you can assign back to myself and @sunjayBhatia.
We would appreciate accepting this PR as-is, and we will revisit this after resolving the rest of the Windows CI //test/... RBE changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I had forgotten that socketpair on Linux fails with AF_INET, so the Windows logic can't be used until we support AF_UNIX on Windows.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure SGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM modulo some small comments. Thank you!
/wait
@@ -1,5 +1,8 @@ | |||
#ifndef WIN32 | |||
#include <pthread.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually needed on linux? I kind of doubt it. Can it just be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed on gcc.
test/main.cc
Outdated
|
||
_set_invalid_parameter_handler(noop_invalid_parameter_handler); | ||
|
||
WORD wVersionRequested; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: snake case var names here and below.
os_fd_t pipe_fds[2] = {0, 0}; | ||
auto& os_sys_calls = Api::OsSysCallsSingleton::get(); | ||
#ifdef WIN32 | ||
ASSERT_EQ(os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think as all of these tests are buffer tests and not network tests, having them all use socket pair seems fine to me so let's just do that?
…lation Signed-off-by: William A Rowe Jr <[email protected]>
Signed-off-by: William A Rowe Jr <[email protected]>
Signed-off-by: Sunjay Bhatia <[email protected]> Signed-off-by: William A Rowe Jr <[email protected]>
…lation Signed-off-by: William A Rowe Jr <[email protected]>
as suggested by mattklein123. Signed-off-by: William A Rowe Jr <[email protected]>
Signed-off-by: Sunjay Bhatia <[email protected]>
/retest ... likely won't retest for github 500's overload on the envoy-presubmit pipeline |
🤷♀️ nothing to rebuild. |
Signed-off-by: William A Rowe Jr <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Co-authored-by: Sunjay Bhatia <[email protected]> Co-authored-by: William A Rowe Jr <[email protected]> Signed-off-by: Sunjay Bhatia <[email protected]> Signed-off-by: William A Rowe Jr <[email protected]> Signed-off-by: pengg <[email protected]>
Description:
This patch is extracted from #10542 and must be preceded by that merge in order for all enabled tests to compile successfully on Windows.
This patch should still be correct in the interim, and should effectively be a no-op on Linux.
causing compilation on Windows to fail. It appears to
have no purpose, copy-paste error?
excluded with skip_on_windows tag
windows (signals, etc.)
fix
with skip_on_windows
fixed/tagged in subsequent efforts
does not abort when functions are called with invalid parameters
constructor+lambda that does not compile on Windows
string passed to EXPECT_EQ macro, pull into intermediate variable
Co-authored-by: Sunjay Bhatia [email protected]
Co-authored-by: William A Rowe Jr [email protected]
Signed-off-by: Sunjay Bhatia [email protected]
Signed-off-by: William A Rowe Jr [email protected]
Risk Level: Low
Testing: Local on msvc-cl, linux-gcc
Docs Changes: n/a
Release Notes: n/a
[Optional Fixes #Issue]
[Optional Deprecated:]