Loading .gitlab-ci.yml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -129,6 +129,7 @@ gkfs:integration: ## capture coverage information ## capture coverage information - cd ${BUILD_PATH} - cd ${BUILD_PATH} - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --capture integration_${SUBTEST} --capture integration_${SUBTEST} --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading Loading @@ -171,6 +172,7 @@ gkfwd:integration: ## capture coverage information ## capture coverage information - cd ${BUILD_PATH} - cd ${BUILD_PATH} - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --capture integration_${SUBTEST} --capture integration_${SUBTEST} --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading Loading @@ -205,6 +207,7 @@ gkfs:unit: ## capture coverage information ## capture coverage information - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --capture unit --capture unit --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading @@ -228,6 +231,7 @@ coverage: - cd ${BUILD_PATH} - cd ${BUILD_PATH} ## merge the partial coverage files from each test in the pipeline ## merge the partial coverage files from each test in the pipeline - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --merge --merge --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading scripts/ci/coverage.sh +57 −11 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,8 @@ export CCOV_BUILD_DIR="${PWD}" export CCOV_MODE="" export CCOV_MODE="" export CCOV_CAPTURE_NAME="" export CCOV_CAPTURE_NAME="" export CCOV_EXCLUSIONS_FILE=".coverage-exclusions" export CCOV_EXCLUSIONS_FILE=".coverage-exclusions" export CCOV_LOG_FILE="/dev/stdout" export CCOV_VERBOSE=false export GCOVR_EXTRA_OPTIONS=() export GCOVR_EXTRA_OPTIONS=() usage() { usage() { Loading Loading @@ -64,6 +66,10 @@ Options: and/or [[BUILD_DIR]] tags that will be expanded with the and/or [[BUILD_DIR]] tags that will be expanded with the appropriate values. appropriate values. Defaults to .coverage-exclusions. Defaults to .coverage-exclusions. -l, --log-file LOG_FILE Redirect output to LOG_FILE. -v, --verbose Increase verbosity. EOF EOF # EOF is found above and hence cat command stops reading. This is equivalent to # EOF is found above and hence cat command stops reading. This is equivalent to # echo but much neater when printing out. # echo but much neater when printing out. Loading @@ -76,8 +82,8 @@ parse_args() { # -l is for long options with double dash like --version # -l is for long options with double dash like --version # the comma separates different long options # the comma separates different long options options=$(getopt -l \ options=$(getopt -l \ "capture:,merge,help,root-dir:,build-dir:,exclusions:,output:" \ "capture:,merge,help,root-dir:,build-dir:,exclusions:,output:,log-file:,verbose" \ -o "cmhr:b:e:o:" -- "$@") -o "cmhr:b:e:o:l:v" -- "$@") # set --: # set --: # If no arguments follow this option, then the positional parameters are # If no arguments follow this option, then the positional parameters are Loading Loading @@ -162,6 +168,26 @@ parse_args() { export CCOV_EXCLUSIONS_FILE=$1 export CCOV_EXCLUSIONS_FILE=$1 ;; ;; -l|--log-file) shift if [[ -z $1 ]]; then echo "Missing mandatory argument for '${opt}'." exit 1 fi if [[ $1 =~ ^--.* ]]; then echo "Invalid argument '${1}' for '${opt}'." exit 1 fi export CCOV_LOG_FILE=$1 ;; -v|--verbose) CCOV_VERBOSE=true ;; --) --) shift shift GCOVR_EXTRA_OPTIONS="$@" GCOVR_EXTRA_OPTIONS="$@" Loading Loading @@ -206,19 +232,24 @@ capture() { ! [[ -d "${COVERAGE_OUTPUT_DIR}" ]] && mkdir -p "${COVERAGE_OUTPUT_DIR}" ! [[ -d "${COVERAGE_OUTPUT_DIR}" ]] && mkdir -p "${COVERAGE_OUTPUT_DIR}" exclude_args=() if [ "$CCOV_VERBOSE" = true ]; then printf "Executing capture command:" for p in "${CCOV_EXCLUSIONS[@]}"; printf " gcovr" do printf " --root ${CCOV_ROOT_DIR}" exclude_args+=( "--exclude '${p}'" ) printf " %s\n" "${CCOV_EXCLUSIONS[@]/#/--exclude=}" done printf " --json" printf " --output ${COVERAGE_OUTPUT_DIR}/coverage.json" printf " --verbose" printf " %s\n" "${GCOVR_EXTRA_OPTIONS[@]}" fi gcovr \ gcovr \ --root "${CCOV_ROOT_DIR}" \ --root "${CCOV_ROOT_DIR}" \ "${CCOV_EXCLUSIONS[@]/#/--exclude=/}" \ "${CCOV_EXCLUSIONS[@]/#/--exclude=}" \ --json \ --json \ --output "${COVERAGE_OUTPUT_DIR}/coverage.json" \ --output "${COVERAGE_OUTPUT_DIR}/coverage.json" \ ${GCOVR_EXTRA_OPTIONS[@]} --verbose \ ${GCOVR_EXTRA_OPTIONS[@]} > "${CCOV_LOG_FILE}" 2>&1 echo "Coverage report written to ${COVERAGE_OUTPUT_DIR}/coverage.json" echo "Coverage report written to ${COVERAGE_OUTPUT_DIR}/coverage.json" } } Loading @@ -234,6 +265,20 @@ merge() { mapfile -d $'\0' tracefiles < \ mapfile -d $'\0' tracefiles < \ <(find "${PWD}/.coverage/partial" -name coverage.json -print0) <(find "${PWD}/.coverage/partial" -name coverage.json -print0) if [ "$CCOV_VERBOSE" = true ]; then printf "Executing merge command:" printf " gcovr" printf " --root ${CCOV_ROOT_DIR}" printf " %s\n" "${tracefiles[@]/#/--add-tracefile=}" printf " --html-details ${COVERAGE_OUTPUT_DIR}/coverage.html" printf " --xml" printf " --output ${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" printf " --print-summary" printf " --verbose" printf " %s\n" "${GCOVR_EXTRA_OPTIONS[@]}" fi gcovr \ gcovr \ --root "${CCOV_ROOT_DIR}" \ --root "${CCOV_ROOT_DIR}" \ "${tracefiles[@]/#/--add-tracefile=}" \ "${tracefiles[@]/#/--add-tracefile=}" \ Loading @@ -241,7 +286,8 @@ merge() { --xml \ --xml \ --output "${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" \ --output "${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" \ --print-summary \ --print-summary \ ${GCOVR_EXTRA_OPTIONS[@]} --verbose \ ${GCOVR_EXTRA_OPTIONS[@]} > "${CCOV_LOG_FILE}" 2>&1 echo "Cobertura XML report written to ${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" echo "Cobertura XML report written to ${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" echo "HTML report written to ${COVERAGE_OUTPUT_DIR}/coverage.html" echo "HTML report written to ${COVERAGE_OUTPUT_DIR}/coverage.html" Loading Loading
.gitlab-ci.yml +4 −0 Original line number Original line Diff line number Diff line Loading @@ -129,6 +129,7 @@ gkfs:integration: ## capture coverage information ## capture coverage information - cd ${BUILD_PATH} - cd ${BUILD_PATH} - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --capture integration_${SUBTEST} --capture integration_${SUBTEST} --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading Loading @@ -171,6 +172,7 @@ gkfwd:integration: ## capture coverage information ## capture coverage information - cd ${BUILD_PATH} - cd ${BUILD_PATH} - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --capture integration_${SUBTEST} --capture integration_${SUBTEST} --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading Loading @@ -205,6 +207,7 @@ gkfs:unit: ## capture coverage information ## capture coverage information - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --capture unit --capture unit --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading @@ -228,6 +231,7 @@ coverage: - cd ${BUILD_PATH} - cd ${BUILD_PATH} ## merge the partial coverage files from each test in the pipeline ## merge the partial coverage files from each test in the pipeline - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh - ${CI_PROJECT_DIR}/scripts/ci/coverage.sh --verbose --merge --merge --root-dir ${CI_PROJECT_DIR} --root-dir ${CI_PROJECT_DIR} --build-dir ${BUILD_PATH} --build-dir ${BUILD_PATH} Loading
scripts/ci/coverage.sh +57 −11 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,8 @@ export CCOV_BUILD_DIR="${PWD}" export CCOV_MODE="" export CCOV_MODE="" export CCOV_CAPTURE_NAME="" export CCOV_CAPTURE_NAME="" export CCOV_EXCLUSIONS_FILE=".coverage-exclusions" export CCOV_EXCLUSIONS_FILE=".coverage-exclusions" export CCOV_LOG_FILE="/dev/stdout" export CCOV_VERBOSE=false export GCOVR_EXTRA_OPTIONS=() export GCOVR_EXTRA_OPTIONS=() usage() { usage() { Loading Loading @@ -64,6 +66,10 @@ Options: and/or [[BUILD_DIR]] tags that will be expanded with the and/or [[BUILD_DIR]] tags that will be expanded with the appropriate values. appropriate values. Defaults to .coverage-exclusions. Defaults to .coverage-exclusions. -l, --log-file LOG_FILE Redirect output to LOG_FILE. -v, --verbose Increase verbosity. EOF EOF # EOF is found above and hence cat command stops reading. This is equivalent to # EOF is found above and hence cat command stops reading. This is equivalent to # echo but much neater when printing out. # echo but much neater when printing out. Loading @@ -76,8 +82,8 @@ parse_args() { # -l is for long options with double dash like --version # -l is for long options with double dash like --version # the comma separates different long options # the comma separates different long options options=$(getopt -l \ options=$(getopt -l \ "capture:,merge,help,root-dir:,build-dir:,exclusions:,output:" \ "capture:,merge,help,root-dir:,build-dir:,exclusions:,output:,log-file:,verbose" \ -o "cmhr:b:e:o:" -- "$@") -o "cmhr:b:e:o:l:v" -- "$@") # set --: # set --: # If no arguments follow this option, then the positional parameters are # If no arguments follow this option, then the positional parameters are Loading Loading @@ -162,6 +168,26 @@ parse_args() { export CCOV_EXCLUSIONS_FILE=$1 export CCOV_EXCLUSIONS_FILE=$1 ;; ;; -l|--log-file) shift if [[ -z $1 ]]; then echo "Missing mandatory argument for '${opt}'." exit 1 fi if [[ $1 =~ ^--.* ]]; then echo "Invalid argument '${1}' for '${opt}'." exit 1 fi export CCOV_LOG_FILE=$1 ;; -v|--verbose) CCOV_VERBOSE=true ;; --) --) shift shift GCOVR_EXTRA_OPTIONS="$@" GCOVR_EXTRA_OPTIONS="$@" Loading Loading @@ -206,19 +232,24 @@ capture() { ! [[ -d "${COVERAGE_OUTPUT_DIR}" ]] && mkdir -p "${COVERAGE_OUTPUT_DIR}" ! [[ -d "${COVERAGE_OUTPUT_DIR}" ]] && mkdir -p "${COVERAGE_OUTPUT_DIR}" exclude_args=() if [ "$CCOV_VERBOSE" = true ]; then printf "Executing capture command:" for p in "${CCOV_EXCLUSIONS[@]}"; printf " gcovr" do printf " --root ${CCOV_ROOT_DIR}" exclude_args+=( "--exclude '${p}'" ) printf " %s\n" "${CCOV_EXCLUSIONS[@]/#/--exclude=}" done printf " --json" printf " --output ${COVERAGE_OUTPUT_DIR}/coverage.json" printf " --verbose" printf " %s\n" "${GCOVR_EXTRA_OPTIONS[@]}" fi gcovr \ gcovr \ --root "${CCOV_ROOT_DIR}" \ --root "${CCOV_ROOT_DIR}" \ "${CCOV_EXCLUSIONS[@]/#/--exclude=/}" \ "${CCOV_EXCLUSIONS[@]/#/--exclude=}" \ --json \ --json \ --output "${COVERAGE_OUTPUT_DIR}/coverage.json" \ --output "${COVERAGE_OUTPUT_DIR}/coverage.json" \ ${GCOVR_EXTRA_OPTIONS[@]} --verbose \ ${GCOVR_EXTRA_OPTIONS[@]} > "${CCOV_LOG_FILE}" 2>&1 echo "Coverage report written to ${COVERAGE_OUTPUT_DIR}/coverage.json" echo "Coverage report written to ${COVERAGE_OUTPUT_DIR}/coverage.json" } } Loading @@ -234,6 +265,20 @@ merge() { mapfile -d $'\0' tracefiles < \ mapfile -d $'\0' tracefiles < \ <(find "${PWD}/.coverage/partial" -name coverage.json -print0) <(find "${PWD}/.coverage/partial" -name coverage.json -print0) if [ "$CCOV_VERBOSE" = true ]; then printf "Executing merge command:" printf " gcovr" printf " --root ${CCOV_ROOT_DIR}" printf " %s\n" "${tracefiles[@]/#/--add-tracefile=}" printf " --html-details ${COVERAGE_OUTPUT_DIR}/coverage.html" printf " --xml" printf " --output ${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" printf " --print-summary" printf " --verbose" printf " %s\n" "${GCOVR_EXTRA_OPTIONS[@]}" fi gcovr \ gcovr \ --root "${CCOV_ROOT_DIR}" \ --root "${CCOV_ROOT_DIR}" \ "${tracefiles[@]/#/--add-tracefile=}" \ "${tracefiles[@]/#/--add-tracefile=}" \ Loading @@ -241,7 +286,8 @@ merge() { --xml \ --xml \ --output "${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" \ --output "${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" \ --print-summary \ --print-summary \ ${GCOVR_EXTRA_OPTIONS[@]} --verbose \ ${GCOVR_EXTRA_OPTIONS[@]} > "${CCOV_LOG_FILE}" 2>&1 echo "Cobertura XML report written to ${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" echo "Cobertura XML report written to ${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml" echo "HTML report written to ${COVERAGE_OUTPUT_DIR}/coverage.html" echo "HTML report written to ${COVERAGE_OUTPUT_DIR}/coverage.html" Loading