]> git.ozlabs.org Git - petitboot/blob - test/parser/test-grub2-blscfg-multiple-bls.c
94f40d191fa7251eccd7c044e9f162a1aa0aa5f1
[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_dir(test, test->ctx->device, "/loader/entries");
13
14         test_add_file_string(test, test->ctx->device,
15                              "/loader/entries/6c063c8e48904f2684abde8eea303f41-4.15.2-302.fc28.x86_64.conf",
16                              "title Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)\n"
17                              "linux /vmlinuz-4.15.2-302.fc28.x86_64\n"
18                              "initrd /initramfs-4.15.2-302.fc28.x86_64.img\n"
19                              "options root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root\n\n");
20
21         test_add_file_string(test, test->ctx->device,
22                              "/loader/entries/6c063c8e48904f2684abde8eea303f41-4.14.18-300.fc28.x86_64.conf",
23                              "title Fedora (4.14.18-300.fc28.x86_64) 28 (Twenty Eight)\n"
24                              "linux /vmlinuz-4.14.18-300.fc28.x86_64\n"
25                              "initrd /initramfs-4.14.18-300.fc28.x86_64.img\n"
26                              "options root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root\n");
27
28         test_read_conf_embedded(test, "/boot/grub2/grub.cfg");
29
30         test_run_parser(test, "grub2");
31
32         ctx = test->ctx;
33
34         check_boot_option_count(ctx, 2);
35         opt = get_boot_option(ctx, 0);
36
37         check_name(opt, "Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)");
38         check_resolved_local_resource(opt->boot_image, ctx->device,
39                         "/vmlinuz-4.15.2-302.fc28.x86_64");
40
41         opt = get_boot_option(ctx, 1);
42
43         check_name(opt, "Fedora (4.14.18-300.fc28.x86_64) 28 (Twenty Eight)");
44         check_resolved_local_resource(opt->initrd, ctx->device,
45                         "/initramfs-4.14.18-300.fc28.x86_64.img");
46 }