Skip to content

Commit b231cbc

Browse files
xtask: Add option to skip uefi-macros tests
The uefi-macros tests check that the expected compiler output is produced for errors. The error output is slightly different between stable and nightly, so when we transition to testing on stable we have to handle that somehow. We could potentially have two sets of expected output, one for stable and one for nightly, but that's probably more trouble than it's worth. Instead, add an option to skip the uefi-macros tests, and enable that flag in the CI job for the nightly channel.
1 parent bd2d6aa commit b231cbc

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.github/workflows/rust.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,10 @@ jobs:
175175
- name: Run cargo doc with the `unstable` feature
176176
run: cargo xtask doc --warnings-as-errors --document-private-items --unstable
177177

178-
- name: Run tests with the `unstable` feature
179-
run: cargo xtask test --unstable
178+
- name: Run test with the `unstable` feature
179+
# Skip testing uefi-macros on nightly because the tests that check the
180+
# compiler error output produce different output on stable vs nightly.
181+
run: cargo xtask test --unstable --skip-macro-tests
180182

181183
- name: Run unit tests and doctests under Miri
182184
run: |

xtask/src/main.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ fn run_host_tests(test_opt: &TestOpt) -> Result<()> {
177177
};
178178
run_cmd(cargo.command()?)?;
179179

180+
let mut packages = vec![Package::Uefi];
181+
if !test_opt.skip_macro_tests {
182+
packages.push(Package::UefiMacros);
183+
}
184+
180185
// Run uefi-rs and uefi-macros tests.
181186
let cargo = Cargo {
182187
action: CargoAction::Test,
@@ -187,7 +192,7 @@ fn run_host_tests(test_opt: &TestOpt) -> Result<()> {
187192
features: Feature::more_code(*test_opt.unstable, false),
188193
// Don't test uefi-services (or the packages that depend on it)
189194
// as it has lang items that conflict with `std`.
190-
packages: vec![Package::Uefi, Package::UefiMacros],
195+
packages,
191196
release: false,
192197
// Use the host target so that tests can run without a VM.
193198
target: None,

xtask/src/opt.rs

+4
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ pub struct QemuOpt {
184184
pub struct TestOpt {
185185
#[clap(flatten)]
186186
pub unstable: UnstableOpt,
187+
188+
/// Skip the uefi-macros tests.
189+
#[clap(long, action)]
190+
pub skip_macro_tests: bool,
187191
}
188192

189193
/// Build the template against the crates.io packages.

0 commit comments

Comments
 (0)