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 <johannes.schindelin@gmx.de> Reviewed-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jun 21, 2016 at 15:53 UTC e3efa94be985c398b2118c3c7f7f9bfe3d056687
2 files changed +7 -1
.travis.yml
+2
@@ -82,6 +82,8 @@ before_install:
82 brew tap homebrew/binary --quiet
83 brew_force_set_latest_binary_hash perforce
84 brew_force_set_latest_binary_hash perforce-server
85 + # Uncomment this if you want to run perf tests:
86 + # brew install gnu-time
87 brew install git-lfs perforce-server perforce gettext
88 brew link --force gettext
89 ;;
t/perf/perf-lib.sh
+5 -1
@@ -127,11 +127,15 @@ test_checkout_worktree () {
127 # Performance tests should never fail. If they do, stop immediately
128 immediate=t
129
130 +# Perf tests require GNU time
131 +case "$(uname -s)" in Darwin) GTIME="${GTIME:-gtime}";; esac
132 +GTIME="${GTIME:-/usr/bin/time}"
133 +
134 test_run_perf_ () {
135 test_cleanup=:
136 test_export_="test_cleanup"
137 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 '
139 . '"$TEST_DIRECTORY"/test-lib-functions.sh'
140 test_export () {
141 [ $# != 0 ] || return 0