]> git.ozlabs.org Git - petitboot/blob - test/parser/test-grub2-multiple-resolve.c
discover/grub2: Allow URL resources
[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_not_present_resource(opt[0]->initrd);
34         check_unresolved_resource(opt[1]->boot_image);
35         check_not_present_resource(opt[1]->initrd);
36
37         dev = test_create_device(test, "external");
38         dev->uuid = "48c1b787-20ad-47ce-b9eb-b108dddc3535";
39         test_hotplug_device(test, dev);
40
41         check_resolved_local_resource(opt[0]->boot_image, dev, "/vmlinux");
42         check_not_present_resource(opt[0]->initrd);
43         check_resolved_local_resource(opt[1]->boot_image, dev, "/vmlinux");
44         check_not_present_resource(opt[1]->initrd);
45 }