6 #include "device-handler.h"
10 struct device_handler *handler;
11 struct discover_context *ctx;
18 /* interface required for parsers */
19 void __register_parser(struct parser *parser);
22 struct discover_device *test_create_device(struct discover_context *ctx,
25 #define test_read_conf_data(t, d) \
26 __test_read_conf_data(t, d, sizeof(d))
28 void __test_read_conf_data(struct parser_test *test,
29 const char *buf, size_t len);
30 void test_read_conf_file(struct parser_test *test, const char *filename);
31 void test_set_conf_source(struct parser_test *test, const char *url);
33 int test_run_parser(struct parser_test *test, const char *parser_name);
35 void test_hotplug_device(struct parser_test *test, struct discover_device *dev);
37 struct discover_boot_option *get_boot_option(struct discover_context *ctx,
41 extern const char __embedded_config[];
42 extern const size_t __embedded_config_size;
43 #define test_read_conf_embedded(t) \
44 __test_read_conf_data(t, __embedded_config, __embedded_config_size)
47 * Checks for parser results.
49 * These return void, but will respond to check failures by printing a reason
50 * for the failure, and exit the test with a non-zero exit status.
54 * Check that we have an expected number of boot options parsed. If not,
55 * print out what we did find, then exit.
57 #define check_boot_option_count(ctx, count) \
58 __check_boot_option_count(ctx, count, __FILE__, __LINE__)
59 void __check_boot_option_count(struct discover_context *ctx, int count,
60 const char *file, int line);
62 * Check that a boot option @opt has args @args
64 void __check_args(struct discover_boot_option *opt, const char *args,
65 const char *file, int line);
66 #define check_args(opt, args) \
67 __check_args(opt, args, __FILE__, __LINE__)
70 * Check that a boot option @opt has name @name
72 void __check_name(struct discover_boot_option *opt, const char *name,
73 const char *file, int line);
74 #define check_name(opt, name) \
75 __check_name(opt, name, __FILE__, __LINE__)
78 * Check that a boot option @opt is marked as default
80 void __check_is_default(struct discover_boot_option *opt,
81 const char *file, int line);
82 #define check_is_default(opt) \
83 __check_is_default(opt, __FILE__, __LINE__)
86 * Check that a resource (@res) is present, resolved, and has a local path
87 * (within @dev's mount point) of @path.
89 #define check_resolved_local_resource(res, dev, path) \
90 __check_resolved_local_resource(res, dev, path, __FILE__, __LINE__)
92 void __check_resolved_local_resource(struct resource *res,
93 struct discover_device *dev, const char *local_path,
94 const char *file, int line);
97 * Check that a resource (@res) is present, resolved, and has a URL of
100 #define check_resolved_url_resource(res, url) \
101 __check_resolved_url_resource(res, url, __FILE__, __LINE__)
102 void __check_resolved_url_resource(struct resource *res,
103 const char *url, const char *file, int line);
105 * Check that a resource (@res) is present but not resolved
107 void __check_unresolved_resource(struct resource *res,
108 const char *file, int line);
109 #define check_unresolved_resource(res) \
110 __check_unresolved_resource(res, __FILE__, __LINE__)
113 * Check that a resource (@res) is not present
115 void __check_not_present_resource(struct resource *res,
116 const char *file, int line);
117 #define check_not_present_resource(res) \
118 __check_not_present_resource(res, __FILE__, __LINE__)
120 #endif /* PARSER_TEST_H */