health check tests: test relayd and consumerd
[lttng-tools.git] / tests / regression / tools / health / health_fail.c
CommitLineData
6b5133f2
CB
1/*
2 * Copyright (C) 2012 - Christian Babeux <christian.babeux@efficios.com>
a33d2d4a 3 * Copyright (C) 2014 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6b5133f2
CB
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#include <stdlib.h>
20#include <string.h>
21#include <pthread.h>
a33d2d4a 22#include <urcu.h>
6b5133f2
CB
23
24/*
25 * Check if the specified environment variable is set.
26 * Return 1 if set, otherwise 0.
27 */
a33d2d4a 28static
6b5133f2
CB
29int check_env_var(const char *env)
30{
31 if (env) {
32 char *env_val = getenv(env);
33 if (env_val && (strncmp(env_val, "1", 1) == 0)) {
34 return 1;
35 }
36 }
37
38 return 0;
39}
40
a33d2d4a
MD
41/* Session daemon */
42
e547b070 43int __testpoint_sessiond_thread_manage_clients(void)
6b5133f2 44{
e547b070 45 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_TP_FAIL";
6b5133f2
CB
46
47 if (check_env_var(var)) {
48 return 1;
49 }
50
51 return 0;
52}
53
a33d2d4a
MD
54int __testpoint_sessiond_thread_registration_apps(void)
55{
56 const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_TP_FAIL";
57
58 if (check_env_var(var)) {
59 return 1;
60 }
61
62 return 0;
63}
64
e547b070 65int __testpoint_sessiond_thread_manage_apps(void)
6b5133f2 66{
e547b070 67 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_TP_FAIL";
6b5133f2
CB
68
69 if (check_env_var(var)) {
70 return 1;
71 }
72
73 return 0;
74}
75
e547b070 76int __testpoint_sessiond_thread_manage_kernel(void)
6b5133f2 77{
e547b070 78 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_TP_FAIL";
6b5133f2
CB
79
80 if (check_env_var(var)) {
81 return 1;
82 }
83
84 return 0;
85}
a33d2d4a
MD
86
87int __testpoint_sessiond_thread_manage_consumer(void)
88{
89 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_TP_FAIL";
90
91 if (check_env_var(var)) {
92 return 1;
93 }
94
95 return 0;
96}
97
98int __testpoint_sessiond_thread_ht_cleanup(void)
99{
100 const char *var = "LTTNG_SESSIOND_THREAD_HT_CLEANUP_TP_FAIL";
101
102 if (check_env_var(var)) {
103 return 1;
104 }
105
106 return 0;
107}
108
109int __testpoint_sessiond_thread_app_manage_notify(void)
110{
111 const char *var = "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY_TP_FAIL";
112
113 if (check_env_var(var)) {
114 return 1;
115 }
116
117 return 0;
118}
119
120int __testpoint_sessiond_thread_app_reg_dispatch(void)
121{
122 const char *var = "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH_TP_FAIL";
123
124 if (check_env_var(var)) {
125 return 1;
126 }
127
128 return 0;
129}
130
131/* Consumer daemon */
132
133int __testpoint_consumerd_thread_channel(void)
134{
135 const char *var = "LTTNG_CONSUMERD_THREAD_CHANNEL_TP_FAIL";
136
137 if (check_env_var(var)) {
138 return 1;
139 }
140
141 return 0;
142}
143
144int __testpoint_consumerd_thread_metadata(void)
145{
146 const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TP_FAIL";
147
148 if (check_env_var(var)) {
149 return 1;
150 }
151
152 return 0;
153}
154
155int __testpoint_consumerd_thread_data(void)
156{
157 const char *var = "LTTNG_CONSUMERD_THREAD_DATA_TP_FAIL";
158
159 if (check_env_var(var)) {
160 return 1;
161 }
162
163 return 0;
164}
165
166int __testpoint_consumerd_thread_sessiond(void)
167{
168 const char *var = "LTTNG_CONSUMERD_THREAD_SESSIOND_TP_FAIL";
169
170 if (check_env_var(var)) {
171 return 1;
172 }
173
174 return 0;
175}
176
177int __testpoint_consumerd_thread_metadata_timer(void)
178{
179 const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TIMER_TP_FAIL";
180
181 if (check_env_var(var)) {
182 return 1;
183 }
184
185 return 0;
186}
187
188/* Relay daemon */
189
190int __testpoint_relayd_thread_dispatcher(void)
191{
192 const char *var = "LTTNG_RELAYD_THREAD_DISPATCHER_TP_FAIL";
193
194 if (check_env_var(var)) {
195 return 1;
196 }
197
198 return 0;
199}
200
201int __testpoint_relayd_thread_worker(void)
202{
203 const char *var = "LTTNG_RELAYD_THREAD_WORKER_TP_FAIL";
204
205 if (check_env_var(var)) {
206 return 1;
207 }
208
209 return 0;
210}
211
212int __testpoint_relayd_thread_listener(void)
213{
214 const char *var = "LTTNG_RELAYD_THREAD_LISTENER_TP_FAIL";
215
216 if (check_env_var(var)) {
217 return 1;
218 }
219
220 return 0;
221}
222
223int __testpoint_relayd_thread_live_dispatcher(void)
224{
225 const char *var = "LTTNG_RELAYD_THREAD_LIVE_DISPATCHER_TP_FAIL";
226
227 if (check_env_var(var)) {
228 return 1;
229 }
230
231 return 0;
232}
233
234int __testpoint_relayd_thread_live_worker(void)
235{
236 const char *var = "LTTNG_RELAYD_THREAD_LIVE_WORKER_TP_FAIL";
237
238 if (check_env_var(var)) {
239 return 1;
240 }
241
242 return 0;
243}
244
245int __testpoint_relayd_thread_live_listener(void)
246{
247 const char *var = "LTTNG_RELAYD_THREAD_LIVE_LISTENER_TP_FAIL";
248
249 if (check_env_var(var)) {
250 return 1;
251 }
252
253 return 0;
254}
This page took 0.038984 seconds and 4 git commands to generate.