summaryrefslogtreecommitdiffstats
path: root/test/parser/test-grub2-multiple-resolve.c
blob: f24c07fabf27f48b444f353f5497e0cf16fed8bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

#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, "/grub.cfg");

	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_not_present_resource(opt[0]->initrd);
	check_unresolved_resource(opt[1]->boot_image);
	check_not_present_resource(opt[1]->initrd);

	dev = test_create_device(test, "external");
	dev->uuid = "48c1b787-20ad-47ce-b9eb-b108dddc3535";
	test_hotplug_device(test, dev);

	check_resolved_local_resource(opt[0]->boot_image, dev, "/vmlinux");
	check_not_present_resource(opt[0]->initrd);
	check_resolved_local_resource(opt[1]->boot_image, dev, "/vmlinux");
	check_not_present_resource(opt[1]->initrd);
}
OpenPOWER on IntegriCloud