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