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");
11 test_run_parser(test, "grub2");
15 check_boot_option_count(ctx, 5);
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");
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");
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");
33 opt = get_boot_option(ctx, 3);
34 check_unresolved_resource(opt->boot_image);
35 check_name(opt, "Memory test (memtest86+)");
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");
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);
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");
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");
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");
67 opt = get_boot_option(ctx, 3);
68 check_resolved_local_resource(opt->boot_image, dev,
69 "/boot/memtest86+.bin");
71 opt = get_boot_option(ctx, 4);
72 check_resolved_local_resource(opt->boot_image, dev,
73 "/boot/memtest86+.bin");