discover: Add test_data member to struct discover_context
authorJeremy Kerr <jk@ozlabs.org>
Fri, 27 Sep 2013 06:16:10 +0000 (14:16 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 1 Oct 2013 04:51:59 +0000 (12:51 +0800)
We have parsers passing discover_contexts around, which we want to hook
into the test framework. Add a void * member, which the test code can
use to reference the test.

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

index 8b4046edd83e52a686a7ee0b29768a4bffb1f36f..fc280af186fb9d8e400bd59ef6a5b42b9118a39b 100644 (file)
@@ -520,6 +520,7 @@ struct discover_context *device_handler_discover_context_create(
        ctx = talloc(handler, struct discover_context);
        ctx->device = device;
        ctx->conf_url = NULL;
+       ctx->test_data = NULL;
        list_init(&ctx->boot_options);
 
        return ctx;
index 9d477db9979dc249841ff52822d53c8d6fae7024..5dbc349fadb93aa541f6c684abd57bb9972fc7e7 100644 (file)
@@ -64,6 +64,7 @@ struct discover_context {
        struct list             boot_options;
        struct pb_url           *conf_url;
        enum conf_method        method;
+       void                    *test_data;
 };
 
 struct device_handler *device_handler_init(struct discover_server *server,
index 7af4df7397970e6b97c0794b64cb6f647434cab6..40737c4f17c8ef6dd0ca00b8ace225f60c7caf3d 100644 (file)
@@ -75,6 +75,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;
        device_handler_add_device(test->handler, ctx->device);
 
        return ctx;