11# ###############################################################################
22# all.mk - Multi-Server Test Framework
33# ###############################################################################
4- #
5- # TABLE OF CONTENTS:
6- # 1. Overview & Usage
7- # 2. Directory & Path Configuration
8- # 3. Framework Repository Setup
9- # 4. Helper Functions
10- # 5. Dynamic Test Target Generation
11- # 6. Test Discovery & Instantiation
12- #
13- # ###############################################################################
144
155# ###############################################################################
16- # 1. OVERVIEW & USAGE
6+ # 1. OVERVIEW
177# ###############################################################################
188#
199# This Makefile dynamically generates test targets from test-*.yml files.
2717#
2818# make test-5hs-autoaccept-5min
2919# -> TEST_FILENAME = test-5hs-autoaccept-5min.yml
30- # -> ENV_COMPOSE_PATH = environments/docker-compose/env-5hs-autoaccept.yml (same!)
20+ # -> ENV_COMPOSE_PATH = environments/docker-compose/env-5hs-autoaccept.yml
3121#
3222# make test-2p-2p-4hs-sql-mycustomvariantstring
3323# -> TEST_FILENAME = test-2p-2p-4hs-sql-mycustomvariantstring.yml
3424# -> ENV_COMPOSE_PATH = environments/docker-compose/env-2p-2p-4hs-sql.yml
3525#
36- # HOW IT WORKS:
37- # - Test files follow the pattern: test-*.yml
38- # - Environment files follow: env-*.yml.j2 (Jinja2 templates)
39- # - The makefile strips suffixes from test names until it finds a matching env
40- # - Jinja2 templates are rendered using config_builder.py before tests run
41- #
4226# ###############################################################################
4327
4428# ###############################################################################
@@ -94,13 +78,10 @@ $(MULTI_SERVER_BUILD_DIR_REL_PATH):
9478# 4. HELPER FUNCTIONS
9579# ###############################################################################
9680
97- # FIND_ENV_COMPOSE_J2 - Locate the environment Compose template
81+ # FIND_ENV_COMPOSE_J2 - Locate the test's environment Docker compose template
9882#
99- # Given a test name like "test-5hs-autoaccept-5min", this function strips
100- # trailing hyphenated segments until it finds a matching environment file:
101- #
102- # test-5hs-autoaccept-5min -> env-5hs-autoaccept-5min.yml.j2 (check)
103- # test-5hs-autoaccept -> env-5hs-autoaccept.yml.j2 (found!)
83+ # For example, for a test name "test-5hs-autoaccept-5min", this function strips
84+ # trailing hyphenated segments until it finds a matching environment file.
10485#
10586# Returns: Path to the .j2 template relative to MULTI_SERVER_TESTS_BASE_DIR_ABS_PATH
10687#
@@ -145,7 +126,7 @@ define MAKE_TEST_TARGET
145126$(1 ) : TEST_NAME := $(1 )
146127$(1 ) : TEST_FILENAME := $$(TEST_NAME ) .yml
147128
148- # Find which environment Compose template to use (must exist)
129+ # Find which environment Compose template to use
149130$(1 ) : ENV_COMPOSE_TEMPLATE_PATH := $$(call FIND_ENV_COMPOSE_J2,$$(TEST_NAME ) )
150131
151132# Output Compose file path (strip .j2 extension)
@@ -155,10 +136,9 @@ $(1): ENV_COMPOSE_PATH := $$(patsubst %.j2,%,$$(ENV_COMPOSE_TEMPLATE_PATH))
155136# Example: environments/docker-compose/env-5hs-autoaccept.yml -> 5hs-autoaccept
156137$(1 ) : ENV_STEM := $$(patsubst environments/docker-compose/env-% .yml,% ,$$(ENV_COMPOSE_PATH ) )
157138
158- # Jinja2 variables file (aligned to environment stem)
139+ # Jinja2 variables file
159140$(1 ) : VARS_FILE_REL ?= environments/jinja-vars/env-$$(ENV_STEM ) .vars.yml
160141
161- # ---- Test Execution ----
162142$(1 ) : clone
163143 @echo "MULTI_SERVER_BUILD_DIR_REL_PATH=$(MULTI_SERVER_BUILD_DIR_REL_PATH ) "
164144 @echo "MULTI_SERVER_BUILD_DIR_ABS_PATH=$(MULTI_SERVER_BUILD_DIR_ABS_PATH ) "
@@ -203,44 +183,32 @@ $(1): clone
203183 echo " DEBUG: ENV_COMPOSE_TEMPLATE_ABS = $$$$ENV_COMPOSE_TEMPLATE_ABS"; \
204184 echo " DEBUG: ENV_COMPOSE_ABS = $$$$ENV_COMPOSE_ABS"; \
205185 echo " DEBUG: TEST_FILENAME_ABS = $$$$TEST_FILENAME_ABS"; \
206- echo " ✓ Variables set successfully"; \
207- \
208- echo ""; \
209- echo "Configuration:"; \
210- echo " TEST_NAME = $(1 ) "; \
211- echo " TEST_FILENAME = $$(TEST_FILENAME ) "; \
212- echo " TEST_FILENAME_ABS = $$$$TEST_FILENAME_ABS"; \
213- echo " ENV_STEM = $$(ENV_STEM ) "; \
214- echo " ENV_COMPOSE_PATH = $$(ENV_COMPOSE_PATH ) "; \
215- echo " VARS_FILE_REL = $$(VARS_FILE_REL ) "; \
216- echo " LISTENER_DIR = $$$$LISTENER_DIR"; \
217- echo ""; \
218186 \
219187 echo "==> [Step 6/7] Validating required files"; \
220188 \
221189 test -f "$$$$VARS_FILE_ABS" || { \
222190 echo "ERROR: Missing vars file: $$$$VARS_FILE_ABS" >&2; exit 1; \
223191 }; \
224- echo " ✓ Found vars file"; \
192+ echo " - Found vars file"; \
225193 test -f "$$$$ENV_COMPOSE_TEMPLATE_ABS" || { \
226194 echo "ERROR: Missing compose template: $$$$ENV_COMPOSE_TEMPLATE_ABS" >&2; exit 1; \
227195 }; \
228- echo " ✓ Found compose template"; \
196+ echo " - Found compose template"; \
229197 test -f "$$$$TEST_FILENAME_ABS" || { \
230198 echo "ERROR: Missing test file: $$$$TEST_FILENAME_ABS" >&2; exit 1; \
231199 }; \
232- echo " ✓ Found test file"; \
200+ echo " - Found test file"; \
233201 echo ""; \
234202 \
235203 echo "==> [Step 7/7] Rendering Jinja2 templates and running tests"; \
236204 \
237- echo " → Reading jinja_templates_to_render from vars file"; \
205+ echo " - Reading jinja_templates_to_render from vars file"; \
238206 TEMPLATE_LIST_FILE=`mktemp`; \
239207 sed -n "/^jinja_templates_to_render:/,/^[A-Za-z0-9_].*:/p" "$$$$VARS_FILE_ABS" \
240208 | sed -n "s/^ - //p" > "$$$$TEMPLATE_LIST_FILE"; \
241209 \
242210 if [ -s "$$$$TEMPLATE_LIST_FILE" ]; then \
243- echo " → Templates to render:"; \
211+ echo " - Templates to render:"; \
244212 while IFS= read -r rel_tmpl; do \
245213 [ -n "$$$$rel_tmpl" ] || continue; \
246214 echo " - $$$$rel_tmpl"; \
@@ -253,13 +221,13 @@ $(1): clone
253221 test -f "$$$$aux_abs" || { echo "ERROR: Template not found: $$$$aux_abs" >&2; exit 1; }; \
254222 if [ -d "$$$$output_abs" ]; then \
255223 if [ -z "$$(ls -A "$$$$output_abs" ) " ]; then \
256- echo " → Removing empty directory blocking output: $$$$output_abs"; \
224+ echo " - Removing empty directory blocking output: $$$$output_abs"; \
257225 rmdir "$$$$output_abs"; \
258226 else \
259227 echo "ERROR: Output path is a non-empty directory: $$$$output_abs" >&2; exit 1; \
260228 fi; \
261229 fi; \
262- echo " → Rendering $$$$rel_tmpl"; \
230+ echo " - Rendering $$$$rel_tmpl"; \
263231 python3 src/config_builder.py \
264232 --vars-file "$$$$VARS_FILE_ABS" \
265233 --aux-file "$$$$aux_abs" \
@@ -273,12 +241,12 @@ $(1): clone
273241 test -f "$$$$ENV_COMPOSE_ABS" || { \
274242 echo "ERROR: Compose file was not generated: $$$$ENV_COMPOSE_ABS" >&2; exit 1; \
275243 }; \
276- echo " ✓ Generated compose file"; \
244+ echo " - Generated compose file"; \
277245 echo ""; \
278246 \
279- echo " → Running test-framework"; \
247+ echo " - Running test-framework"; \
280248 DATA_PATH="$$(MULTI_SERVER_TESTS_BASE_DIR_ABS_PATH ) environments/configs" \
281- make test-framework -- -x -vvv \
249+ make test-framework -- -x -v \
282250 --compose "$$$$ENV_COMPOSE_ABS" \
283251 --test "$$$$TEST_FILENAME_ABS" \
284252 --use-files \
0 commit comments