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