rewrite short-ice
in rmake
format
This commit is contained in:
parent
7bb0ef4902
commit
f88c647cda
@ -218,7 +218,6 @@ run-make/sepcomp-cci-copies/Makefile
|
|||||||
run-make/sepcomp-inlining/Makefile
|
run-make/sepcomp-inlining/Makefile
|
||||||
run-make/sepcomp-separate/Makefile
|
run-make/sepcomp-separate/Makefile
|
||||||
run-make/share-generics-dylib/Makefile
|
run-make/share-generics-dylib/Makefile
|
||||||
run-make/short-ice/Makefile
|
|
||||||
run-make/silly-file-names/Makefile
|
run-make/silly-file-names/Makefile
|
||||||
run-make/simd-ffi/Makefile
|
run-make/simd-ffi/Makefile
|
||||||
run-make/split-debuginfo/Makefile
|
run-make/split-debuginfo/Makefile
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
include ../tools.mk
|
|
||||||
|
|
||||||
# ignore-windows
|
|
||||||
|
|
||||||
export RUSTC := $(RUSTC_ORIGINAL)
|
|
||||||
export LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
|
|
||||||
export TMPDIR := $(TMPDIR)
|
|
||||||
|
|
||||||
all:
|
|
||||||
bash check.sh
|
|
@ -1,36 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
export RUSTC_ICE=0
|
|
||||||
RUST_BACKTRACE=1 $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-1.log 2>&1
|
|
||||||
RUST_BACKTRACE=full $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-2.log 2>&1
|
|
||||||
|
|
||||||
short=$(cat $TMPDIR/rust-test-1.log | wc -l)
|
|
||||||
full=$(cat $TMPDIR/rust-test-2.log | wc -l)
|
|
||||||
rustc_query_count=$(cat $TMPDIR/rust-test-1.log | grep rustc_query_ | wc -l)
|
|
||||||
rustc_query_count_full=$(cat $TMPDIR/rust-test-2.log | grep rustc_query_ | wc -l)
|
|
||||||
|
|
||||||
begin_count=$(cat $TMPDIR/rust-test-2.log | grep __rust_begin_short_backtrace | wc -l)
|
|
||||||
end_count=$(cat $TMPDIR/rust-test-2.log | grep __rust_end_short_backtrace | wc -l)
|
|
||||||
|
|
||||||
cat $TMPDIR/rust-test-1.log
|
|
||||||
echo "====================="
|
|
||||||
cat $TMPDIR/rust-test-2.log
|
|
||||||
echo "====================="
|
|
||||||
|
|
||||||
echo "short backtrace: $short"
|
|
||||||
echo "full backtrace: $full"
|
|
||||||
echo "begin_count: $begin_count"
|
|
||||||
echo "end_count : $end_count"
|
|
||||||
echo "rustc_query_count: $rustc_query_count"
|
|
||||||
echo "rustc_query_count_full: $rustc_query_count_full"
|
|
||||||
|
|
||||||
## backtraces to vary a bit depending on platform and configuration options,
|
|
||||||
## here we make sure that the short backtrace of rustc_query is shorter than the full,
|
|
||||||
## and marks are in pairs.
|
|
||||||
if [ $short -lt $full ] &&
|
|
||||||
[ $begin_count -eq $end_count ] &&
|
|
||||||
[ $(($rustc_query_count + 5)) -lt $rustc_query_count_full ] &&
|
|
||||||
[ $rustc_query_count_full -gt 5 ]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
31
tests/run-make/short-ice/rmake.rs
Normal file
31
tests/run-make/short-ice/rmake.rs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Backtraces in internal compiler errors used to be unbearably long, spanning
|
||||||
|
// multiple hundreds of lines. A fix was pushed in #108938, and this test gathers
|
||||||
|
// varied metrics on level 1 and full-level backtraces to check that the output
|
||||||
|
// was shortened down to an appropriate length.
|
||||||
|
// See https://github.com/rust-lang/rust/issues/107910
|
||||||
|
|
||||||
|
use run_make_support::rustc;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
env::set_var("RUST_BACKTRACE", "1");
|
||||||
|
let mut rust_test_1 = rustc().input("src/lib.rs").arg("-Ztreat-err-as-bug=1").run_fail();
|
||||||
|
env::set_var("RUST_BACKTRACE", "full");
|
||||||
|
let mut rust_test_2 = rustc().input("src/lib.rs").arg("-Ztreat-err-as-bug=1").run_fail();
|
||||||
|
let rust_test_log_1 = rust_test_1.stderr_utf8().push_str(&rust_test_1.stdout_utf8()).as_str();
|
||||||
|
let rust_test_log_2 = rust_test_2.stderr_utf8().push_str(&rust_test_2.stdout_utf8()).as_str();
|
||||||
|
|
||||||
|
let rustc_query_count_full = count_lines_with(rust_test_log_2, "rustc_query_");
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
rust_test_log_1.lines().count() < rust_test_log_2.lines().count()
|
||||||
|
&& count_lines_with(rust_test_log_2, "__rust_begin_short_backtrace")
|
||||||
|
== count_lines_with(rust_test_log_2, "__rust_end_short_backtrace")
|
||||||
|
&& count_lines_with(rust_test_log_1, "rustc_query_") + 5 < rustc_query_count_full
|
||||||
|
&& rustc_query_count_full > 5
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn count_lines_with(s: &str, search: &str) -> usize {
|
||||||
|
s.lines().filter(|l| l.contains(search)).count()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user