summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kdbus/kdbus-test.h
blob: ee937f9a84dcf1af6e15887d2f78da3c0fab4a30 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef _TEST_KDBUS_H_
#define _TEST_KDBUS_H_

struct kdbus_test_env {
	char *buspath;
	const char *root;
	const char *module;
	int control_fd;
	struct kdbus_conn *conn;
};

enum {
	TEST_OK,
	TEST_SKIP,
	TEST_ERR,
};

#define ASSERT_RETURN_VAL(cond, val)		\
	if (!(cond)) {			\
		fprintf(stderr,	"Assertion '%s' failed in %s(), %s:%d\n", \
			#cond, __func__, __FILE__, __LINE__);	\
		return val;	\
	}

#define ASSERT_EXIT_VAL(cond, val)		\
	if (!(cond)) {			\
		fprintf(stderr, "Assertion '%s' failed in %s(), %s:%d\n", \
			#cond, __func__, __FILE__, __LINE__);	\
		_exit(val);	\
	}

#define ASSERT_BREAK(cond)		\
	if (!(cond)) {			\
		fprintf(stderr, "Assertion '%s' failed in %s(), %s:%d\n", \
			#cond, __func__, __FILE__, __LINE__);	\
		break; \
	}

#define ASSERT_RETURN(cond)		\
	ASSERT_RETURN_VAL(cond, TEST_ERR)

#define ASSERT_EXIT(cond)		\
	ASSERT_EXIT_VAL(cond, EXIT_FAILURE)

int kdbus_test_activator(struct kdbus_test_env *env);
int kdbus_test_benchmark(struct kdbus_test_env *env);
int kdbus_test_benchmark_nomemfds(struct kdbus_test_env *env);
int kdbus_test_benchmark_uds(struct kdbus_test_env *env);
int kdbus_test_bus_make(struct kdbus_test_env *env);
int kdbus_test_byebye(struct kdbus_test_env *env);
int kdbus_test_chat(struct kdbus_test_env *env);
int kdbus_test_conn_info(struct kdbus_test_env *env);
int kdbus_test_conn_update(struct kdbus_test_env *env);
int kdbus_test_daemon(struct kdbus_test_env *env);
int kdbus_test_custom_endpoint(struct kdbus_test_env *env);
int kdbus_test_fd_passing(struct kdbus_test_env *env);
int kdbus_test_free(struct kdbus_test_env *env);
int kdbus_test_hello(struct kdbus_test_env *env);
int kdbus_test_match_bloom(struct kdbus_test_env *env);
int kdbus_test_match_id_add(struct kdbus_test_env *env);
int kdbus_test_match_id_remove(struct kdbus_test_env *env);
int kdbus_test_match_replace(struct kdbus_test_env *env);
int kdbus_test_match_name_add(struct kdbus_test_env *env);
int kdbus_test_match_name_change(struct kdbus_test_env *env);
int kdbus_test_match_name_remove(struct kdbus_test_env *env);
int kdbus_test_message_basic(struct kdbus_test_env *env);
int kdbus_test_message_prio(struct kdbus_test_env *env);
int kdbus_test_message_quota(struct kdbus_test_env *env);
int kdbus_test_memory_access(struct kdbus_test_env *env);
int kdbus_test_metadata_ns(struct kdbus_test_env *env);
int kdbus_test_monitor(struct kdbus_test_env *env);
int kdbus_test_name_basic(struct kdbus_test_env *env);
int kdbus_test_name_conflict(struct kdbus_test_env *env);
int kdbus_test_name_queue(struct kdbus_test_env *env);
int kdbus_test_name_takeover(struct kdbus_test_env *env);
int kdbus_test_policy(struct kdbus_test_env *env);
int kdbus_test_policy_ns(struct kdbus_test_env *env);
int kdbus_test_policy_priv(struct kdbus_test_env *env);
int kdbus_test_sync_byebye(struct kdbus_test_env *env);
int kdbus_test_sync_reply(struct kdbus_test_env *env);
int kdbus_test_timeout(struct kdbus_test_env *env);
int kdbus_test_writable_pool(struct kdbus_test_env *env);

#endif /* _TEST_KDBUS_H_ */