about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <github@jyn.dev>2023-04-09 12:38:03 -0500
committerJoshua Nelson <github@jyn.dev>2023-04-09 12:38:03 -0500
commit464a24e68d62acfb7b1084cbf6a331b8b3cde6cb (patch)
treecef6a63ebbfc4b970228e16d3c204245682ec9de
parentdd2b19539ea4d62a150cf13d45942e58b6b44e54 (diff)
downloadrust-464a24e68d62acfb7b1084cbf6a331b8b3cde6cb.tar.gz
rust-464a24e68d62acfb7b1084cbf6a331b8b3cde6cb.zip
compiletest: Use remap-path-prefix only in CI
This makes jump-to-definition work in most IDEs, as well as being easier
to understand for contributors.
-rw-r--r--src/tools/compiletest/src/header.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 735351fbf60..a7efe16150e 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -6,6 +6,7 @@ use std::io::BufReader;
 use std::path::{Path, PathBuf};
 use std::process::Command;
 
+use build_helper::ci::CiEnv;
 use tracing::*;
 
 use crate::common::{Config, Debugger, FailMode, Mode, PassMode};
@@ -276,8 +277,12 @@ impl TestProps {
     /// `//[foo]`), then the property is ignored unless `cfg` is
     /// `Some("foo")`.
     fn load_from(&mut self, testfile: &Path, cfg: Option<&str>, config: &Config) {
-        // Mode-dependent defaults.
-        self.remap_src_base = config.mode == Mode::Ui && !config.suite.contains("rustdoc");
+        // In CI, we've sometimes encountered non-determinism related to truncating very long paths.
+        // Set a consistent (short) prefix to avoid issues, but only in CI to avoid regressing the
+        // contributor experience.
+        if CiEnv::is_ci() {
+            self.remap_src_base = config.mode == Mode::Ui && !config.suite.contains("rustdoc");
+        }
 
         let mut has_edition = false;
         if !testfile.is_dir() {