X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=test%2Fparser%2Fparser-test.c;h=d8ec75ba02f6220829e7768083958b2e2313132f;hb=92806cf6bc15f680f75879288df12ea9a87e4608;hp=90b3e3b8e8693a9960b3ef5ed6d13854a677f98f;hpb=8bd85461621fb0ff18059305a6c1aecdbc18016c;p=petitboot diff --git a/test/parser/parser-test.c b/test/parser/parser-test.c index 90b3e3b..d8ec75b 100644 --- a/test/parser/parser-test.c +++ b/test/parser/parser-test.c @@ -7,7 +7,7 @@ #include #include -#include "pb-protocol/pb-protocol.h" +#include #include #include "discover/device-handler.h" @@ -17,10 +17,15 @@ static FILE *testf; -void device_add_boot_option(struct device *device, +struct device *discover_context_device(struct discover_context *ctx) +{ + return ctx->device->device; +} + +void discover_context_add_boot_option(struct discover_context *ctx, struct boot_option *boot_option) { - fprintf(testf, "%s: %s\n", __func__, device->id); + fprintf(testf, "%s: %s\n", __func__, ctx->device->device->id); fprintf(testf, " id '%s'\n", boot_option->id); fprintf(testf, " name '%s'\n", boot_option->name); fprintf(testf, " descr '%s'\n", boot_option->description); @@ -62,9 +67,11 @@ int main(int argc, char **argv) ctx = talloc_zero(NULL, struct discover_context); - ctx->device_path = talloc_asprintf(ctx, "%s/%s", argv[1], argv[2]); - ctx->device = talloc_zero(ctx, struct device); - ctx->device->id = talloc_strdup(ctx->device, argv[2]); + ctx->device = talloc_zero(ctx, struct discover_device); + ctx->device->device = talloc_zero(ctx->device, struct device); + ctx->device->device_path = talloc_asprintf(ctx, "%s/%s", + argv[1], argv[2]); + ctx->device->device->id = talloc_strdup(ctx->device->device, argv[2]); iterate_parsers(ctx);