Skip to content

Commit

Permalink
Merge pull request #75 from privacysandbox/release-0.53.0
Browse files Browse the repository at this point in the history
Release 0.53.0
  • Loading branch information
Andrew-Dame authored Jan 25, 2024
2 parents f2b3f2a + ee87170 commit 11f7724
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 19 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## 0.53.0 (2024-01-25)


### Features

* Add support to collect-coverage tool for custom lcov report


### Bug Fixes

* Improve --cmd-profiler support

## 0.52.0 (2023-12-02)


Expand Down
1 change: 1 addition & 0 deletions images/build-debian/install_apps
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function install_misc() {
gettext="0.19.*" \
git="1:2.25.*" \
gnupg="2.2.*" \
google-perftools="2.*" \
locales="2.31-*" \
lsb-release="11.1.*" \
openssh-client="1:8.2*" \
Expand Down
2 changes: 1 addition & 1 deletion tests/data/hashes/build-debian
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5d35b75b008dc13b64cfdd3e9f49ff8b77a6fb8f7851d653b17c078214299c08
a99a8af64d61e3eb635aecfb81d229437890693cd6f6d33bd269e9f1c55ca760
29 changes: 21 additions & 8 deletions tools/cbuild
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@ if ! [[ " ${IMAGE_LIST[*]} " =~ " ${IMAGE} " ]]; then
usage 1
fi

if [[ ${WITH_CMD_PROFILER} -eq 1 ]]; then
if [[ ${IMAGE} != build-debian ]]; then
printf "error: --cmd-profiler is only compatible with build-debian\n" &>/dev/stderr
usage 1
fi
CMD_PROFILER="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libprofiler.so "
fi
TOOLS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
readonly TOOLS_DIR
# shellcheck disable=SC1090
Expand All @@ -160,6 +153,9 @@ if [[ ${VERBOSE} -eq 1 ]]; then
printf "mounting workspace into container: %s\n" "${WORKSPACE_MOUNT}" &>/dev/stderr
fi

TOOLS_RELDIR="$(realpath "${TOOLS_DIR}" --relative-to="${WORKSPACE}")"
readonly TOOLS_RELDIR

if [[ -n ${CBUILD_IMAGE} ]]; then
IMAGE_TAGGED=${CBUILD_IMAGE}
else
Expand All @@ -181,6 +177,17 @@ if [[ ${DOCKER_SECCOMP_UNCONFINED} -eq 1 ]]; then
DOCKER_RUN_ARGS+=("--security-opt=seccomp=unconfined")
fi

if [[ ${WITH_CMD_PROFILER} -eq 1 ]]; then
if [[ ${IMAGE} != build-debian ]]; then
printf "error: --cmd-profiler is only compatible with build-debian\n" &>/dev/stderr
usage 1
fi
DOCKER_RUN_ARGS+=(
"--env=CMD_PROFILER=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libprofiler.so"
"--env=CPUPROFILE=benchmark.prof"
)
fi

# inside the docker build images, /bazel_root is the bazel cache dir, per the system-wide bazelrc
readonly BAZEL_ROOT=/bazel_root
if [[ ${WITH_SHARED_CACHE} -eq 0 ]]; then
Expand Down Expand Up @@ -222,10 +229,16 @@ if [[ -z ${CMD} ]]; then
${DOCKER_RUN_ARGS[@]} \
"${IMAGE_TAGGED}" \
--login
elif [[ ${WITH_CMD_PROFILER} -eq 1 ]]; then
# shellcheck disable=SC2068
docker run \
${DOCKER_RUN_ARGS[@]} \
"${IMAGE_TAGGED}" \
--login -c "'${TOOLS_RELDIR}'/normalize-bazel-symlinks; env \${CMD_PROFILER} ${CMD}"
else
# shellcheck disable=SC2068
docker run \
${DOCKER_RUN_ARGS[@]} \
"${IMAGE_TAGGED}" \
--login -c "${CMD_PROFILER}${CMD}"
--login -c "'${TOOLS_RELDIR}'/normalize-bazel-symlinks; ${CMD}"
fi
50 changes: 41 additions & 9 deletions tools/collect-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,50 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# environment variables (all optional):
# environment variables:
# WORKSPACE Set the path to the workspace (repo root)

set -o pipefail
set -o errexit

declare LCOV_REPORT="${WORKSPACE}/bazel-out/_coverage/_coverage_report.dat"
declare COVERAGE_FILENAME=coverage.zip

function usage() {
local exitval=${1-1}
cat &>/dev/stderr << USAGE
usage:
$0 <options>
--lcov_report path to lcov report relative to the WORKSPACE
--coverage_output_filename name of ZIP file that will contain artifacts from coverage collection
USAGE
# shellcheck disable=SC2086
exit ${exitval}
}

while [[ $# -gt 0 ]]; do
case "$1" in
--lcov_report)
LCOV_REPORT="${WORKSPACE}/$2"
shift 2 || usage
;;
--coverage_output_filename)
COVERAGE_FILENAME="$2"
shift 2 || usage
if [[ ${COVERAGE_FILENAME##*.} != zip ]]; then
printf "error: --coverage_output_filename must be a ZIP file\n" &>/dev/stderr
exit 1
fi
;;
-h | --help)
usage 0
;;
*)
usage
;;
esac
done

trap _cleanup EXIT
function _cleanup() {
declare -r -i status=$?
Expand All @@ -33,10 +71,9 @@ function _cleanup() {
function generate_coverage_report() {
local -r cov_dir="$(mktemp --tmpdir="${WORKSPACE}" --directory coverage-XXXX)"
trap 'rm -rf "${cov_dir}"' RETURN EXIT
local -r cov_dat="${WORKSPACE}/bazel-out/_coverage/_coverage_report.dat"
cp "${cov_dat}" "${cov_dir}"
cp "${LCOV_REPORT}" "${cov_dir}"/_coverage_report.dat
local -r dist_dir="${WORKSPACE}"/dist
cp "${cov_dat}" "${dist_dir}"
cp "${LCOV_REPORT}" "${dist_dir}"/_coverage_report.dat
chmod -x {"${cov_dir}","${dist_dir}"}/_coverage_report.dat

"${TOOLS_DIR}"/lcov --list dist/_coverage_report.dat >"${dist_dir}"/coverage_report.txt
Expand Down Expand Up @@ -64,10 +101,5 @@ source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/builder.sh
TOOLS_DIR="$(builder::get_tools_dir)"
readonly TOOLS_DIR

declare COVERAGE_FILENAME="$1"
if [[ ${COVERAGE_FILENAME##*.} != zip ]]; then
COVERAGE_FILENAME=coverage.zip
fi

generate_coverage_report
"${TOOLS_DIR}"/normalize-dist
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.52.0
0.53.0

0 comments on commit 11f7724

Please sign in to comment.