Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 7d9b9475 authored by hhakim's avatar hhakim
Browse files

Add junit test report to ctest (cpp tests) ci job and refactor junit2html...

Add junit test report to ctest (cpp tests) ci job and refactor junit2html generation for all ctest_* jobs.
parent b9e18973
No related branches found
No related tags found
No related merge requests found
...@@ -39,13 +39,19 @@ stages: ...@@ -39,13 +39,19 @@ stages:
ctest: ctest:
variables: {SLOW_TESTS: "OFF", BUILD_MULTITHREAD: "ON"} # the CDashConfScript is able to retrieve OpenMP_gomp_LIBRARY and OpenMP_INC_DIR from environment (it's necessary on macOS, so the runner's env. must be configured) variables: {SLOW_TESTS: "OFF", BUILD_MULTITHREAD: "ON"} # the CDashConfScript is able to retrieve OpenMP_gomp_LIBRARY and OpenMP_INC_DIR from environment (it's necessary on macOS, so the runner's env. must be configured)
script: script:
- if git log --oneline -n 1 --name-status | grep -E '\s+(src/|misc/test/src/C++)'; then ctest -O ctest.log -S ./CDashConfScript.cmake -j4; else echo 'nothing new to test in C++ code'; fi # C++ tests are executed only if something was modified in C++ lib or C++ tests # C++ tests are executed only if something was modified in C++ lib or C++ tests
- if git log --oneline -n 1 --name-status | grep -E '\s+(src/|misc/test/src/C++)'; then ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml; misc/continuous_integration/jobs/junit_html_report.sh cpp_test_report; else echo 'nothing new to test in C++ code'; if grep -B 1 'Outcome:.*Failed' $(ls build*/cpp_test_report.html | tail -1) | sed -ne 's%.*Test case:.*<b>\(.*\)</b>.*%\1%p'; then exit 1; else echo "all tests passed"; exit 0;fi; fi
except: except:
- schedules - schedules
- tags - tags
stage: test stage: test
tags: tags:
- linux - linux
artifacts:
paths:
- $(ls -d build* | tail -1)/cpp_test_report.html
when: always
expire_in: '6 months'
ctest_python: ctest_python:
before_script: before_script:
...@@ -54,13 +60,7 @@ ctest_python: ...@@ -54,13 +60,7 @@ ctest_python:
variables: {BUILD_WRAPPER_PYTHON: "ON", SLOW_TESTS: "OFF", DONT_PYPLOT_FAUST_TIME: "ON", NOCPPTESTS: "ON", NOPY2: "ON", BUILD_MULTITHREAD: "ON", BUILD_FLOAT_PYX: "ON"} #, GIT_STRATEGY: none} variables: {BUILD_WRAPPER_PYTHON: "ON", SLOW_TESTS: "OFF", DONT_PYPLOT_FAUST_TIME: "ON", NOCPPTESTS: "ON", NOPY2: "ON", BUILD_MULTITHREAD: "ON", BUILD_FLOAT_PYX: "ON"} #, GIT_STRATEGY: none}
script: script:
- ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml - ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml
- python3 -m venv junit_venv # use default python3 in PATH (the same has been used in ctest building -- cf. CDashConfScript) - misc/continuous_integration/jobs/junit_html_report.sh python_pyfaust_test_output
- source junit_venv/bin/activate
- pip install junit2html
- junit2html build_FaustLinuxPython/junit_output.xml build_FaustLinuxPython/python_pyfaust_test_output.html
- deactivate
- rm -Rf junit_venv
- 'echo The test report will be published here: https://gitlab.inria.fr/faustgrp/faust/-/jobs/${CI_JOB_ID}/artifacts/external_file/build_FaustLinuxPython/python_pyfaust_test_output.html'
# fail the ci job if any ctest test (or unit test) have failed # fail the ci job if any ctest test (or unit test) have failed
- echo "Failed tests:" - echo "Failed tests:"
- if grep -B 1 'Outcome:.*Failed' build_FaustLinuxPython/python_pyfaust_test_output.html | sed -ne 's%.*Test case:.*<b>\(.*\)</b>.*%\1%p'; then exit 1; else echo "all tests passed"; exit 0;fi - if grep -B 1 'Outcome:.*Failed' build_FaustLinuxPython/python_pyfaust_test_output.html | sed -ne 's%.*Test case:.*<b>\(.*\)</b>.*%\1%p'; then exit 1; else echo "all tests passed"; exit 0;fi
...@@ -77,21 +77,14 @@ ctest_python: ...@@ -77,21 +77,14 @@ ctest_python:
when: always when: always
expire_in: '6 months' expire_in: '6 months'
ctest_matlab: ctest_matlab:
variables: {BUILD_WRAPPER_MATLAB: "ON", SLOW_TESTS: "OFF", NOCPPTESTS: "ON", BUILD_MULTITHREAD: "OFF", BUILD_FLOAT_MEX: "ON"} # MT OFF because of macOS complicated way to enable OpenMP (but packages are OMP enabled) variables: {BUILD_WRAPPER_MATLAB: "ON", SLOW_TESTS: "OFF", NOCPPTESTS: "ON", BUILD_MULTITHREAD: "OFF", BUILD_FLOAT_MEX: "ON"} # MT OFF because of macOS complicated way to enable OpenMP (but packages are OMP enabled)
script: script:
# TODO: refactor with ctest_python script # TODO: refactor with ctest_python script
- ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml - ctest -O ctest.log -S ./CDashConfScript.cmake -j4 --output-junit junit_output.xml
- python3 -m venv junit_venv # use default python3 in PATH (the same has been used in ctest building -- cf. CDashConfScript) - misc/continuous_integration/jobs/junit_html_report.sh matlab_matfaust_test_output
- source junit_venv/bin/activate
- export BUILD_DIR=$(ls -d build_* | tail -1)
- pip install junit2html
- junit2html ${BUILD_DIR}/junit_output.xml ${BUILD_DIR}/matlab_matfaust_test_output.html
- deactivate
- rm -Rf junit_venv
- 'echo The test report will be published here: https://gitlab.inria.fr/faustgrp/faust/-/jobs/${CI_JOB_ID}/artifacts/external_file/${BUILD_DIR}/matlab_matfaust_test_output.html'
# fail the ci job if any ctest test (or unit test) have failed # fail the ci job if any ctest test (or unit test) have failed
- export BUILD_DIR=$(ls -d build | tail -1)
- echo "Failed tests:" - echo "Failed tests:"
- if grep -B 1 'Outcome:.*Failed' ${BUILD_DIR}/matlab_matfaust_test_output.html | sed -ne 's%.*Test case:.*<b>\(.*\)</b>.*%\1%p'; then exit 1; else if grep "Failure Summary:" ${BUILD_DIR}/matlab_matfaust_test_output.html; then echo "all ctest passed but some unit tests failed (look the junit report!)"; exit 2; else echo "(None) all tests passed"; exit 0;fi;fi - if grep -B 1 'Outcome:.*Failed' ${BUILD_DIR}/matlab_matfaust_test_output.html | sed -ne 's%.*Test case:.*<b>\(.*\)</b>.*%\1%p'; then exit 1; else if grep "Failure Summary:" ${BUILD_DIR}/matlab_matfaust_test_output.html; then echo "all ctest passed but some unit tests failed (look the junit report!)"; exit 2; else echo "(None) all tests passed"; exit 0;fi;fi
except: except:
......
#!/usr/bin/env bash
[[ $# -lt 1 ]] && echo "I need a report name" && exit 1
REPORT_NAME="$1"
python3 -m venv junit_venv # use default python3 in PATH (the same has been used in ctest building -- cf. CDashConfScript)
source junit_venv/bin/activate
export BUILD_DIR=$(ls -d build | tail -1)
pip install junit2html
junit2html ${BUILD_DIR}/junit_output.xml ${BUILD_DIR}/${REPORT_NAME}.html
deactivate
rm -Rf junit_venv
echo The test report will be published here: https://gitlab.inria.fr/faustgrp/faust/-/jobs/${CI_JOB_ID}/artifacts/external_file/${BUILD_DIR}/${REPORT_NAME}.html
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment