]> git.ozlabs.org Git - petitboot/blobdiff - test/parser/utils.c
autotools: Fix make maintainer-clean
[petitboot] / test / parser / utils.c
index 68fc3debb333baf36cc2560dc8668393d0effe3e..6f78c2f93e36e8da2b117bd1ee94e64885e49fc2 100644 (file)
@@ -32,6 +32,14 @@ void __register_parser(struct parser *parser)
        list_add(&parsers, &i->list);
 }
 
+static void __attribute__((destructor)) __cleanup_parsers(void)
+{
+       struct p_item *item, *tmp;
+
+       list_for_each_entry_safe(&parsers, item, tmp, list)
+               talloc_free(item);
+}
+
 static struct discover_device *test_create_device_simple(
                struct discover_context *ctx)
 {
@@ -282,3 +290,10 @@ void __check_unresolved_resource(struct resource *res,
        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);
+}