Skip to content

Commit a501d96

Browse files
committed
Merge branch 'staging'
2 parents e082eeb + e735206 commit a501d96

File tree

6 files changed

+52
-149
lines changed

6 files changed

+52
-149
lines changed

.cirrus.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,4 @@ task:
1515
- ./y.rs prepare
1616
test_script:
1717
- . $HOME/.cargo/env
18-
- # Enable backtraces for easier debugging
19-
- export RUST_BACKTRACE=1
20-
- # Reduce amount of benchmark runs as they are slow
21-
- export COMPILE_RUNS=2
22-
- export RUN_RUNS=2
2318
- ./y.rs test

.github/workflows/main.yml

Lines changed: 26 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
runs-on: ${{ matrix.os }}
2626
timeout-minutes: 60
2727

28+
defaults:
29+
run:
30+
shell: bash
31+
2832
strategy:
2933
fail-fast: false
3034
matrix:
@@ -46,6 +50,14 @@ jobs:
4650
- os: ubuntu-latest
4751
env:
4852
TARGET_TRIPLE: s390x-unknown-linux-gnu
53+
# Native Windows build with MSVC
54+
- os: windows-latest
55+
env:
56+
TARGET_TRIPLE: x86_64-pc-windows-msvc
57+
# cross-compile from Windows to Windows MinGW
58+
- os: windows-latest
59+
env:
60+
TARGET_TRIPLE: x86_64-pc-windows-gnu
4961

5062
steps:
5163
- uses: actions/checkout@v3
@@ -54,21 +66,25 @@ jobs:
5466
uses: actions/cache@v3
5567
with:
5668
path: ~/.cargo/bin
57-
key: ${{ runner.os }}-cargo-installed-crates
69+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
5870

5971
- name: Cache cargo registry and index
6072
uses: actions/cache@v3
6173
with:
6274
path: |
6375
~/.cargo/registry
6476
~/.cargo/git
65-
key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
77+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
6678

6779
- name: Cache cargo target dir
6880
uses: actions/cache@v3
6981
with:
7082
path: build/cg_clif
71-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
83+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
84+
85+
- name: Set MinGW as the default toolchain
86+
if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
87+
run: rustup set default-host x86_64-pc-windows-gnu
7288

7389
- name: Install MinGW toolchain and wine
7490
if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
@@ -89,6 +105,10 @@ jobs:
89105
sudo apt-get update
90106
sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
91107
108+
- name: Windows setup
109+
if: matrix.os == 'windows-latest'
110+
run: git config --global core.autocrlf false
111+
92112
- name: Prepare dependencies
93113
run: ./y.rs prepare
94114

@@ -104,124 +124,21 @@ jobs:
104124
- name: Test
105125
env:
106126
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
107-
run: |
108-
# Enable backtraces for easier debugging
109-
export RUST_BACKTRACE=1
110-
111-
# Reduce amount of benchmark runs as they are slow
112-
export COMPILE_RUNS=2
113-
export RUN_RUNS=2
114-
115-
# Enable extra checks
116-
export CG_CLIF_ENABLE_VERIFIER=1
117-
118-
./y.rs test
127+
run: ./y.rs test
119128

120129
- name: Package prebuilt cg_clif
121130
run: tar cvfJ cg_clif.tar.xz dist
122131

123132
- name: Upload prebuilt cg_clif
124-
if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
133+
if: matrix.os == 'windows-latest' || matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
125134
uses: actions/upload-artifact@v3
126135
with:
127136
name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
128137
path: cg_clif.tar.xz
129138

130139
- name: Upload prebuilt cg_clif (cross compile)
131-
if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
140+
if: matrix.os != 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
132141
uses: actions/upload-artifact@v3
133142
with:
134143
name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
135144
path: cg_clif.tar.xz
136-
137-
windows:
138-
runs-on: ${{ matrix.os }}
139-
timeout-minutes: 60
140-
141-
strategy:
142-
fail-fast: false
143-
matrix:
144-
include:
145-
# Native Windows build with MSVC
146-
- os: windows-latest
147-
env:
148-
TARGET_TRIPLE: x86_64-pc-windows-msvc
149-
# cross-compile from Windows to Windows MinGW
150-
- os: windows-latest
151-
env:
152-
TARGET_TRIPLE: x86_64-pc-windows-gnu
153-
154-
steps:
155-
- uses: actions/checkout@v3
156-
157-
- name: Cache cargo installed crates
158-
uses: actions/cache@v3
159-
with:
160-
path: ~/.cargo/bin
161-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-installed-crates
162-
163-
- name: Cache cargo registry and index
164-
uses: actions/cache@v3
165-
with:
166-
path: |
167-
~/.cargo/registry
168-
~/.cargo/git
169-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
170-
171-
- name: Cache cargo target dir
172-
uses: actions/cache@v3
173-
with:
174-
path: build/cg_clif
175-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
176-
177-
- name: Set MinGW as the default toolchain
178-
if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
179-
run: rustup set default-host x86_64-pc-windows-gnu
180-
181-
- name: Prepare dependencies
182-
run: |
183-
git config --global core.autocrlf false
184-
rustc y.rs -o y.exe -g
185-
./y.exe prepare
186-
187-
- name: Build without unstable features
188-
env:
189-
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
190-
# This is the config rust-lang/rust uses for builds
191-
run: ./y.rs build --no-unstable-features
192-
193-
- name: Build
194-
run: ./y.rs build --sysroot none
195-
196-
- name: Test
197-
run: |
198-
# Enable backtraces for easier debugging
199-
$Env:RUST_BACKTRACE=1
200-
201-
# Reduce amount of benchmark runs as they are slow
202-
$Env:COMPILE_RUNS=2
203-
$Env:RUN_RUNS=2
204-
205-
# Enable extra checks
206-
$Env:CG_CLIF_ENABLE_VERIFIER=1
207-
208-
# WIP Disable some tests
209-
210-
# This fails due to some weird argument handling by hyperfine, not an actual regression
211-
# more of a build system issue
212-
(Get-Content config.txt) -replace '(bench.simple-raytracer)', '# $1' | Out-File config.txt
213-
214-
# This fails with a different output than expected
215-
(Get-Content config.txt) -replace '(test.regex-shootout-regex-dna)', '# $1' | Out-File config.txt
216-
217-
./y.exe test
218-
219-
- name: Package prebuilt cg_clif
220-
# don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
221-
run: tar cvf cg_clif.tar dist
222-
223-
- name: Upload prebuilt cg_clif
224-
uses: actions/upload-artifact@v3
225-
with:
226-
name: cg_clif-${{ matrix.env.TARGET_TRIPLE }}
227-
path: cg_clif.tar

.github/workflows/nightly-cranelift.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,4 @@ jobs:
4545
- name: Build
4646
run: ./y.rs build --sysroot none
4747
- name: Test
48-
run: |
49-
# Enable backtraces for easier debugging
50-
export RUST_BACKTRACE=1
51-
52-
# Reduce amount of benchmark runs as they are slow
53-
export COMPILE_RUNS=2
54-
export RUN_RUNS=2
55-
56-
# Enable extra checks
57-
export CG_CLIF_ENABLE_VERIFIER=1
58-
59-
./test.sh
48+
run: ./test.sh

.github/workflows/rustc.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ jobs:
3737
./y.rs prepare
3838
3939
- name: Test
40-
run: |
41-
# Enable backtraces for easier debugging
42-
export RUST_BACKTRACE=1
43-
44-
# Enable extra checks
45-
export CG_CLIF_ENABLE_VERIFIER=1
46-
47-
./scripts/test_bootstrap.sh
40+
run: ./scripts/test_bootstrap.sh
4841
rustc_test_suite:
4942
runs-on: ubuntu-latest
5043

@@ -78,11 +71,4 @@ jobs:
7871
./y.rs prepare
7972
8073
- name: Test
81-
run: |
82-
# Enable backtraces for easier debugging
83-
export RUST_BACKTRACE=1
84-
85-
# Enable extra checks
86-
export CG_CLIF_ENABLE_VERIFIER=1
87-
88-
./scripts/test_rustc_tests.sh
74+
run: ./scripts/test_rustc_tests.sh

build_system/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,18 @@ pub(crate) enum SysrootKind {
6464
}
6565

6666
pub fn main() {
67+
if env::var("RUST_BACKTRACE").is_err() {
68+
env::set_var("RUST_BACKTRACE", "1");
69+
}
6770
env::set_var("CG_CLIF_DISPLAY_CG_TIME", "1");
6871
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
6972

7073
if is_ci() {
7174
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
7275
env::set_var("CARGO_BUILD_INCREMENTAL", "false");
76+
77+
// Enable the Cranelift verifier
78+
env::set_var("CG_CLIF_ENABLE_VERIFIER", "1");
7379
}
7480

7581
let mut args = env::args().skip(1);

build_system/tests.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use super::build_sysroot;
22
use super::config;
33
use super::path::{Dirs, RelPath};
44
use super::prepare::GitRepo;
5-
use super::rustc_info::get_wrapper_file_name;
5+
use super::rustc_info::{get_file_name, get_wrapper_file_name};
66
use super::utils::{
7-
hyperfine_command, spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler,
7+
hyperfine_command, is_ci, spawn_and_wait, spawn_and_wait_with_input, CargoProject, Compiler,
88
};
99
use super::SysrootKind;
1010
use std::env;
@@ -281,7 +281,10 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
281281
}
282282
}),
283283
TestCase::new("bench.simple-raytracer", &|runner| {
284-
let run_runs = env::var("RUN_RUNS").unwrap_or("10".to_string()).parse().unwrap();
284+
let run_runs = env::var("RUN_RUNS")
285+
.unwrap_or(if is_ci() { "2" } else { "10" }.to_string())
286+
.parse()
287+
.unwrap();
285288

286289
if runner.is_native {
287290
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
@@ -315,13 +318,20 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
315318

316319
eprintln!("[BENCH RUN] ebobby/simple-raytracer");
317320
fs::copy(
318-
target_dir.join("debug").join("main"),
319-
RelPath::BUILD.to_path(&runner.dirs).join("raytracer_cg_clif"),
321+
target_dir.join("debug").join(get_file_name("main", "bin")),
322+
RelPath::BUILD
323+
.to_path(&runner.dirs)
324+
.join(get_file_name("raytracer_cg_clif", "bin")),
320325
)
321326
.unwrap();
322327

323-
let mut bench_run =
324-
hyperfine_command(0, run_runs, None, "./raytracer_cg_llvm", "./raytracer_cg_clif");
328+
let mut bench_run = hyperfine_command(
329+
0,
330+
run_runs,
331+
None,
332+
Path::new(".").join(get_file_name("raytracer_cg_llvm", "bin")).to_str().unwrap(),
333+
Path::new(".").join(get_file_name("raytracer_cg_clif", "bin")).to_str().unwrap(),
334+
);
325335
bench_run.current_dir(RelPath::BUILD.to_path(&runner.dirs));
326336
spawn_and_wait(bench_run);
327337
} else {

0 commit comments

Comments
 (0)