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

libtest: Fix unwrap panic on duplicate TestDesc #82274

Merged
merged 1 commit into from
Feb 19, 2021

Conversation

andersk
Copy link
Contributor

@andersk andersk commented Feb 18, 2021

It is possible for different tests to collide to the same TestDesc when macros are involved. That is a bug, but it didn’t cause a panic until #81367. For now, change the code to ignore this problem.

Fixes #81852.

This will need to be applied to beta too.

It is possible for different tests to collide to the same TestDesc
when macros are involved.  That is a bug, but it didn’t cause a panic
until rust-lang#81367.  For now, change the code to ignore this problem.

Fixes rust-lang#81852.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 18, 2021
@jyn514 jyn514 added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Feb 18, 2021
@Mark-Simulacrum
Copy link
Member

Hm, are we just losing the result for the "other" test when things collide right now? It's a bit worrying that was missed; obviously an edge case but seems not great!

I am going to accept this, as I think fixing the panic is likely the first thing we want (and particularly for a beta backport), but I would love to see a patch which avoids the collision somehow, and ideally adds asserts on any other maps/sets of TestDesc. Perhaps we should de-implement Hash on it and have some kind of wrapper type for maps...

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 18, 2021

📌 Commit 1605af0 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 19, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#79747 (Add explanations and suggestions to `irrefutable_let_patterns` lint)
 - rust-lang#81496 (name async generators something more human friendly in type error diagnostic)
 - rust-lang#81873 (Add Mutex::unlock)
 - rust-lang#82093 (Add tests for Atomic*::fetch_{min,max})
 - rust-lang#82238 (ast: Keep expansion status for out-of-line module items)
 - rust-lang#82245 (Do not ICE when evaluating locals' types of invalid `yield`)
 - rust-lang#82259 (Fix popping singleton paths in when generating E0433)
 - rust-lang#82261 (rustdoc: Support argument files)
 - rust-lang#82274 (libtest: Fix unwrap panic on duplicate TestDesc)
 - rust-lang#82275 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 36a348b into rust-lang:master Feb 19, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 19, 2021
@andersk
Copy link
Contributor Author

andersk commented Feb 19, 2021

I agree, and I’ve now submitted that more complete solution as #82300.

I don’t think we were losing the result from tests with duplicate TestDesc, except in the case where the test failed by panicking in a TLS destructor after reporting success. That isn’t a regression, so either solution should be acceptable for beta.

@apiraino
Copy link
Contributor

@andersk does #82300 replace or is a complement to this patch? In other words is the beta-nomination label still valid (i.e. should this patch be backported)?

@andersk
Copy link
Contributor Author

andersk commented Feb 25, 2021

This patch should still be backported.

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 25, 2021
@apiraino apiraino added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Mar 4, 2021
@cuviper cuviper mentioned this pull request Mar 11, 2021
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Mar 11, 2021
@cuviper cuviper modified the milestones: 1.52.0, 1.51.0 Mar 11, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2021
[beta] backports

This backports some beta-accepted PRs and one additional LLVM fix for s390x.

- rustdoc: treat edition 2021 as unstable rust-lang#82207
- Fix popping singleton paths in when generating E0433 rust-lang#82259
- libtest: Fix unwrap panic on duplicate TestDesc rust-lang#82274
- [intra-doc links] Don't check feature gates of items re-exported across crates rust-lang#82295
- rustdoc: Remove duplicate "List of all items" rust-lang#82484
- Substitute erased lifetimes on bad placeholder type rust-lang#82494
- Revert LLVM D81803 because it broke Windows 7 rust-lang#82605
- [SystemZ] Assign the full space for promoted and split outgoing args. rust-lang/llvm-project#95

r? `@Mark-Simulacrum`
bors pushed a commit to rust-lang-ci/rust that referenced this pull request Apr 12, 2021
This more robustly avoids problems with duplicate TestDesc.  See rust-lang#81852
and rust-lang#82274.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 12, 2021
libtest: Index tests by a unique TestId

This more robustly avoids problems with duplicate `TestDesc`. See rust-lang#81852 and rust-lang#82274.

Cc `@Mark-Simulacrum.`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
8 participants