tests: add check_skip_kernel_test to check root user and lttng kernel modules
[lttng-tools.git] / tests / regression / tools / health / health_fail.c
CommitLineData
6b5133f2 1/*
9d16b343
MJ
2 * Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
3 * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6b5133f2 4 *
9d16b343 5 * SPDX-License-Identifier: GPL-2.0-only
6b5133f2 6 *
6b5133f2
CB
7 */
8
4bd69c5f 9#include <lttng/lttng-export.h>
28f23191
JG
10
11#include <pthread.h>
6b5133f2
CB
12#include <stdlib.h>
13#include <string.h>
a33d2d4a 14#include <urcu.h>
6b5133f2
CB
15
16/*
17 * Check if the specified environment variable is set.
18 * Return 1 if set, otherwise 0.
19 */
28f23191 20static int check_env_var(const char *env)
6b5133f2
CB
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
a33d2d4a
MD
32/* Session daemon */
33
4bd69c5f 34LTTNG_EXPORT int __testpoint_sessiond_thread_manage_clients(void);
e547b070 35int __testpoint_sessiond_thread_manage_clients(void)
6b5133f2 36{
e547b070 37 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_CLIENTS_TP_FAIL";
6b5133f2
CB
38
39 if (check_env_var(var)) {
40 return 1;
41 }
42
43 return 0;
44}
45
4bd69c5f 46LTTNG_EXPORT int __testpoint_sessiond_thread_registration_apps(void);
a33d2d4a
MD
47int __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
4bd69c5f 58LTTNG_EXPORT int __testpoint_sessiond_thread_manage_apps(void);
e547b070 59int __testpoint_sessiond_thread_manage_apps(void)
6b5133f2 60{
e547b070 61 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_APPS_TP_FAIL";
6b5133f2
CB
62
63 if (check_env_var(var)) {
64 return 1;
65 }
66
67 return 0;
68}
69
4bd69c5f 70LTTNG_EXPORT int __testpoint_sessiond_thread_manage_kernel(void);
e547b070 71int __testpoint_sessiond_thread_manage_kernel(void)
6b5133f2 72{
e547b070 73 const char *var = "LTTNG_SESSIOND_THREAD_MANAGE_KERNEL_TP_FAIL";
6b5133f2
CB
74
75 if (check_env_var(var)) {
76 return 1;
77 }
78
79 return 0;
80}
a33d2d4a 81
4bd69c5f 82LTTNG_EXPORT int __testpoint_sessiond_thread_manage_consumer(void);
a33d2d4a
MD
83int __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
4bd69c5f 94LTTNG_EXPORT int __testpoint_sessiond_thread_app_manage_notify(void);
a33d2d4a
MD
95int __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
4bd69c5f 106LTTNG_EXPORT int __testpoint_sessiond_thread_app_reg_dispatch(void);
a33d2d4a
MD
107int __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
4bd69c5f 120LTTNG_EXPORT int __testpoint_consumerd_thread_channel(void);
a33d2d4a
MD
121int __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
4bd69c5f 132LTTNG_EXPORT int __testpoint_consumerd_thread_metadata(void);
a33d2d4a
MD
133int __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
4bd69c5f 144LTTNG_EXPORT int __testpoint_consumerd_thread_data(void);
a33d2d4a
MD
145int __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
4bd69c5f 156LTTNG_EXPORT int __testpoint_consumerd_thread_sessiond(void);
a33d2d4a
MD
157int __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
4bd69c5f 168LTTNG_EXPORT int __testpoint_consumerd_thread_metadata_timer(void);
a33d2d4a
MD
169int __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
4bd69c5f 182LTTNG_EXPORT int __testpoint_relayd_thread_dispatcher(void);
a33d2d4a
MD
183int __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
4bd69c5f 194LTTNG_EXPORT int __testpoint_relayd_thread_worker(void);
a33d2d4a
MD
195int __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
4bd69c5f 206LTTNG_EXPORT int __testpoint_relayd_thread_listener(void);
a33d2d4a
MD
207int __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
4bd69c5f 218LTTNG_EXPORT int __testpoint_relayd_thread_live_dispatcher(void);
a33d2d4a
MD
219int __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
4bd69c5f 230LTTNG_EXPORT int __testpoint_relayd_thread_live_worker(void);
a33d2d4a
MD
231int __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
4bd69c5f 242LTTNG_EXPORT int __testpoint_relayd_thread_live_listener(void);
a33d2d4a
MD
243int __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.082297 seconds and 4 git commands to generate.