summaryrefslogtreecommitdiff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/common.rs3
-rw-r--r--src/tools/compiletest/src/header.rs9
-rw-r--r--src/tools/compiletest/src/main.rs9
-rw-r--r--src/tools/compiletest/src/runtest.rs16
4 files changed, 26 insertions, 11 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 98b27a5c6b6..d2f494942cf 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -313,7 +313,8 @@ pub struct Config {
pub cflags: String,
pub cxxflags: String,
pub ar: String,
- pub linker: Option<String>,
+ pub target_linker: Option<String>,
+ pub host_linker: Option<String>,
pub llvm_components: String,
/// Path to a NodeJS executable. Used for JS doctests, emscripten and WASM tests
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 02382f8d4c6..aaa70bf19b2 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};
@@ -287,8 +288,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() {
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 0e49822c1b7..4a2b9de8aee 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -135,7 +135,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
.reqopt("", "cflags", "flags for the C compiler", "FLAGS")
.reqopt("", "cxxflags", "flags for the CXX compiler", "FLAGS")
.optopt("", "ar", "path to an archiver", "PATH")
- .optopt("", "linker", "path to a linker", "PATH")
+ .optopt("", "target-linker", "path to a linker for the target", "PATH")
+ .optopt("", "host-linker", "path to a linker for the host", "PATH")
.reqopt("", "llvm-components", "list of LLVM components built in", "LIST")
.optopt("", "llvm-bin-dir", "Path to LLVM's `bin` directory", "PATH")
.optopt("", "nodejs", "the name of nodejs", "PATH")
@@ -308,7 +309,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
cflags: matches.opt_str("cflags").unwrap(),
cxxflags: matches.opt_str("cxxflags").unwrap(),
ar: matches.opt_str("ar").unwrap_or_else(|| String::from("ar")),
- linker: matches.opt_str("linker"),
+ target_linker: matches.opt_str("target-linker"),
+ host_linker: matches.opt_str("host-linker"),
llvm_components: matches.opt_str("llvm-components").unwrap(),
nodejs: matches.opt_str("nodejs"),
npm: matches.opt_str("npm"),
@@ -351,7 +353,8 @@ pub fn log_config(config: &Config) {
logv(c, format!("adb_test_dir: {:?}", config.adb_test_dir));
logv(c, format!("adb_device_status: {}", config.adb_device_status));
logv(c, format!("ar: {}", config.ar));
- logv(c, format!("linker: {:?}", config.linker));
+ logv(c, format!("target-linker: {:?}", config.target_linker));
+ logv(c, format!("host-linker: {:?}", config.host_linker));
logv(c, format!("verbose: {}", config.verbose));
logv(c, format!("format: {:?}", config.format));
logv(c, "\n".to_string());
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index a35284f05b5..0fa5c54ae8e 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1570,7 +1570,7 @@ impl<'test> TestCx<'test> {
rustdoc.arg("--output-format").arg("json").arg("-Zunstable-options");
}
- if let Some(ref linker) = self.config.linker {
+ if let Some(ref linker) = self.config.target_linker {
rustdoc.arg(format!("-Clinker={}", linker));
}
@@ -2083,10 +2083,15 @@ impl<'test> TestCx<'test> {
if self.props.force_host {
self.maybe_add_external_args(&mut rustc, &self.config.host_rustcflags);
+ if !is_rustdoc {
+ if let Some(ref linker) = self.config.host_linker {
+ rustc.arg(format!("-Clinker={}", linker));
+ }
+ }
} else {
self.maybe_add_external_args(&mut rustc, &self.config.target_rustcflags);
if !is_rustdoc {
- if let Some(ref linker) = self.config.linker {
+ if let Some(ref linker) = self.config.target_linker {
rustc.arg(format!("-Clinker={}", linker));
}
}
@@ -2135,7 +2140,7 @@ impl<'test> TestCx<'test> {
if let Some(ref p) = self.config.nodejs {
args.push(p.clone());
} else {
- self.fatal("no NodeJS binary found (--nodejs)");
+ self.fatal("emscripten target requested and no NodeJS binary found (--nodejs)");
}
// If this is otherwise wasm, then run tests under nodejs with our
// shim
@@ -2143,7 +2148,7 @@ impl<'test> TestCx<'test> {
if let Some(ref p) = self.config.nodejs {
args.push(p.clone());
} else {
- self.fatal("no NodeJS binary found (--nodejs)");
+ self.fatal("wasm32 target requested and no NodeJS binary found (--nodejs)");
}
let src = self
@@ -2999,6 +3004,7 @@ impl<'test> TestCx<'test> {
|| host.contains("freebsd")
|| host.contains("netbsd")
|| host.contains("openbsd")
+ || host.contains("aix")
{
"gmake"
} else {
@@ -3038,7 +3044,7 @@ impl<'test> TestCx<'test> {
cmd.env("NODE", node);
}
- if let Some(ref linker) = self.config.linker {
+ if let Some(ref linker) = self.config.target_linker {
cmd.env("RUSTC_LINKER", linker);
}