]> git.ozlabs.org Git - petitboot/blob - test/parser/test-grub2-blscfg-default-title.c
test/efivar: Rework for efi_mount
[petitboot] / test / parser / test-grub2-blscfg-default-title.c
1 #include "parser-test.h"
2
3 #if 0 /* PARSER_EMBEDDED_CONFIG */
4 load_env
5 set default=${saved_entry}
6 blscfg
7 #endif
8
9 void run_test(struct parser_test *test)
10 {
11         struct discover_boot_option *opt;
12         struct discover_context *ctx;
13
14         test_add_dir(test, test->ctx->device, "/boot/loader/entries");
15
16         test_add_file_string(test, test->ctx->device,
17                              "/boot/grub2/grubenv",
18                              "# GRUB Environment Block\n"
19                              "saved_entry=Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)\n"
20                              "kernelopts=root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root\n");
21
22         test_add_file_string(test, test->ctx->device,
23                              "/boot/loader/entries/6c063c8e48904f2684abde8eea303f41-4.15.2-302.fc28.x86_64.conf",
24                              "title Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)\n"
25                              "linux /boot/vmlinuz-4.15.2-302.fc28.x86_64\n"
26                              "initrd /boot/initramfs-4.15.2-302.fc28.x86_64.img\n"
27                              "options $kernelopts\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         opt = get_boot_option(ctx, 0);
36
37         check_is_default(opt);
38 }