From 34014a0a2b3404db38315d41c5befc267da18c18 Mon Sep 17 00:00:00 2001 From: Ali Mohammed <ali.mohammed@hpe.com> Date: Tue, 27 Jul 2021 19:49:37 +0200 Subject: [PATCH] modify check_pm_interlock test to have both clients name as Client but with different indices 1 and 2 --- tests/Makefile.am | 6 +++--- tests/check_pm_interlock.sh.in | 4 ++-- tests/simple_interlock_client.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 78cc3cd1..1135d93f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -157,11 +157,11 @@ INJECTOR_OPS="\ simple_interlock_client_1_SOURCES = simple_interlock_client.c -simple_interlock_client_1_CPPFLAGS = $(AM_CPPFLAGS) -DCLIENT_ARGS=$(CLIENT1_OPS) +simple_interlock_client_1_CPPFLAGS = $(AM_CPPFLAGS) -DCOMPONENT_ID=1 -DCLIENT_ARGS=$(CLIENT1_OPS) simple_interlock_client_2_SOURCES = simple_interlock_client.c -simple_interlock_client_2_CPPFLAGS = $(AM_CPPFLAGS) -DCLIENT_ARGS=$(CLIENT2_OPS) +simple_interlock_client_2_CPPFLAGS = $(AM_CPPFLAGS) -DCOMPONENT_ID=2 -DCLIENT_ARGS=$(CLIENT2_OPS) simple_injector_SOURCES = simple_interlock_client.c -simple_injector_CPPFLAGS = $(AM_CPPFLAGS) -DCLIENT_ARGS=$(INJECTOR_OPS) +simple_injector_CPPFLAGS = $(AM_CPPFLAGS) -DCOMPONENT_ID=0 -DCLIENT_ARGS=$(INJECTOR_OPS) simple_group_injector_SOURCES = simple_group_client.c simple_group_injector_CPPFLAGS = $(AM_CPPFLAGS) -DINJECT_GROUP_MEMBERS=1 diff --git a/tests/check_pm_interlock.sh.in b/tests/check_pm_interlock.sh.in index ba7ee0d4..a91f052b 100644 --- a/tests/check_pm_interlock.sh.in +++ b/tests/check_pm_interlock.sh.in @@ -90,10 +90,10 @@ MSTRO_POOL_MANAGER_INFO="$pm_info" export MSTRO_POOL_MANAGER_INFO # start client 1 -(env MSTRO_COMPONENT_NAME="C1a" MSTRO_TRANSPORT_DEFAULT="MIO" MSTRO_MIO_CONFIG="./mio-config-C1a.yaml" MSTRO_LOG_COLOR_ERRORS=1 MSTRO_LOG_COLOR="BLUE" ${CLIENT_CMD}_1 -n) || exit 99 & +(env MSTRO_COMPONENT_NAME="Client" MSTRO_TRANSPORT_DEFAULT="MIO" MSTRO_MIO_CONFIG="./mio-config-C1a.yaml" MSTRO_LOG_COLOR_ERRORS=1 MSTRO_LOG_COLOR="BLUE" ${CLIENT_CMD}_1 -n) || exit 99 & # start client 2 -(env MSTRO_COMPONENT_NAME="C2a" MSTRO_TRANSPORT_DEFAULT="MIO" MSTRO_MIO_CONFIG="./mio-config-C2a.yaml" MSTRO_LOG_COLOR_ERRORS=1 MSTRO_LOG_COLOR="CYAN" ${CLIENT_CMD}_2 -n) || exit 99 & +(env MSTRO_COMPONENT_NAME="Client" MSTRO_TRANSPORT_DEFAULT="MIO" MSTRO_MIO_CONFIG="./mio-config-C2a.yaml" MSTRO_LOG_COLOR_ERRORS=1 MSTRO_LOG_COLOR="CYAN" ${CLIENT_CMD}_2 -n) || exit 99 & wait %1 || exit 99 wait %2 || exit 99 diff --git a/tests/simple_interlock_client.c b/tests/simple_interlock_client.c index a018c33c..38d27d86 100644 --- a/tests/simple_interlock_client.c +++ b/tests/simple_interlock_client.c @@ -61,6 +61,12 @@ #error You need to define CLIENT_ARGS when compiling this file #endif +#ifndef COMPONENT_ID +#error You need to define COMPONENT_ID when compiling this file +#endif + + + #define XSTRINGIFY(s) #s #define STRINGIFY(s) XSTRINGIFY(s) @@ -267,7 +273,10 @@ CHEAT_DECLARE( ) CHEAT_TEST(simple_interlock_client, - cheat_assert(MSTRO_OK == mstro_init(NULL,NULL,0)); + + char *component_id = STRINGIFY(COMPONENT_ID); + int my_id = atoi(component_id); + cheat_assert(MSTRO_OK == mstro_init(NULL,NULL,my_id)); cheat_yield(); cheat_assert(0==parse_args(g_client_args)); cheat_assert(0==execute_steps(g_steps)); -- GitLab