]> git.ozlabs.org Git - petitboot/commitdiff
test/parser: Add grub2 multiple resolution test
authorJeremy Kerr <jk@ozlabs.org>
Fri, 10 May 2013 04:00:23 +0000 (12:00 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 16 May 2013 04:21:56 +0000 (12:21 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
test/parser/Makefile.am
test/parser/test-grub2-multiple-resolve.c [new file with mode: 0644]

index f711c1e7fab8560c472527b0327ba5df332a6228..e330e8268f1f30823797d8ff0097f9e04c3db1fa 100644 (file)
@@ -26,6 +26,7 @@ AM_CFLAGS = -O0 -ggdb -Wall -Wextra -Werror
 
 TESTS = test-null \
        test-grub2-single \
+       test-grub2-multiple-resolve \
        test-grub2-f18-ppc64 \
        test-kboot-single \
        test-yaboot-single \
diff --git a/test/parser/test-grub2-multiple-resolve.c b/test/parser/test-grub2-multiple-resolve.c
new file mode 100644 (file)
index 0000000..3bf4eab
--- /dev/null
@@ -0,0 +1,41 @@
+
+#include "parser-test.h"
+
+#if 0 /* PARSER_EMBEDDED_CONFIG */
+menuentry 'Linux 1' {
+       search --set=root 48c1b787-20ad-47ce-b9eb-b108dddc3535
+       linux   /vmlinux
+}
+
+menuentry 'Linux 2' {
+       search --set=root 48c1b787-20ad-47ce-b9eb-b108dddc3535
+       linux   /vmlinux
+}
+#endif
+
+void run_test(struct parser_test *test)
+{
+       struct discover_boot_option *opt[2];
+       struct discover_context *ctx;
+       struct discover_device *dev;
+
+       test_read_conf_embedded(test);
+       test_run_parser(test, "grub2");
+
+       ctx = test->ctx;
+
+       check_boot_option_count(ctx, 2);
+
+       opt[0] = get_boot_option(ctx, 0);
+       opt[1] = get_boot_option(ctx, 1);
+
+       check_unresolved_resource(opt[0]->boot_image);
+       check_unresolved_resource(opt[1]->boot_image);
+
+       dev = test_create_device(ctx, "external");
+       dev->uuid = "48c1b787-20ad-47ce-b9eb-b108dddc3535";
+       test_hotplug_device(test, dev);
+
+       check_resolved_local_resource(opt[0]->boot_image, dev, "/vmlinux");
+       check_resolved_local_resource(opt[1]->boot_image, dev, "/vmlinux");
+}