about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-12-15 18:44:27 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-12-15 18:44:27 +0000
commita501d96f3368575eb9a8feeb3f16f5900dc06b48 (patch)
treeecda7b1b27927f063080d51c306b1f845ab861dc
parente082eebb5f3fceac83b5cca666e601e5ce0a964b (diff)
parente735206f50af9754ab21171e4472cfbe1eecd92f (diff)
downloadrust-a501d96f3368575eb9a8feeb3f16f5900dc06b48.tar.gz
rust-a501d96f3368575eb9a8feeb3f16f5900dc06b48.zip
Merge branch 'staging'
-rw-r--r--.cirrus.yml5
-rw-r--r--.github/workflows/main.yml135
-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.rs24
6 files changed, 52 insertions, 149 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..b79406879ff 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -25,6 +25,10 @@ jobs:
     runs-on: ${{ matrix.os }}
     timeout-minutes: 60
 
+    defaults:
+      run:
+        shell: bash
+
     strategy:
       fail-fast: false
       matrix:
@@ -46,6 +50,14 @@ jobs:
           - os: ubuntu-latest
             env:
               TARGET_TRIPLE: s390x-unknown-linux-gnu
+          # Native Windows build with MSVC
+          - os: windows-latest
+            env:
+              TARGET_TRIPLE: x86_64-pc-windows-msvc
+          # cross-compile from Windows to Windows MinGW
+          - os: windows-latest
+            env:
+              TARGET_TRIPLE: x86_64-pc-windows-gnu
 
     steps:
     - uses: actions/checkout@v3
@@ -54,7 +66,7 @@ jobs:
       uses: actions/cache@v3
       with:
         path: ~/.cargo/bin
-        key: ${{ runner.os }}-cargo-installed-crates
+        key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
 
     - name: Cache cargo registry and index
       uses: actions/cache@v3
@@ -62,13 +74,17 @@ jobs:
         path: |
             ~/.cargo/registry
             ~/.cargo/git
-        key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
+        key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
 
     - name: Cache cargo target dir
       uses: actions/cache@v3
       with:
         path: build/cg_clif
-        key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
+        key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
+
+    - name: Set MinGW as the default toolchain
+      if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
+      run: rustup set default-host x86_64-pc-windows-gnu
 
     - name: Install MinGW toolchain and wine
       if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
@@ -89,6 +105,10 @@ jobs:
         sudo apt-get update
         sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
 
+    - name: Windows setup
+      if: matrix.os == 'windows-latest'
+      run: git config --global core.autocrlf false
+
     - name: Prepare dependencies
       run: ./y.rs prepare
 
@@ -104,124 +124,21 @@ 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
 
     - name: Upload prebuilt cg_clif
-      if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
+      if: matrix.os == 'windows-latest' || matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
       uses: actions/upload-artifact@v3
       with:
         name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
         path: cg_clif.tar.xz
 
     - name: Upload prebuilt cg_clif (cross compile)
-      if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
+      if: matrix.os != 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
       uses: actions/upload-artifact@v3
       with:
         name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
         path: cg_clif.tar.xz
-
-  windows:
-    runs-on: ${{ matrix.os }}
-    timeout-minutes: 60
-
-    strategy:
-      fail-fast: false
-      matrix:
-        include:
-          # Native Windows build with MSVC
-          - os: windows-latest
-            env:
-              TARGET_TRIPLE: x86_64-pc-windows-msvc
-          # cross-compile from Windows to Windows MinGW
-          - os: windows-latest
-            env:
-              TARGET_TRIPLE: x86_64-pc-windows-gnu
-
-    steps:
-    - uses: actions/checkout@v3
-
-    - name: Cache cargo installed crates
-      uses: actions/cache@v3
-      with:
-        path: ~/.cargo/bin
-        key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
-
-    - name: Cache cargo registry and index
-      uses: actions/cache@v3
-      with:
-        path: |
-            ~/.cargo/registry
-            ~/.cargo/git
-        key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
-
-    - name: Cache cargo target dir
-      uses: actions/cache@v3
-      with:
-        path: build/cg_clif
-        key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
-
-    - name: Set MinGW as the default toolchain
-      if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
-      run: rustup set default-host x86_64-pc-windows-gnu
-
-    - name: Prepare dependencies
-      run: |
-        git config --global core.autocrlf false
-        rustc y.rs -o y.exe -g
-        ./y.exe prepare
-
-    - name: Build without unstable features
-      env:
-        TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
-      # This is the config rust-lang/rust uses for builds
-      run: ./y.rs build --no-unstable-features
-
-    - name: Build
-      run: ./y.rs build --sysroot none
-
-    - 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
-        # more of a build system issue
-        (Get-Content config.txt) -replace '(bench.simple-raytracer)', '# $1' |  Out-File config.txt
-
-        # This fails with a different output than expected
-        (Get-Content config.txt) -replace '(test.regex-shootout-regex-dna)', '# $1' |  Out-File config.txt
-
-        ./y.exe test
-
-    - name: Package prebuilt cg_clif
-      # don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
-      run: tar cvf cg_clif.tar dist
-
-    - name: Upload prebuilt cg_clif
-      uses: actions/upload-artifact@v3
-      with:
-        name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
-        path: cg_clif.tar
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..37c35106af6 100644
--- a/build_system/tests.rs
+++ b/build_system/tests.rs
@@ -2,9 +2,9 @@ use super::build_sysroot;
 use super::config;
 use super::path::{Dirs, RelPath};
 use super::prepare::GitRepo;
-use super::rustc_info::get_wrapper_file_name;
+use super::rustc_info::{get_file_name, 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");
@@ -315,13 +318,20 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
 
             eprintln!("[BENCH RUN] ebobby/simple-raytracer");
             fs::copy(
-                target_dir.join("debug").join("main"),
-                RelPath::BUILD.to_path(&runner.dirs).join("raytracer_cg_clif"),
+                target_dir.join("debug").join(get_file_name("main", "bin")),
+                RelPath::BUILD
+                    .to_path(&runner.dirs)
+                    .join(get_file_name("raytracer_cg_clif", "bin")),
             )
             .unwrap();
 
-            let mut bench_run =
-                hyperfine_command(0, run_runs, None, "./raytracer_cg_llvm", "./raytracer_cg_clif");
+            let mut bench_run = hyperfine_command(
+                0,
+                run_runs,
+                None,
+                Path::new(".").join(get_file_name("raytracer_cg_llvm", "bin")).to_str().unwrap(),
+                Path::new(".").join(get_file_name("raytracer_cg_clif", "bin")).to_str().unwrap(),
+            );
             bench_run.current_dir(RelPath::BUILD.to_path(&runner.dirs));
             spawn_and_wait(bench_run);
         } else {