10 #include <types/types.h>
11 #include <talloc/talloc.h>
13 #include "discover/device-handler.h"
14 #include "discover/parser.h"
15 #include "discover/parser-utils.h"
16 #include "discover/paths.h"
20 struct device *discover_context_device(struct discover_context *ctx)
22 return ctx->device->device;
25 void discover_context_add_boot_option(struct discover_context *ctx,
26 struct boot_option *boot_option)
28 fprintf(testf, "%s: %s\n", __func__, ctx->device->device->id);
29 fprintf(testf, " id '%s'\n", boot_option->id);
30 fprintf(testf, " name '%s'\n", boot_option->name);
31 fprintf(testf, " descr '%s'\n", boot_option->description);
32 fprintf(testf, " icon '%s'\n", boot_option->icon_file);
33 fprintf(testf, " image '%s'\n", boot_option->boot_image_file);
34 fprintf(testf, " initrd '%s'\n", boot_option->initrd_file);
35 fprintf(testf, " args '%s'\n", boot_option->boot_args);
39 const char *generic_icon_file(
40 enum generic_icon_type __attribute__((unused)) type)
45 enum generic_icon_type guess_device_type(
46 struct discover_context __attribute__((unused)) *ctx)
48 return ICON_TYPE_UNKNOWN;
51 int main(int argc, char **argv)
53 struct discover_context *ctx;
56 fprintf(stderr, "usage: %s <basedir> <devname>\n", argv[0]);
60 /* Default to test on stdout, pb_log on stderr. */
64 pb_log_set_stream(stderr);
65 pb_log_always_flush(1);
66 pb_log("--- parser-test ---\n");
68 ctx = talloc_zero(NULL, struct discover_context);
70 ctx->device = talloc_zero(ctx, struct discover_device);
71 ctx->device->device = talloc_zero(ctx->device, struct device);
72 ctx->device->device_path = talloc_asprintf(ctx, "%s/%s",
74 ctx->device->device->id = talloc_strdup(ctx->device->device, argv[2]);
78 pb_log("--- end ---\n");