Skip to content

Commit 7bc5388

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 + 4b982cc commit 7bc5388

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

.github/workflows/clippy_bors.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,14 @@ jobs:
187187
- name: Extract Binaries
188188
run: |
189189
DIR=$CARGO_TARGET_DIR/debug
190-
rm $DIR/deps/integration-*.d
191-
mv $DIR/deps/integration-* $DIR/integration
190+
find $DIR/deps/integration-* -executable ! -type d | xargs -I {} mv {} $DIR/integration
192191
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
193-
rm -rf $CARGO_TARGET_DIR/release
194192
195193
- name: Upload Binaries
196-
uses: actions/upload-artifact@v1
194+
uses: actions/upload-artifact@v3
197195
with:
198-
name: target
199-
path: target
196+
name: binaries
197+
path: target/debug
200198

201199
integration:
202200
needs: integration_build
@@ -206,22 +204,21 @@ jobs:
206204
matrix:
207205
integration:
208206
- 'rust-lang/cargo'
209-
# FIXME: re-enable once fmt_macros is renamed in RLS
210-
# - 'rust-lang/rls'
211207
- 'rust-lang/chalk'
212208
- 'rust-lang/rustfmt'
213209
- 'Marwes/combine'
214210
- 'Geal/nom'
215211
- 'rust-lang/stdarch'
216212
- 'serde-rs/serde'
217-
# FIXME: chrono currently cannot be compiled with `--all-targets`
218-
# - 'chronotope/chrono'
213+
- 'chronotope/chrono'
219214
- 'hyperium/hyper'
220215
- 'rust-random/rand'
221216
- 'rust-lang/futures-rs'
222217
- 'rust-itertools/itertools'
223218
- 'rust-lang-nursery/failure'
224219
- 'rust-lang/log'
220+
- 'matthiaskrgr/clippy_ci_panic_test'
221+
225222

226223
runs-on: ubuntu-latest
227224

@@ -237,12 +234,17 @@ jobs:
237234
- name: Install toolchain
238235
run: rustup show active-toolchain
239236

237+
- name: Set LD_LIBRARY_PATH
238+
run: |
239+
SYSROOT=$(rustc --print sysroot)
240+
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
241+
240242
# Download
241243
- name: Download target dir
242-
uses: actions/download-artifact@v1
244+
uses: actions/download-artifact@v3
243245
with:
244-
name: target
245-
path: target
246+
name: binaries
247+
path: target/debug
246248

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

tests/integration.rs

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

6767
let stderr = String::from_utf8_lossy(&output.stderr);
68+
69+
// debug:
70+
eprintln!("{stderr}");
71+
72+
// this is an internal test to make sure we would correctly panic on a delay_span_bug
73+
if repo_name == "matthiaskrgr/clippy_ci_panic_test" {
74+
// we need to kind of switch around our logic here:
75+
// if we find a panic, everything is fine, if we don't panic, SOMETHING is broken about our testing
76+
77+
if let Some(backtrace_start) = stderr.find("error: internal compiler error") {
78+
eprintln!("we saw that we intentionally panicked, yay")
79+
} else {
80+
panic!("panic caused by delay_span_bug was NOT detected! Something is broken!")
81+
}
82+
}
83+
6884
if let Some(backtrace_start) = stderr.find("error: internal compiler error") {
6985
static BACKTRACE_END_MSG: &str = "end of query stack";
7086
let backtrace_end = stderr[backtrace_start..]

0 commit comments

Comments
 (0)