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

Tests use custom completion token instead of spawn #1996

Open
vinniefalco opened this issue Jun 25, 2020 · 0 comments
Open

Tests use custom completion token instead of spawn #1996

vinniefalco opened this issue Jun 25, 2020 · 0 comments
Assignees
Labels

Comments

@vinniefalco
Copy link
Member

@vinniefalco vinniefalco commented Jun 25, 2020

Some of the tests use stackful coroutines (boost::asio::spawn), which creates a risky dependence on an extra component. These tests can be replaced with the style of manually advancing the operations by calling io_context::run_one strategically, as is done in some of the newer tests.

To make this even easier, we can introduce a new completion token type for tests which simply advances the I/O context until a condition is met and then returns, turning asynchronous calls into blocking calls. Example:

error_code ec;
auto bytes_transferred =
  ws.async_read_some( b, run_for(2)[ec] ); // calls run_one twice
@vinniefalco vinniefalco self-assigned this Jun 25, 2020
@vinniefalco vinniefalco added the Test label Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.