Skip to content

Fix compilation of the xtask package under Windows and add to CI #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,25 @@ jobs:

- name: Build
run: cargo xtask test-latest-release

windows:
name: Check that the build works on a Windows target
runs-on: windows-latest
steps:
- 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

- name: Build
run: cargo xtask build
1 change: 1 addition & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ publish = false

[dependencies]
anyhow = "1.0.51"
cfg-if = "1.0.0"
clap = { version = "3.0.13", features = ["derive"] }
# The latest fatfs release (0.3.5) is old, use git instead to pick up some fixes.
fatfs = { git = "https://github.com/rafalh/rust-fatfs.git", rev = "87fc1ed5074a32b4e0344fcdde77359ef9e75432" }
Expand Down
2 changes: 2 additions & 0 deletions xtask/src/disk.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(unix)]

use anyhow::Result;
use fatfs::{Date, DateTime, FileSystem, FormatVolumeOptions, FsOptions, StdIoWrapper, Time};
use mbrman::{MBRPartitionEntry, CHS, MBR};
Expand Down
9 changes: 8 additions & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod util;

use anyhow::Result;
use cargo::{Cargo, CargoAction, Feature, Package};
use cfg_if::cfg_if;
use clap::Parser;
use opt::{Action, BuildOpt, ClippyOpt, DocOpt, MiriOpt, Opt, QemuOpt};
use std::process::Command;
Expand Down Expand Up @@ -102,7 +103,13 @@ fn run_vm_tests(opt: &QemuOpt) -> Result<()> {
};
run_cmd(cargo.command()?)?;

qemu::run_qemu(*opt.target, opt)
cfg_if! {
if #[cfg(unix)] {
qemu::run_qemu(*opt.target, opt)
} else {
panic!("vm tests are only supported on unix targets");
}
}
}

/// Run unit tests and doctests on the host. Most of uefi-rs is tested
Expand Down
2 changes: 2 additions & 0 deletions xtask/src/net.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(unix)]

use std::net::UdpSocket;

/// Start a thread that listens on UDP port 21572 and simulates a simple echo
Expand Down
2 changes: 2 additions & 0 deletions xtask/src/qemu.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(unix)]

use crate::arch::UefiArch;
use crate::disk::{check_mbr_test_disk, create_mbr_test_disk};
use crate::net;
Expand Down