Skip to content

Commit 9506682

Browse files
committed
check if gdate is installed + cleanup
1 parent 5cd8a1c commit 9506682

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/performance_test.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
##
1414
##===----------------------------------------------------------------------===##
1515

16-
# set -eu
17-
# set -euo pipefail
18-
1916
log() { printf -- "** %s\n" "$*" >&2; }
2017
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
2118
fatal() { error "$@"; exit 1; }
@@ -27,9 +24,12 @@ export LOG_LEVEL=error # important, otherwise log becomes a bottleneck
2724

2825
DATE_CMD="date"
2926
# using gdate on darwin for nanoseconds
27+
# gdate is installed by coreutils on macOS
3028
if [[ $(uname -s) == "Darwin" ]]; then
31-
# DATE_CMD="gdate"
32-
DATE_CMD="date" #temp for testing
29+
if ! command -v gdate &> /dev/null; then
30+
fatal "gdate could not be found. Please `brew install coreutils` to proceed."
31+
fi
32+
DATE_CMD="gdate"
3333
fi
3434
echo "⏱️ using $DATE_CMD to count time"
3535

@@ -48,7 +48,9 @@ cleanup() {
4848

4949
# start a mock server
5050
start_mockserver() {
51-
# TODO: check if we have two parameters
51+
if [ $# -ne 2 ]; then
52+
fatal "Usage: $0 <mode> <invocations>"
53+
fi
5254
MODE=$1
5355
INVOCATIONS=$2
5456
pkill -9 MockServer && echo "killed previous mock server" && sleep 1 # ignore-unacceptable-language

0 commit comments

Comments
 (0)