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

panic=abort compatible test harness #43788

Closed
alexcrichton opened this issue Aug 10, 2017 · 2 comments
Closed

panic=abort compatible test harness #43788

alexcrichton opened this issue Aug 10, 2017 · 2 comments
Labels
A-libtest Area: `#[test]` / the `test` library C-feature-accepted Category: A feature request that has been accepted pending implementation. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

Right now developing a panic=abort project can be relatively painful when running tests. A cargo build will compile everything with panic=abort but a cargo test will recompile everything with panic=unwind. This is currently due to the fact that libtest requires panic=unwind to correctly operate. Otherwise it can't catch test failures!

We may wish to explore a panic=abort compatible test harness to remove Cargo's special casing. Some possible ways to implement this may be:

  • Instead of starting a thread for all tests we could instead start a process. This process could be a re-execution of the executable itself and we'd just do that once per test. The downside of this is that it may be super slow.
  • We could continue to start a thread for each test but override the panic handler for the process. This panic handler would do "test related things" and provide an opportunity for a "clean exit". The downside of this is that you wouldn't get a set of all tests that failed, just the first few (maybe)

I think that we'll also need support in the compiler for this, we'd have to inject different test frameworks or backends depending on the -C panic=... configured mode.

@alexcrichton alexcrichton added A-libtest Area: `#[test]` / the `test` library C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Aug 10, 2017
@Mark-Simulacrum Mark-Simulacrum added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-feature-accepted Category: A feature request that has been accepted pending implementation. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Aug 10, 2017
@Mark-Simulacrum
Copy link
Member

I believe this is #32512, closing in favor of that. I agree that this would be good, though I think it's more of a feature than an enhancement (but it's a fine line that doesn't matter that much).

@alexcrichton
Copy link
Member Author

Aha indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-libtest Area: `#[test]` / the `test` library C-feature-accepted Category: A feature request that has been accepted pending implementation. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants