From 334034b9f5fea3ecff7262a1315cd9aff8673c4f Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Fri, 1 Apr 2022 14:31:48 -0700 Subject: [PATCH 1/2] xtask: run xtask tests separately from uefi tests The xtask tests don't need to use the nightly toolchain or have any features set. Partially fixes https://github.com/rust-osdev/uefi-rs/issues/397 --- xtask/src/main.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 279386fa1..1e0adc7e8 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -108,13 +108,26 @@ fn run_vm_tests(opt: &QemuOpt) -> Result<()> { /// with VM tests, but a few things like macros and data types can be /// tested with regular tests. fn run_host_tests() -> Result<()> { + // Run xtask tests. + let cargo = Cargo { + action: CargoAction::Test, + features: Vec::new(), + toolchain: None, + packages: vec![Package::Xtask], + release: false, + target: None, + warnings_as_errors: false, + }; + run_cmd(cargo.command()?)?; + + // Run uefi-rs and uefi-macros tests. let cargo = Cargo { action: CargoAction::Test, features: vec![Feature::Exts], toolchain: Some(NIGHTLY.into()), // Don't test uefi-services (or the packages that depend on it) // as it has lang items that conflict with `std`. - packages: vec![Package::Uefi, Package::UefiMacros, Package::Xtask], + packages: vec![Package::Uefi, Package::UefiMacros], release: false, // Use the host target so that tests can run without a VM. target: None, From 32800a62e5906f9317fc26893f76a1d0387d569a Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Fri, 1 Apr 2022 14:13:16 -0700 Subject: [PATCH 2/2] ci: use stable toolchain for compiling xtask The nightly rust compiler is currently unable to compile the version of fatfs we are using in xtask. Rust bug: https://github.com/rust-lang/rust/issues/95538. But we don't need to use nightly to compile xtask. In the CI, install both stable and nightly toolchains. The stable toolchain will be used by default, and xtask already knows to insert `+nightly` when building uefi-rs, so there's no need to set `override: true` for the nightly toolchain anymore. Fixes https://github.com/rust-osdev/uefi-rs/issues/397 --- .github/workflows/rust.yml | 41 ++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a954c8b13..e5994d252 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,11 +27,15 @@ jobs: cp /usr/share/AAVMF/AAVMF_CODE.fd uefi-test-runner/QEMU_EFI-pflash.raw cp /usr/share/AAVMF/AAVMF_VARS.fd uefi-test-runner/vars-template-pflash.raw + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install latest nightly uses: actions-rs/toolchain@v1 with: toolchain: nightly - override: true components: rust-src # TODO: cache Rust binaries @@ -54,11 +58,15 @@ jobs: sudo apt-get update sudo apt-get install qemu-system-x86 ovmf -y + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install latest nightly uses: actions-rs/toolchain@v1 with: toolchain: nightly - override: true components: rust-src # TODO: cache Rust binaries @@ -97,11 +105,15 @@ jobs: curl -o uefi-test-runner/OVMF32_CODE.fd https://raw.githubusercontent.com/retrage/edk2-nightly/${EDK2_NIGHTLY_COMMIT}/bin/RELEASEIa32_OVMF_CODE.fd curl -o uefi-test-runner/OVMF32_VARS.fd https://raw.githubusercontent.com/retrage/edk2-nightly/${EDK2_NIGHTLY_COMMIT}/bin/RELEASEIa32_OVMF_VARS.fd + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install latest nightly uses: actions-rs/toolchain@v1 with: toolchain: nightly - override: true components: rust-src # TODO: cache Rust binaries @@ -119,13 +131,17 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install latest nightly uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly components: rust-src - override: true - name: Run cargo test run: cargo xtask test @@ -137,13 +153,17 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install latest nightly uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly components: rustfmt, clippy, rust-src - override: true - name: Run cargo fmt uses: actions-rs/cargo@v1 @@ -164,6 +184,11 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install latest nightly toolchain that includes Miri uses: actions-rs/toolchain@v1 with: @@ -188,11 +213,15 @@ jobs: - name: Checkout sources uses: actions/checkout@v2 + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Install latest nightly uses: actions-rs/toolchain@v1 with: toolchain: nightly - override: true components: rust-src - name: Build