mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 14:38:46 +00:00
Auto merge of #11228 - matthiaskrgr:fix_integration_tests2__with_test, r=flip1995
test that we correctly detect panics in intergation tests should be merged after https://github.com/rust-lang/rust-clippy/pull/11225 changelog: add test for integration tests
This commit is contained in:
commit
d446378143
2 changed files with 21 additions and 0 deletions
1
.github/workflows/clippy_bors.yml
vendored
1
.github/workflows/clippy_bors.yml
vendored
|
@ -217,6 +217,7 @@ jobs:
|
||||||
- 'rust-itertools/itertools'
|
- 'rust-itertools/itertools'
|
||||||
- 'rust-lang-nursery/failure'
|
- 'rust-lang-nursery/failure'
|
||||||
- 'rust-lang/log'
|
- 'rust-lang/log'
|
||||||
|
- 'matthiaskrgr/clippy_ci_panic_test'
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,26 @@ fn integration_test() {
|
||||||
// debug:
|
// debug:
|
||||||
eprintln!("{stderr}");
|
eprintln!("{stderr}");
|
||||||
|
|
||||||
|
// this is an internal test to make sure we would correctly panic on a delay_span_bug
|
||||||
|
if repo_name == "matthiaskrgr/clippy_ci_panic_test" {
|
||||||
|
// we need to kind of switch around our logic here:
|
||||||
|
// if we find a panic, everything is fine, if we don't panic, SOMETHING is broken about our testing
|
||||||
|
|
||||||
|
// the repo basically just contains a delay_span_bug that forces rustc/clippy to panic:
|
||||||
|
/*
|
||||||
|
#![feature(rustc_attrs)]
|
||||||
|
#[rustc_error(delay_span_bug_from_inside_query)]
|
||||||
|
fn main() {}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if stderr.find("error: internal compiler error").is_some() {
|
||||||
|
eprintln!("we saw that we intentionally panicked, yay");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
panic!("panic caused by delay_span_bug was NOT detected! Something is broken!");
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(backtrace_start) = stderr.find("error: internal compiler error") {
|
if let Some(backtrace_start) = stderr.find("error: internal compiler error") {
|
||||||
static BACKTRACE_END_MSG: &str = "end of query stack";
|
static BACKTRACE_END_MSG: &str = "end of query stack";
|
||||||
let backtrace_end = stderr[backtrace_start..]
|
let backtrace_end = stderr[backtrace_start..]
|
||||||
|
|
Loading…
Add table
Reference in a new issue