about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-12-15 14:12:46 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-12-15 14:16:53 +0000
commitcc3ac006a2fecc9a6543244798c9f13c73c3db8d (patch)
treea41aa4d3dec3eab1e74327147518c9ad5faca7e0
parente082eebb5f3fceac83b5cca666e601e5ce0a964b (diff)
downloadrust-cc3ac006a2fecc9a6543244798c9f13c73c3db8d.tar.gz
rust-cc3ac006a2fecc9a6543244798c9f13c73c3db8d.zip
Move many env vars from CI configuration to the build system
-rw-r--r--.cirrus.yml5
-rw-r--r--.github/workflows/main.yml23
-rw-r--r--.github/workflows/nightly-cranelift.yml13
-rw-r--r--.github/workflows/rustc.yml18
-rw-r--r--build_system/mod.rs6
-rw-r--r--build_system/tests.rs7
6 files changed, 15 insertions, 57 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index d627c2ee09c..76b48d70ab7 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -15,9 +15,4 @@ task:
     - ./y.rs prepare
   test_script:
     - . $HOME/.cargo/env
-    - # Enable backtraces for easier debugging
-    - export RUST_BACKTRACE=1
-    - # Reduce amount of benchmark runs as they are slow
-    - export COMPILE_RUNS=2
-    - export RUN_RUNS=2
     - ./y.rs test
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 010979c9c33..3492df72720 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -104,18 +104,7 @@ jobs:
     - name: Test
       env:
         TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
-      run: |
-        # Enable backtraces for easier debugging
-        export RUST_BACKTRACE=1
-
-        # Reduce amount of benchmark runs as they are slow
-        export COMPILE_RUNS=2
-        export RUN_RUNS=2
-
-        # Enable extra checks
-        export CG_CLIF_ENABLE_VERIFIER=1
-
-        ./y.rs test
+      run: ./y.rs test
 
     - name: Package prebuilt cg_clif
       run: tar cvfJ cg_clif.tar.xz dist
@@ -195,16 +184,6 @@ jobs:
 
     - name: Test
       run: |
-        # Enable backtraces for easier debugging
-        $Env:RUST_BACKTRACE=1
-
-        # Reduce amount of benchmark runs as they are slow
-        $Env:COMPILE_RUNS=2
-        $Env:RUN_RUNS=2
-
-        # Enable extra checks
-        $Env:CG_CLIF_ENABLE_VERIFIER=1
-
         # WIP Disable some tests
 
         # This fails due to some weird argument handling by hyperfine, not an actual regression
diff --git a/.github/workflows/nightly-cranelift.yml b/.github/workflows/nightly-cranelift.yml
index d0d58d2a7ea..0565938ee35 100644
--- a/.github/workflows/nightly-cranelift.yml
+++ b/.github/workflows/nightly-cranelift.yml
@@ -45,15 +45,4 @@ jobs:
     - name: Build
       run: ./y.rs build --sysroot none
     - name: Test
-      run: |
-        # Enable backtraces for easier debugging
-        export RUST_BACKTRACE=1
-
-        # Reduce amount of benchmark runs as they are slow
-        export COMPILE_RUNS=2
-        export RUN_RUNS=2
-
-        # Enable extra checks
-        export CG_CLIF_ENABLE_VERIFIER=1
-
-        ./test.sh
+      run: ./test.sh
diff --git a/.github/workflows/rustc.yml b/.github/workflows/rustc.yml
index af34e10c759..bab81b9dc2a 100644
--- a/.github/workflows/rustc.yml
+++ b/.github/workflows/rustc.yml
@@ -37,14 +37,7 @@ jobs:
         ./y.rs prepare
 
     - name: Test
-      run: |
-        # Enable backtraces for easier debugging
-        export RUST_BACKTRACE=1
-
-        # Enable extra checks
-        export CG_CLIF_ENABLE_VERIFIER=1
-
-        ./scripts/test_bootstrap.sh
+      run: ./scripts/test_bootstrap.sh
   rustc_test_suite:
     runs-on: ubuntu-latest
 
@@ -78,11 +71,4 @@ jobs:
         ./y.rs prepare
 
     - name: Test
-      run: |
-        # Enable backtraces for easier debugging
-        export RUST_BACKTRACE=1
-
-        # Enable extra checks
-        export CG_CLIF_ENABLE_VERIFIER=1
-
-        ./scripts/test_rustc_tests.sh
+      run: ./scripts/test_rustc_tests.sh
diff --git a/build_system/mod.rs b/build_system/mod.rs
index 1afc9a55c73..2f311aed7c8 100644
--- a/build_system/mod.rs
+++ b/build_system/mod.rs
@@ -64,12 +64,18 @@ pub(crate) enum SysrootKind {
 }
 
 pub fn main() {
+    if env::var("RUST_BACKTRACE").is_err() {
+        env::set_var("RUST_BACKTRACE", "1");
+    }
     env::set_var("CG_CLIF_DISPLAY_CG_TIME", "1");
     env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
 
     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");
+
+        // Enable the Cranelift verifier
+        env::set_var("CG_CLIF_ENABLE_VERIFIER", "1");
     }
 
     let mut args = env::args().skip(1);
diff --git a/build_system/tests.rs b/build_system/tests.rs
index 738a76ef4c5..81993b9d337 100644
--- a/build_system/tests.rs
+++ b/build_system/tests.rs
@@ -4,7 +4,7 @@ use super::path::{Dirs, RelPath};
 use super::prepare::GitRepo;
 use super::rustc_info::get_wrapper_file_name;
 use super::utils::{
-    hyperfine_command, spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler,
+    hyperfine_command, is_ci, spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler,
 };
 use super::SysrootKind;
 use std::env;
@@ -281,7 +281,10 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
         }
     }),
     TestCase::new("bench.simple-raytracer", &|runner| {
-        let run_runs = env::var("RUN_RUNS").unwrap_or("10".to_string()).parse().unwrap();
+        let run_runs = env::var("RUN_RUNS")
+            .unwrap_or(if is_ci() { "2" } else { "10" }.to_string())
+            .parse()
+            .unwrap();
 
         if runner.is_native {
             eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");