Skip to content
Draft
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
31 changes: 31 additions & 0 deletions .github/workflows/real-hw-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: UEFI real-hardware test smoke test

on: [pull_request, merge_group]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
qemu:
name: Headless QEMU TCG
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-uefi
- name: Install QEMU and OVMF
run: |
sudo apt-get update
sudo apt-get install -y ovmf qemu-system-x86
- name: Run deterministic UEFI checks
working-directory: real-hw-test
run: |
OVMF=$(find /usr/share/OVMF -maxdepth 1 -type f -name OVMF_CODE.fd -print -quit)
if [[ -z "$OVMF" ]]; then
echo "error: the ovmf package did not install OVMF_CODE.fd" >&2
exit 1
fi
make ci-qemu OVMF="$OVMF"
1 change: 1 addition & 0 deletions real-hw-test/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions real-hw-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build/
/target/
267 changes: 267 additions & 0 deletions real-hw-test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions real-hw-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "uart-16550-real-hw-test"
version = "0.1.0"
edition = "2024"
publish = false

[features]
ci = []

[dependencies]
jiff = { version = "0.2", default-features = false }
uart_16550 = { path = ".." }
uefi = { version = "0.38.0", features = ["alloc", "global_allocator", "jiff02", "panic_handler"] }
54 changes: 54 additions & 0 deletions real-hw-test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
CARGO ?= cargo
QEMU ?= qemu-system-x86_64
QEMU_ACCEL ?= kvm
TARGET := x86_64-unknown-uefi
TARGET_DIR := ../target/real-hw-test
PROFILE := release
BINARY := $(TARGET_DIR)/$(TARGET)/$(PROFILE)/uart-16550-real-hw-test.efi
ARTIFACT := build/BOOTX64.EFI
BUILD := CARGO_TARGET_DIR=$(TARGET_DIR) $(CARGO) build --locked
CLIPPY := CARGO_TARGET_DIR=$(TARGET_DIR) $(CARGO) clippy --locked
CI_ARTIFACT := build/BOOTX64-CI.EFI

.PHONY: all artifact ci-artifact check qemu qemu-tcg ci-qemu install clean

all: artifact

artifact: $(ARTIFACT)

$(ARTIFACT): FORCE
$(BUILD) --target $(TARGET) --release
mkdir -p $(dir $(ARTIFACT))
cp $(BINARY) $(ARTIFACT)

ci-artifact: FORCE
$(BUILD) --target $(TARGET) --release --features ci
mkdir -p $(dir $(CI_ARTIFACT))
cp $(BINARY) $(CI_ARTIFACT)

check:
$(CARGO) fmt --check
$(CLIPPY) --target $(TARGET) --release -- -D warnings
$(CLIPPY) --target $(TARGET) --release --features ci -- -D warnings
bash -n scripts/*.sh
$(MAKE) artifact

qemu: artifact
QEMU="$(QEMU)" QEMU_ACCEL="$(QEMU_ACCEL)" OVMF="$(OVMF)" \
./scripts/run-qemu.sh $(QEMU_ARGS)

qemu-tcg:
$(MAKE) qemu QEMU_ACCEL=tcg

ci-qemu: ci-artifact
QEMU="$(QEMU)" OVMF="$(OVMF)" ./scripts/run-qemu-ci.sh $(CI_ARTIFACT)

install: artifact
USB_MOUNT="$(USB_MOUNT)" ./scripts/install-usb.sh $(ARTIFACT)

clean:
$(CARGO) clean --target-dir $(TARGET_DIR)
rm -rf build

.PHONY: FORCE
FORCE:
Loading
Loading