Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit46e47c7

Browse files
test-runner: Test the uefi::system module
1 parentfc637c8 commit46e47c7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

‎uefi-test-runner/src/main.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use uefi::proto::console::serial::Serial;
1313
use uefi::proto::device_path::build::{self,DevicePathBuilder};
1414
use uefi::proto::device_path::messaging::Vendor;
1515
use uefi::table::boot::{MemoryMap,MemoryType};
16-
use uefi::{print, println,Result};
16+
use uefi::{print, println,system,Result};
1717

1818
mod boot;
1919
mod fs;
@@ -45,6 +45,9 @@ fn efi_main(image: Handle, mut st: SystemTable<Boot>) -> Status {
4545
// Ensure the tests are run on a version of UEFI we support.
4646
check_revision(st.uefi_revision());
4747

48+
// Check the `uefi::system` module.
49+
check_system(&st);
50+
4851
// Test all the boot services.
4952
let bt = st.boot_services();
5053

@@ -67,6 +70,8 @@ fn efi_main(image: Handle, mut st: SystemTable<Boot>) -> Status {
6770
}
6871

6972
fncheck_revision(rev: uefi::table::Revision){
73+
assert_eq!(system::uefi_revision(), rev);
74+
7075
let(major, minor) =(rev.major(), rev.minor());
7176

7277
info!("UEFI {}.{}", major, minor /10);
@@ -78,6 +83,25 @@ fn check_revision(rev: uefi::table::Revision) {
7883
);
7984
}
8085

86+
fncheck_system(st:&SystemTable<Boot>){
87+
assert_eq!(system::firmware_vendor(), cstr16!("EDK II"));
88+
check_revision(system::uefi_revision());
89+
90+
assert_eq!(system::firmware_revision(), st.firmware_revision());
91+
system::with_config_table(|t|assert_eq!(t, st.config_table()));
92+
93+
system::with_stdout(|stdout|{
94+
stdout
95+
.output_string(cstr16!("test system::with_stdout\n"))
96+
.unwrap()
97+
});
98+
system::with_stderr(|stdout|{
99+
stdout
100+
.output_string(cstr16!("test system::with_stderr\n"))
101+
.unwrap()
102+
});
103+
}
104+
81105
#[derive(Clone,Copy,Debug)]
82106
enumHostRequest{
83107
/// Tell the host to take a screenshot and compare against the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp