Skip to content

Commit 79fd209

Browse files
committed
DAOS-19111 build: Enable code coverage
Enable the option for generating Bullseye code coverage reports. Signed-off-by: Phil Henderson <phillip.henderson@hpe.com>
1 parent 54a7558 commit 79fd209

35 files changed

Lines changed: 1473 additions & 584 deletions

Jenkinsfile

Lines changed: 950 additions & 354 deletions
Large diffs are not rendered by default.

ci/bullseye_generate_report.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

ci/provisioning/post_provision_config.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ if ! retry_cmd 2400 clush -B -S -l root -w "$NODESTRING" \
143143
DAOS_CI_INFO_DIR=\"${DAOS_CI_INFO_DIR:?DAOS_CI_INFO_DIR is missing. Can not continue with node(s) provisioning process}\"
144144
CI_SCONS_ARGS=\"${CI_SCONS_ARGS:-}\"
145145
PYTHON_VERSION=\"${PYTHON_VERSION}\"
146+
CI_BULLSEYE=\"${CI_BULLSEYE:-false}\"
146147
$(cat ci/stacktrace.sh)
147148
$(cat ci/junit.sh)
148149
$(cat ci/provisioning/post_provision_config_common_functions.sh)

ci/provisioning/post_provision_config_common_functions.sh

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,41 @@ add_repo() {
6060
fi
6161
}
6262

63+
add_inst_repo() {
64+
local repo="$1"
65+
local branch="$2"
66+
local build_number="$3"
67+
local distro_name="$4"
68+
local bullseye="${5:-false}"
69+
local sudo="${6:-false}"
70+
local dnf_cmd=("dnf" "-y")
71+
local repo_base="${ARTIFACTS_URL:-${JENKINS_URL}job/}daos-stack/job/${repo}/job/${branch//\//%252F}/${build_number}/artifact/artifacts"
72+
local repo_url="${repo_base}/$distro_name/"
73+
if [[ "$bullseye" == "true" ]]; then
74+
repo_url="${repo_base}/${distro_name}-bullseye/"
75+
fi
76+
if [[ "$sudo" == "true" ]]; then
77+
dnf_cmd=("sudo" "${dnf_cmd[@]}")
78+
fi
79+
"${dnf_cmd[@]}" config-manager --add-repo="$repo_url"
80+
repo="$(url_to_repo "$repo_url")"
81+
# PR-repos: should always be able to upgrade modular packages
82+
"${dnf_cmd[@]}" config-manager --save --setopt "$repo.module_hotfixes=true" "$repo"
83+
disable_gpg_check "$repo_url" "$sudo"
84+
}
85+
6386
disable_gpg_check() {
6487
local url="$1"
88+
local sudo="${2:-false}"
89+
local dnf_cmd=("dnf" "-y")
90+
if [[ "$sudo" == "true" ]]; then
91+
dnf_cmd=("sudo" "${dnf_cmd[@]}")
92+
fi
6593

6694
repo="$(url_to_repo "$url")"
6795
# bug in EL7 DNF: this needs to be enabled before it can be disabled
68-
dnf -y config-manager --save --setopt="$repo".gpgcheck=1
69-
dnf -y config-manager --save --setopt="$repo".gpgcheck=0
96+
"${dnf_cmd[@]}" config-manager --save --setopt="$repo".gpgcheck=1
97+
"${dnf_cmd[@]}" config-manager --save --setopt="$repo".gpgcheck=0
7098
# but even that seems to be not enough, so just brute-force it
7199
if [ -d /etc/yum.repos.d ] &&
72100
! grep gpgcheck /etc/yum.repos.d/"$repo".repo; then
@@ -304,6 +332,8 @@ update_repos() {
304332
}
305333

306334
post_provision_config_nodes() {
335+
local bullseye="${1:-false}"
336+
307337
# shellcheck disable=SC2154
308338
if ! update_repos "$DISTRO_NAME"; then
309339
# need to use the image supplied repos
@@ -379,16 +409,7 @@ post_provision_config_nodes() {
379409
branch="${branch%:*}"
380410
fi
381411
fi
382-
local subdir
383-
if ! $COVFN_DISABLED; then
384-
subdir="bullseye/"
385-
fi
386-
local repo_url="${ARTIFACTS_URL:-${JENKINS_URL}job/}"daos-stack/job/"$repo"/job/"${branch//\//%252F}"/"$build_number"/artifact/artifacts/"${subdir:-}"$DISTRO_NAME/
387-
dnf -y config-manager --add-repo="$repo_url"
388-
repo="$(url_to_repo "$repo_url")"
389-
# PR-repos: should always be able to upgrade modular packages
390-
dnf -y config-manager --save --setopt "$repo.module_hotfixes=true" "$repo"
391-
disable_gpg_check "$repo_url"
412+
add_inst_repo "${repo}" "${branch}" "${build_number}" "${DISTRO_NAME}" "${bullseye}"
392413
done
393414

394415
# start with everything fully up-to-date

ci/provisioning/post_provision_config_nodes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fi
6363

6464
# defined in ci/functional/post_provision_config_nodes_<distro>.sh
6565
# and catted to the remote node along with this script
66-
if ! post_provision_config_nodes; then
66+
if ! post_provision_config_nodes "${CI_BULLSEYE}"; then
6767
rc=${PIPESTATUS[0]}
6868
echo "post_provision_config_nodes failed with rc=$rc"
6969
exit "$rc"

ci/rpm/build_deps.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
#!/bin/bash
2+
#
3+
# Copyright 2025-2026 Hewlett Packard Enterprise Development LP
4+
#
5+
# Build DAOS dependencies
6+
code_coverage="${1:-false}"
7+
bullseye_key="${2:-}"
8+
mydir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
9+
210
cd /home/daos/pre || exit 1
311
scons install --build-deps=only USE_INSTALLED=all PREFIX=/opt/daos TARGET_TYPE=release -j 32
12+
13+
if [[ "${code_coverage}" == "true" ]] ; then
14+
pushd "${mydir}/../.." || exit 1
15+
utils/rpms/bullseye_build.sh "${bullseye_key}"
16+
popd || exit 1
17+
fi

ci/rpm/build_success.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ elif [ -d /var/cache/pbuilder/ ]; then
4343
fi
4444

4545
if [ -d /home/daos/rpms/ ]; then
46-
if [ -d /home/daos/rpms/deps ]; then
47-
mkdir -p "$artdir/deps"
48-
cp /home/daos/rpms/deps/*.rpm "${artdir}/deps"
49-
fi
50-
cp /home/daos/rpms/daos/*.rpm "${artdir}/daos"
46+
# shellcheck disable=SC2044
47+
for dir in $(find /home/daos/rpms/ -maxdepth 1 -mindepth 1 -type d -exec basename {} \;); do
48+
if [ -d "/home/daos/rpms/${dir}" ]; then
49+
mkdir -p "${artdir}/${dir}"
50+
cp "/home/daos/rpms/${dir}"/*.rpm "${artdir}/${dir}"
51+
fi
52+
done
5153
else
5254
mockroot="/var/lib/mock/${CHROOT_NAME}"
5355
cat "$mockroot"/result/{root,build}.log 2>/dev/null || true

ci/rpm/gen_rpms.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,29 @@ if [ -e "${ci_envs}" ]; then
1616
source "${ci_envs}"
1717
fi
1818

19-
env
19+
function mv_rpms() {
20+
local dir="${1}"
21+
if ls -1 ./*.rpm; then
22+
mkdir -p "/home/daos/rpms/${dir}"
23+
cp ./*.rpm "/home/daos/rpms/${dir}"
24+
rm -f ./*.rpm
25+
fi
26+
}
27+
28+
env | sort -n
2029

2130
pushd "${mydir}/../.." || exit 1
2231
export DISTRO="${1}"
2332
export DAOS_RELVAL="${2}"
33+
code_coverage="${3:-false}"
34+
build_types="deps daos"
35+
if [[ "${code_coverage}" == "true" ]]; then
36+
build_types="deps bullseye"
37+
fi
2438
rm -f ./*.rpm
2539
rm -rf /home/daos/rpms/*
26-
utils/rpms/build_packages.sh deps
27-
if ls -1 ./*.rpm; then
28-
mkdir -p /home/daos/rpms/deps
29-
cp ./*.rpm /home/daos/rpms/deps
30-
rm -f ./*.rpm
31-
fi
32-
utils/rpms/build_packages.sh daos
33-
mkdir -p /home/daos/rpms/daos
34-
cp ./*.rpm /home/daos/rpms/daos
40+
for build_type in ${build_types}; do
41+
utils/rpms/build_packages.sh "${build_type}"
42+
mv_rpms "${build_type}"
43+
done
3544
popd || exit 1

ci/rpm/install_deps.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ env
2121
pushd "${mydir}/../.." || exit 1
2222
export DISTRO="${1}"
2323
export DAOS_RELVAL="${2}"
24+
code_coverage="${3:-false}"
2425
libfabric_pkg="$(utils/rpms/package_version.sh libfabric dev)"
2526
mercury_pkg="$(utils/rpms/package_version.sh mercury dev)"
2627
argobots_pkg="$(utils/rpms/package_version.sh argobots dev)"
@@ -38,4 +39,10 @@ sudo dnf install --allowerasing -y "${fused_pkg}" || echo "${fused_pkg} not avai
3839
sudo dnf install --allowerasing -y "${pmdk_pkg}" || echo "${pmdk_pkg} not available"
3940
sudo dnf install --allowerasing -y "${isal_pkg}" || echo "${isal_pkg} not available"
4041
sudo dnf install --allowerasing -y "${isal_crypto_pkg}" || echo "${isal_crypto_pkg} not available"
42+
43+
if [[ "${code_coverage}" == "true" ]] ; then
44+
bullseye_pkg="$(utils/rpms/package_version.sh bullseye normal)"
45+
sudo dnf install --allowerasing -y "${bullseye_pkg}" || echo "${bullseye_pkg} not available"
46+
fi
47+
4148
popd || exit 1

ci/summary/bullseye_report.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2026 Hewlett Packard Enterprise Development LP
4+
#
5+
# Script for generating a bullseye code coverage report summary
6+
set -uex
7+
8+
if [ ! -d '/opt/BullseyeCoverage/bin' ]; then
9+
echo 'Bullseye not found.'
10+
exit 1
11+
fi
12+
export COVFILE="${WORKSPACE:-/tmp}/test.cov"
13+
export PATH="/opt/BullseyeCoverage/bin:$PATH"
14+
15+
# Merge all coverage files
16+
cp /opt/BullseyeCoverage/daos/test.cov "${COVFILE}"
17+
readarray -t cov_files < <(find "${WORKSPACE}" -name test.cov)
18+
if [ ${#cov_files[@]} -gt 0 ]; then
19+
covmerge --no-banner --file "${COVFILE}" "${cov_files[@]}"
20+
fi
21+
22+
if [ ! -e "$COVFILE" ]; then
23+
echo "Coverage file ${COVFILE} is missing"
24+
exit 1
25+
fi
26+
27+
# Generate the html report
28+
rm -fr bullseye_code_coverage_report || true
29+
mkdir bullseye_code_coverage_report
30+
cd bullseye_code_coverage_report
31+
mkdir sources
32+
tar -xf /opt/BullseyeCoverage/daos/bullseye_sources.tar.gz -C sources/
33+
covhtml --srcdir sources --file "${COVFILE}" .

0 commit comments

Comments
 (0)