From ce577f7f121f22e01c390d34de23a9a0536964e5 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Thu, 17 Mar 2022 20:59:39 +0100 Subject: [PATCH 1/4] Fix and re-enable some rustc tests * Set `config.opts.trimmed_def_paths` to `GoodPath` to trim def paths in error messages as expected by the rustc test suite * Fix `$SRC_DIR` normalization for out of tree compiled standard library --- scripts/setup_rust_fork.sh | 19 +++++++++++++++++++ scripts/test_rustc_tests.sh | 8 -------- src/base.rs | 5 ++++- src/bin/cg_clif.rs | 4 +++- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/scripts/setup_rust_fork.sh b/scripts/setup_rust_fork.sh index 18eb3fb5692..ddcf05ec252 100644 --- a/scripts/setup_rust_fork.sh +++ b/scripts/setup_rust_fork.sh @@ -53,9 +53,28 @@ index 887d27fd6dca4..2c2239f2b83d1 100644 let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some(); +diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs +index 8431aa7b818..a3ff7e68ce5 100644 +--- a/src/tools/compiletest/src/runtest.rs ++++ b/src/tools/compiletest/src/runtest.rs +@@ -3489,11 +3489,7 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S + .join("library"); + normalize_path(&src_dir, "$(echo '$SRC_DIR')"); + +- if let Some(virtual_rust_source_base_dir) = +- option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(PathBuf::from) +- { +- normalize_path(&virtual_rust_source_base_dir.join("library"), "$(echo '$SRC_DIR')"); +- } ++ normalize_path(&Path::new("$(cd ../build_sysroot/sysroot_src/library; pwd)"), "$(echo '$SRC_DIR')"); + + // Paths into the build directory + let test_build_dir = &self.config.build_base; EOF cat > config.toml <) { if fx.clif_comments.enabled() { let mut terminator_head = "\n".to_string(); - bb_data.terminator().kind.fmt_head(&mut terminator_head).unwrap(); + with_no_trimmed_paths!({ + bb_data.terminator().kind.fmt_head(&mut terminator_head).unwrap(); + }); let inst = fx.bcx.func.layout.last_inst(block).unwrap(); fx.add_comment(inst, terminator_head); } diff --git a/src/bin/cg_clif.rs b/src/bin/cg_clif.rs index a8fb09e69b7..5984ec8412a 100644 --- a/src/bin/cg_clif.rs +++ b/src/bin/cg_clif.rs @@ -13,7 +13,7 @@ use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry}; use rustc_interface::interface; -use rustc_session::config::ErrorOutputType; +use rustc_session::config::{ErrorOutputType, TrimmedDefPaths}; use rustc_session::early_error; use rustc_target::spec::PanicStrategy; @@ -55,6 +55,8 @@ fn config(&mut self, config: &mut interface::Config) { config.opts.maybe_sysroot = Some(config.opts.maybe_sysroot.clone().unwrap_or_else(|| { std::env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_owned() })); + + config.opts.trimmed_def_paths = TrimmedDefPaths::GoodPath; } } From fc80e8b9703d12abe69d77311462e663f075ef67 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Thu, 17 Mar 2022 21:16:26 +0100 Subject: [PATCH 2/4] Re-enable fixed tests --- scripts/test_rustc_tests.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index c9f21d8f9cb..be1f8c05153 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -46,7 +46,6 @@ rm src/test/ui/issues/issue-28950.rs # depends on stack size optimizations rm src/test/ui/codegen/init-large-type.rs # same rm src/test/ui/sse2.rs # cpuid not supported, so sse2 not detected rm src/test/ui/issues/issue-33992.rs # unsupported linkages -rm src/test/ui/issues/issue-51947.rs # same rm src/test/incremental/hashes/function_interfaces.rs # same rm src/test/incremental/hashes/statics.rs # same rm src/test/ui/numbers-arithmetic/saturating-float-casts.rs # intrinsic gives different but valid result @@ -63,7 +62,6 @@ rm src/test/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and n rm src/test/incremental/hashes/inline_asm.rs # inline asm rm src/test/incremental/issue-72386.rs # same rm src/test/incremental/lto.rs # requires lto -rm src/test/incremental/dirty_clean.rs # TODO rm -r src/test/run-make/emit-shared-files # requires the rustdoc executable in build/bin/ rm -r src/test/run-make/unstable-flag-required # same @@ -72,12 +70,10 @@ rm -r src/test/run-make/emit-named-files # requires full --emit support rm -r src/test/run-pass-valgrind/unsized-locals -rm src/test/ui/intrinsics/const-eval-select-x86_64.rs # same -rm src/test/ui/type-alias-impl-trait/cross_crate_ice*.rs # requires removed aux dep +rm src/test/ui/intrinsics/const-eval-select-x86_64.rs # requires x86_64 vendor intrinsics rm src/test/ui/allocator/no_std-alloc-error-handler-default.rs # missing rust_oom definition rm src/test/ui/cfg/cfg-panic.rs -rm -r src/test/ui/hygiene/ rm src/test/ui/mir/ssa-analysis-regression-50041.rs # uses old definition of Box @@ -90,8 +86,6 @@ rm -r src/test/run-make/fmt-write-bloat/ # tests an optimization rm src/test/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs rm src/test/ui/abi/variadic-ffi.rs # requires callee side vararg support -rm src/test/ui/command/command-current-dir.rs # can't find libstd.so - rm src/test/ui/abi/stack-protector.rs # requires stack protector support rm src/test/incremental/issue-80691-bad-eval-cache.rs # wrong exit code From d1c8cf76b0222e43e55a76125aeffc05f55c83f9 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 18 Mar 2022 15:38:58 +0100 Subject: [PATCH 3/4] Run tests with warnings --- scripts/test_rustc_tests.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index be1f8c05153..2748469c34b 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -15,7 +15,7 @@ for test in $(rg --files-with-matches "asm!|catch_unwind|should_panic|lto|// nee rm $test done -for test in $(rg -i --files-with-matches "//(\[\w+\])?~|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" src/test/ui); do +for test in $(rg -i --files-with-matches "//(\[\w+\])?~[^\|]*\s*ERR|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" src/test/ui); do rm $test done @@ -95,6 +95,8 @@ rm src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs # gives a stackoverf rm src/test/incremental/thinlto/cgu_invalidated_when_import_{added,removed}.rs # requires LLVM +rm src/test/ui/unsafe/union.rs # has UB caught by cg_clif. see rust-lang/rust#95075 + echo "[TEST] rustc test suite" RUST_TEST_NOCAPTURE=1 COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0 src/test/{codegen-units,run-make,run-pass-valgrind,ui,incremental} popd From afd59464a927d97b80435b8bc45603bf6f76d0b3 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 18 Mar 2022 16:38:28 +0100 Subject: [PATCH 4/4] Reorganize test list --- scripts/test_rustc_tests.sh | 85 +++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 2748469c34b..b4ce2abb18c 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -21,7 +21,10 @@ done git checkout -- src/test/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed -# these all depend on unwinding support +# missing features +# ================ + +# requires stack unwinding rm src/test/ui/backtrace.rs rm src/test/ui/array-slice-vec/box-of-array-of-drop-*.rs rm src/test/ui/array-slice-vec/slice-panic-*.rs @@ -42,59 +45,79 @@ rm src/test/ui/runtime/rt-explody-panic-payloads.rs rm src/test/incremental/change_crate_dep_kind.rs rm src/test/ui/threads-sendsync/unwind-resource.rs -rm src/test/ui/issues/issue-28950.rs # depends on stack size optimizations -rm src/test/ui/codegen/init-large-type.rs # same +# requires compiling with -Cpanic=unwind +rm src/test/ui/cfg/cfg-panic.rs +rm src/test/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs # "Cannot run dynamic test fn out-of-process" +rm src/test/ui/async-await/async-fn-size-moved-locals.rs # -Cpanic=abort shrinks some generator by one byte +rm src/test/ui/async-await/async-fn-size-uninit-locals.rs # same +rm src/test/ui/generator/size-moved-locals.rs # same + +# vendor intrinsics rm src/test/ui/sse2.rs # cpuid not supported, so sse2 not detected +rm src/test/ui/intrinsics/const-eval-select-x86_64.rs # requires x86_64 vendor intrinsics + +# inline asm +rm src/test/incremental/hashes/inline_asm.rs # inline asm +rm src/test/incremental/issue-72386.rs # same + +# exotic linkages rm src/test/ui/issues/issue-33992.rs # unsupported linkages rm src/test/incremental/hashes/function_interfaces.rs # same rm src/test/incremental/hashes/statics.rs # same + +# LTO +rm src/test/incremental/lto.rs # requires lt + +# variadic arguments +rm src/test/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs +rm src/test/ui/abi/variadic-ffi.rs # requires callee side vararg support + +# unsized locals +rm -r src/test/run-pass-valgrind/unsized-locals + +# misc unimplemented things +rm src/test/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics +rm src/test/ui/target-feature/missing-plusminus.rs # error not implemented +rm src/test/ui/fn/dyn-fn-alignment.rs # wants a 256 byte alignment +rm -r src/test/run-make/emit-named-files # requires full --emit support + +# optimization tests +# ================== +rm src/test/ui/issues/issue-28950.rs # depends on stack size optimizations +rm src/test/ui/codegen/init-large-type.rs # same +rm -r src/test/run-make/fmt-write-bloat/ # tests an optimization + +# backend specific tests +# ====================== +rm src/test/incremental/thinlto/cgu_invalidated_when_import_{added,removed}.rs # requires LLVM +rm src/test/ui/abi/stack-protector.rs # requires stack protector support + +# giving different but possibly correct results +# ============================================= rm src/test/ui/numbers-arithmetic/saturating-float-casts.rs # intrinsic gives different but valid result rm src/test/ui/mir/mir_misc_casts.rs # depends on deduplication of constants rm src/test/ui/mir/mir_raw_fat_ptr.rs # same rm src/test/ui/consts/issue-33537.rs # same -rm src/test/ui/async-await/async-fn-size-moved-locals.rs # -Cpanic=abort shrinks some generator by one byte -rm src/test/ui/async-await/async-fn-size-uninit-locals.rs # same -rm src/test/ui/generator/size-moved-locals.rs # same -rm src/test/ui/fn/dyn-fn-alignment.rs # wants a 256 byte alignment -rm src/test/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs # "Cannot run dynamic test fn out-of-process" -rm src/test/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics - -rm src/test/incremental/hashes/inline_asm.rs # inline asm -rm src/test/incremental/issue-72386.rs # same -rm src/test/incremental/lto.rs # requires lto rm -r src/test/run-make/emit-shared-files # requires the rustdoc executable in build/bin/ rm -r src/test/run-make/unstable-flag-required # same rm -r src/test/run-make/rustdoc-* # same -rm -r src/test/run-make/emit-named-files # requires full --emit support - -rm -r src/test/run-pass-valgrind/unsized-locals - -rm src/test/ui/intrinsics/const-eval-select-x86_64.rs # requires x86_64 vendor intrinsics +# genuine bugs +# ============ rm src/test/ui/allocator/no_std-alloc-error-handler-default.rs # missing rust_oom definition -rm src/test/ui/cfg/cfg-panic.rs - -rm src/test/ui/mir/ssa-analysis-regression-50041.rs # uses old definition of Box - -rm src/test/ui/target-feature/missing-plusminus.rs # error not implemented rm -r src/test/ui/polymorphization/ # polymorphization not yet supported rm src/test/codegen-units/polymorphization/unused_type_parameters.rs # same -rm -r src/test/run-make/fmt-write-bloat/ # tests an optimization -rm src/test/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs -rm src/test/ui/abi/variadic-ffi.rs # requires callee side vararg support - -rm src/test/ui/abi/stack-protector.rs # requires stack protector support - rm src/test/incremental/issue-80691-bad-eval-cache.rs # wrong exit code rm src/test/incremental/spike-neg1.rs # errors out for some reason rm src/test/incremental/spike-neg2.rs # same rm src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs # gives a stackoverflow before the backend runs +rm src/test/ui/mir/ssa-analysis-regression-50041.rs # produces ICE -rm src/test/incremental/thinlto/cgu_invalidated_when_import_{added,removed}.rs # requires LLVM - +# bugs in the test suite +# ====================== rm src/test/ui/unsafe/union.rs # has UB caught by cg_clif. see rust-lang/rust#95075 echo "[TEST] rustc test suite"