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
This commit is contained in:
Junio C Hamano 2016-07-11 10:31:06 -07:00
commit e9a6d71331
3 changed files with 17 additions and 6 deletions

View File

@ -115,8 +115,16 @@ After that you will want to use some of the following:
At least one of the first two is required! At least one of the first two is required!
You can use test_expect_success as usual. For actual performance You can use test_expect_success as usual. In both test_expect_success
tests, use 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' ' test_perf 'descriptive string' '
command1 && command1 &&

View File

@ -23,11 +23,11 @@ test_perf 'git log --follow (baseline for -M)' '
git log --oneline --follow -- "$file" >/dev/null git log --oneline --follow -- "$file" >/dev/null
' '
test_perf 'git log -L' ' test_perf 'git log -L (renames off)' '
git log -L 1:"$file" >/dev/null 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 git log -M -L 1:"$file" >/dev/null
' '

View File

@ -52,6 +52,9 @@ TEST_NO_MALLOC_CHECK=t
# need to export them for test_perf subshells # need to export them for test_perf subshells
export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP 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 perf_results_dir=$TEST_OUTPUT_DIRECTORY/test-results
mkdir -p "$perf_results_dir" mkdir -p "$perf_results_dir"
rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests
@ -81,7 +84,7 @@ test_perf_create_repo_from () {
repo="$1" repo="$1"
source="$2" source="$2"
source_git="$(git -C "$source" rev-parse --git-dir)" 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" mkdir -p "$repo/.git"
( (
cd "$source" && cd "$source" &&