Fix testing with unstable features disabled
This commit is contained in:
parent
72e67c862f
commit
134dc33485
@ -196,6 +196,7 @@ pub(crate) fn main() {
|
||||
&dirs,
|
||||
channel,
|
||||
sysroot_kind,
|
||||
use_unstable_features,
|
||||
&cg_clif_dylib,
|
||||
&bootstrap_host_compiler,
|
||||
rustup_toolchain_name.as_deref(),
|
||||
|
@ -214,6 +214,7 @@ pub(crate) fn run_tests(
|
||||
dirs: &Dirs,
|
||||
channel: &str,
|
||||
sysroot_kind: SysrootKind,
|
||||
use_unstable_features: bool,
|
||||
cg_clif_dylib: &CodegenBackend,
|
||||
bootstrap_host_compiler: &Compiler,
|
||||
rustup_toolchain_name: Option<&str>,
|
||||
@ -233,6 +234,7 @@ pub(crate) fn run_tests(
|
||||
let runner = TestRunner::new(
|
||||
dirs.clone(),
|
||||
target_compiler,
|
||||
use_unstable_features,
|
||||
bootstrap_host_compiler.triple == target_triple,
|
||||
);
|
||||
|
||||
@ -262,6 +264,7 @@ pub(crate) fn run_tests(
|
||||
let runner = TestRunner::new(
|
||||
dirs.clone(),
|
||||
target_compiler,
|
||||
use_unstable_features,
|
||||
bootstrap_host_compiler.triple == target_triple,
|
||||
);
|
||||
|
||||
@ -282,12 +285,18 @@ pub(crate) fn run_tests(
|
||||
struct TestRunner {
|
||||
is_native: bool,
|
||||
jit_supported: bool,
|
||||
use_unstable_features: bool,
|
||||
dirs: Dirs,
|
||||
target_compiler: Compiler,
|
||||
}
|
||||
|
||||
impl TestRunner {
|
||||
fn new(dirs: Dirs, mut target_compiler: Compiler, is_native: bool) -> Self {
|
||||
fn new(
|
||||
dirs: Dirs,
|
||||
mut target_compiler: Compiler,
|
||||
use_unstable_features: bool,
|
||||
is_native: bool,
|
||||
) -> Self {
|
||||
if let Ok(rustflags) = env::var("RUSTFLAGS") {
|
||||
target_compiler.rustflags.push(' ');
|
||||
target_compiler.rustflags.push_str(&rustflags);
|
||||
@ -302,11 +311,12 @@ impl TestRunner {
|
||||
target_compiler.rustflags.push_str(" -Clink-arg=-undefined -Clink-arg=dynamic_lookup");
|
||||
}
|
||||
|
||||
let jit_supported = is_native
|
||||
let jit_supported = use_unstable_features
|
||||
&& is_native
|
||||
&& target_compiler.triple.contains("x86_64")
|
||||
&& !target_compiler.triple.contains("windows");
|
||||
|
||||
Self { is_native, jit_supported, dirs, target_compiler }
|
||||
Self { is_native, jit_supported, use_unstable_features, dirs, target_compiler }
|
||||
}
|
||||
|
||||
fn run_testsuite(&self, tests: &[TestCase]) {
|
||||
@ -325,10 +335,24 @@ impl TestRunner {
|
||||
match *cmd {
|
||||
TestCaseCmd::Custom { func } => func(self),
|
||||
TestCaseCmd::BuildLib { source, crate_types } => {
|
||||
self.run_rustc([source, "--crate-type", crate_types]);
|
||||
if self.use_unstable_features {
|
||||
self.run_rustc([source, "--crate-type", crate_types]);
|
||||
} else {
|
||||
self.run_rustc([
|
||||
source,
|
||||
"--crate-type",
|
||||
crate_types,
|
||||
"--cfg",
|
||||
"no_unstable_features",
|
||||
]);
|
||||
}
|
||||
}
|
||||
TestCaseCmd::BuildBinAndRun { source, args } => {
|
||||
self.run_rustc([source]);
|
||||
if self.use_unstable_features {
|
||||
self.run_rustc([source]);
|
||||
} else {
|
||||
self.run_rustc([source, "--cfg", "no_unstable_features"]);
|
||||
}
|
||||
self.run_out_command(
|
||||
source.split('/').last().unwrap().split('.').next().unwrap(),
|
||||
args,
|
||||
|
@ -322,7 +322,12 @@ fn main() {
|
||||
#[cfg(all(not(jit), not(all(windows, target_env = "gnu"))))]
|
||||
test_tls();
|
||||
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", any(target_os = "linux", target_os = "darwin")))]
|
||||
#[cfg(all(
|
||||
not(jit),
|
||||
not(no_unstable_features),
|
||||
target_arch = "x86_64",
|
||||
any(target_os = "linux", target_os = "darwin")
|
||||
))]
|
||||
unsafe {
|
||||
global_asm_test();
|
||||
}
|
||||
@ -350,12 +355,17 @@ fn main() {
|
||||
let _a = f.0[0];
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", any(target_os = "linux", target_os = "darwin")))]
|
||||
#[cfg(all(
|
||||
not(jit),
|
||||
not(no_unstable_features),
|
||||
target_arch = "x86_64",
|
||||
any(target_os = "linux", target_os = "darwin")
|
||||
))]
|
||||
extern "C" {
|
||||
fn global_asm_test();
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "linux"))]
|
||||
#[cfg(all(not(jit), not(no_unstable_features), target_arch = "x86_64", target_os = "linux"))]
|
||||
global_asm! {
|
||||
"
|
||||
.global global_asm_test
|
||||
@ -365,7 +375,7 @@ global_asm! {
|
||||
"
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "darwin"))]
|
||||
#[cfg(all(not(jit), not(no_unstable_features), target_arch = "x86_64", target_os = "darwin"))]
|
||||
global_asm! {
|
||||
"
|
||||
.global _global_asm_test
|
||||
|
Loading…
x
Reference in New Issue
Block a user