]> git.ozlabs.org Git - petitboot/blob - test/parser/test-grub2-ubuntu-13_04-x86.c
ui/ncurses: Implement non-boot-cancelling keys
[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", "/grub.cfg");
11
12         test_run_parser(test, "grub2");
13
14         ctx = test->ctx;
15
16         check_boot_option_count(ctx, 5);
17
18         opt = get_boot_option(ctx, 0);
19         check_unresolved_resource(opt->boot_image);
20         check_unresolved_resource(opt->initrd);
21         check_name(opt, "Kubuntu GNU/Linux");
22         check_args(opt, "root=UUID=29beca39-9181-4780-bbb2-ab5d4be59aaf ro quiet splash ");
23
24         opt = get_boot_option(ctx, 1);
25         check_unresolved_resource(opt->boot_image);
26         check_unresolved_resource(opt->initrd);
27         check_name(opt, "Kubuntu GNU/Linux, with Linux 3.8.0-19-generic");
28         check_args(opt, "root=UUID=29beca39-9181-4780-bbb2-ab5d4be59aaf ro quiet splash ");
29
30         opt = get_boot_option(ctx, 2);
31         check_name(opt, "Kubuntu GNU/Linux, with Linux 3.8.0-19-generic (recovery mode)");
32         check_args(opt, "root=UUID=29beca39-9181-4780-bbb2-ab5d4be59aaf ro recovery nomodeset");
33
34         opt = get_boot_option(ctx, 3);
35         check_unresolved_resource(opt->boot_image);
36         check_not_present_resource(opt->initrd);
37         check_name(opt, "Memory test (memtest86+)");
38         check_args(opt, NULL);
39
40         opt = get_boot_option(ctx, 4);
41         check_unresolved_resource(opt->boot_image);
42         check_not_present_resource(opt->initrd);
43         check_name(opt, "Memory test (memtest86+, serial console 115200)");
44         check_args(opt, "console=ttyS0,115200n8");
45
46         /* hotplug a device with a maching UUID, and check that our
47          * resources become resolved */
48         dev = test_create_device(test, "external");
49         dev->uuid = "29beca39-9181-4780-bbb2-ab5d4be59aaf";
50         test_hotplug_device(test, dev);
51
52         opt = get_boot_option(ctx, 0);
53         check_resolved_local_resource(opt->boot_image, dev,
54                 "/boot/vmlinuz-3.8.0-19-generic");
55         check_resolved_local_resource(opt->initrd, dev,
56                 "/boot/initrd.img-3.8.0-19-generic");
57
58         opt = get_boot_option(ctx, 1);
59         check_resolved_local_resource(opt->boot_image, dev,
60                 "/boot/vmlinuz-3.8.0-19-generic");
61         check_resolved_local_resource(opt->initrd, dev,
62                 "/boot/initrd.img-3.8.0-19-generic");
63
64         opt = get_boot_option(ctx, 2);
65         check_resolved_local_resource(opt->boot_image, dev,
66                 "/boot/vmlinuz-3.8.0-19-generic");
67         check_resolved_local_resource(opt->initrd, dev,
68                 "/boot/initrd.img-3.8.0-19-generic");
69
70         opt = get_boot_option(ctx, 3);
71         check_resolved_local_resource(opt->boot_image, dev,
72                 "/boot/memtest86+.bin");
73         check_not_present_resource(opt->initrd);
74
75         opt = get_boot_option(ctx, 4);
76         check_resolved_local_resource(opt->boot_image, dev,
77                 "/boot/memtest86+.bin");
78         check_not_present_resource(opt->initrd);
79 }