]> git.ozlabs.org Git - petitboot/blobdiff - test/parser/utils.c
test/parser: Fixed uninitialized variable warning
[petitboot] / test / parser / utils.c
index 5cebc99062ad23a06d6217804cf57ae88a298f74..47779c86f7832fcd792fd32114c777bee569b029 100644 (file)
@@ -73,7 +73,7 @@ struct discover_device *test_create_device(struct parser_test *test,
 {
        struct discover_device *dev;
 
-       dev = discover_device_create(test->handler, name);
+       dev = discover_device_create(test->handler, NULL, name);
 
        dev->device->id = talloc_strdup(dev, name);
        dev->device_path = talloc_asprintf(dev, "/dev/%s", name);
@@ -93,6 +93,7 @@ static struct discover_context *test_create_context(struct parser_test *test)
        list_init(&ctx->boot_options);
        ctx->device = test_create_device_simple(test);
        ctx->test_data = test;
+       ctx->handler = test->handler;
        device_handler_add_device(test->handler, ctx->device);
 
        return ctx;
@@ -284,7 +285,7 @@ int parser_replace_file(struct discover_context *ctx,
                char *buf, int len)
 {
        struct parser_test *test = ctx->test_data;
-       struct test_file *f, *file;
+       struct test_file *f, *file = NULL;
 
        list_for_each_entry(&test->files, f, list) {
                if (f->dev != dev)
@@ -309,7 +310,8 @@ int parser_replace_file(struct discover_context *ctx,
 }
 
 struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
-               load_url_complete async_cb, void *async_data)
+               load_url_complete async_cb, void *async_data,
+               waiter_cb stdout_cb, void *stdout_data)
 {
        struct conf_context *conf = async_data;
        struct parser_test *test = conf->dc->test_data;
@@ -319,6 +321,10 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
        struct test_file *file;
        int fd;
 
+       /* Ignore the stdout callback for tests */
+       (void)stdout_cb;
+       (void)stdout_data;
+
        fd = mkstemp(tmp);
 
        if (fd < 0)
@@ -352,6 +358,7 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
                return NULL;
 
        result->local = talloc_strdup(result, tmp);
+       result->url = url;
        if (rc < 0)
                result->status = LOAD_ERROR;
        else