Support hpc-coveralls for coverage upload

This commit is contained in:
Harendra Kumar 2020-12-27 19:07:19 +05:30
parent 4dc01677c7
commit 002551e55f
3 changed files with 26 additions and 13 deletions

View File

@ -256,6 +256,7 @@ run_reports() {
cd $SCRIPT_DIR/..
USE_GIT_CABAL=1
set_common_vars
DEFAULT_FIELDS="allocated bytescopied cputime"

View File

@ -147,11 +147,14 @@ set_common_vars () {
# Use branch specific builds if git-cabal is present in PATH
BUILD_DIR=dist-newstyle
if which git-cabal 2>/dev/null
if test "$USE_GIT_CABAL" -eq 1
then
echo "Using git-cabal for branch specific builds"
CABAL_EXECUTABLE=git-cabal
BUILD_DIR=$(git-cabal show-builddir)
if which git-cabal 2>/dev/null
then
echo "Using git-cabal for branch specific builds"
CABAL_EXECUTABLE=git-cabal
BUILD_DIR=$(git-cabal show-builddir)
fi
fi
}
@ -191,6 +194,11 @@ run_build () {
run_verbose $build_prog $COMPONENTS || die "build failed"
}
# $1: target name
get_tix_file () {
echo $BUILD_DIR/build/$SYSTEM/ghc-${GHC_VERSION}/$PACKAGE_FULL_NAME/hpc/vanilla/tix/$1/$1.tix
}
# $1: package name
# $2: component
# $3: target
@ -209,7 +217,8 @@ run_target () {
# Needed by bench-exec-one.sh
export BENCH_EXEC_PATH=$target_prog
export HPCTIXFILE=$BUILD_DIR/coverage/$target_name.tix
mkdir -p $(dirname $(get_tix_file $target_name))
export HPCTIXFILE=$(get_tix_file $target_name)
run_verbose $target_prog $($extra_args $target_name $target_prog) \
|| die "Target exe failed"

View File

@ -30,6 +30,7 @@ print_help () {
RUNNING_TESTS=y
source $SCRIPT_DIR/build-lib.sh
USE_GIT_CABAL=1
set_common_vars
COVERAGE=
MEASURE=1
@ -106,11 +107,18 @@ target_exe_extra_args () {
if test "$COVERAGE" -eq "1"
then
# Used to determine the hpc tix dir
PACKAGE_FULL_NAME=streamly-0.7.2
case `uname` in
Linux) SYSTEM=x86_64-linux ;;
*) echo "Unsupported system"; exit 1 ;;
esac
# With the --enable-coverage option the tests as well as the library get
# compiled with -fhpc, and we get coverage for tests as well. But we want to
# exclude that, so a project file is needed.
CABAL_BUILD_OPTIONS+=" --project-file cabal.project.coverage"
mkdir -p $BUILD_DIR/coverage
mkdir -p $BUILD_DIR/hpc
fi
BUILD_TEST="$CABAL_EXECUTABLE v2-build $CABAL_BUILD_OPTIONS --enable-tests"
@ -137,15 +145,10 @@ then
TIXFILES=
for i in $TARGETS
do
TIXFILES+="$BUILD_DIR/coverage/${i}.tix "
TIXFILES+="$(get_tix_file ${i}) "
done
case `uname` in
Linux) SYSTEM=x86_64-linux ;;
*) echo "Unsupported system"; exit 1 ;;
esac
ALLTIX=$BUILD_DIR/coverage/all.tix
ALLTIX=$BUILD_DIR/hpc/all.tix
hpc sum --output=$ALLTIX $TIXFILES
run_verbose hpc markup $ALLTIX --hpcdir \
$BUILD_DIR/build/$SYSTEM/ghc-${GHC_VERSION}/streamly-0.7.2/hpc/vanilla/mix/streamly-0.7.2/