10 #include "pb-protocol/pb-protocol.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 void device_add_boot_option(struct device *device,
21 struct boot_option *boot_option)
23 fprintf(testf, "%s: %s\n", __func__, device->id);
24 fprintf(testf, " id '%s'\n", boot_option->id);
25 fprintf(testf, " name '%s'\n", boot_option->name);
26 fprintf(testf, " descr '%s'\n", boot_option->description);
27 fprintf(testf, " icon '%s'\n", boot_option->icon_file);
28 fprintf(testf, " image '%s'\n", boot_option->boot_image_file);
29 fprintf(testf, " initrd '%s'\n", boot_option->initrd_file);
30 fprintf(testf, " args '%s'\n", boot_option->boot_args);
34 const char *generic_icon_file(
35 enum generic_icon_type __attribute__((unused)) type)
40 enum generic_icon_type guess_device_type(
41 struct discover_context __attribute__((unused)) *ctx)
43 return ICON_TYPE_UNKNOWN;
46 int main(int argc, char **argv)
48 struct discover_context *ctx;
52 fprintf(stderr, "usage: %s <basedir> <devname>\n", argv[0]);
56 /* Default to test on stdout, pb_log on stderr. */
60 pb_log_set_stream(stderr);
61 pb_log_always_flush(1);
62 pb_log("--- parser-test ---\n");
64 ctx = talloc_zero(NULL, struct discover_context);
66 ctx->device_path = talloc_asprintf(ctx, "%s/%s", argv[1], argv[2]);
67 ctx->device = talloc_zero(ctx, struct device);
68 ctx->device->id = talloc_strdup(ctx->device, argv[2]);
70 rc = iterate_parsers(ctx);
72 pb_log("--- end ---\n");