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

How to retrieve madsim seed when the test case was canceled by cargo-nextest due to timeout #217

Open
Phoenix500526 opened this issue Jun 11, 2024 · 1 comment

Comments

@Phoenix500526
Copy link

When running madsim tests with cargo-nextest, it is possible that madsim tests may be canceled by cargo-nextest due to timeouts. In such cases, the seed generated by madsim cannot be retrieved. How should this issue be resolved? Would adding an function hook on kill, like issue #6 , solve the problem?

@wangrunji0408
Copy link
Member

I think the function hook mentioned in #6 is not exactly what you want. #6 discussed how to do clean up when the simulated node is restarted. But now we are talking about the moment when the entire simulation is killed.

A simple solution I can think of is to print the seed at the beginning of each test.

eprintln!("seed = {}", madsim::runtime::Handle::current().seed());

This way, if the test is cancelled due to a timeout, you can retrieve the seed from stdout or stderr.

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