Skip to content

[Windows] Moves nullDevicePath to Platform header#12781

Merged
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
davinci26:integration-tests
Sep 5, 2020
Merged

[Windows] Moves nullDevicePath to Platform header#12781
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
davinci26:integration-tests

Conversation

@davinci26
Copy link
Copy Markdown
Member

Signed-off-by: Sotiris Nanopoulos sonanopo@microsoft.com

Moves TestEnvironment::nullDevicePath() to platform.h so it can be used in production code as well.

The reason for that is that in Windows we cant have a watcher on NUL. This causes integration tests to crash and it would also crash in prod as well.

Additional Description:
Tests have been verified that they are not flaky with 100+ runs without failures.

Risk Level: Low
Testing: Already tests
Docs Changes: N/A (Windows support is not released)
Release Notes: N/A (Windows support is not released)

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
#define SOCKET_ERROR_INVAL WSAEINVAL
#define SOCKET_ERROR_ADDR_IN_USE WSAEADDRINUSE

static constexpr std::string_view platform_null_device_path{"NUL"};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need static (constexpr implies). This file is not namespaced, add namespace?

Sotiris Nanopoulos added 2 commits August 22, 2020 15:03
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@wrowe
Copy link
Copy Markdown
Contributor

wrowe commented Aug 28, 2020

Note this issue in server_test at 197 and again at 216;

test/server/server_test.cc(197): note: Reason: cannot convert from 'const std::string_view' to 'const std::string'
test/server/server_test.cc(197): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
bazel-out/x64_windows-opt/bin/include/envoy/filesystem/_virtual_includes/filesystem_interface\envoy/filesystem/filesystem.h(93): note: see declaration of 'Envoy::Filesystem::Instance::fileExists'

I doubt there is a strong reason that fileExists() could not accept string_view

Sotiris Nanopoulos added 2 commits September 3, 2020 07:06
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@davinci26
Copy link
Copy Markdown
Member Author

I doubt there is a strong reason that fileExists() could not accept string_view

I did not change the implementation because (i) all the function signatures in the filesystem interface take an std::string as input. Also (ii) the implementation of fileExists()relies on std::ifstream constructor. The constructor does not have an overload that accepts astring_view as input.

@wrowe
Copy link
Copy Markdown
Contributor

wrowe commented Sep 3, 2020

Also (ii) the implementation of fileExists()relies on std::ifstream constructor.

Thanks, now I recall tripping over this same puzzle before. I agree, explicitly creating temporary std::string(s) in test/server/server_test.cc should button up this commit, LGTM.

wrowe
wrowe previously approved these changes Sep 3, 2020
Copy link
Copy Markdown
Contributor

@wrowe wrowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending CI passing, this looks ready for merge.

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@mattklein123
Copy link
Copy Markdown
Member

Please fix format.

/wait

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, thank you.

/wait

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@davinci26
Copy link
Copy Markdown
Member Author

davinci26 commented Sep 4, 2020

what is the issue with #include "absl/strings/string_view.h" in platform.h, clang-tidy complains that the file is not found but this is the common way we include absl throughout the codebase.

I also tried to include it with #include <absl/strings/string_view.h> but then all the CI fails

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@mattklein123
Copy link
Copy Markdown
Member

Can you make sure the bazel build rule for the header includes a dep on string_view?

/wait

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mattklein123 mattklein123 merged commit 0b24c6a into envoyproxy:master Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants