Use non-zero exit codes in benchmark.sh when the benchmark cannot be run (#8554)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/8554

Reviewed By: ajkr

Differential Revision: D29756562

Pulled By: mrambacher

fbshipit-source-id: ab2f5ef988c8ac7ea7c633e6a3dacaf16f021529
main
Adam Retter 3 years ago committed by Facebook GitHub Bot
parent c55460c734
commit 48c468c22e
  1. 14
      tools/benchmark.sh

@ -2,13 +2,17 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# REQUIRE: db_bench binary exists in the current directory # REQUIRE: db_bench binary exists in the current directory
EXIT_INVALID_ARGS=1
EXIT_NOT_COMPACTION_TEST=2
EXIT_UNKNOWN_JOB=3
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo -n "./benchmark.sh [bulkload/fillseq_disable_wal/fillseq_enable_wal/overwrite/" echo -n "./benchmark.sh [bulkload/fillseq_disable_wal/fillseq_enable_wal/overwrite/"
echo "updaterandom/readrandom/mergerandom/filluniquerandom/multireadrandom/" echo "updaterandom/readrandom/mergerandom/filluniquerandom/multireadrandom/"
echo "fwdrange/revrange/readwhilewriting/readwhilemerging/" echo "fwdrange/revrange/readwhilewriting/readwhilemerging/"
echo "fwdrangewhilewriting/revrangewhilewriting/fwdrangewhilemerging/revrangewhilemerging/" echo "fwdrangewhilewriting/revrangewhilewriting/fwdrangewhilemerging/revrangewhilemerging/"
echo "randomtransaction/universal_compaction/debug]" echo "randomtransaction/universal_compaction/debug]"
exit 0 exit $EXIT_INVALID_ARGS
fi fi
bench_cmd=$1 bench_cmd=$1
shift shift
@ -19,7 +23,7 @@ bench_args=$*
# rest of the benchmarks helps. # rest of the benchmarks helps.
if [ "$COMPACTION_TEST" == "1" -a "$bench_cmd" != "universal_compaction" ]; then if [ "$COMPACTION_TEST" == "1" -a "$bench_cmd" != "universal_compaction" ]; then
echo "Skipping $1 because it's not a compaction test." echo "Skipping $1 because it's not a compaction test."
exit 0 exit $EXIT_NOT_COMPACTION_TEST
fi fi
# size constants # size constants
@ -30,12 +34,12 @@ T=$((1024 * G))
if [ -z $DB_DIR ]; then if [ -z $DB_DIR ]; then
echo "DB_DIR is not defined" echo "DB_DIR is not defined"
exit 0 exit $EXIT_INVALID_ARGS
fi fi
if [ -z $WAL_DIR ]; then if [ -z $WAL_DIR ]; then
echo "WAL_DIR is not defined" echo "WAL_DIR is not defined"
exit 0 exit $EXIT_INVALID_ARGS
fi fi
output_dir=${OUTPUT_DIR:-/tmp/} output_dir=${OUTPUT_DIR:-/tmp/}
@ -543,7 +547,7 @@ for job in ${jobs[@]}; do
echo "Setting num_keys to $num_keys" echo "Setting num_keys to $num_keys"
else else
echo "unknown job $job" echo "unknown job $job"
exit exit $EXIT_UNKNOWN_JOB
fi fi
end=$(now) end=$(now)

Loading…
Cancel
Save