c77c589b77079f7810e9952324ba1b973920ceb4
[petitboot] / test / parser / test-grub2-blscfg-opts-grubenv.c
1 #include "parser-test.h"
2
3 #if 0 /* PARSER_EMBEDDED_CONFIG */
4 load_env
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_file_string(test, test->ctx->device,
14                              "/boot/grub2/grubenv",
15                              "# GRUB Environment Block\n"
16                              "kernelopts=root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root\n");
17
18         test_add_file_string(test, test->ctx->device,
19                              "/loader/entries/6c063c8e48904f2684abde8eea303f41-4.15.2-302.fc28.x86_64.conf",
20                              "title Fedora (4.15.2-302.fc28.x86_64) 28 (Twenty Eight)\n"
21                              "linux /vmlinuz-4.15.2-302.fc28.x86_64\n"
22                              "initrd /initramfs-4.15.2-302.fc28.x86_64.img\n"
23                              "options $kernelopts\n");
24
25         test_read_conf_embedded(test, "/boot/grub2/grub.cfg");
26
27         test_run_parser(test, "grub2");
28
29         ctx = test->ctx;
30
31         opt = get_boot_option(ctx, 0);
32
33         check_args(opt, "root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root");
34 }