From 5d16719922866622fc0f42c570b9934f595e3c33 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 15 May 2013 15:28:57 +0800 Subject: test: Replace parser tests with empty framework This change is a major rework of the parser tests. Currently, the parser tests just run the parsers on each subdir of data/, but we don't actually check the results. Rather than just running parsers and expecting a certain fixed output, the new tests are arbitraty (short!) C programs. This allows us to set up the device configuration / discover context etc in whatever manner necessary, and check that the boot options that the parsers emit are correct. This change removes all of the old tests, and adds a new "null" test. Actual tests will be added in subsequent changes. Signed-off-by: Jeremy Kerr --- test/parser/parser-test.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/parser/parser-test.h (limited to 'test/parser/parser-test.h') diff --git a/test/parser/parser-test.h b/test/parser/parser-test.h new file mode 100644 index 0000000..e17cbbc --- /dev/null +++ b/test/parser/parser-test.h @@ -0,0 +1,29 @@ +#ifndef PARSER_TEST_H +#define PARSER_TEST_H + +#include + +#include "device-handler.h" +#include "resource.h" + +struct parser_test { + struct device_handler *handler; + struct discover_context *ctx; + struct { + void *buf; + size_t size; + } conf; +}; + +/* interface required for parsers */ +void __register_parser(struct parser *parser); + +/* test functions */ +struct discover_device *test_create_device(struct discover_context *ctx, + const char *name); + +void test_read_conf_file(struct parser_test *test, const char *filename); + +int test_run_parser(struct parser_test *test, const char *parser_name); + +#endif /* PARSER_TEST_H */ -- cgit v1.2.1