summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_cranelift/build_system/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_cranelift/build_system/mod.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/mod.rs58
1 files changed, 48 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_cranelift/build_system/mod.rs b/compiler/rustc_codegen_cranelift/build_system/mod.rs
index b897b7fba..c3706dc6f 100644
--- a/compiler/rustc_codegen_cranelift/build_system/mod.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/mod.rs
@@ -2,11 +2,15 @@ use std::env;
use std::path::PathBuf;
use std::process;
+use self::utils::is_ci;
+
+mod abi_checker;
mod build_backend;
mod build_sysroot;
mod config;
mod prepare;
mod rustc_info;
+mod tests;
mod utils;
fn usage() {
@@ -15,6 +19,9 @@ fn usage() {
eprintln!(
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
);
+ eprintln!(
+ " ./y.rs test [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
+ );
}
macro_rules! arg_error {
@@ -25,11 +32,13 @@ macro_rules! arg_error {
}};
}
+#[derive(PartialEq, Debug)]
enum Command {
Build,
+ Test,
}
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
pub(crate) enum SysrootKind {
None,
Clif,
@@ -42,16 +51,22 @@ pub fn main() {
// The target dir is expected in the default location. Guard against the user changing it.
env::set_var("CARGO_TARGET_DIR", "target");
+ if is_ci() {
+ // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
+ env::set_var("CARGO_BUILD_INCREMENTAL", "false");
+ }
+
let mut args = env::args().skip(1);
let command = match args.next().as_deref() {
Some("prepare") => {
if args.next().is_some() {
- arg_error!("./x.rs prepare doesn't expect arguments");
+ arg_error!("./y.rs prepare doesn't expect arguments");
}
prepare::prepare();
process::exit(0);
}
Some("build") => Command::Build,
+ Some("test") => Command::Test,
Some(flag) if flag.starts_with('-') => arg_error!("Expected command found flag {}", flag),
Some(command) => arg_error!("Unknown command {}", command),
None => {
@@ -117,12 +132,35 @@ pub fn main() {
let cg_clif_build_dir =
build_backend::build_backend(channel, &host_triple, use_unstable_features);
- build_sysroot::build_sysroot(
- channel,
- sysroot_kind,
- &target_dir,
- cg_clif_build_dir,
- &host_triple,
- &target_triple,
- );
+ match command {
+ Command::Test => {
+ tests::run_tests(
+ channel,
+ sysroot_kind,
+ &target_dir,
+ &cg_clif_build_dir,
+ &host_triple,
+ &target_triple,
+ );
+
+ abi_checker::run(
+ channel,
+ sysroot_kind,
+ &target_dir,
+ &cg_clif_build_dir,
+ &host_triple,
+ &target_triple,
+ );
+ }
+ Command::Build => {
+ build_sysroot::build_sysroot(
+ channel,
+ sysroot_kind,
+ &target_dir,
+ &cg_clif_build_dir,
+ &host_triple,
+ &target_triple,
+ );
+ }
+ }
}