8f9785862d3826d27da4f51ced71dd717d2b9dbb
[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 ");
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 ");
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_not_present_resource(opt->initrd);
36         check_name(opt, "Memory test (memtest86+)");
37         check_args(opt, NULL);
38
39         opt = get_boot_option(ctx, 4);
40         check_unresolved_resource(opt->boot_image);
41         check_not_present_resource(opt->initrd);
42         check_name(opt, "Memory test (memtest86+, serial console 115200)");
43         check_args(opt, "console=ttyS0,115200n8");
44
45         /* hotplug a device with a maching UUID, and check that our
46          * resources become resolved */
47         dev = test_create_device(test, "external");
48         dev->uuid = "29beca39-9181-4780-bbb2-ab5d4be59aaf";
49         test_hotplug_device(test, dev);
50
51         opt = get_boot_option(ctx, 0);
52         check_resolved_local_resource(opt->boot_image, dev,
53                 "/boot/vmlinuz-3.8.0-19-generic");
54         check_resolved_local_resource(opt->initrd, dev,
55                 "/boot/initrd.img-3.8.0-19-generic");
56
57         opt = get_boot_option(ctx, 1);
58         check_resolved_local_resource(opt->boot_image, dev,
59                 "/boot/vmlinuz-3.8.0-19-generic");
60         check_resolved_local_resource(opt->initrd, dev,
61                 "/boot/initrd.img-3.8.0-19-generic");
62
63         opt = get_boot_option(ctx, 2);
64         check_resolved_local_resource(opt->boot_image, dev,
65                 "/boot/vmlinuz-3.8.0-19-generic");
66         check_resolved_local_resource(opt->initrd, dev,
67                 "/boot/initrd.img-3.8.0-19-generic");
68
69         opt = get_boot_option(ctx, 3);
70         check_resolved_local_resource(opt->boot_image, dev,
71                 "/boot/memtest86+.bin");
72         check_not_present_resource(opt->initrd);
73
74         opt = get_boot_option(ctx, 4);
75         check_resolved_local_resource(opt->boot_image, dev,
76                 "/boot/memtest86+.bin");
77         check_not_present_resource(opt->initrd);
78 }