on master help sign in
Support hpc-coveralls for coverage upload
commit002551e55f428ae706750c0c4160f26e90d6f880 authorHarendra Kumar <harendra@composewell.com> dateSun 27 Dec 2020, 19:07 (6 years ago) parent4dc0167
3 files changed+26−13
bin/bench.sh+1 bin/build-lib.sh+14−5 bin/test.sh+11−8
bin/bench.sh+1
@@ -256,6 +256,7 @@ run_reports() {
256256
257257cd $SCRIPT_DIR/..
258258
259+USE_GIT_CABAL=1
259260set_common_vars
260261
261262DEFAULT_FIELDS="allocated bytescopied cputime"
bin/build-lib.sh+14−5
@@ -147,11 +147,14 @@ set_common_vars () {
147147
148148 # Use branch specific builds if git-cabal is present in PATH
149149 BUILD_DIR=dist-newstyle
150− if which git-cabal 2>/dev/null
150+ if test "$USE_GIT_CABAL" -eq 1
151151 then
152− echo "Using git-cabal for branch specific builds"
153− CABAL_EXECUTABLE=git-cabal
154− BUILD_DIR=$(git-cabal show-builddir)
152+ if which git-cabal 2>/dev/null
153+ then
154+ echo "Using git-cabal for branch specific builds"
155+ CABAL_EXECUTABLE=git-cabal
156+ BUILD_DIR=$(git-cabal show-builddir)
157+ fi
155158 fi
156159}
157160
@@ -191,6 +194,11 @@ run_build () {
191194 run_verbose $build_prog $COMPONENTS || die "build failed"
192195}
193196
197+# $1: target name
198+get_tix_file () {
199+ echo $BUILD_DIR/build/$SYSTEM/ghc-${GHC_VERSION}/$PACKAGE_FULL_NAME/hpc/vanilla/tix/$1/$1.tix
200+}
201+
194202# $1: package name
195203# $2: component
196204# $3: target
@@ -209,7 +217,8 @@ run_target () {
209217
210218 # Needed by bench-exec-one.sh
211219 export BENCH_EXEC_PATH=$target_prog
212− export HPCTIXFILE=$BUILD_DIR/coverage/$target_name.tix
220+ mkdir -p $(dirname $(get_tix_file $target_name))
221+ export HPCTIXFILE=$(get_tix_file $target_name)
213222
214223 run_verbose $target_prog $($extra_args $target_name $target_prog) \
215224 || die "Target exe failed"
bin/test.sh+11−8
@@ -30,6 +30,7 @@ print_help () {
3030RUNNING_TESTS=y
3131source $SCRIPT_DIR/build-lib.sh
3232
33+USE_GIT_CABAL=1
3334set_common_vars
3435COVERAGE=
3536MEASURE=1
@@ -106,11 +107,18 @@ target_exe_extra_args () {
106107
107108if test "$COVERAGE" -eq "1"
108109then
110+ # Used to determine the hpc tix dir
111+ PACKAGE_FULL_NAME=streamly-0.7.2
112+ case `uname` in
113+ Linux) SYSTEM=x86_64-linux ;;
114+ *) echo "Unsupported system"; exit 1 ;;
115+ esac
116+
109117 # With the --enable-coverage option the tests as well as the library get
110118 # compiled with -fhpc, and we get coverage for tests as well. But we want to
111119 # exclude that, so a project file is needed.
112120 CABAL_BUILD_OPTIONS+=" --project-file cabal.project.coverage"
113− mkdir -p $BUILD_DIR/coverage
121+ mkdir -p $BUILD_DIR/hpc
114122fi
115123BUILD_TEST="$CABAL_EXECUTABLE v2-build $CABAL_BUILD_OPTIONS --enable-tests"
116124
@@ -137,15 +145,10 @@ then
137145 TIXFILES=
138146 for i in $TARGETS
139147 do
140− TIXFILES+="$BUILD_DIR/coverage/${i}.tix "
148+ TIXFILES+="$(get_tix_file ${i}) "
141149 done
142150
143− case `uname` in
144− Linux) SYSTEM=x86_64-linux ;;
145− *) echo "Unsupported system"; exit 1 ;;
146− esac
147−
148− ALLTIX=$BUILD_DIR/coverage/all.tix
151+ ALLTIX=$BUILD_DIR/hpc/all.tix
149152 hpc sum --output=$ALLTIX $TIXFILES
150153 run_verbose hpc markup $ALLTIX --hpcdir \
151154 $BUILD_DIR/build/$SYSTEM/ghc-${GHC_VERSION}/streamly-0.7.2/hpc/vanilla/mix/streamly-0.7.2/