test/parser: Add grub2 multiple resolution test
[petitboot] / test / parser / test-grub2-multiple-resolve.c
1
2 #include "parser-test.h"
3
4 #if 0 /* PARSER_EMBEDDED_CONFIG */
5 menuentry 'Linux 1' {
6         search --set=root 48c1b787-20ad-47ce-b9eb-b108dddc3535
7         linux   /vmlinux
8 }
9
10 menuentry 'Linux 2' {
11         search --set=root 48c1b787-20ad-47ce-b9eb-b108dddc3535
12         linux   /vmlinux
13 }
14 #endif
15
16 void run_test(struct parser_test *test)
17 {
18         struct discover_boot_option *opt[2];
19         struct discover_context *ctx;
20         struct discover_device *dev;
21
22         test_read_conf_embedded(test);
23         test_run_parser(test, "grub2");
24
25         ctx = test->ctx;
26
27         check_boot_option_count(ctx, 2);
28
29         opt[0] = get_boot_option(ctx, 0);
30         opt[1] = get_boot_option(ctx, 1);
31
32         check_unresolved_resource(opt[0]->boot_image);
33         check_unresolved_resource(opt[1]->boot_image);
34
35         dev = test_create_device(ctx, "external");
36         dev->uuid = "48c1b787-20ad-47ce-b9eb-b108dddc3535";
37         test_hotplug_device(test, dev);
38
39         check_resolved_local_resource(opt[0]->boot_image, dev, "/vmlinux");
40         check_resolved_local_resource(opt[1]->boot_image, dev, "/vmlinux");
41 }