]> git.ozlabs.org Git - petitboot/commitdiff
test/parser: Add test_set_conf_source()
authorJeremy Kerr <jk@ozlabs.org>
Thu, 4 Jul 2013 07:27:01 +0000 (15:27 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 4 Jul 2013 07:27:01 +0000 (15:27 +0800)
For non-local parsers (ie, PXE), we need to have the conf_url set. This
change adds a function to provide the originating URL.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
test/parser/parser-test.h
test/parser/utils.c

index ab3744315f1260ddc1a5787a2aadc0436a7e925b..9d9ec7e77d0bf4acdf0939a6dc9dc9b66c5ad41b 100644 (file)
@@ -28,6 +28,7 @@ struct discover_device *test_create_device(struct discover_context *ctx,
 void __test_read_conf_data(struct parser_test *test,
                const char *buf, size_t len);
 void test_read_conf_file(struct parser_test *test, const char *filename);
 void __test_read_conf_data(struct parser_test *test,
                const char *buf, size_t len);
 void test_read_conf_file(struct parser_test *test, const char *filename);
+void test_set_conf_source(struct parser_test *test, const char *url);
 
 int test_run_parser(struct parser_test *test, const char *parser_name);
 
 
 int test_run_parser(struct parser_test *test, const char *parser_name);
 
index 70a40bbd5b60b2ce40daf3fec41c09b0b5d03a32..f1604e06a30c0dedd8f3dcbbdd8de4f80fab9ca1 100644 (file)
@@ -133,6 +133,12 @@ void test_read_conf_file(struct parser_test *test, const char *filename)
        talloc_free(path);
 }
 
        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;
 int test_run_parser(struct parser_test *test, const char *parser_name)
 {
        struct p_item* i;