Merge branch 'js/perf-on-apple' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2016 17:44:15 +0000 (10:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2016 17:44:15 +0000 (10:44 -0700)
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

.travis.yml
t/perf/perf-lib.sh
index c20ec540c8488e1d3b589a66a69ba269342159d7..c2b76f9b7ea0bfa76720d3c1867ad148c35fa858 100644 (file)
@@ -82,6 +82,8 @@ before_install:
       brew tap homebrew/binary --quiet
       brew_force_set_latest_binary_hash perforce
       brew_force_set_latest_binary_hash perforce-server
+      # Uncomment this if you want to run perf tests:
+      # brew install gnu-time
       brew install git-lfs perforce-server perforce gettext
       brew link --force gettext
       ;;
index 18c363ea7f384ee625b0efc162dc081f51a3780f..773f955d4a251e768b8bc39f7e05161936fda1f5 100644 (file)
@@ -127,11 +127,15 @@ test_checkout_worktree () {
 # Performance tests should never fail.  If they do, stop immediately
 immediate=t
 
+# Perf tests require GNU time
+case "$(uname -s)" in Darwin) GTIME="${GTIME:-gtime}";; esac
+GTIME="${GTIME:-/usr/bin/time}"
+
 test_run_perf_ () {
        test_cleanup=:
        test_export_="test_cleanup"
        export test_cleanup test_export_
-       /usr/bin/time -f "%E %U %S" -o test_time.$i "$SHELL" -c '
+       "$GTIME" -f "%E %U %S" -o test_time.$i "$SHELL" -c '
 . '"$TEST_DIRECTORY"/test-lib-functions.sh'
 test_export () {
        [ $# != 0 ] || return 0