From 3777b4b6c013ab882da09cfbfbea949fe7e0eb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Wed, 22 Jun 2022 12:59:33 +0200 Subject: [PATCH] Clean up convert-trs-to-junit.py invocations - Use absolute paths when invoking the convert-trs-to-junit.py script so that it also works correctly for out-of-tree and tarball-based test jobs. - Quote the variables used in convert-trs-to-junit.py invocations to future-proof the code. - Use "&&" instead of ";" in shell pipelines invoking the convert-trs-to-junit.py script in order to prevent "source" errors from being silently ignored. - Ensure convert-trs-to-junit.py is invoked from the correct directory for out-of-tree and tarball-based unit test jobs by adding appropriate "cd" invocations. - Ensure the convert-trs-to-junit.py invocations are always the last step in each 'after_script', in order to run that script from the correct directory for out-of-tree and tarball-based system test jobs and to ensure that any potential errors in that script do not prevent more important steps in the 'after_script' from being executed. (cherry picked from commit 2cd20ee3702b72456197ffd2f612b506795d8a10) --- .gitlab-ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6cd65121e2..e932726513 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -302,10 +302,10 @@ stages: - make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 - if git rev-parse > /dev/null 2>&1; then ( ! grep "^I:.*:file.*not removed$" *.log ); fi after_script: - - (source bin/tests/system/conf.sh; $PYTHON bin/tests/convert-trs-to-junit.py . > junit.xml) - test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" - test -d bind-* && cd bind-* - cat bin/tests/system/test-suite.log + - (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml") .system_test: &system_test_job <<: *system_test_common @@ -328,7 +328,7 @@ stages: after_script: - cat bin/tests/system/test-suite.log - find bin -name 'tsan.*' -exec python3 util/parse_tsan.py {} \; - - (source bin/tests/system/conf.sh; $PYTHON bin/tests/convert-trs-to-junit.py . > junit.xml) + - (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml") artifacts: expire_in: "1 day" untracked: true @@ -344,7 +344,9 @@ stages: script: - make -j${TEST_PARALLEL_JOBS:-1} -k unit V=1 after_script: - - (source bin/tests/system/conf.sh; $PYTHON bin/tests/convert-trs-to-junit.py . > junit.xml) + - test -n "${OUT_OF_TREE_WORKSPACE}" && cd "${OUT_OF_TREE_WORKSPACE}" + - test -d bind-* && cd bind-* + - (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml") .unit_test: &unit_test_job <<: *unit_test_common @@ -366,7 +368,7 @@ stages: <<: *unit_test_common after_script: - find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \; - - (source bin/tests/system/conf.sh; $PYTHON bin/tests/convert-trs-to-junit.py . > junit.xml) + - (source bin/tests/system/conf.sh && "${PYTHON}" "${CI_PROJECT_DIR}/bin/tests/convert-trs-to-junit.py" . > "${CI_PROJECT_DIR}/junit.xml") artifacts: expire_in: "1 day" paths: