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)
{
struct parser_test *test;
test = talloc_zero(NULL, struct parser_test);
- test->handler = device_handler_init(NULL, 0);
+ test->handler = device_handler_init(NULL, NULL, 0);
test->ctx = test_create_context(test);
return test;
talloc_free(path);
}
+void test_set_conf_source(struct parser_test *test, const char *url)
+{
+ test->ctx->conf_url = pb_url_parse(test, url);
+ assert(test->ctx->conf_url);
+}
+
int test_run_parser(struct parser_test *test, const char *parser_name)
{
struct p_item* i;
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);
+}