X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fhealth%2Fhealth_fail.c;fp=tests%2Fregression%2Ftools%2Fhealth%2Fhealth_fail.c;h=6227825480108d92625e25c0a7ba6b4082ec6e09;hp=0000000000000000000000000000000000000000;hb=9ac429ef32142eaecfec2d1a44569464c4f8f721;hpb=785d2d0dc3aec3a4e44fcf677155dd07e8e4cc1f diff --git a/tests/regression/tools/health/health_fail.c b/tests/regression/tools/health/health_fail.c new file mode 100644 index 000000000..622782548 --- /dev/null +++ b/tests/regression/tools/health/health_fail.c @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 - Christian Babeux + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License, version 2 only, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include + +/* + * Check if the specified environment variable is set. + * Return 1 if set, otherwise 0. + */ +int check_env_var(const char *env) +{ + if (env) { + char *env_val = getenv(env); + if (env_val && (strncmp(env_val, "1", 1) == 0)) { + return 1; + } + } + + return 0; +} + +int __testpoint_thread_manage_clients(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_TP_FAIL"; + + if (check_env_var(var)) { + return 1; + } + + return 0; +} + +int __testpoint_thread_manage_apps(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_APPS_TP_FAIL"; + + if (check_env_var(var)) { + return 1; + } + + return 0; +} + +int __testpoint_thread_manage_kernel(void) +{ + const char *var = "LTTNG_THREAD_MANAGE_KERNEL_TP_FAIL"; + + if (check_env_var(var)) { + return 1; + } + + return 0; +}