]> git.ozlabs.org Git - petitboot/blob - test/parser/test-grub2-ubuntu-13_04-x86.c
parser: Use list to hold parsers
[petitboot] / test / parser / test-grub2-ubuntu-13_04-x86.c
1
2 #include "parser-test.h"
3
4 void run_test(struct parser_test *test)
5 {
6         struct discover_boot_option *opt;
7         struct discover_context *ctx;
8         struct discover_device *dev;
9
10         test_read_conf_file(test, "grub2-ubuntu-13_04-x86.conf");
11         test_run_parser(test, "grub2");
12
13         ctx = test->ctx;
14
15         check_boot_option_count(ctx, 5);
16
17         opt = get_boot_option(ctx, 0);
18         check_unresolved_resource(opt->boot_image);
19         check_unresolved_resource(opt->initrd);
20         check_name(opt, "Kubuntu GNU/Linux");
21         check_args(opt, "root=UUID=29beca39-9181-4780-bbb2-ab5d4be59aaf ro   quiet splash $vt_handoff");
22
23         opt = get_boot_option(ctx, 1);
24         check_unresolved_resource(opt->boot_image);
25         check_unresolved_resource(opt->initrd);
26         check_name(opt, "Kubuntu GNU/Linux, with Linux 3.8.0-19-generic");
27         check_args(opt, "root=UUID=29beca39-9181-4780-bbb2-ab5d4be59aaf ro   quiet splash $vt_handoff");
28
29         opt = get_boot_option(ctx, 2);
30         check_name(opt, "Kubuntu GNU/Linux, with Linux 3.8.0-19-generic (recovery mode)");
31         check_args(opt, "root=UUID=29beca39-9181-4780-bbb2-ab5d4be59aaf ro recovery nomodeset");
32
33         opt = get_boot_option(ctx, 3);
34         check_unresolved_resource(opt->boot_image);
35         check_name(opt, "Memory test (memtest86+)");
36         check_args(opt, "");
37
38         opt = get_boot_option(ctx, 4);
39         check_unresolved_resource(opt->boot_image);
40         check_name(opt, "Memory test (memtest86+, serial console 115200)");
41         check_args(opt, "console=ttyS0,115200n8");
42
43         /* hotplug a device with a maching UUID, and check that our
44          * resources become resolved */
45         dev = test_create_device(ctx, "external");
46         dev->uuid = "29beca39-9181-4780-bbb2-ab5d4be59aaf";
47         test_hotplug_device(test, dev);
48
49         opt = get_boot_option(ctx, 0);
50         check_resolved_local_resource(opt->boot_image, dev,
51                 "/boot/vmlinuz-3.8.0-19-generic");
52         check_resolved_local_resource(opt->initrd, dev,
53                 "/boot/initrd.img-3.8.0-19-generic");
54
55         opt = get_boot_option(ctx, 1);
56         check_resolved_local_resource(opt->boot_image, dev,
57                 "/boot/vmlinuz-3.8.0-19-generic");
58         check_resolved_local_resource(opt->initrd, dev,
59                 "/boot/initrd.img-3.8.0-19-generic");
60
61         opt = get_boot_option(ctx, 2);
62         check_resolved_local_resource(opt->boot_image, dev,
63                 "/boot/vmlinuz-3.8.0-19-generic");
64         check_resolved_local_resource(opt->initrd, dev,
65                 "/boot/initrd.img-3.8.0-19-generic");
66
67         opt = get_boot_option(ctx, 3);
68         check_resolved_local_resource(opt->boot_image, dev,
69                 "/boot/memtest86+.bin");
70
71         opt = get_boot_option(ctx, 4);
72         check_resolved_local_resource(opt->boot_image, dev,
73                 "/boot/memtest86+.bin");
74 }