Skip to content

Commit

Permalink
Auto merge of #11228 - matthiaskrgr:fix_integration_tests2__with_test…
Browse files Browse the repository at this point in the history
…, 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
  • Loading branch information
bors committed Jul 25, 2023
2 parents 70c5798 + 4b982cc commit 7bc5388
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/clippy_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,14 @@ jobs:
- name: Extract Binaries
run: |
DIR=$CARGO_TARGET_DIR/debug
rm $DIR/deps/integration-*.d
mv $DIR/deps/integration-* $DIR/integration
find $DIR/deps/integration-* -executable ! -type d | xargs -I {} mv {} $DIR/integration
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
rm -rf $CARGO_TARGET_DIR/release
- name: Upload Binaries
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: target
path: target
name: binaries
path: target/debug

integration:
needs: integration_build
Expand All @@ -206,22 +204,21 @@ jobs:
matrix:
integration:
- 'rust-lang/cargo'
# FIXME: re-enable once fmt_macros is renamed in RLS
# - 'rust-lang/rls'
- 'rust-lang/chalk'
- 'rust-lang/rustfmt'
- 'Marwes/combine'
- 'Geal/nom'
- 'rust-lang/stdarch'
- 'serde-rs/serde'
# FIXME: chrono currently cannot be compiled with `--all-targets`
# - 'chronotope/chrono'
- 'chronotope/chrono'
- 'hyperium/hyper'
- 'rust-random/rand'
- 'rust-lang/futures-rs'
- 'rust-itertools/itertools'
- 'rust-lang-nursery/failure'
- 'rust-lang/log'
- 'matthiaskrgr/clippy_ci_panic_test'


runs-on: ubuntu-latest

Expand All @@ -237,12 +234,17 @@ jobs:
- name: Install toolchain
run: rustup show active-toolchain

- name: Set LD_LIBRARY_PATH
run: |
SYSROOT=$(rustc --print sysroot)
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
# Download
- name: Download target dir
uses: actions/download-artifact@v1
uses: actions/download-artifact@v3
with:
name: target
path: target
name: binaries
path: target/debug

- name: Make Binaries Executable
run: chmod +x $CARGO_TARGET_DIR/debug/*
Expand All @@ -251,7 +253,7 @@ jobs:
- name: Test ${{ matrix.integration }}
run: |
RUSTUP_TOOLCHAIN="$(rustup show active-toolchain | grep -o -E "nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}")" \
$CARGO_TARGET_DIR/debug/integration
$CARGO_TARGET_DIR/debug/integration --show-output
env:
INTEGRATION: ${{ matrix.integration }}

Expand Down
16 changes: 16 additions & 0 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ fn integration_test() {
.expect("unable to run clippy");

let stderr = String::from_utf8_lossy(&output.stderr);

// 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

if let Some(backtrace_start) = stderr.find("error: internal compiler error") {
eprintln!("we saw that we intentionally panicked, yay")
} else {
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..]
Expand Down

0 comments on commit 7bc5388

Please sign in to comment.