[bootloader] Extend tests and docs with a few more error cases

This commit is contained in:
Adriaan de Groot 2022-01-18 14:27:54 +01:00
parent 7a462f4522
commit c9156d41b1
2 changed files with 18 additions and 3 deletions

View File

@ -53,6 +53,8 @@ efiBootMgr: "efibootmgr"
# @@PHRASE@@ can be used to obtain a unique 1-to-3-word suffix
# from a dictionary of space-themed words
# Note that these must be at the **end** of the *efiBootloaderId* value.
# There must also be at most one of them. If there is none, no suffix-
# processing is done and the *efiBootloaderId* is used unchanged.
#
# efiBootloaderId: "dirname"

View File

@ -27,15 +27,28 @@ for n in range(10):
print(g.next())
# it's random, nothing to assert
# Check two invalid things
# Check invalid things
try:
g = main.get_efi_suffix_generator("derp")
raise TypeError("Shouldn't get generator")
raise TypeError("Shouldn't get generator (no indicator)")
except ValueError as e:
pass
try:
g = main.get_efi_suffix_generator("derp@@HEX@@")
raise TypeError("Shouldn't get generator")
raise TypeError("Shouldn't get generator (unknown indicator)")
except ValueError as e:
pass
try:
g = main.get_efi_suffix_generator("derp@@SERIAL@@x")
raise TypeError("Shouldn't get generator (trailing garbage)")
except ValueError as e:
pass
try:
g = main.get_efi_suffix_generator("derp@@SERIAL@@@@RANDOM@@")
raise TypeError("Shouldn't get generator (multiple indicators)")
except ValueError as e:
pass