Add support for GPG signature enforcement on booted
[petitboot] / test / parser / test-grub2-saved-default.c
1
2 #include "parser-test.h"
3
4 #if 0 /* PARSER_EMBEDDED_CONFIG */
5 if [ -s $prefix/grubenv ]; then
6   load_env
7 fi
8 if [ "${next_entry}" ] ; then
9    set default="${next_entry}"
10    set next_entry=
11    save_env next_entry
12    set boot_once=true
13 else
14    set default="${saved_entry}"
15 fi
16 menuentry 'test saved option' {
17         linux   vmlinux
18 }
19 #endif
20
21
22
23 void run_test(struct parser_test *test)
24 {
25         struct discover_boot_option *opt;
26         struct discover_context *ctx;
27
28         test_add_file_string(test, test->ctx->device,
29                                 "/boot/grub/grubenv",
30                                 "# GRUB Environment Block\n"
31                                 "saved_entry=test saved option\n"
32                                 "#############################");
33
34         test_read_conf_embedded(test, "/boot/grub/grub.cfg");
35
36         test_run_parser(test, "grub2");
37
38         ctx = test->ctx;
39
40         check_boot_option_count(ctx, 1);
41         opt = get_boot_option(ctx, 0);
42
43         check_name(opt, "test saved option");
44         check_resolved_local_resource(opt->boot_image, ctx->device,
45                         "/vmlinux");
46         check_is_default(opt);
47 }