Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions compute-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,41 @@ set -Eeuxo pipefail
# directory containing this script.

# Combine .tix files
# Avoid tripping on an existing all.tix from a prior run
SUM_TIX="all.tix"
hpc sum --output=$SUM_TIX --union --exclude=Main --exclude=GitRev $(find . -name "*.tix")
hpc sum --output=$SUM_TIX --union --exclude=Main --exclude=GitRev \
$(find . ! -path ./all.tix -name "*.tix" -print)

# Generate report
HPC_ROOT=$(find dist-newstyle -name "hpc")
# Find the HPC dir, and don't trip on old versions after a version bump.
# See saw-script #2114.
#
# There is no direct way to do this. Instead, fetch the name of the
# SAW executable. This gives us a path into the build directory for
# the current version:
# dist-newstyle/build/$TARGET/ghc-$GHC/saw-script-$VERSION/build/saw/saw
#
# where we don't want to have to try to figure out $TARGET, $GHC, or $VERSION.
#
# The hpc dir we want lives under the saw-script-$VERSION dir, but can be in
# different places with different versions of the tooling. So start there and
# then use find.
#
# -v0 (verbosity 0) prevents cabal from accidentally including extraneous
# data (see saw-script #2103)
SAW=$(cabal list-bin -v0 exe:saw)
SAWSCRIPT=$(echo "$SAW" | sed 's,/build/saw/saw$,,')
HPC_ROOT=$(find "$SAWSCRIPT" -name "hpc" -print)

# Check if it actually exists, in case it doesn't, and bail with an error
# message instead of generating hpc's usage message.
if ! [ -d "$HPC_ROOT" ]; then
echo "$0: no HPC dir found" 1>&2
exit 1
fi

# Now generate the report
HPC_ARGS=""
for dir in ${HPC_ROOT}/vanilla/mix/*; do
for dir in "$HPC_ROOT"/vanilla/mix/*; do
HPC_ARGS="${HPC_ARGS} --hpcdir=${dir}"
done
hpc markup --destdir=hpc-html ${HPC_ARGS} ${SUM_TIX}