Skip to content

Commit 955f2e2

Browse files
committed
Auto merge of #11228 - matthiaskrgr:fix_integration_tests2__with_test, r=<try>
test that we correctly detect panics in intergation tests Right now, this should pass as it is on top of #11225 but once I removed that from the pr, I should be able to see the failure. changelog: add test for integration tests
2 parents 70c5798 + 4a12b23 commit 955f2e2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.github/workflows/clippy_bors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ jobs:
222222
- 'rust-itertools/itertools'
223223
- 'rust-lang-nursery/failure'
224224
- 'rust-lang/log'
225+
- 'matthiaskrgr/clippy_ci_panic_test'
225226

226227
runs-on: ubuntu-latest
227228

tests/integration.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,27 @@ fn integration_test() {
6565
.expect("unable to run clippy");
6666

6767
let stderr = String::from_utf8_lossy(&output.stderr);
68+
69+
// this is an internal test to make sure we would correctly panic on a delay_span_bug
70+
if repo_name == "matthiaskrgr/clippy_ci_panic_test" {
71+
// we need to kind of switch around our logic here:
72+
// if we find a panic, everything is fine, if we don't panic, SOMETHING is broken about our testing
73+
74+
// the repo basically just contains a delay_span_bug that forces rustc/clippy to panic:
75+
/*
76+
#![feature(rustc_attrs)]
77+
#[rustc_error(delay_span_bug_from_inside_query)]
78+
fn main() {}
79+
*/
80+
81+
if stderr.find("error: internal compiler error").is_some() {
82+
eprintln!("we saw that we intentionally panicked, yay");
83+
return;
84+
}
85+
86+
panic!("panic caused by delay_span_bug was NOT detected! Something is broken!");
87+
}
88+
6889
if let Some(backtrace_start) = stderr.find("error: internal compiler error") {
6990
static BACKTRACE_END_MSG: &str = "end of query stack";
7091
let backtrace_end = stderr[backtrace_start..]

0 commit comments

Comments
 (0)