]> git.ozlabs.org Git - petitboot/blob - test/parser/test-syslinux-global-append.c
discover/grub2: Allow to separate the --id argument using a space char
[petitboot] / test / parser / test-syslinux-global-append.c
1
2 #include "parser-test.h"
3
4 #if 0 /* PARSER_EMBEDDED_CONFIG */
5
6 APPEND console=ttyS0
7
8 LABEL linux
9 LINUX /vmlinuz
10 APPEND console=tty0
11
12 LABEL backup
13 KERNEL /backup/vmlinuz
14 APPEND root=/dev/sdb
15 INITRD /boot/initrd
16
17 LABEL hyphen
18 KERNEL /test/vmlinuz
19 APPEND -
20
21 LABEL onlyglobal
22 KERNEL /only/vmlinuz
23
24 #endif
25
26 void run_test(struct parser_test *test)
27 {
28         struct discover_boot_option *opt;
29         struct discover_context *ctx;
30
31         test_read_conf_embedded(test, "/syslinux/syslinux.cfg");
32
33         test_run_parser(test, "syslinux");
34
35         ctx = test->ctx;
36
37         check_boot_option_count(ctx, 4);
38
39         opt = get_boot_option(ctx, 3);
40
41         check_name(opt, "linux");
42         check_resolved_local_resource(opt->boot_image, ctx->device, "/vmlinuz");
43         check_is_default(opt);
44         check_args(opt, "console=ttyS0 console=tty0");
45         check_not_present_resource(opt->initrd);
46
47         opt = get_boot_option(ctx, 2);
48
49         check_name(opt, "backup");
50         check_resolved_local_resource(opt->boot_image, ctx->device, "/backup/vmlinuz");
51         check_args(opt, "console=ttyS0 root=/dev/sdb");
52         check_resolved_local_resource(opt->initrd, ctx->device, "/boot/initrd");
53
54         opt = get_boot_option(ctx, 1);
55
56         check_name(opt, "hyphen");
57         check_resolved_local_resource(opt->boot_image, ctx->device, "/test/vmlinuz");
58         check_args(opt, "");
59         check_not_present_resource(opt->initrd);
60
61         opt = get_boot_option(ctx, 0);
62
63         check_name(opt, "onlyglobal");
64         check_resolved_local_resource(opt->boot_image, ctx->device, "/only/vmlinuz");
65         check_args(opt, "console=ttyS0");
66         check_not_present_resource(opt->initrd);
67 }