Skip to content

Commit 77b83ca

Browse files
committed
ci: separate ui & normal tests
Signed-off-by: Benno Lossin <lossin@kernel.org>
1 parent 257b95b commit 77b83ca

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,24 @@ jobs:
8989
git rebase --exec "bash exec.sh" --root
9090
env:
9191
RUSTFLAGS: "-Dwarnings"
92-
test:
92+
ui-tests:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v4
96+
with:
97+
fetch-depth: ${{github.event.pull_request.commits}}
98+
ref: ${{github.event.pull_request.head.sha}}
99+
- uses: dtolnay/rust-toolchain@nightly
100+
with:
101+
components: rust-src
102+
- run: cargo install cargo-expand
103+
- run: git config user.name "github-runner" && git config user.email "<>"
104+
- run: git rebase --exec 'cargo test ui_ --locked --all-targets' --root
105+
env:
106+
RUSTFLAGS: >
107+
-Dwarnings
108+
--cfg UI_TESTS
109+
tests:
93110
runs-on: ubuntu-latest
94111
steps:
95112
- uses: actions/checkout@v4
@@ -170,7 +187,6 @@ jobs:
170187
env:
171188
ASAN_OPTIONS: "detect_odr_violation=0:detect_leaks=0"
172189
RUSTFLAGS: >
173-
--cfg NO_UI_TESTS
174190
--cfg NO_ALLOC_FAIL_TESTS
175191
-Z sanitizer=address
176192
-Dwarnings
@@ -187,7 +203,6 @@ jobs:
187203
env:
188204
ASAN_OPTIONS: "detect_odr_violation=0:detect_leaks=0"
189205
RUSTFLAGS: >
190-
--cfg NO_UI_TESTS
191206
--cfg NO_ALLOC_FAIL_TESTS
192207
-Z sanitizer=address
193208
-Dwarnings
@@ -197,7 +212,6 @@ jobs:
197212
--root
198213
env:
199214
RUSTFLAGS: >
200-
--cfg NO_UI_TESTS
201215
--cfg NO_ALLOC_FAIL_TESTS
202216
-Z sanitizer=leak
203217
-Dwarnings
@@ -208,7 +222,6 @@ jobs:
208222
--root
209223
env:
210224
RUSTFLAGS: >
211-
--cfg NO_UI_TESTS
212225
--cfg NO_ALLOC_FAIL_TESTS
213226
-Z sanitizer=leak
214227
-Dwarnings

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ prettyplease = { version = "0.2", features = ["verbatim"] }
3636
[lints.rust]
3737
non_ascii_idents = "deny"
3838
unexpected_cfgs = { level = "warn", check-cfg = [
39-
'cfg(NO_UI_TESTS)',
39+
'cfg(UI_TESTS)',
4040
'cfg(NO_ALLOC_FAIL_TESTS)',
4141
'cfg(kernel)',
4242
] }

tests/ui.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
22

33
#[test]
4-
#[cfg_attr(any(miri, NO_UI_TESTS), ignore)]
5-
fn compile_fail() {
4+
#[cfg_attr(not(UI_TESTS), ignore)]
5+
fn ui_compile_fail() {
66
let test_cases = trybuild::TestCases::new();
77
test_cases.compile_fail("tests/ui/compile-fail/pinned_drop/*.rs");
88
test_cases.compile_fail("tests/ui/compile-fail/pin_data/*.rs");
@@ -11,7 +11,7 @@ fn compile_fail() {
1111
}
1212

1313
#[test]
14-
#[cfg_attr(any(miri, NO_UI_TESTS), ignore)]
15-
fn expand() {
14+
#[cfg_attr(not(UI_TESTS), ignore)]
15+
fn ui_expand() {
1616
macrotest::expand("tests/ui/expand/*.rs");
1717
}

0 commit comments

Comments
 (0)