]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/perf: add 'GIT_PERF_USE_SCALAR' run option
authorVictoria Dye <vdye@github.com>
Fri, 2 Sep 2022 15:56:49 +0000 (15:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Sep 2022 17:02:56 +0000 (10:02 -0700)
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 <derrickstolee@github.com>
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/README
t/perf/perf-lib.sh
t/perf/run

index fb9127a66f7561e528584c326a7d2539d2647dcb..8f217d7be7d557b642714cd8fa47bdb9d8f8981a 100644 (file)
@@ -95,6 +95,10 @@ You can set the following variables (also in your config.mak):
        Git (e.g., performance of index-pack as the number of threads
        changes). These can be enabled with GIT_PERF_EXTRA.
 
+    GIT_PERF_USE_SCALAR
+       Boolean indicating whether to register test repo(s) with Scalar
+       before executing tests.
+
 You can also pass the options taken by ordinary git tests; the most
 useful one is:
 
index 27c28017921a0bc804bb2488a3163bf632c09340..e7786775a9016151e063335047256bfea93d2f63 100644 (file)
@@ -49,6 +49,9 @@ export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP
 MODERN_GIT=$GIT_BUILD_DIR/bin-wrappers/git
 export MODERN_GIT
 
+MODERN_SCALAR=$GIT_BUILD_DIR/bin-wrappers/scalar
+export MODERN_SCALAR
+
 perf_results_dir=$TEST_RESULTS_DIR
 test -n "$GIT_PERF_SUBSECTION" && perf_results_dir="$perf_results_dir/$GIT_PERF_SUBSECTION"
 mkdir -p "$perf_results_dir"
@@ -120,6 +123,10 @@ test_perf_create_repo_from () {
                        # status" due to a locked index. Since we have
                        # a copy it's fine to remove the lock.
                        rm .git/index.lock
+               fi &&
+               if test_bool_env GIT_PERF_USE_SCALAR false
+               then
+                       "$MODERN_SCALAR" register
                fi
        ) || error "failed to copy repository '$source' to '$repo'"
 }
@@ -130,7 +137,11 @@ test_perf_fresh_repo () {
        "$MODERN_GIT" init -q "$repo" &&
        (
                cd "$repo" &&
-               test_perf_do_repo_symlink_config_
+               test_perf_do_repo_symlink_config_ &&
+               if test_bool_env GIT_PERF_USE_SCALAR false
+               then
+                       "$MODERN_SCALAR" register
+               fi
        )
 }
 
index 55219aa405638304411bc319cc29bb5eb2a39d0b..33da4d2aba2587b4591b0cd1c3785e6ff8119996 100755 (executable)
@@ -171,6 +171,9 @@ run_subsection () {
        get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf" "makeCommand"
        get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf" "makeOpts"
 
+       get_var_from_env_or_config "GIT_PERF_USE_SCALAR" "perf" "useScalar" "--bool"
+       export GIT_PERF_USE_SCALAR
+
        get_var_from_env_or_config "GIT_PERF_REPO_NAME" "perf" "repoName"
        export GIT_PERF_REPO_NAME