blob: 880abcc4770ece80462879e9398b63e2ad86a197 [file] [log] [blame]
Chris Frantzb231f112021-12-02 15:42:10 -08001#!/usr/bin/env bash
2#
3# Copyright lowRISC contributors.
4# Licensed under the Apache License, Version 2.0, see LICENSE for details.
5# SPDX-License-Identifier: Apache-2.0
6
7set -e
8
9if [[ $# == 0 ]]; then
10 ARGS=("//...")
11else
12 ARGS="$@"
13fi
14
15if ! cd "$BUILD_WORKSPACE_DIRECTORY"; then
16 echo "Unable to change to workspace (BUILD_WORKSPACE_DIRECTORY: ${BUILD_WORKSPACE_DIRECTORY})"
17 exit 1
18fi
19
20bazel coverage "${ARGS[@]}"
21genhtml -o bazel-out/_coverage/ bazel-out/_coverage/_coverage_report.dat
22echo "Coverage report: file://$(pwd)/bazel-out/_coverage/index.html"