on master help sign in
Move the bench-runner script to bench-report pkg
commitcffe01216b525cb97bd9783577dc912b284b749e authorHarendra Kumar <harendra@composewell.com> dateSun 4 Jul 2021, 03:16 (5 years ago) parentac3ed9a
4 files changed+23−36
benchmark/bench-report/bin/bench-runner.sh+7−32 bin/bench-config.sh+1−1 bin/bench.sh+13−1 streamly.cabal+2−2
benchmark/bench-report/bin/bench-runner.sh+7−32
@@ -77,39 +77,17 @@ list_comparisons () {
7777 echo
7878}
7979
80−# chart is expensive to build and usually not required to be rebuilt
81−cabal_which_report() {
82− local path="./bin/$1"
83− if test -e "$path"
84− then
85− echo $path
86− fi
87−}
88−
89−find_report_prog() {
90− local prog_name="bench-report"
91− hash -r
92− local prog_path=$(cabal_which_report $prog_name)
93− if test -x "$prog_path"
94− then
95− echo $prog_path
96− else
97− return 1
98− fi
99−}
100−
10180build_report_prog() {
102− local prog_name="bench-report"
103− local prog_path=$(cabal_which_report $prog_name)
81+ local prog_path=$BENCH_REPORT_DIR/bin/bench-report
10482
10583 hash -r
10684 if test ! -x "$prog_path" -a "$BUILD_ONCE" = "0"
10785 then
10886 echo "Building bench-report executables"
10987 BUILD_ONCE=1
110− pushd $BENCHMARK_DIR/bench-report
88+ pushd $BENCH_REPORT_DIR
11189 local cmd
112− cmd="$CABAL_EXECUTABLE install --installdir $SCRIPT_DIR bench-report"
90+ cmd="$CABAL_EXECUTABLE install --installdir bin bench-report"
11391 if test "$USE_NIX" -eq 0
11492 then
11593 $cmd || die "bench-report build failed"
@@ -117,7 +95,6 @@ build_report_prog() {
11795 nix-shell --run "$cmd" || die "bench-report build failed"
11896 fi
11997 popd
120−
12198 elif test ! -x "$prog_path"
12299 then
123100 return 1
@@ -130,8 +107,8 @@ build_report_progs() {
130107 then
131108 build_report_prog || exit 1
132109 local prog
133− prog=$(find_report_prog) || \
134− die "Cannot find bench-report executable"
110+ prog=$BENCH_REPORT_DIR/bin/bench-report
111+ test -x $prog || die "Cannot find bench-report executable"
135112 echo "Using bench-report executable [$prog]"
136113 fi
137114}
@@ -426,8 +403,8 @@ run_measurements() {
426403
427404run_reports() {
428405 local prog
429− prog=$(find_report_prog) || \
430− die "Cannot find bench-graph executable"
406+ prog=$BENCH_REPORT_DIR/bin/bench-report
407+ test -x $prog || die "Cannot find bench-report executable"
431408 echo
432409
433410 for i in $1
@@ -445,8 +422,6 @@ run_reports() {
445422# Execution starts here
446423#-----------------------------------------------------------------------------
447424
448−cd $SCRIPT_DIR/..
449−
450425USE_GIT_CABAL=1 # This is used by set_common_vars
451426set_common_vars
452427
bin/bench-config.sh+1−1
@@ -2,7 +2,7 @@
22
33# Customization options
44bench_config () {
5− BENCHMARK_DIR=benchmark
5+ BENCH_REPORT_DIR=benchmark/bench-report
66 BENCHMARK_PACKAGE_NAME=streamly-benchmarks
77 BENCHMARK_PACKAGE_VERSION=0.0.0
88
bin/bench.sh+13−1
@@ -1,3 +1,15 @@
11#!/usr/bin/env bash
22
3−bin/bench-runner.sh --config bin/bench-config.sh "$@"
3+SCRIPT_DIR=$(cd `dirname $0`; pwd)
4+source $SCRIPT_DIR/bench-config.sh \
5+ || { echo "Cannot source $SCRIPT_DIR/bench-config.sh"; exit 1; }
6+
7+bench_config
8+if test -z "$BENCH_REPORT_DIR"
9+then
10+ echo "BENCH_REPORT_DIR variable not defined by bench-config() in $SCRIPT_DIR/bench-config.sh"
11+ exit 1
12+fi
13+
14+cd $SCRIPT_DIR/..
15+$BENCH_REPORT_DIR/bin/bench-runner.sh --config $SCRIPT_DIR/bench-config.sh "$@"
streamly.cabal+2−2
@@ -62,6 +62,8 @@ extra-source-files:
6262 benchmark/README.md
6363 benchmark/bench-report/BenchReport.hs
6464 benchmark/bench-report/bench-report.cabal
65+ benchmark/bench-report/bin/bench-runner.sh
66+ benchmark/bench-report/bin/build-lib.sh
6567 benchmark/bench-report/cabal.project
6668 benchmark/bench-report/default.nix
6769 benchmark/Streamly/Benchmark/Data/*.hs
@@ -78,8 +80,6 @@ extra-source-files:
7880 benchmark/streamly-benchmarks.cabal
7981 bin/bench.sh
8082 bin/bench-config.sh
81− bin/bench-runner.sh
82− bin/build-lib.sh
8383 bin/ghc.sh
8484 bin/run-ci.sh
8585 bin/mk-hscope.sh