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);
32 int test_run_parser(struct parser_test *test, const char *parser_name);
34 void test_hotplug_device(struct parser_test *test, struct discover_device *dev);
36 struct discover_boot_option *get_boot_option(struct discover_context *ctx,
40 extern const char __embedded_config[];
41 extern const size_t __embedded_config_size;
42 #define test_read_conf_embedded(t) \
43 __test_read_conf_data(t, __embedded_config, __embedded_config_size)
46 * Checks for parser results.
48 * These return void, but will respond to check failures by printing a reason
49 * for the failure, and exit the test with a non-zero exit status.
53 * Check that we have an expected number of boot options parsed. If not,
54 * print out what we did find, then exit.
56 #define check_boot_option_count(ctx, count) \
57 __check_boot_option_count(ctx, count, __FILE__, __LINE__)
58 void __check_boot_option_count(struct discover_context *ctx, int count,
59 const char *file, int line);
61 * Check that a boot option @opt has args @args
63 void __check_args(struct discover_boot_option *opt, const char *args,
64 const char *file, int line);
65 #define check_args(opt, args) \
66 __check_args(opt, args, __FILE__, __LINE__)
69 * Check that a boot option @opt has name @name
71 void __check_name(struct discover_boot_option *opt, const char *name,
72 const char *file, int line);
73 #define check_name(opt, name) \
74 __check_name(opt, name, __FILE__, __LINE__)
77 * Check that a resource (@res) is present, resolved, and has a local path
78 * (within @dev's mount point) of @path.
80 #define check_resolved_local_resource(res, dev, path) \
81 __check_resolved_local_resource(res, dev, path, __FILE__, __LINE__)
83 void __check_resolved_local_resource(struct resource *res,
84 struct discover_device *dev, const char *local_path,
85 const char *file, int line);
88 * Check that a resource (@res) is present but not resolved
90 void __check_unresolved_resource(struct resource *res,
91 const char *file, int line);
92 #define check_unresolved_resource(res) \
93 __check_unresolved_resource(res, __FILE__, __LINE__)
96 * Check that a resource (@res) is not present
98 void __check_not_present_resource(struct resource *res,
99 const char *file, int line);
100 #define check_not_present_resource(res) \
101 __check_not_present_resource(res, __FILE__, __LINE__)
103 #endif /* PARSER_TEST_H */