diff options
Diffstat (limited to 'test/parser')
-rw-r--r-- | test/parser/Makefile.am | 1 | ||||
-rw-r--r-- | test/parser/test-grub2-multiple-resolve.c | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/parser/Makefile.am b/test/parser/Makefile.am index f711c1e..e330e82 100644 --- a/test/parser/Makefile.am +++ b/test/parser/Makefile.am @@ -26,6 +26,7 @@ AM_CFLAGS = -O0 -ggdb -Wall -Wextra -Werror TESTS = test-null \ test-grub2-single \ + test-grub2-multiple-resolve \ test-grub2-f18-ppc64 \ test-kboot-single \ test-yaboot-single \ diff --git a/test/parser/test-grub2-multiple-resolve.c b/test/parser/test-grub2-multiple-resolve.c new file mode 100644 index 0000000..3bf4eab --- /dev/null +++ b/test/parser/test-grub2-multiple-resolve.c @@ -0,0 +1,41 @@ + +#include "parser-test.h" + +#if 0 /* PARSER_EMBEDDED_CONFIG */ +menuentry 'Linux 1' { + search --set=root 48c1b787-20ad-47ce-b9eb-b108dddc3535 + linux /vmlinux +} + +menuentry 'Linux 2' { + search --set=root 48c1b787-20ad-47ce-b9eb-b108dddc3535 + linux /vmlinux +} +#endif + +void run_test(struct parser_test *test) +{ + struct discover_boot_option *opt[2]; + struct discover_context *ctx; + struct discover_device *dev; + + test_read_conf_embedded(test); + test_run_parser(test, "grub2"); + + ctx = test->ctx; + + check_boot_option_count(ctx, 2); + + opt[0] = get_boot_option(ctx, 0); + opt[1] = get_boot_option(ctx, 1); + + check_unresolved_resource(opt[0]->boot_image); + check_unresolved_resource(opt[1]->boot_image); + + dev = test_create_device(ctx, "external"); + dev->uuid = "48c1b787-20ad-47ce-b9eb-b108dddc3535"; + test_hotplug_device(test, dev); + + check_resolved_local_resource(opt[0]->boot_image, dev, "/vmlinux"); + check_resolved_local_resource(opt[1]->boot_image, dev, "/vmlinux"); +} |