1538aa54dSGarrett D'Amore /*
2538aa54dSGarrett D'Amore  * This file and its contents are supplied under the terms of the
3538aa54dSGarrett D'Amore  * Common Development and Distribution License ("CDDL"), version 1.0.
4538aa54dSGarrett D'Amore  * You may only use this file in accordance with the terms of version
5538aa54dSGarrett D'Amore  * 1.0 of the CDDL.
6538aa54dSGarrett D'Amore  *
7538aa54dSGarrett D'Amore  * A full copy of the text of the CDDL should have accompanied this
8538aa54dSGarrett D'Amore  * source.  A copy of the CDDL is also available via the Internet at
9538aa54dSGarrett D'Amore  * http://www.illumos.org/license/CDDL.
10538aa54dSGarrett D'Amore  */
11538aa54dSGarrett D'Amore 
12538aa54dSGarrett D'Amore /*
13538aa54dSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
14538aa54dSGarrett D'Amore  */
15538aa54dSGarrett D'Amore 
16538aa54dSGarrett D'Amore /*
17538aa54dSGarrett D'Amore  * Common handling for test programs.
18538aa54dSGarrett D'Amore  */
19538aa54dSGarrett D'Amore 
20538aa54dSGarrett D'Amore #ifndef	_TEST_COMMON_H
21538aa54dSGarrett D'Amore #define	_TEST_COMMON_H
22538aa54dSGarrett D'Amore 
23538aa54dSGarrett D'Amore #ifdef	__cplusplus
24538aa54dSGarrett D'Amore extern "C" {
25538aa54dSGarrett D'Amore #endif
26538aa54dSGarrett D'Amore 
27538aa54dSGarrett D'Amore typedef struct test *test_t;
28538aa54dSGarrett D'Amore typedef void (*test_func_t)(test_t, void *);
29538aa54dSGarrett D'Amore 
30538aa54dSGarrett D'Amore extern void test_set_debug(void);
31538aa54dSGarrett D'Amore extern void test_set_force(void);
32538aa54dSGarrett D'Amore extern test_t test_start(const char *name, ...);
33538aa54dSGarrett D'Amore extern void test_failed(test_t, const char *format, ...);
34538aa54dSGarrett D'Amore extern void test_passed(test_t);
35538aa54dSGarrett D'Amore extern void test_debugf(test_t, const char *format, ...);
36538aa54dSGarrett D'Amore extern void test_run(int nthr, test_func_t, void *arg, const char *, ...);
37*de572d98SGarrett D'Amore extern void test_summary(void);
38*de572d98SGarrett D'Amore 
39*de572d98SGarrett D'Amore extern void test_trim(char **);
40*de572d98SGarrett D'Amore 
41*de572d98SGarrett D'Amore typedef int (*test_cfg_func_t)(char **fields, int nfields, char **err);
42*de572d98SGarrett D'Amore 
43*de572d98SGarrett D'Amore /*
44*de572d98SGarrett D'Amore  * Args list is array of pairs of const char *keyword, test_config_func_t,
45*de572d98SGarrett D'Amore  * terminated by NULL.
46*de572d98SGarrett D'Amore  */
47*de572d98SGarrett D'Amore extern int test_load_config(test_t, const char *, ...);
48538aa54dSGarrett D'Amore 
49538aa54dSGarrett D'Amore #ifdef	__cplusplus
50538aa54dSGarrett D'Amore }
51538aa54dSGarrett D'Amore #endif
52538aa54dSGarrett D'Amore #endif	/* _TEST_COMMON_H */
53