summaryrefslogtreecommitdiff
path: root/usr/src/test/libc-tests/tests/common/test_common.h
blob: ce4813f7ac4dae0135c66a54b999457a6bee459c (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * This file and its contents are supplied under the terms of the
 * Common Development and Distribution License ("CDDL"), version 1.0.
 * You may only use this file in accordance with the terms of version
 * 1.0 of the CDDL.
 *
 * A full copy of the text of the CDDL should have accompanied this
 * source.  A copy of the CDDL is also available via the Internet at
 * http://www.illumos.org/license/CDDL.
 */

/*
 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
 */

/*
 * Common handling for test programs.
 */

#ifndef	_TEST_COMMON_H
#define	_TEST_COMMON_H

#ifdef	__cplusplus
extern "C" {
#endif

typedef struct test *test_t;
typedef void (*test_func_t)(test_t, void *);

extern void test_set_debug(void);
extern void test_set_force(void);
extern test_t test_start(const char *name, ...);
extern void test_failed(test_t, const char *format, ...);
extern void test_passed(test_t);
extern void test_debugf(test_t, const char *format, ...);
extern void test_run(int nthr, test_func_t, void *arg, const char *, ...);
extern void test_summary(void);

extern void test_trim(char **);

typedef int (*test_cfg_func_t)(char **fields, int nfields, char **err);

/*
 * Args list is array of pairs of const char *keyword, test_config_func_t,
 * terminated by NULL.
 */
extern int test_load_config(test_t, const char *, ...);

#ifdef	__cplusplus
}
#endif
#endif	/* _TEST_COMMON_H */