-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
discover/grub2: Allow to separate the --id argument using a space char
The GRUB menuentry command allows to separate the arguments for options using either a '=' or a ' '. The latter is the convention used when the menu entries are defined in the GRUB config file, but this is currently not supported by Petitboot. Add tests to cover both using '--id=foo' and '--id foo' as options. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
- Loading branch information
1 parent
53e0f3e
commit 7edc34c
Showing
4 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
#include "parser-test.h" | ||
|
||
#if 0 /* PARSER_EMBEDDED_CONFIG */ | ||
set default=option1 | ||
menuentry 'test-option-0' --id option0 { | ||
linux /vmlinux.0 | ||
} | ||
menuentry 'test-option-1' --id option1 { | ||
linux /vmlinux.1 | ||
} | ||
menuentry 'test-option-2' --id option2 { | ||
linux /vmlinux.2 | ||
} | ||
#endif | ||
|
||
void run_test(struct parser_test *test) | ||
{ | ||
struct discover_boot_option *opt; | ||
struct discover_context *ctx; | ||
|
||
test_read_conf_embedded(test, "/boot/grub2/grub.cfg"); | ||
test_run_parser(test, "grub2"); | ||
|
||
ctx = test->ctx; | ||
|
||
check_boot_option_count(ctx, 3); | ||
opt = get_boot_option(ctx, 1); | ||
|
||
check_name(opt, "test-option-1"); | ||
check_resolved_local_resource(opt->boot_image, ctx->device, | ||
"/vmlinux.1"); | ||
check_is_default(opt); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
#include "parser-test.h" | ||
|
||
#if 0 /* PARSER_EMBEDDED_CONFIG */ | ||
set default=option1 | ||
menuentry 'test-option-0' --id=option0 { | ||
linux /vmlinux.0 | ||
} | ||
menuentry 'test-option-1' --id=option1 { | ||
linux /vmlinux.1 | ||
} | ||
menuentry 'test-option-2' --id=option2 { | ||
linux /vmlinux.2 | ||
} | ||
#endif | ||
|
||
void run_test(struct parser_test *test) | ||
{ | ||
struct discover_boot_option *opt; | ||
struct discover_context *ctx; | ||
|
||
test_read_conf_embedded(test, "/boot/grub2/grub.cfg"); | ||
test_run_parser(test, "grub2"); | ||
|
||
ctx = test->ctx; | ||
|
||
check_boot_option_count(ctx, 3); | ||
opt = get_boot_option(ctx, 1); | ||
|
||
check_name(opt, "test-option-1"); | ||
check_resolved_local_resource(opt->boot_image, ctx->device, | ||
"/vmlinux.1"); | ||
check_is_default(opt); | ||
} |