Skip to content

Commit

Permalink
ci: Add code coverage job for GitLab
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabrielcarvfer committed Sep 7, 2024
1 parent 59ae023 commit 498a832
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
6 changes: 4 additions & 2 deletions build-support/custom-modules/ns3-coverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ if(${NS3_COVERAGE})
else()
add_custom_target(
coverage_cobertura
COMMAND lcov_cobertura ns3.info --output cobertura.xml --demangle
WORKING_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/coverage
COMMAND
lcov_cobertura ${CMAKE_OUTPUT_DIRECTORY}/coverage/ns3.info --output
${CMAKE_OUTPUT_DIRECTORY}/coverage/cobertura.xml --demangle
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
DEPENDS coverage_gcc
)
endif()
Expand Down
30 changes: 28 additions & 2 deletions utils/tests/gitlab-ci-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
- pacman-key --init
- pacman -Syu --noconfirm
base-devel cmake ninja ccache valgrind
python
python python-pip python-distutils-extra binutils lcov
boost gsl gtk3 openmpi
glibc-debug
openssh git
- pip install lcov_cobertura --break-system-packages
script:
- mkdir -p $CCACHE_BASEDIR_VALUE
- export CCACHE_BASEDIR=${PWD}
Expand All @@ -25,7 +26,7 @@
# missing the flag --disable-python
- ./ns3 configure -d $MODE -GNinja --enable-examples --enable-tests --enable-mpi --disable-gtk $EXTRA_OPTIONS
- if [[ "$CI_JOB_STAGE" == "build" ]];
then ./ns3 build;
then ./ns3 build $TARGET;
fi
- if [[ "$CI_JOB_STAGE" == "test" ]] || [[ "$FORCE_TESTS" == "Force" ]];
then ./test.py -n $VALGRIND_FLAG $FULLNESS;
Expand Down Expand Up @@ -237,3 +238,28 @@ weekly-build-test-takes-forever-optimized:
tags:
- nsnam
- linux

# Code coverage scanning
weekly-build-coverage:
extends: .base-test
rules:
- if: $RELEASE == "weekly"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
allow_failure: true
stage: build
needs: ["weekly-slow-jobs"]
dependencies: []
variables:
MODE: debug
EXTRA_OPTIONS: "--enable-gcov --disable-asserts --disable-logs"
TARGET: coverage_cobertura
artifacts:
paths:
- build/coverage/cobertura.xml
reports:
coverage_report:
coverage_format: cobertura
path: build/coverage/cobertura.xml
tags:
- nsnam
- linux

0 comments on commit 498a832

Please sign in to comment.