@@ -112,6 +112,24 @@ set_targets() {
112112 fi
113113}
114114
115+# XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables
116+
117+# $1: builddir
118+# $2: package name with version
119+# $3: component ("" (lib), t (test), b (benchmark), x (executable))
120+# $4: command to find
121+cabal_which_builddir() {
122+ local path=$(echo $1/build/*/ghc-${GHC_VERSION}/${2}/$3/$4/build/$4/$4)
123+ test -f "$path" && echo $path
124+}
125+
126+# $1: package name with version
127+# $2: component
128+# $3: command to find
129+cabal_which() {
130+ cabal_which_builddir $BUILD_DIR $1 $2 $3
131+}
132+
115133# We run the benchmarks in isolation in a separate process so that different
116134# benchmarks do not interfere with other. To enable that we need to pass the
117135# benchmark exe path to gauge as an argument. Unfortunately it cannot find its
@@ -119,7 +137,7 @@ set_targets() {
119137
120138# The path is dependent on the architecture and cabal version.
121139
122−# $1: package name
140+# $1: package name with version
123141# $2: component
124142# $3: target
125143cabal_target_prog () {
@@ -169,24 +187,6 @@ set_derived_vars () {
169187 GHC_VERSION=$($CABAL_WITH_COMPILER --numeric-version)
170188}
171189
172−# XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables
173−
174−# $1: builddir
175−# $2: package name
176−# $3: component ("" (lib), t (test), b (benchmark), x (executable))
177−# $4: command to find
178−cabal_which_builddir() {
179− local path=$(echo $1/build/*/ghc-${GHC_VERSION}/${2}-0.0.0/$3/$4/build/$4/$4)
180− test -f "$path" && echo $path
181−}
182−
183−# $1: package name
184−# $2: component
185−# $3: command to find
186−cabal_which() {
187− cabal_which_builddir $BUILD_DIR $1 $2 $3
188−}
189−
190190# $1: build program
191191# $2: package name
192192# $3: component prefix
@@ -204,47 +204,3 @@ run_build () {
204204 done
205205 run_verbose $build_prog $COMPONENTS || die "build failed"
206206}
207−
208−# $1: target name
209−get_tix_file () {
210− echo $BUILD_DIR/build/$SYSTEM/ghc-${GHC_VERSION}/$PACKAGE_FULL_NAME/hpc/vanilla/tix/$1/$1.tix
211−}
212−
213−# $1: package name
214−# $2: component
215−# $3: target
216−# $4: args generator func
217−run_target () {
218− local package_name=$1
219− local component=$2
220− local target_name=$3
221− local extra_args=$4
222−
223− local target_prog
224− target_prog=$(cabal_target_prog $package_name $component $target_name) || \
225− die "Cannot find executable for target $target_name"
226−
227− echo "Running executable $target_name ..."
228−
229− # Needed by bench-exec-one.sh
230− export BENCH_EXEC_PATH=$target_prog
231− mkdir -p $(dirname $(get_tix_file $target_name))
232− export HPCTIXFILE=$(get_tix_file $target_name)
233−
234− run_verbose $target_prog $($extra_args $target_name $target_prog) \
235− || die "Target exe failed"
236−
237− # hpc-coveralls fails if there is an empty dir and no .tix file generated
238− rmdir $(dirname $(get_tix_file $target_name)) 2>/dev/null || true
239−}
240−
241−# $1: package name
242−# $2: component
243−# $3: targets
244−# $4: args generator func
245−run_targets() {
246− for i in $3
247− do
248− run_target $1 $2 $i $4
249− done
250−}