mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-21 03:57:38 +00:00
Don't run host-only tests when targeting another platform
This commit is contained in:
parent
4a21c72fb0
commit
f1d04a3434
@ -236,9 +236,9 @@ impl<'a> Builder<'a> {
|
|||||||
tool::UnstableBookGen, tool::Tidy, tool::Linkchecker, tool::CargoTest,
|
tool::UnstableBookGen, tool::Tidy, tool::Linkchecker, tool::CargoTest,
|
||||||
tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
|
tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
|
||||||
tool::RustInstaller, tool::Cargo, tool::Rls),
|
tool::RustInstaller, tool::Cargo, tool::Rls),
|
||||||
Kind::Test => describe!(check::Tidy, check::Bootstrap, check::Compiletest, check::Crate,
|
Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
|
||||||
check::CrateLibrustc, check::Linkcheck, check::Cargotest, check::Cargo, check::Docs,
|
check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Linkcheck,
|
||||||
check::ErrorIndex, check::Distcheck),
|
check::Cargotest, check::Cargo, check::Docs, check::ErrorIndex, check::Distcheck),
|
||||||
Kind::Bench => describe!(check::Crate, check::CrateLibrustc),
|
Kind::Bench => describe!(check::Crate, check::CrateLibrustc),
|
||||||
Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
|
Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
|
||||||
doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon,
|
doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon,
|
||||||
|
@ -468,14 +468,6 @@ fn testdir(build: &Build, host: Interned<String>) -> PathBuf {
|
|||||||
// "pretty", "run-fail-fulldeps");
|
// "pretty", "run-fail-fulldeps");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub struct Compiletest {
|
|
||||||
compiler: Compiler,
|
|
||||||
target: Interned<String>,
|
|
||||||
mode: &'static str,
|
|
||||||
suite: &'static str,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
struct Test {
|
struct Test {
|
||||||
path: &'static str,
|
path: &'static str,
|
||||||
@ -501,8 +493,74 @@ static DEFAULT_COMPILETESTS: &[Test] = &[
|
|||||||
|
|
||||||
// What this runs varies depending on the native platform being apple
|
// What this runs varies depending on the native platform being apple
|
||||||
Test { path: "src/test/debuginfo", mode: "debuginfo-XXX", suite: "debuginfo" },
|
Test { path: "src/test/debuginfo", mode: "debuginfo-XXX", suite: "debuginfo" },
|
||||||
|
Test { path: "src/test/debuginfo-lldb", mode: "debuginfo-lldb", suite: "debuginfo" },
|
||||||
|
Test { path: "src/test/debuginfo-gdb", mode: "debuginfo-gdb", suite: "debuginfo" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub struct DefaultCompiletest {
|
||||||
|
compiler: Compiler,
|
||||||
|
target: Interned<String>,
|
||||||
|
mode: &'static str,
|
||||||
|
suite: &'static str,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Step for DefaultCompiletest {
|
||||||
|
type Output = ();
|
||||||
|
const DEFAULT: bool = true;
|
||||||
|
|
||||||
|
fn should_run(mut run: ShouldRun) -> ShouldRun {
|
||||||
|
for test in DEFAULT_COMPILETESTS {
|
||||||
|
run = run.path(test.path);
|
||||||
|
}
|
||||||
|
run
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_run(
|
||||||
|
builder: &Builder,
|
||||||
|
path: Option<&Path>,
|
||||||
|
host: Interned<String>,
|
||||||
|
target: Interned<String>,
|
||||||
|
) {
|
||||||
|
let compiler = builder.compiler(builder.top_stage, host);
|
||||||
|
|
||||||
|
let test = path.map(|path| {
|
||||||
|
DEFAULT_COMPILETESTS.iter().find(|&&test| {
|
||||||
|
path.ends_with(test.path)
|
||||||
|
}).unwrap_or_else(|| {
|
||||||
|
panic!("make_run in compile test to receive test path, received {:?}", path);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
if let Some(test) = test {
|
||||||
|
builder.ensure(DefaultCompiletest {
|
||||||
|
compiler,
|
||||||
|
target,
|
||||||
|
mode: test.mode,
|
||||||
|
suite: test.suite,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
for test in DEFAULT_COMPILETESTS {
|
||||||
|
builder.ensure(DefaultCompiletest {
|
||||||
|
compiler,
|
||||||
|
target,
|
||||||
|
mode: test.mode,
|
||||||
|
suite: test.suite
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run(self, builder: &Builder) {
|
||||||
|
builder.ensure(Compiletest {
|
||||||
|
compiler: self.compiler,
|
||||||
|
target: self.target,
|
||||||
|
mode: self.mode,
|
||||||
|
suite: self.suite,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Also default, but host-only.
|
// Also default, but host-only.
|
||||||
static HOST_COMPILETESTS: &[Test] = &[
|
static HOST_COMPILETESTS: &[Test] = &[
|
||||||
Test { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" },
|
Test { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" },
|
||||||
@ -524,20 +582,21 @@ static HOST_COMPILETESTS: &[Test] = &[
|
|||||||
Test { path: "src/test/run-fail-fulldeps/pretty", mode: "pretty", suite: "run-fail-fulldeps" },
|
Test { path: "src/test/run-fail-fulldeps/pretty", mode: "pretty", suite: "run-fail-fulldeps" },
|
||||||
];
|
];
|
||||||
|
|
||||||
static COMPILETESTS: &[Test] = &[
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
Test { path: "src/test/debuginfo-lldb", mode: "debuginfo-lldb", suite: "debuginfo" },
|
pub struct HostCompiletest {
|
||||||
Test { path: "src/test/debuginfo-gdb", mode: "debuginfo-gdb", suite: "debuginfo" },
|
compiler: Compiler,
|
||||||
];
|
target: Interned<String>,
|
||||||
|
mode: &'static str,
|
||||||
|
suite: &'static str,
|
||||||
|
}
|
||||||
|
|
||||||
impl Step for Compiletest {
|
impl Step for HostCompiletest {
|
||||||
type Output = ();
|
type Output = ();
|
||||||
const DEFAULT: bool = true;
|
const DEFAULT: bool = true;
|
||||||
|
const ONLY_HOSTS: bool = true;
|
||||||
|
|
||||||
fn should_run(mut run: ShouldRun) -> ShouldRun {
|
fn should_run(mut run: ShouldRun) -> ShouldRun {
|
||||||
// Note that this is general, while a few more cases are skipped inside
|
for test in HOST_COMPILETESTS {
|
||||||
// run() itself. This is to avoid duplication across should_run and
|
|
||||||
// make_run.
|
|
||||||
for test in COMPILETESTS.iter().chain(DEFAULT_COMPILETESTS).chain(HOST_COMPILETESTS) {
|
|
||||||
run = run.path(test.path);
|
run = run.path(test.path);
|
||||||
}
|
}
|
||||||
run
|
run
|
||||||
@ -552,44 +611,57 @@ impl Step for Compiletest {
|
|||||||
let compiler = builder.compiler(builder.top_stage, host);
|
let compiler = builder.compiler(builder.top_stage, host);
|
||||||
|
|
||||||
let test = path.map(|path| {
|
let test = path.map(|path| {
|
||||||
COMPILETESTS.iter().chain(DEFAULT_COMPILETESTS).chain(HOST_COMPILETESTS).find(|&&test| {
|
HOST_COMPILETESTS.iter().find(|&&test| {
|
||||||
path.ends_with(test.path)
|
path.ends_with(test.path)
|
||||||
}).unwrap_or_else(|| {
|
}).unwrap_or_else(|| {
|
||||||
panic!("make_run in compile test to receive test path, received {:?}", path);
|
panic!("make_run in compile test to receive test path, received {:?}", path);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(test) = test { // specific test
|
if let Some(test) = test {
|
||||||
let target = if HOST_COMPILETESTS.contains(test) {
|
builder.ensure(HostCompiletest {
|
||||||
host
|
compiler,
|
||||||
} else {
|
target,
|
||||||
target
|
mode: test.mode,
|
||||||
};
|
suite: test.suite,
|
||||||
builder.ensure(Compiletest {
|
|
||||||
compiler, target, mode: test.mode, suite: test.suite
|
|
||||||
});
|
});
|
||||||
} else { // default tests
|
} else {
|
||||||
for test in DEFAULT_COMPILETESTS {
|
for test in HOST_COMPILETESTS {
|
||||||
builder.ensure(Compiletest {
|
builder.ensure(HostCompiletest {
|
||||||
compiler,
|
compiler,
|
||||||
target,
|
target,
|
||||||
mode: test.mode,
|
mode: test.mode,
|
||||||
suite: test.suite
|
suite: test.suite
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for test in HOST_COMPILETESTS {
|
|
||||||
if test.mode != "pretty" {
|
|
||||||
builder.ensure(Compiletest {
|
|
||||||
compiler,
|
|
||||||
target: host,
|
|
||||||
mode: test.mode,
|
|
||||||
suite: test.suite
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn run(self, builder: &Builder) {
|
||||||
|
builder.ensure(Compiletest {
|
||||||
|
compiler: self.compiler,
|
||||||
|
target: self.target,
|
||||||
|
mode: self.mode,
|
||||||
|
suite: self.suite,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
|
struct Compiletest {
|
||||||
|
compiler: Compiler,
|
||||||
|
target: Interned<String>,
|
||||||
|
mode: &'static str,
|
||||||
|
suite: &'static str,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Step for Compiletest {
|
||||||
|
type Output = ();
|
||||||
|
|
||||||
|
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||||
|
run.never()
|
||||||
|
}
|
||||||
|
|
||||||
/// Executes the `compiletest` tool to run a suite of tests.
|
/// Executes the `compiletest` tool to run a suite of tests.
|
||||||
///
|
///
|
||||||
/// Compiles all tests with `compiler` for `target` with the specified
|
/// Compiles all tests with `compiler` for `target` with the specified
|
||||||
|
Loading…
Reference in New Issue
Block a user