X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=test%2Fparser%2Futils.c;h=67401abc9e0d8fa5d95cfb2ed9f1b27ba2fce35e;hp=b80e0e102025430f4ebaece59540481d44fb5814;hb=d14bf38b9881c385478a460e3058d7cadee107fb;hpb=cc28b17bb59411e6031a8273b784e9d1d3a9490d;ds=inline diff --git a/test/parser/utils.c b/test/parser/utils.c index b80e0e1..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 @@ -301,6 +305,21 @@ void test_hotplug_device(struct parser_test *test, struct discover_device *dev) boot_option_resolve(test->handler, opt); } +void test_remove_device(struct parser_test *test, struct discover_device *dev) +{ + struct discover_boot_option *opt, *tmp; + + if (dev == test->ctx->device) { + list_for_each_entry_safe(&test->ctx->boot_options, + opt, tmp, list) { + list_remove(&opt->list); + talloc_free(opt); + } + } + + device_handler_remove(test->handler, dev); +} + struct discover_boot_option *get_boot_option(struct discover_context *ctx, int idx) {