From: Mathieu Desnoyers Date: Sat, 5 Oct 2013 00:53:55 +0000 (-0400) Subject: Health check test: add relayd check support X-Git-Tag: v2.4.0-rc1~110 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4d6fd6965d3dcff5ae2a157c58873f30dc117c09;p=lttng-tools.git Health check test: add relayd check support Signed-off-by: Mathieu Desnoyers --- diff --git a/tests/regression/tools/health/health_check.c b/tests/regression/tools/health/health_check.c index 0569a4187..22cbcf12d 100644 --- a/tests/regression/tools/health/health_check.c +++ b/tests/regression/tools/health/health_check.c @@ -17,9 +17,12 @@ #include #include +#include #include +static const char *relayd_path; + static int check_component(struct lttng_health *lh, const char *component_name) { @@ -106,15 +109,49 @@ int check_consumerd(enum lttng_health_consumerd hc) return status; } +static +int check_relayd(const char *path) +{ + struct lttng_health *lh; + int status; + + lh = lttng_health_create_relayd(path); + if (!lh) { + perror("lttng_health_create_relayd"); + return -1; + } + + status = check_component(lh, "relayd"); + + lttng_health_destroy(lh); + + return status; +} int main(int argc, char *argv[]) { int status = 0, i; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--relayd-path")) { + if (i >= argc - 1) { + fprintf(stderr, "Missing relayd path\n"); + exit(EXIT_FAILURE); + } + relayd_path = argv[++i]; + } else { + fprintf(stderr, "Unknown option \"%s\". Try --relayd-path PATH.\n", argv[i]); + exit(EXIT_FAILURE); + } + } + status |= check_sessiond(); for (i = 0; i < NR_LTTNG_HEALTH_CONSUMERD; i++) { status |= check_consumerd(i); } + if (relayd_path) { + status |= check_relayd(relayd_path); + } if (!status) { exit(EXIT_SUCCESS); } else {