on master help sign in
Fix error handling, use pipefail
edbb7b8Harendra Kumar
bin/bench-exec-one.sh+7−4
@@ -7,6 +7,9 @@
7# USE_GAUGE: whether to use gauge or tasty-bench
7# USE_GAUGE: whether to use gauge or tasty-bench
8# LONG: whether to use a large stream size
8# LONG: whether to use a large stream size
9
9
10+set -e
11+set -o pipefail
12+
10# $1: message
13# $1: message
11die () {
14die () {
12 >&2 echo -e "Error: $1"
15 >&2 echo -e "Error: $1"
@@ -183,9 +186,9 @@ then
183 # XXX this is a hack to make the "/" separated names used in the functions
186 # XXX this is a hack to make the "/" separated names used in the functions
184 # determining options based on benchmark name. For tasty-bench the benchmark
187 # determining options based on benchmark name. For tasty-bench the benchmark
185 # names are separated by "." instead of "/".
188 # names are separated by "." instead of "/".
186− BENCH_NAME=$(echo $BENCH_NAME_ORIG | sed -e s/^All\.//)
189+ BENCH_NAME0=$(echo $BENCH_NAME_ORIG | sed -e s/^All\.//)
187− BENCH_NAME1=$(echo $BENCH_NAME | cut -f1 -d '/')
190+ BENCH_NAME1=$(echo $BENCH_NAME0 | cut -f1 -d '/')
188− BENCH_NAME2=$(echo $BENCH_NAME | cut -f2- -d '/' | sed -e 's/\./\//g')
191+ BENCH_NAME2=$(echo $BENCH_NAME0 | cut -f2- -d '/' | sed -e 's/\./\//g')
189 BENCH_NAME="$BENCH_NAME1/$BENCH_NAME2"
192 BENCH_NAME="$BENCH_NAME1/$BENCH_NAME2"
190else
193else
191 BENCH_NAME=$BENCH_NAME_ORIG
194 BENCH_NAME=$BENCH_NAME_ORIG
@@ -219,7 +222,7 @@ then
219 STREAM_SIZE_OPT="--stream-size $STREAM_SIZE"
222 STREAM_SIZE_OPT="--stream-size $STREAM_SIZE"
220fi
223fi
221
224
222−echo "$BENCH_NAME: \
225+echo "$BENCH_NAME_ORIG: \
223$RTS_OPTIONS \
226$RTS_OPTIONS \
224$STREAM_LEN \
227$STREAM_LEN \
225$QUICK_BENCH_OPTIONS" \
228$QUICK_BENCH_OPTIONS" \
bin/bench.sh+3−1
@@ -1,5 +1,7 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3+set -o pipefail
4+
3SCRIPT_DIR=$(cd `dirname $0`; pwd)
5SCRIPT_DIR=$(cd `dirname $0`; pwd)
4
6
5RUNNING_BENCHMARKS=y
7RUNNING_BENCHMARKS=y
@@ -333,7 +335,7 @@ do
333 # options with arguments
335 # options with arguments
334 --benchmarks) shift; TARGETS=$1; shift ;;
336 --benchmarks) shift; TARGETS=$1; shift ;;
335 --targets) shift; TARGETS=$1; shift ;;
337 --targets) shift; TARGETS=$1; shift ;;
336− --prefix) shift; BENCH_PREFIX="$1" shift ;;
338+ --prefix) shift; BENCH_PREFIX="$1"; shift ;;
337 --fields) shift; FIELDS=$1; shift ;;
339 --fields) shift; FIELDS=$1; shift ;;
338 --base) shift; BASE=$1; shift ;;
340 --base) shift; BASE=$1; shift ;;
339 --candidate) shift; CANDIDATE=$1; shift ;;
341 --candidate) shift; CANDIDATE=$1; shift ;;