Move the bench-runner script to bench-report pkg

This commit is contained in:
Harendra Kumar 2021-07-04 03:16:56 +05:30
parent ac3ed9a197
commit cffe01216b
4 changed files with 23 additions and 36 deletions

View File

@ -77,39 +77,17 @@ list_comparisons () {
echo
}
# chart is expensive to build and usually not required to be rebuilt
cabal_which_report() {
local path="./bin/$1"
if test -e "$path"
then
echo $path
fi
}
find_report_prog() {
local prog_name="bench-report"
hash -r
local prog_path=$(cabal_which_report $prog_name)
if test -x "$prog_path"
then
echo $prog_path
else
return 1
fi
}
build_report_prog() {
local prog_name="bench-report"
local prog_path=$(cabal_which_report $prog_name)
local prog_path=$BENCH_REPORT_DIR/bin/bench-report
hash -r
if test ! -x "$prog_path" -a "$BUILD_ONCE" = "0"
then
echo "Building bench-report executables"
BUILD_ONCE=1
pushd $BENCHMARK_DIR/bench-report
pushd $BENCH_REPORT_DIR
local cmd
cmd="$CABAL_EXECUTABLE install --installdir $SCRIPT_DIR bench-report"
cmd="$CABAL_EXECUTABLE install --installdir bin bench-report"
if test "$USE_NIX" -eq 0
then
$cmd || die "bench-report build failed"
@ -117,7 +95,6 @@ build_report_prog() {
nix-shell --run "$cmd" || die "bench-report build failed"
fi
popd
elif test ! -x "$prog_path"
then
return 1
@ -130,8 +107,8 @@ build_report_progs() {
then
build_report_prog || exit 1
local prog
prog=$(find_report_prog) || \
die "Cannot find bench-report executable"
prog=$BENCH_REPORT_DIR/bin/bench-report
test -x $prog || die "Cannot find bench-report executable"
echo "Using bench-report executable [$prog]"
fi
}
@ -426,8 +403,8 @@ run_measurements() {
run_reports() {
local prog
prog=$(find_report_prog) || \
die "Cannot find bench-graph executable"
prog=$BENCH_REPORT_DIR/bin/bench-report
test -x $prog || die "Cannot find bench-report executable"
echo
for i in $1
@ -445,8 +422,6 @@ run_reports() {
# Execution starts here
#-----------------------------------------------------------------------------
cd $SCRIPT_DIR/..
USE_GIT_CABAL=1 # This is used by set_common_vars
set_common_vars

View File

@ -2,7 +2,7 @@
# Customization options
bench_config () {
BENCHMARK_DIR=benchmark
BENCH_REPORT_DIR=benchmark/bench-report
BENCHMARK_PACKAGE_NAME=streamly-benchmarks
BENCHMARK_PACKAGE_VERSION=0.0.0

View File

@ -1,3 +1,15 @@
#!/usr/bin/env bash
bin/bench-runner.sh --config bin/bench-config.sh "$@"
SCRIPT_DIR=$(cd `dirname $0`; pwd)
source $SCRIPT_DIR/bench-config.sh \
|| { echo "Cannot source $SCRIPT_DIR/bench-config.sh"; exit 1; }
bench_config
if test -z "$BENCH_REPORT_DIR"
then
echo "BENCH_REPORT_DIR variable not defined by bench-config() in $SCRIPT_DIR/bench-config.sh"
exit 1
fi
cd $SCRIPT_DIR/..
$BENCH_REPORT_DIR/bin/bench-runner.sh --config $SCRIPT_DIR/bench-config.sh "$@"

View File

@ -62,6 +62,8 @@ extra-source-files:
benchmark/README.md
benchmark/bench-report/BenchReport.hs
benchmark/bench-report/bench-report.cabal
benchmark/bench-report/bin/bench-runner.sh
benchmark/bench-report/bin/build-lib.sh
benchmark/bench-report/cabal.project
benchmark/bench-report/default.nix
benchmark/Streamly/Benchmark/Data/*.hs
@ -78,8 +80,6 @@ extra-source-files:
benchmark/streamly-benchmarks.cabal
bin/bench.sh
bin/bench-config.sh
bin/bench-runner.sh
bin/build-lib.sh
bin/ghc.sh
bin/run-ci.sh
bin/mk-hscope.sh