6 #include "device-handler.h"
10 struct device_handler *handler;
11 struct discover_context *ctx;
12 struct config *config;
19 /* interface required for parsers */
20 void __register_parser(struct parser *parser);
23 struct discover_device *test_create_device(struct parser_test *test,
26 #define test_read_conf_data(t, d) \
27 __test_read_conf_data(t, d, sizeof(d))
29 void __test_read_conf_data(struct parser_test *test,
30 const char *buf, size_t len);
31 void test_read_conf_file(struct parser_test *test, const char *filename);
32 void test_set_conf_source(struct parser_test *test, const char *url);
34 int test_run_parser(struct parser_test *test, const char *parser_name);
36 void test_hotplug_device(struct parser_test *test, struct discover_device *dev);
38 struct discover_boot_option *get_boot_option(struct discover_context *ctx,
42 extern const char __embedded_config[];
43 extern const size_t __embedded_config_size;
44 #define test_read_conf_embedded(t) \
45 __test_read_conf_data(t, __embedded_config, __embedded_config_size)
48 * Checks for parser results.
50 * These return void, but will respond to check failures by printing a reason
51 * for the failure, and exit the test with a non-zero exit status.
55 * Check that we have an expected number of boot options parsed. If not,
56 * print out what we did find, then exit.
58 #define check_boot_option_count(ctx, count) \
59 __check_boot_option_count(ctx, count, __FILE__, __LINE__)
60 void __check_boot_option_count(struct discover_context *ctx, int count,
61 const char *file, int line);
63 * Check that a boot option @opt has args @args
65 void __check_args(struct discover_boot_option *opt, const char *args,
66 const char *file, int line);
67 #define check_args(opt, args) \
68 __check_args(opt, args, __FILE__, __LINE__)
71 * Check that a boot option @opt has name @name
73 void __check_name(struct discover_boot_option *opt, const char *name,
74 const char *file, int line);
75 #define check_name(opt, name) \
76 __check_name(opt, name, __FILE__, __LINE__)
79 * Check that a boot option @opt is marked as default
81 void __check_is_default(struct discover_boot_option *opt,
82 const char *file, int line);
83 #define check_is_default(opt) \
84 __check_is_default(opt, __FILE__, __LINE__)
87 * Check that a resource (@res) is present, resolved, and has a local path
88 * (within @dev's mount point) of @path.
90 #define check_resolved_local_resource(res, dev, path) \
91 __check_resolved_local_resource(res, dev, path, __FILE__, __LINE__)
93 void __check_resolved_local_resource(struct resource *res,
94 struct discover_device *dev, const char *local_path,
95 const char *file, int line);
98 * Check that a resource (@res) is present, resolved, and has a URL of
101 #define check_resolved_url_resource(res, url) \
102 __check_resolved_url_resource(res, url, __FILE__, __LINE__)
103 void __check_resolved_url_resource(struct resource *res,
104 const char *url, const char *file, int line);
106 * Check that a resource (@res) is present but not resolved
108 void __check_unresolved_resource(struct resource *res,
109 const char *file, int line);
110 #define check_unresolved_resource(res) \
111 __check_unresolved_resource(res, __FILE__, __LINE__)
114 * Check that a resource (@res) is not present
116 void __check_not_present_resource(struct resource *res,
117 const char *file, int line);
118 #define check_not_present_resource(res) \
119 __check_not_present_resource(res, __FILE__, __LINE__)
121 #endif /* PARSER_TEST_H */