summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-07-11 10:31:06 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-07-11 10:31:06 -0700
commite9a6d713316d2e774d8005b8594a4fad75d7652d (patch)
treeb785c5e2a1c08f7ed88560a80f4450d426539b23
parentMerge branch 'jk/ansi-color' (diff)
parentp4211: explicitly disable renames in no-rename test (diff)
downloadtgif-e9a6d713316d2e774d8005b8594a4fad75d7652d.tar.xz
Merge branch 'jk/perf-any-version'
Allow t/perf framework to use the features from the most recent version of Git even when testing an older installed version. * jk/perf-any-version: p4211: explicitly disable renames in no-rename test t/perf: fix regression in testing older versions of git
-rw-r--r--t/perf/README12
-rwxr-xr-xt/perf/p4211-line-log.sh6
-rw-r--r--t/perf/perf-lib.sh5
3 files changed, 17 insertions, 6 deletions
diff --git a/t/perf/README b/t/perf/README
index 8848c14619..49ea4349be 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -115,8 +115,16 @@ After that you will want to use some of the following:
At least one of the first two is required!
-You can use test_expect_success as usual. For actual performance
-tests, use
+You can use test_expect_success as usual. In both test_expect_success
+and in test_perf, running "git" points to the version that is being
+perf-tested. The $MODERN_GIT variable points to the git wrapper for the
+currently checked-out version (i.e., the one that matches the t/perf
+scripts you are running). This is useful if your setup uses commands
+that only work with newer versions of git than what you might want to
+test (but obviously your new commands must still create a state that can
+be used by the older version of git you are testing).
+
+For actual performance tests, use
test_perf 'descriptive string' '
command1 &&
diff --git a/t/perf/p4211-line-log.sh b/t/perf/p4211-line-log.sh
index 3d074b0e41..b7ff68d4fa 100755
--- a/t/perf/p4211-line-log.sh
+++ b/t/perf/p4211-line-log.sh
@@ -23,11 +23,11 @@ test_perf 'git log --follow (baseline for -M)' '
git log --oneline --follow -- "$file" >/dev/null
'
-test_perf 'git log -L' '
- git log -L 1:"$file" >/dev/null
+test_perf 'git log -L (renames off)' '
+ git log --no-renames -L 1:"$file" >/dev/null
'
-test_perf 'git log -M -L' '
+test_perf 'git log -L (renames on)' '
git log -M -L 1:"$file" >/dev/null
'
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 773f955d4a..46f08ee087 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -52,6 +52,9 @@ TEST_NO_MALLOC_CHECK=t
# need to export them for test_perf subshells
export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP
+MODERN_GIT=$GIT_BUILD_DIR/bin-wrappers/git
+export MODERN_GIT
+
perf_results_dir=$TEST_OUTPUT_DIRECTORY/test-results
mkdir -p "$perf_results_dir"
rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests
@@ -81,7 +84,7 @@ test_perf_create_repo_from () {
repo="$1"
source="$2"
source_git="$(git -C "$source" rev-parse --git-dir)"
- objects_dir="$(git -C "$source" rev-parse --git-path objects)"
+ objects_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-path objects)"
mkdir -p "$repo/.git"
(
cd "$source" &&