From aeda36e925a2b34af33527463fe9ad639c82253d Mon Sep 17 00:00:00 2001 From: zhutao Date: Wed, 19 Jul 2023 12:05:24 -0700 Subject: [PATCH] add exe and script path check (#11621) Summary: Add path existence check in the script to avoid script running even when db_bench executable does not exist or relative path is not right. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11621 Reviewed By: jowlyzhang Differential Revision: D47552590 Pulled By: ajkr fbshipit-source-id: f09ea069f69e067212b249a22ad755b76bc6063a --- tools/benchmark.sh | 6 ++++++ tools/run_blob_bench.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tools/benchmark.sh b/tools/benchmark.sh index b41d25c787..73d9e96135 100755 --- a/tools/benchmark.sh +++ b/tools/benchmark.sh @@ -6,6 +6,7 @@ EXIT_INVALID_ARGS=1 EXIT_NOT_COMPACTION_TEST=2 EXIT_UNKNOWN_JOB=3 +EXIT_INVALID_PATH=4 # Size Constants K=1024 @@ -114,6 +115,11 @@ fi job_id=${JOB_ID} +if [ ! -x ./db_bench ]; then + echo "./db_bench not found. Please make sure it exists in the current directory." + exit $EXIT_INVALID_PATH +fi + # Make it easier to run only the compaction test. Getting valid data requires # a number of iterations and having an ability to run the test separately from # rest of the benchmarks helps. diff --git a/tools/run_blob_bench.sh b/tools/run_blob_bench.sh index 3755a9e56b..aeb2894f40 100755 --- a/tools/run_blob_bench.sh +++ b/tools/run_blob_bench.sh @@ -19,6 +19,7 @@ # Exit Codes EXIT_INVALID_ARGS=1 +EXIT_INVALID_PATH=2 # Size constants K=1024 @@ -74,6 +75,11 @@ if [ $# -ge 1 ]; then fi fi +if [ ! -f tools/benchmark.sh ]; then + echo "tools/benchmark.sh not found" + exit $EXIT_INVALID_PATH +fi + # shellcheck disable=SC2153 if [ -z "$DB_DIR" ]; then echo "DB_DIR is not defined"