Skip to content

Commit 75a3155

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. (cherry picked from commit 4bc2b3b)
1 parent 2c167bb commit 75a3155

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.gitlab-ci.yml

+26-1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ stages:
249249
- PYTHON="$(source bin/tests/system/conf.sh; echo $PYTHON)"
250250
- test -x "$PYTHON"
251251

252+
.find_pytest: &find_pytest
253+
- PYTEST="$(source bin/tests/system/conf.sh; echo $PYTEST)"
254+
- test -x "$PYTEST"
255+
252256
.parse_tsan: &parse_tsan
253257
- find -name 'tsan.*' -exec "$PYTHON" util/parse_tsan.py {} \;
254258

@@ -313,6 +317,17 @@ stages:
313317
before_script:
314318
- test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}"
315319
- *setup_interfaces
320+
script:
321+
- *find_pytest
322+
- cd bin/tests/system
323+
- >
324+
"$PYTEST" --junit-xml="$CI_PROJECT_DIR"/junit.xml -n "$TEST_PARALLEL_JOBS" --dist loadscope | tee pytest.out.txt
325+
- '( ! grep -F "grep: warning:" pytest.out.txt )'
326+
after_script:
327+
- awk '/^=+ FAILURES =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt || true
328+
- awk '/^=+ ERRORS =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt || true
329+
330+
.system_test_legacy: &system_test_legacy
316331
script:
317332
- cd bin/tests/system
318333
- make -j${TEST_PARALLEL_JOBS:-1} -k check V=1
@@ -332,6 +347,8 @@ stages:
332347
<<: *system_test_common
333348
artifacts:
334349
untracked: true
350+
exclude:
351+
- "**/__pycache__/**/*"
335352
when: always
336353
reports:
337354
junit: junit.xml
@@ -340,19 +357,24 @@ stages:
340357
<<: *system_test_common
341358
artifacts:
342359
untracked: true
360+
exclude:
361+
- "**/__pycache__/**/*"
343362
when: always
344363

345364
.system_test_tsan: &system_test_tsan_job
346365
<<: *system_test_common
347366
after_script:
348-
- cat bin/tests/system/test-suite.log
367+
- awk '/^=+ FAILURES =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt || true
368+
- awk '/^=+ ERRORS =+/{flag=1;next}/^=+.*=+$/{flag=0}flag' bin/tests/system/pytest.out.txt || true
349369
- find bin/tests/system -name "*dig.*" | xargs grep "error" || true
350370
- *find_python
351371
- *parse_tsan
352372
- >
353373
"$PYTHON" bin/tests/convert-trs-to-junit.py . > "$CI_PROJECT_DIR"/junit.xml
354374
artifacts:
355375
untracked: true
376+
exclude:
377+
- "**/__pycache__/**/*"
356378
when: always
357379
reports:
358380
junit: junit.xml
@@ -604,6 +626,7 @@ gcc:oraclelinux7:amd64:
604626
system:gcc:oraclelinux7:amd64:
605627
<<: *oraclelinux_7_amd64_image
606628
<<: *system_test_job
629+
<<: *system_test_legacy
607630
needs:
608631
- job: gcc:oraclelinux7:amd64
609632
artifacts: true
@@ -830,6 +853,7 @@ system:gcc:out-of-tree:
830853
artifacts: true
831854
<<: *base_image
832855
<<: *system_test_job
856+
<<: *system_test_legacy
833857
<<: *api_schedules_tags_triggers_web_triggering_rules
834858

835859
unit:gcc:out-of-tree:
@@ -1191,6 +1215,7 @@ clang:openbsd:amd64:
11911215
system:clang:openbsd:amd64:
11921216
<<: *openbsd_amd64_image
11931217
<<: *system_test_job
1218+
<<: *system_test_legacy
11941219
<<: *api_schedules_triggers_web_triggering_rules
11951220
variables:
11961221
USER: gitlab-runner

0 commit comments

Comments
 (0)