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