about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-10-21 19:01:08 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-10-21 19:01:08 +0000
commitc07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa (patch)
tree534295af2dc906dc93c67142424904d6aebc9140
parent62f6e84ac1755f2c6c356a20113d12196d792e4f (diff)
downloadrust-c07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa.tar.gz
rust-c07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa.zip
Use same --remap-path-prefix as bootstrap for testing the rustc test suite
This allows removing the CFG_VIRTUAL_RUST_SOURCE_BASE_DIR hack and
re-enabling a fair amount of tests.
-rw-r--r--build_system/build_sysroot.rs9
-rw-r--r--scripts/setup_rust_fork.sh7
-rwxr-xr-xscripts/test_rustc_tests.sh14
3 files changed, 13 insertions, 17 deletions
diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs
index 31a4b209826..1ed896c6bf0 100644
--- a/build_system/build_sysroot.rs
+++ b/build_system/build_sysroot.rs
@@ -1,3 +1,4 @@
+use std::env;
 use std::fs;
 use std::path::{Path, PathBuf};
 use std::process::Command;
@@ -259,6 +260,14 @@ fn build_clif_sysroot_for_triple(
         // inlining.
         rustflags.push("-Zinline-mir".to_owned());
     }
+    if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") {
+        rustflags.push("--remap-path-prefix".to_owned());
+        rustflags.push(format!(
+            "{}={}",
+            STDLIB_SRC.to_path(dirs).to_str().unwrap(),
+            prefix.to_str().unwrap()
+        ));
+    }
     compiler.rustflags.extend(rustflags);
     let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
     maybe_incremental(&mut build_cmd);
diff --git a/scripts/setup_rust_fork.sh b/scripts/setup_rust_fork.sh
index 6bcf56abb95..3e48fb006de 100644
--- a/scripts/setup_rust_fork.sh
+++ b/scripts/setup_rust_fork.sh
@@ -1,7 +1,10 @@
 #!/usr/bin/env bash
 set -e
 
-./y.sh build
+# Compiletest expects all standard library paths to start with /rustc/FAKE_PREFIX.
+# CG_CLIF_STDLIB_REMAP_PATH_PREFIX will cause cg_clif's build system to pass
+# --remap-path-prefix to handle this.
+CG_CLIF_STDLIB_REMAP_PATH_PREFIX=/rustc/FAKE_PREFIX ./y.sh build
 
 echo "[SETUP] Rust fork"
 git clone https://github.com/rust-lang/rust.git || true
@@ -32,8 +35,6 @@ verbose-tests = false
 EOF
 popd
 
-export CFG_VIRTUAL_RUST_SOURCE_BASE_DIR="$(cd build/stdlib; pwd)"
-
 # Allow the testsuite to use llvm tools
 host_triple=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
 export LLVM_BIN_DIR="$(rustc --print sysroot)/lib/rustlib/$host_triple/bin"
diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh
index 738701c6409..b485f2571cc 100755
--- a/scripts/test_rustc_tests.sh
+++ b/scripts/test_rustc_tests.sh
@@ -111,20 +111,6 @@ rm tests/ui/consts/issue-33537.rs # same
 rm tests/ui/layout/valid_range_oob.rs # different ICE message
 rm tests/ui/const-generics/generic_const_exprs/issue-80742.rs # gives error instead of ICE with cg_clif
 
-rm tests/ui/consts/issue-miri-1910.rs # different error message
-rm tests/ui/consts/offset_ub.rs # same
-rm tests/ui/consts/const-eval/ub-slice-get-unchecked.rs # same
-rm tests/ui/intrinsics/panic-uninitialized-zeroed.rs # same
-rm tests/ui/lint/lint-const-item-mutation.rs # same
-rm tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.rs # same
-rm tests/ui/suggestions/derive-trait-for-method-call.rs # same
-rm tests/ui/typeck/issue-46112.rs # same
-rm tests/ui/consts/const_cmp_type_id.rs # same
-rm tests/ui/consts/issue-73976-monomorphic.rs # same
-rm tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs # same
-rm tests/ui/consts/issue-94675.rs # same
-rm tests/ui/associated-types/issue-85103-layout-debug.rs # same
-
 # rustdoc-clif passes extra args, suppressing the help message when no args are passed
 rm -r tests/run-make/issue-88756-default-output