Skip to content

Commit ba1b117

Browse files
vdyegitster
authored andcommitted
t/perf: add 'GIT_PERF_USE_SCALAR' run option
Add a 'GIT_PERF_USE_SCALAR' environment variable (and corresponding perf config 'useScalar') to register a repository created with any of: * test_perf_fresh_repo * test_perf_default_repo * test_perf_large_repo as a Scalar enlistment. This is intended to allow a developer to test the impact of Scalar on already-defined performance scenarios. Suggested-by: Derrick Stolee <[email protected]> Signed-off-by: Victoria Dye <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e280923 commit ba1b117

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

t/perf/README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ You can set the following variables (also in your config.mak):
9595
Git (e.g., performance of index-pack as the number of threads
9696
changes). These can be enabled with GIT_PERF_EXTRA.
9797

98+
GIT_PERF_USE_SCALAR
99+
Boolean indicating whether to register test repo(s) with Scalar
100+
before executing tests.
101+
98102
You can also pass the options taken by ordinary git tests; the most
99103
useful one is:
100104

t/perf/perf-lib.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP
4949
MODERN_GIT=$GIT_BUILD_DIR/bin-wrappers/git
5050
export MODERN_GIT
5151

52+
MODERN_SCALAR=$GIT_BUILD_DIR/bin-wrappers/scalar
53+
export MODERN_SCALAR
54+
5255
perf_results_dir=$TEST_RESULTS_DIR
5356
test -n "$GIT_PERF_SUBSECTION" && perf_results_dir="$perf_results_dir/$GIT_PERF_SUBSECTION"
5457
mkdir -p "$perf_results_dir"
@@ -120,6 +123,10 @@ test_perf_create_repo_from () {
120123
# status" due to a locked index. Since we have
121124
# a copy it's fine to remove the lock.
122125
rm .git/index.lock
126+
fi &&
127+
if test_bool_env GIT_PERF_USE_SCALAR false
128+
then
129+
"$MODERN_SCALAR" register
123130
fi
124131
) || error "failed to copy repository '$source' to '$repo'"
125132
}
@@ -130,7 +137,11 @@ test_perf_fresh_repo () {
130137
"$MODERN_GIT" init -q "$repo" &&
131138
(
132139
cd "$repo" &&
133-
test_perf_do_repo_symlink_config_
140+
test_perf_do_repo_symlink_config_ &&
141+
if test_bool_env GIT_PERF_USE_SCALAR false
142+
then
143+
"$MODERN_SCALAR" register
144+
fi
134145
)
135146
}
136147

t/perf/run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ run_subsection () {
171171
get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf" "makeCommand"
172172
get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf" "makeOpts"
173173

174+
get_var_from_env_or_config "GIT_PERF_USE_SCALAR" "perf" "useScalar" "--bool"
175+
export GIT_PERF_USE_SCALAR
176+
174177
get_var_from_env_or_config "GIT_PERF_REPO_NAME" "perf" "repoName"
175178
export GIT_PERF_REPO_NAME
176179

0 commit comments

Comments
 (0)