on master help sign in
Add a --quick option
b4f6e6eHarendra Kumar
benchmark/bench-report/bin/build-lib.sh+8−1
@@ -119,7 +119,14 @@ set_targets() {
119# $3: component ("" (lib), t (test), b (benchmark), x (executable))
119# $3: component ("" (lib), t (test), b (benchmark), x (executable))
120# $4: command to find
120# $4: command to find
121cabal_which_builddir() {
121cabal_which_builddir() {
122+ local noopt=""
123+ if test "$TEST_QUICK_MODE" -eq 1
124+ then
125+ noopt="/noopt"
126+ fi
127+
122− local path=$(echo $1/build/*/ghc-${GHC_VERSION}/${2}/$3/$4/build/$4/$4)
128+ local path=$(echo $1/build/*/ghc-${GHC_VERSION}/${2}/$3/$4$noopt/build/$4/$4)
129+ echo "[cabal_which $path]" 1>&2
123 test -f "$path" && echo $path
130 test -f "$path" && echo $path
124}
131}
125
132
bin/test.sh+15−2
@@ -13,25 +13,32 @@ source $SCRIPT_DIR/targets.sh
13print_help () {
13print_help () {
14 echo "Usage: $0 "
14 echo "Usage: $0 "
15 echo " [--targets <"target1 target2 ..." | help>]"
15 echo " [--targets <"target1 target2 ..." | help>]"
16+ echo
17+ echo " [--quick]"
16 echo " [--with-compiler <compiler exe name>]"
18 echo " [--with-compiler <compiler exe name>]"
17 echo " [--cabal-build-options <option>]"
19 echo " [--cabal-build-options <option>]"
18 echo " [--dev-build]"
20 echo " [--dev-build]"
21+ echo
19 echo " [--coverage]"
22 echo " [--coverage]"
20 echo " [--hpc-report-options <option>]"
23 echo " [--hpc-report-options <option>]"
21 echo " [--no-measure]"
24 echo " [--no-measure]"
22 echo " [--raw]"
25 echo " [--raw]"
26+ echo
23 echo " [--rtsopts <option>]"
27 echo " [--rtsopts <option>]"
24 echo " -- <hspec options or test names>"
28 echo " -- <hspec options or test names>"
25 echo
29 echo
26 echo "--targets: targets to run, use 'help' for list of targets"
30 echo "--targets: targets to run, use 'help' for list of targets"
31+ echo
32+ echo "--quick: disable optimizations to build quickly"
27 echo "--cabal-build-options: Pass any cabal build options to be used for build"
33 echo "--cabal-build-options: Pass any cabal build options to be used for build"
28 echo "--dev-build: runs some additional tests"
34 echo "--dev-build: runs some additional tests"
35+ echo
29 echo "--coverage: enable coverage and report coverage info"
36 echo "--coverage: enable coverage and report coverage info"
30 echo "--hpc-report-options: option for 'hpc report'"
37 echo "--hpc-report-options: option for 'hpc report'"
31 echo "--no-measure: with --coverage, do not run tests, only show coverage info"
38 echo "--no-measure: with --coverage, do not run tests, only show coverage info"
32 echo "--raw: with --coverage, do not run hpc"
39 echo "--raw: with --coverage, do not run hpc"
33− echo "--rtsopts: pass GHC RTS options to the test executable"
34 echo
40 echo
41+ echo "--rtsopts: pass GHC RTS options to the test executable"
35 echo "Any arguments after a '--' are passed directly to hspec"
42 echo "Any arguments after a '--' are passed directly to hspec"
36 exit
43 exit
37}
44}
@@ -65,7 +72,7 @@ do
65 # flags
72 # flags
66 --raw) RAW=1; shift ;;
73 --raw) RAW=1; shift ;;
67 #--slow) SLOW=1; shift ;; # not implemented
74 #--slow) SLOW=1; shift ;; # not implemented
68− #--quick) QUICK_MODE=1; shift ;; # not implemented
75+ --quick) TEST_QUICK_MODE=1; shift ;;
69 --dev-build) RUNNING_DEVBUILD=1 CABAL_BUILD_OPTIONS+=" --flag dev"; shift ;;
76 --dev-build) RUNNING_DEVBUILD=1 CABAL_BUILD_OPTIONS+=" --flag dev"; shift ;;
70 --coverage) COVERAGE=1; shift ;;
77 --coverage) COVERAGE=1; shift ;;
71 --no-measure) MEASURE=0; shift ;;
78 --no-measure) MEASURE=0; shift ;;
@@ -78,6 +85,11 @@ TARGET_EXE_ARGS=$*
78
85
79set_derived_vars
86set_derived_vars
80
87
88+if test "$TEST_QUICK_MODE" -eq 1
89+then
90+ CABAL_BUILD_OPTIONS+=" --disable-optimization --flags -opt"
91+fi
92+
81#-----------------------------------------------------------------------------
93#-----------------------------------------------------------------------------
82# Determine targets
94# Determine targets
83#-----------------------------------------------------------------------------
95#-----------------------------------------------------------------------------
@@ -174,6 +186,7 @@ run_target () {
174 local extra_args=$4
186 local extra_args=$4
175
187
176 local target_prog
188 local target_prog
189+
177 target_prog=$(cabal_target_prog $package_name $component $target_name) || \
190 target_prog=$(cabal_target_prog $package_name $component $target_name) || \
178 die "Cannot find executable for target $target_name"
191 die "Cannot find executable for target $target_name"
179
192