Add a new routine check_not_present_resource() to check
that a resource is not present. This is typically used
to check that an initrd entry has not been found.
Also add any needed checks for no initrd to the existing
tests.
Signed-off-by: Geoff Levand <geoff@infradead.org>
#define check_unresolved_resource(res) \
__check_unresolved_resource(res, __FILE__, __LINE__)
#define check_unresolved_resource(res) \
__check_unresolved_resource(res, __FILE__, __LINE__)
+/**
+ * Check that a resource (@res) is not present
+ */
+void __check_not_present_resource(struct resource *res,
+ const char *file, int line);
+#define check_not_present_resource(res) \
+ __check_not_present_resource(res, __FILE__, __LINE__)
+
#endif /* PARSER_TEST_H */
#endif /* PARSER_TEST_H */
opt[1] = get_boot_option(ctx, 1);
check_unresolved_resource(opt[0]->boot_image);
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_unresolved_resource(opt[1]->boot_image);
+ check_not_present_resource(opt[1]->initrd);
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");
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_not_present_resource(opt[0]->initrd);
check_resolved_local_resource(opt[1]->boot_image, dev, "/vmlinux");
check_resolved_local_resource(opt[1]->boot_image, dev, "/vmlinux");
+ check_not_present_resource(opt[1]->initrd);
opt = get_boot_option(ctx, 3);
check_unresolved_resource(opt->boot_image);
opt = get_boot_option(ctx, 3);
check_unresolved_resource(opt->boot_image);
+ check_not_present_resource(opt->initrd);
check_name(opt, "Memory test (memtest86+)");
check_args(opt, "");
opt = get_boot_option(ctx, 4);
check_unresolved_resource(opt->boot_image);
check_name(opt, "Memory test (memtest86+)");
check_args(opt, "");
opt = get_boot_option(ctx, 4);
check_unresolved_resource(opt->boot_image);
+ check_not_present_resource(opt->initrd);
check_name(opt, "Memory test (memtest86+, serial console 115200)");
check_args(opt, "console=ttyS0,115200n8");
check_name(opt, "Memory test (memtest86+, serial console 115200)");
check_args(opt, "console=ttyS0,115200n8");
opt = get_boot_option(ctx, 3);
check_resolved_local_resource(opt->boot_image, dev,
"/boot/memtest86+.bin");
opt = get_boot_option(ctx, 3);
check_resolved_local_resource(opt->boot_image, dev,
"/boot/memtest86+.bin");
+ check_not_present_resource(opt->initrd);
opt = get_boot_option(ctx, 4);
check_resolved_local_resource(opt->boot_image, dev,
"/boot/memtest86+.bin");
opt = get_boot_option(ctx, 4);
check_resolved_local_resource(opt->boot_image, dev,
"/boot/memtest86+.bin");
+ check_not_present_resource(opt->initrd);
if (res->resolved)
errx(EXIT_FAILURE, "%s:%d: Resource is resolved", file, line);
}
if (res->resolved)
errx(EXIT_FAILURE, "%s:%d: Resource is resolved", file, line);
}
+
+void __check_not_present_resource(struct resource *res,
+ const char *file, int line)
+{
+ if (res)
+ errx(EXIT_FAILURE, "%s:%d: Resource present", file, line);
+}