2121# DESELECT_FROM_FILE: path to file with tests to deselect
2222# CLUSTERS_COUNT: number of local testnet clusters to launch
2323# FORBID_RESTART: if set to 1, do not restart clusters between tests
24+ # SESSION_TIMEOUT: overall timeout for the test session (e.g. 10800 for 3 hours)
2425#
2526# Notes:
2627# - If PYTEST_ARGS is provided, we disable cleanup and the initial "skip all" pass.
@@ -51,9 +52,14 @@ All targets respect the same env vars as the original Makefile.
5152EOF
5253}
5354
54- pytest_w_echo () {
55- echo " Running: PYTEST_ADDOPTS='${PYTEST_ADDOPTS:- } ' pytest $* "
56- pytest " $@ "
55+ run_pytest () {
56+ if [ -n " ${SESSION_TIMEOUT:- } " ]; then
57+ echo " Running with session timeout of ${SESSION_TIMEOUT} : PYTEST_ADDOPTS='${PYTEST_ADDOPTS:- } ' pytest $* "
58+ timeout --signal=INT --kill-after=0 " $SESSION_TIMEOUT " pytest " $@ "
59+ else
60+ echo " Running: PYTEST_ADDOPTS='${PYTEST_ADDOPTS:- } ' pytest $* "
61+ pytest " $@ "
62+ fi
5763}
5864
5965ensure_dirs () {
@@ -133,7 +139,7 @@ initial_skip_pass() {
133139}
134140
135141run_real_tests () {
136- pytest_w_echo \
142+ run_pytest \
137143 " $TESTS_DIR " \
138144 " ${MARKEXPR_ARR[@]} " \
139145 " ${DESELECT_FROM_FILE_ARR[@]} " \
@@ -157,41 +163,44 @@ ensure_markexpr_default() {
157163target_tests () {
158164 export DbSyncAbortOnPanic=" ${DbSyncAbortOnPanic:- 1} "
159165 TEST_THREADS=" ${TEST_THREADS:- 20} "
166+ SESSION_TIMEOUT=" ${SESSION_TIMEOUT:- 72000} "
160167
161168 ensure_dirs
162169 set_common_env
163170 compute_common_args
164171 cleanup_previous_run
165172 initial_skip_pass
166- run_real_tests --timeout=10800 --session-timeout=72000 " $@ "
173+ run_real_tests --timeout=10800 " $@ "
167174}
168175
169176target_testpr () {
170177 export TESTPR=1
171178 export CLUSTERS_COUNT=" ${CLUSTERS_COUNT:- 5} "
172179 TEST_THREADS=" ${TEST_THREADS:- 20} "
180+ SESSION_TIMEOUT=" ${SESSION_TIMEOUT:- 27000} "
173181 ensure_markexpr_default " smoke"
174182
175183 ensure_dirs
176184 set_common_env
177185 compute_common_args
178186 cleanup_previous_run
179187 initial_skip_pass
180- run_real_tests --timeout=1200 --session-timeout=2700 " $@ "
188+ run_real_tests --timeout=1200 " $@ "
181189}
182190
183191target_testnets () {
184192 export CLUSTERS_COUNT=1
185193 export FORBID_RESTART=1
186194 TEST_THREADS=" ${TEST_THREADS:- 15} "
195+ SESSION_TIMEOUT=" ${SESSION_TIMEOUT:- 10800} "
187196 ensure_markexpr_default " testnets"
188197
189198 ensure_dirs
190199 set_common_env
191200 compute_common_args
192201 cleanup_previous_run
193202 initial_skip_pass
194- run_real_tests --timeout=7200 --session-timeout=10800 " $@ "
203+ run_real_tests --timeout=7200 " $@ "
195204}
196205
197206# Dispatch
0 commit comments