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_not_present_resource(opt->initrd);
36 check_name(opt, "Memory test (memtest86+)");
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");
45 /* hotplug a device with a maching UUID, and check that our
46 * resources become resolved */
47 dev = test_create_device(ctx, "external");
48 dev->uuid = "29beca39-9181-4780-bbb2-ab5d4be59aaf";
49 test_hotplug_device(test, dev);
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");
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");
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");
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);
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);