Skip to content

Commit 1dc4a46

Browse files
committed
Use pytest system test runner in CI
Replace the legacy system test runner by the pytest system test runner. Since EL7 and OpenBSD have only ancient versions of pytest / xdist, keep using the legacy test runner there for now. Out of tree tests aren't supported by the pytest runner yet. Use the legacy test runner for that purpose as well. Use awk to display failures and errors at the end of the log for convenience, since pytest displays them first, which makes them difficult to find.
1 parent f6a83ac commit 1dc4a46

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.gitlab-ci.yml

+25-5
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ stages:
239239
- PYTHON="$(source bin/tests/system/conf.sh; echo $PYTHON)"
240240
- test -x "$PYTHON"
241241

242+
.find_pytest: &find_pytest
243+
- PYTEST="$(source bin/tests/system/conf.sh; echo $PYTEST)"
244+
- test -x "$PYTEST"
245+
242246
.parse_tsan: &parse_tsan
243247
- find -name 'tsan.*' -exec "$PYTHON" util/parse_tsan.py {} \;
244248

@@ -303,6 +307,17 @@ stages:
303307
before_script:
304308
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
305309
- *setup_interfaces
310+
script:
311+
- *find_pytest
312+
- cd bin/tests/system
313+
- >
314+
"$PYTEST" --junit-xml="$CI_PROJECT_DIR"/junit.xml -n "$TEST_PARALLEL_JOBS" --dist loadscope | tee pytest.out.txt
315+
- '( ! grep -F "grep: warning:" pytest.out.txt )'
316+
after_script:
317+
- awk '/^=+ FAILURES =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt
318+
- awk '/^=+ ERRORS =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt
319+
320+
.system_test_legacy: &system_test_legacy
306321
script:
307322
- cd bin/tests/system
308323
- make -j${TEST_PARALLEL_JOBS:-1} -k check V=1
@@ -321,6 +336,8 @@ stages:
321336
<<: *system_test_common
322337
artifacts:
323338
untracked: true
339+
exclude:
340+
- "**/__pycache__/**/*"
324341
when: always
325342
reports:
326343
junit: junit.xml
@@ -329,18 +346,19 @@ stages:
329346
<<: *system_test_common
330347
artifacts:
331348
untracked: true
349+
exclude:
350+
- "**/__pycache__/**/*"
332351
when: always
333352

334353
.system_test_tsan: &system_test_tsan_job
335354
<<: *system_test_common
336355
after_script:
337-
- cat bin/tests/system/test-suite.log
338-
- *find_python
339-
- *parse_tsan
340-
- >
341-
"$PYTHON" bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
356+
- awk '/^=+ FAILURES =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt
357+
- awk '/^=+ ERRORS =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt
342358
artifacts:
343359
untracked: true
360+
exclude:
361+
- "**/__pycache__/**/*"
344362
when: always
345363
reports:
346364
junit: junit.xml
@@ -791,6 +809,7 @@ system:gcc:out-of-tree:
791809
artifacts: true
792810
<<: *base_image
793811
<<: *system_test_job
812+
<<: *system_test_legacy
794813
<<: *api_schedules_tags_triggers_web_triggering_rules
795814

796815
unit:gcc:out-of-tree:
@@ -1125,6 +1144,7 @@ clang:openbsd:amd64:
11251144
system:clang:openbsd:amd64:
11261145
<<: *openbsd_amd64_image
11271146
<<: *system_test_job
1147+
<<: *system_test_legacy
11281148
<<: *api_schedules_triggers_web_triggering_rules
11291149
variables:
11301150
USER: gitlab-runner

0 commit comments

Comments
 (0)