8fd218c371e8b92135a565f8ed82c30a346dcb09
[petitboot] / test / parser / test-grub2-blscfg-multiple-bls.c
1 #include "parser-test.h"
2
3 #if 0 /* PARSER_EMBEDDED_CONFIG */
4 blscfg
5 #endif
6
7 void run_test(struct parser_test *test)
8 {
9         struct discover_boot_option *opt;
10         struct discover_context *ctx;
11
12         test_add_file_string(test, test->ctx->device,
13                              "/loader/entries/6c063c8e48904f2684abde8eea303f41-4.15.2-302.fc28.x86_64.conf",
14                              "title Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)\n"
15                              "linux /vmlinuz-4.15.2-302.fc28.x86_64\n"
16                              "initrd /initramfs-4.15.2-302.fc28.x86_64.img\n"
17                              "options root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root\n\n");
18
19         test_add_file_string(test, test->ctx->device,
20                              "/loader/entries/6c063c8e48904f2684abde8eea303f41-4.14.18-300.fc28.x86_64.conf",
21                              "title Fedora (4.14.18-300.fc28.x86_64) 28 (Twenty Eight)\n"
22                              "linux /vmlinuz-4.14.18-300.fc28.x86_64\n"
23                              "initrd /initramfs-4.14.18-300.fc28.x86_64.img\n"
24                              "options root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root\n");
25
26         test_read_conf_embedded(test, "/boot/grub2/grub.cfg");
27
28         test_run_parser(test, "grub2");
29
30         ctx = test->ctx;
31
32         check_boot_option_count(ctx, 2);
33         opt = get_boot_option(ctx, 0);
34
35         check_name(opt, "Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)");
36         check_resolved_local_resource(opt->boot_image, ctx->device,
37                         "/vmlinuz-4.15.2-302.fc28.x86_64");
38
39         opt = get_boot_option(ctx, 1);
40
41         check_name(opt, "Fedora (4.14.18-300.fc28.x86_64) 28 (Twenty Eight)");
42         check_resolved_local_resource(opt->initrd, ctx->device,
43                         "/initramfs-4.14.18-300.fc28.x86_64.img");
44 }