Skip to content
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

Could something like tokio LocalKey be used to allow and_log_failure to work across scopes on multiple threads? #4

Open
DanielJoyce opened this issue Jan 3, 2023 · 3 comments

Comments

@DanielJoyce
Copy link

https://docs.rs/tokio/latest/tokio/task/struct.LocalKey.html

Just a thought

@hovinen
Copy link
Collaborator

hovinen commented Jan 5, 2023

Thanks for the suggestion!

We'll need to give some thought on how to support this without incorporating a dependency to Tokio.

@DanielJoyce
Copy link
Author

It could just be a feature for tokio. I know it's kinda one off, but Tokio so far is the defacto "winner" in the async space right now.

@DanielJoyce
Copy link
Author

Hmm, maybe something like the instrument combinator from tracing.rs adapted to tests.

copybara-service bot pushed a commit that referenced this issue Apr 14, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524288885
copybara-service bot pushed a commit that referenced this issue Apr 14, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524288885
copybara-service bot pushed a commit that referenced this issue Apr 14, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524288885
copybara-service bot pushed a commit that referenced this issue Apr 14, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524288885
copybara-service bot pushed a commit that referenced this issue Apr 14, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524288885
copybara-service bot pushed a commit that referenced this issue Apr 14, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524288885
copybara-service bot pushed a commit that referenced this issue Apr 17, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524288885
copybara-service bot pushed a commit that referenced this issue Apr 17, 2023
Previously, an async test annotated with `googletest::test` would not compile because the test content was put in an ordinary closure. Any uses of `.await` inside that closure would generate a compiler error.

This changes the `googletest::test` macro implementation to detect that the test is async and adjust the generation accordingly. If the test is async, then no closure is generated, but the test content is placed in an async block.

Unfortunately, there does not appear to be a single way to cover both the sync and async cases currently, as explained in the code comments.

A further refinement of this approach could possibly address #4.

PiperOrigin-RevId: 524774676
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants