discover: Reimplement native-parser as a Bison parser
[petitboot] / test / parser / test-native-globals.c
1 #include "parser-test.h"
2
3 #if 0 /* PARSER_EMBEDDED_CONFIG */
4
5 default first
6
7 name first
8 image /vmlinuz
9 args console=hvc0
10 initrd /initrd
11
12 name second
13 image /boot/vmlinuz
14 args console=tty0
15 initrd /boot/initrd
16
17 #endif
18
19 void run_test(struct parser_test *test)
20 {
21         struct discover_boot_option *opt;
22         struct discover_context *ctx;
23
24         test_read_conf_embedded(test, "/boot/petitboot.conf");
25
26         test_run_parser(test, "native");
27
28         ctx = test->ctx;
29
30         check_boot_option_count(ctx, 2);
31
32         opt = get_boot_option(ctx, 0);
33
34         check_name(opt, "first");
35         check_resolved_local_resource(opt->boot_image, ctx->device, "/vmlinuz");
36         check_args(opt, "console=hvc0");
37         check_resolved_local_resource(opt->initrd, ctx->device, "/initrd");
38         check_is_default(opt);
39
40         opt = get_boot_option(ctx, 1);
41         check_name(opt, "second");
42         check_resolved_local_resource(opt->boot_image, ctx->device, "/boot/vmlinuz");
43         check_args(opt, "console=tty0");
44         check_resolved_local_resource(opt->initrd, ctx->device, "/boot/initrd");
45 }