Skip to content

Commit e3efa94

Browse files
dschogitster
authored andcommitted
perf: accommodate for MacOSX
As this developer has no access to MacOSX developer setups anymore, Travis becomes the best bet to run performance tests on that OS. However, on MacOSX /usr/bin/time is that good old BSD executable that no Linux user cares about, as demonstrated by the perf-lib.sh's use of GNU-ish extensions. And by the hard-coded path. Let's just work around this issue by using gtime on MacOSX, the Homebrew-provided GNU implementation onto which pretty much every MacOSX power user falls back anyway. To help other developers use Travis to run performance tests on MacOSX, the .travis.yml file now sports a commented-out line that installs GNU time via Homebrew. Signed-off-by: Johannes Schindelin <[email protected]> Reviewed-by: Lars Schneider <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05219a1 commit e3efa94

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ before_install:
8282
brew tap homebrew/binary --quiet
8383
brew_force_set_latest_binary_hash perforce
8484
brew_force_set_latest_binary_hash perforce-server
85+
# Uncomment this if you want to run perf tests:
86+
# brew install gnu-time
8587
brew install git-lfs perforce-server perforce gettext
8688
brew link --force gettext
8789
;;

t/perf/perf-lib.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,15 @@ test_checkout_worktree () {
127127
# Performance tests should never fail. If they do, stop immediately
128128
immediate=t
129129

130+
# Perf tests require GNU time
131+
case "$(uname -s)" in Darwin) GTIME="${GTIME:-gtime}";; esac
132+
GTIME="${GTIME:-/usr/bin/time}"
133+
130134
test_run_perf_ () {
131135
test_cleanup=:
132136
test_export_="test_cleanup"
133137
export test_cleanup test_export_
134-
/usr/bin/time -f "%E %U %S" -o test_time.$i "$SHELL" -c '
138+
"$GTIME" -f "%E %U %S" -o test_time.$i "$SHELL" -c '
135139
. '"$TEST_DIRECTORY"/test-lib-functions.sh'
136140
test_export () {
137141
[ $# != 0 ] || return 0

0 commit comments

Comments
 (0)