From 01b9f9d9dae466511e1eac2ca26fac5f325fe566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 25 Jul 2023 20:34:18 +0200 Subject: [PATCH] ci: test that we fail CI if we don't find clippy panicking --- .github/workflows/clippy_bors.yml | 1 + tests/integration.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/clippy_bors.yml b/.github/workflows/clippy_bors.yml index a686198f781..5c69714bc1e 100644 --- a/.github/workflows/clippy_bors.yml +++ b/.github/workflows/clippy_bors.yml @@ -217,6 +217,7 @@ jobs: - 'rust-itertools/itertools' - 'rust-lang-nursery/failure' - 'rust-lang/log' + - 'matthiaskrgr/clippy_ci_panic_test' runs-on: ubuntu-latest diff --git a/tests/integration.rs b/tests/integration.rs index e72891c44c2..031982edbe9 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -69,6 +69,26 @@ fn integration_test() { // debug: 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") { static BACKTRACE_END_MSG: &str = "end of query stack"; let backtrace_end = stderr[backtrace_start..]