diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-05-15 16:01:14 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2013-05-16 11:53:34 +0800 |
commit | a5a787c5d170708be5d15ee9418520917653a104 (patch) | |
tree | a27d0556071c3f36c75b65d3f759438f266fca08 /test/parser/utils.c | |
parent | 5d16719922866622fc0f42c570b9934f595e3c33 (diff) | |
download | petitboot-a5a787c5d170708be5d15ee9418520917653a104.zip petitboot-a5a787c5d170708be5d15ee9418520917653a104.tar.gz |
test/parser: Allow tests to provide pre-loaded config data
Some tests may want to use an existing buffer as config data, so add
test_read_config_data() to allow this.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'test/parser/utils.c')
-rw-r--r-- | test/parser/utils.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/parser/utils.c b/test/parser/utils.c index 16c415a..a1d0ad2 100644 --- a/test/parser/utils.c +++ b/test/parser/utils.c @@ -85,6 +85,13 @@ void test_fini(struct parser_test *test) talloc_free(test); } +void __test_read_conf_data(struct parser_test *test, + const char *buf, size_t len) +{ + test->conf.size = len; + test->conf.buf = talloc_memdup(test, buf, len); +} + void test_read_conf_file(struct parser_test *test, const char *filename) { struct stat stat; |