3SCRIPT_DIR=$(dirname $0)
6BENCH_REPORT_DIR=benchmark/bench-report
7source $SCRIPT_DIR/targets.sh
9#------------------------------------------------------------------------------
11#------------------------------------------------------------------------------
15 echo " [--targets <"target1 target2 ..." | help>]"
18 echo " [--with-compiler <compiler exe name>]"
19 echo " [--cabal-build-options <option>]"
23 echo " [--hpc-report-options <option>]"
24 echo " [--no-measure]"
27 echo " [--rtsopts <option>]"
28 echo " -- <hspec options or test names>"
30 echo "--targets: targets to run, use 'help' for list of targets"
32 echo "--quick: disable optimizations to build quickly"
33 echo "--cabal-build-options: Pass any cabal build options to be used for build"
34 echo "--dev-build: runs some additional tests"
36 echo "--coverage: enable coverage and report coverage info"
37 echo "--hpc-report-options: option for 'hpc report'"
38 echo "--no-measure: with --coverage, do not run tests, only show coverage info"
39 echo "--raw: with --coverage, do not run hpc"
41 echo "--rtsopts: pass GHC RTS options to the test executable"
42 echo "Any arguments after a '--' are passed directly to hspec"
46#-----------------------------------------------------------------------------
48#-----------------------------------------------------------------------------
51source $BENCH_REPORT_DIR/bin/build-lib.sh
59CABAL_BUILD_OPTIONS="--flag limit-build-mem"
62# XXX add a bisect option
66 -h|--help|help) print_help ;;
67 # options with arguments
68 --targets) shift; TARGETS=$1; shift ;;
69 --with-compiler) shift; CABAL_WITH_COMPILER=$1; shift ;;
70 --cabal-build-options) shift; CABAL_BUILD_OPTIONS+=" $1"; shift ;;
71 --hpc-report-options) shift; HPC_REPORT_OPTIONS="$1"; shift ;;
72 --rtsopts) shift; RTS_OPTIONS="$1"; shift ;;
74 --raw) RAW=1; shift ;;
75 #--slow) SLOW=1; shift ;; # not implemented
76 --quick) TEST_QUICK_MODE=1; shift ;;
77 --dev-build) RUNNING_DEVBUILD=1 CABAL_BUILD_OPTIONS+=" --flag dev"; shift ;;
78 --coverage) COVERAGE=1; shift ;;
79 --no-measure) MEASURE=0; shift ;;
81 -*|--*) echo "Unknown flags: $*"; echo; print_help ;;
89if test "$TEST_QUICK_MODE" -eq 1
91 CABAL_BUILD_OPTIONS+=" --disable-optimization --flags -opt"
94#-----------------------------------------------------------------------------
96#-----------------------------------------------------------------------------
98# Defined in targets.sh
101if test "$(has_item "$TARGETS" help)" = "help"
108DEFAULT_TARGETS="$(all_grp)"
109TARGETS=$(set_targets)
111echo "Using targets [$TARGETS]"
113#-----------------------------------------------------------------------------
115#-----------------------------------------------------------------------------
117test_exe_rts_opts () {
119 # XXX Data.Array.* heap requirement increased for GHC-8.10
120 Data.Array.Foreign) echo -n "-M128M" ;;
121 Data.Array.Prim) echo -n "-M128M" ;;
122 Data.Array.Prim.Pinned) echo -n "-M128M" ;;
123 Prelude.Rate) echo -n "-M512M" ;;
124 # For -O0 case writeChunks test fails, maybe we should have a separate flag
126 FileSystem.Handle) echo -n "-K16M" ;;
127 *) if test "$COVERAGE" -eq "1"
129 echo -n "-K8M -M1024M"
137# $2: bench executable
138target_exe_extra_args () {
143 $(test_exe_rts_opts $(basename $bench_prog)) \
148if test "$COVERAGE" -eq "1"
150 # Used to determine the hpc tix dir
151 PACKAGE_FULL_NAME=streamly-$STREAMLY_VERSION
153 Linux) SYSTEM=x86_64-linux ;;
154 *) echo "Unsupported system"; exit 1 ;;
157 # With the --enable-coverage option the tests as well as the library get
158 # compiled with -fhpc, and we get coverage for tests as well. But we want to
159 # exclude that, so a project file is needed.
160 CABAL_BUILD_OPTIONS+=" --project-file cabal.project.coverage"
161 mkdir -p $BUILD_DIR/hpc
163BUILD_TEST="$CABAL_EXECUTABLE v2-build $CABAL_BUILD_OPTIONS --enable-tests"
165if test "$MEASURE" -eq "1"
167run_build "$BUILD_TEST" streamly-tests test "$TARGETS"
170#-----------------------------------------------------------------------------
172#-----------------------------------------------------------------------------
176 echo $BUILD_DIR/build/$SYSTEM/ghc-${GHC_VERSION}/$PACKAGE_FULL_NAME/hpc/vanilla/tix/$1/$1.tix
182# $4: args generator func
184 local package_name=$1
191 target_prog=$(cabal_target_prog $package_name $component $target_name) || \
192 die "Cannot find executable for target $target_name"
194 echo "Running executable $target_name ..."
196 mkdir -p $(dirname $(get_tix_file $target_name))
197 export HPCTIXFILE=$(get_tix_file $target_name)
199 run_verbose $target_prog $($extra_args $target_name $target_prog) \
200 || die "Target exe failed"
202 # hpc-coveralls fails if there is an empty dir and no .tix file generated
203 rmdir $(dirname $(get_tix_file $target_name)) 2>/dev/null || true
206# $1: package name with version
209# $4: args generator func
213 run_target $1 $2 $i $4
217if test "$MEASURE" -eq "1"
219run_targets "streamly-tests-0.0.0" t "$TARGETS" target_exe_extra_args
222#-----------------------------------------------------------------------------
223# Run coverage reports
224#-----------------------------------------------------------------------------
226PACKAGE_NAME=streamly-$STREAMLY_VERSION
227MIX_DIR=$BUILD_DIR/build/$SYSTEM/ghc-${GHC_VERSION}/$PACKAGE_NAME/hpc/vanilla/mix/$PACKAGE_NAME/
228ALLTIX=$BUILD_DIR/hpc/all.tix
230if test "$COVERAGE" -eq "1" -a "$RAW" -eq 0
235 tixfile="$(get_tix_file ${i})"
236 if test -f "$tixfile"
238 TIXFILES+="$tixfile "
242 hpc sum --output=$ALLTIX $TIXFILES
243 run_verbose hpc markup $ALLTIX --hpcdir $MIX_DIR
244 run_verbose hpc report $ALLTIX $HPC_REPORT_OPTIONS --hpcdir $MIX_DIR
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list