Skip to content

Commit ce22ea2

Browse files
committed
Merge branch 'js/perf-on-apple' into maint
t/perf needs /usr/bin/time with GNU extension; the invocation of it is updated to "gtime" on Darwin. * js/perf-on-apple: perf: accommodate for MacOSX
2 parents c4cdde4 + e3efa94 commit ce22ea2

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)