Skip to content

Commit 68eb712

Browse files
committed
uefi: Begin integration tests
1 parent 50d3f1a commit 68eb712

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

uefi-test-runner/src/proto/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub fn test() {
2424
rng::test();
2525
shell_params::test();
2626
string::test();
27+
usb::test();
2728
misc::test();
2829

2930
// disable the ATA test on aarch64 for now. The aarch64 UEFI Firmware does not yet seem
@@ -94,3 +95,4 @@ mod shell_params;
9495
mod shim;
9596
mod string;
9697
mod tcg;
98+
mod usb;

uefi-test-runner/src/proto/usb/io.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: MIT OR Apache-2.0
2+
3+
use uefi::{boot, proto::usb::io::UsbIo};
4+
5+
pub fn test() {
6+
info!("Testing USB I/O protocol");
7+
8+
let handles = boot::find_handles::<UsbIo>().unwrap_or_default();
9+
for handle in handles {
10+
let usb = boot::open_protocol_exclusive::<UsbIo>(handle);
11+
if usb.is_err() {
12+
continue;
13+
}
14+
let mut usb = usb.unwrap();
15+
16+
usb.port_reset().unwrap();
17+
}
18+
}

uefi-test-runner/src/proto/usb/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// SPDX-License-Identifier: MIT OR Apache-2.0
2+
3+
pub fn test() {
4+
info!("Testing USB protocols");
5+
6+
io::test();
7+
}
8+
9+
mod io;

xtask/src/qemu.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
547547
None
548548
};
549549

550+
// Attach USB root hub and devices.
551+
cmd.args(["-device", "qemu-xhci"]);
552+
//cmd.args(["-device", ""]);
553+
550554
// Print the actual used QEMU command for running the test.
551555
println!("{}", command_to_string(&cmd));
552556

0 commit comments

Comments
 (0)