From 4d6fd6965d3dcff5ae2a157c58873f30dc117c09 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 4 Oct 2013 20:53:55 -0400 Subject: [PATCH] Health check test: add relayd check support Signed-off-by: Mathieu Desnoyers --- tests/regression/tools/health/health_check.c | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) 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 { -- 2.34.1