b3ebcedeaa222bc79e91dfd68f6d7325b1b3aec4
[lttng-tools.git] / tests / regression / tools / health / health_fail.c
1 /*
2 * Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
3 * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9 #include <stdlib.h>
10 #include <string.h>
11 #include <pthread.h>
12 #include <urcu.h>
13
14 /*
15 * Check if the specified environment variable is set.
16 * Return 1 if set, otherwise 0.
17 */
18 static
19 int check_env_var(const char *env)
20 {
21 if (env) {
22 char *env_val = getenv(env);
23 if (env_val && (strncmp(env_val, "1", 1) == 0)) {
24 return 1;
25 }
26 }
27
28 return 0;
29 }
30
31 /* Session daemon */
32
33 int __testpoint_sessiond_thread_manage_clients(void)
34 {
35 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_TP_FAIL";
36
37 if (check_env_var(var)) {
38 return 1;
39 }
40
41 return 0;
42 }
43
44 int __testpoint_sessiond_thread_registration_apps(void)
45 {
46 const char *var = "LTTNG_SESSIOND_THREAD_REG_APPS_TP_FAIL";
47
48 if (check_env_var(var)) {
49 return 1;
50 }
51
52 return 0;
53 }
54
55 int __testpoint_sessiond_thread_manage_apps(void)
56 {
57 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_TP_FAIL";
58
59 if (check_env_var(var)) {
60 return 1;
61 }
62
63 return 0;
64 }
65
66 int __testpoint_sessiond_thread_manage_kernel(void)
67 {
68 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_TP_FAIL";
69
70 if (check_env_var(var)) {
71 return 1;
72 }
73
74 return 0;
75 }
76
77 int __testpoint_sessiond_thread_manage_consumer(void)
78 {
79 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CONSUMER_TP_FAIL";
80
81 if (check_env_var(var)) {
82 return 1;
83 }
84
85 return 0;
86 }
87
88 int __testpoint_sessiond_thread_ht_cleanup(void)
89 {
90 const char *var = "LTTNG_SESSIOND_THREAD_HT_CLEANUP_TP_FAIL";
91
92 if (check_env_var(var)) {
93 return 1;
94 }
95
96 return 0;
97 }
98
99 int __testpoint_sessiond_thread_app_manage_notify(void)
100 {
101 const char *var = "LTTNG_SESSIOND_THREAD_APP_MANAGE_NOTIFY_TP_FAIL";
102
103 if (check_env_var(var)) {
104 return 1;
105 }
106
107 return 0;
108 }
109
110 int __testpoint_sessiond_thread_app_reg_dispatch(void)
111 {
112 const char *var = "LTTNG_SESSIOND_THREAD_APP_REG_DISPATCH_TP_FAIL";
113
114 if (check_env_var(var)) {
115 return 1;
116 }
117
118 return 0;
119 }
120
121 /* Consumer daemon */
122
123 int __testpoint_consumerd_thread_channel(void)
124 {
125 const char *var = "LTTNG_CONSUMERD_THREAD_CHANNEL_TP_FAIL";
126
127 if (check_env_var(var)) {
128 return 1;
129 }
130
131 return 0;
132 }
133
134 int __testpoint_consumerd_thread_metadata(void)
135 {
136 const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TP_FAIL";
137
138 if (check_env_var(var)) {
139 return 1;
140 }
141
142 return 0;
143 }
144
145 int __testpoint_consumerd_thread_data(void)
146 {
147 const char *var = "LTTNG_CONSUMERD_THREAD_DATA_TP_FAIL";
148
149 if (check_env_var(var)) {
150 return 1;
151 }
152
153 return 0;
154 }
155
156 int __testpoint_consumerd_thread_sessiond(void)
157 {
158 const char *var = "LTTNG_CONSUMERD_THREAD_SESSIOND_TP_FAIL";
159
160 if (check_env_var(var)) {
161 return 1;
162 }
163
164 return 0;
165 }
166
167 int __testpoint_consumerd_thread_metadata_timer(void)
168 {
169 const char *var = "LTTNG_CONSUMERD_THREAD_METADATA_TIMER_TP_FAIL";
170
171 if (check_env_var(var)) {
172 return 1;
173 }
174
175 return 0;
176 }
177
178 /* Relay daemon */
179
180 int __testpoint_relayd_thread_dispatcher(void)
181 {
182 const char *var = "LTTNG_RELAYD_THREAD_DISPATCHER_TP_FAIL";
183
184 if (check_env_var(var)) {
185 return 1;
186 }
187
188 return 0;
189 }
190
191 int __testpoint_relayd_thread_worker(void)
192 {
193 const char *var = "LTTNG_RELAYD_THREAD_WORKER_TP_FAIL";
194
195 if (check_env_var(var)) {
196 return 1;
197 }
198
199 return 0;
200 }
201
202 int __testpoint_relayd_thread_listener(void)
203 {
204 const char *var = "LTTNG_RELAYD_THREAD_LISTENER_TP_FAIL";
205
206 if (check_env_var(var)) {
207 return 1;
208 }
209
210 return 0;
211 }
212
213 int __testpoint_relayd_thread_live_dispatcher(void)
214 {
215 const char *var = "LTTNG_RELAYD_THREAD_LIVE_DISPATCHER_TP_FAIL";
216
217 if (check_env_var(var)) {
218 return 1;
219 }
220
221 return 0;
222 }
223
224 int __testpoint_relayd_thread_live_worker(void)
225 {
226 const char *var = "LTTNG_RELAYD_THREAD_LIVE_WORKER_TP_FAIL";
227
228 if (check_env_var(var)) {
229 return 1;
230 }
231
232 return 0;
233 }
234
235 int __testpoint_relayd_thread_live_listener(void)
236 {
237 const char *var = "LTTNG_RELAYD_THREAD_LIVE_LISTENER_TP_FAIL";
238
239 if (check_env_var(var)) {
240 return 1;
241 }
242
243 return 0;
244 }
This page took 0.0492 seconds and 3 git commands to generate.