summaryrefslogtreecommitdiffstats
path: root/test/parser/utils.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2014-01-17 16:36:41 +0800
committerJeremy Kerr <jk@ozlabs.org>2014-01-17 16:58:14 +0800
commitd14bf38b9881c385478a460e3058d7cadee107fb (patch)
tree57eb1befbbbdc732b4c0715652081d59b5a55b21 /test/parser/utils.c
parentb1d15f894473d4b1e90ad273487a432bcd637195 (diff)
downloadtalos-petitboot-d14bf38b9881c385478a460e3058d7cadee107fb.tar.gz
talos-petitboot-d14bf38b9881c385478a460e3058d7cadee107fb.zip
test/parser: Check for full URLs in parser tests
At present, we only match the 'file' portion of a URL in the parser tests, so we "serve" a file if just the filename (but not the scheme, hostname or path) matches the file we set with test_read_conf_embedded. This change introduces test_read_conf_embedded_url, which we can use to specify a full URL. In this case, the fake parser_request_file matches the entire URL before returning the file data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'test/parser/utils.c')
-rw-r--r--test/parser/utils.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/parser/utils.c b/test/parser/utils.c
index 8011793..67401ab 100644
--- a/test/parser/utils.c
+++ b/test/parser/utils.c
@@ -112,10 +112,11 @@ void test_fini(struct parser_test *test)
talloc_free(test);
}
-void __test_read_conf_data(struct parser_test *test, const char *conf_file,
+void __test_read_conf_data(struct parser_test *test,
+ struct discover_device *dev, const char *conf_file,
const char *buf, size_t len)
{
- test_add_file_data(test, test->ctx->device, conf_file, buf, len);
+ test_add_file_data(test, dev, conf_file, buf, len);
}
void test_read_conf_file(struct parser_test *test, const char *filename,
@@ -239,7 +240,10 @@ int parser_request_url(struct discover_context *ctx, struct pb_url *url,
char *tmp;
list_for_each_entry(&test->files, file, list) {
- if (strcmp(file->name, url->file))
+ if (file->dev)
+ continue;
+
+ if (strcmp(file->name, url->full))
continue;
/* the read_file() interface always adds a trailing null
OpenPOWER on IntegriCloud