Skip to content

Commit

Permalink
test(efiboot): add tests for efiboot boot enable and `efiboot boot …
Browse files Browse the repository at this point in the history
…disable`
  • Loading branch information
iTrooz committed Oct 19, 2023
1 parent 98fd9d6 commit 0a54f7c
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions efiboot/src/cli/boot/tests/enable_disable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ fn enable() {
assert_eq!(orig_entry, new_entry);
}

#[test]
fn enable_enabled() {
let manager = &mut MemoryStore::new();

let orig_entry = add_entry(manager, 0x0001, true);

assert_eq!(
ExitCode::FAILURE,
crate::run(
Command::parse_from(["efiboot", "boot", "enable", "0001",]),
manager,
)
);

// verify variable did not change
assert_eq!(
orig_entry,
BootEntry::read(manager, &Variable::new("Boot0001")).unwrap()
);
}

#[test]
fn disable() {
let manager = &mut MemoryStore::new();
Expand All @@ -51,3 +72,23 @@ fn disable() {

assert_eq!(orig_entry, new_entry);
}

#[test]
fn disable_disabled() {
let manager = &mut MemoryStore::new();

let orig_entry = add_entry(manager, 0x0001, false);

assert_eq!(
ExitCode::FAILURE,
crate::run(
Command::parse_from(["efiboot", "boot", "disable", "0001",]),
manager,
)
);

assert_eq!(
orig_entry,
BootEntry::read(manager, &Variable::new("Boot0001")).unwrap()
);
}

0 comments on commit 0a54f7c

Please sign in to comment.