]> git.ozlabs.org Git - petitboot/blobdiff - test/parser/utils.c
discover: Add test_data member to struct discover_context
[petitboot] / test / parser / utils.c
index 7ebb411c0c9f6eb664991da10e75b7fb684a64c3..40737c4f17c8ef6dd0ca00b8ace225f60c7caf3d 100644 (file)
@@ -61,6 +61,7 @@ struct discover_device *test_create_device(struct parser_test *test,
        dev->device->id = talloc_strdup(dev, name);
        dev->device_path = talloc_asprintf(dev, "/dev/%s", name);
        dev->mount_path = talloc_asprintf(dev, "/test/mount/%s", name);
+       dev->mounted = true;
 
        return dev;
 }
@@ -74,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;
@@ -239,6 +241,9 @@ void __check_args(struct discover_boot_option *opt, const char *args,
 {
        int rc;
 
+       if (!opt->option->boot_args && !args)
+               return;
+
        if (!opt->option->boot_args) {
                fprintf(stderr, "%s:%d: arg check failed\n", file, line);
                fprintf(stderr, "  no arguments parsed\n");