2 #include "parser-test.h"
4 void run_test(struct parser_test *test)
6 struct discover_boot_option *opt;
7 struct discover_context *ctx;
8 struct discover_device *dev;
10 test_read_conf_file(test, "grub2-ubuntu-13_04-x86.conf", "/grub.cfg");
12 test_run_parser(test, "grub2");
16 check_boot_option_count(ctx, 5);
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 ");
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 ");
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");
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);
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");
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);
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");
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");
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");
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);
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);