summaryrefslogtreecommitdiffstats
path: root/test/parser/parser-test.h
blob: 5baa4588588fdd9e4f9c65f75105d21fbfbf45ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef PARSER_TEST_H
#define PARSER_TEST_H

#include <stdlib.h>

#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);

#define test_read_conf_data(t, d) \
	__test_read_conf_data(t, d, sizeof(d))

void __test_read_conf_data(struct parser_test *test,
		const char *buf, size_t len);
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 */
OpenPOWER on IntegriCloud