]> git.ipfire.org Git - thirdparty/git.git/commitdiff
perf-lib.sh: forbid the use of GIT_TEST_INSTALLED
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 7 May 2019 10:54:34 +0000 (12:54 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 May 2019 02:00:28 +0000 (11:00 +0900)
As noted in preceding commits setting GIT_TEST_INSTALLED has never
been supported or documented, and as noted in an earlier t/perf/README
change to the extent that it's been documented nobody's notices that
the example hasn't worked since 3c8f12c96c ("test-lib: reorder and
include GIT-BUILD-OPTIONS a lot earlier", 2012-06-24).

We could directly support GIT_TEST_INSTALLED for invocations without
the "run" script, such as:

    GIT_TEST_INSTALLED=../../ ./p0000-perf-lib-sanity.sh
    GIT_TEST_INSTALLED=/home/avar/g/git ./p0000-perf-lib-sanity.sh

But while not having this "error" will "work", it won't write the the
resulting "test-results/*" files to the right place, and thus a
subsequent call to aggregate.perl won't work as expected.

Let's just tell the user that they need to use the "run" script,
which'll correctly deal with this and set the right
PERF_RESULTS_PREFIX.

If someone's in desperate need of bypassing "run" for whatever reason
they can trivially do so by setting "PERF_SET_GIT_TEST_INSTALLED", but
not we won't have people who expect GIT_TEST_INSTALLED to just work
wondering why their aggregation doesn't work, even though they're
running the right "git".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
t/perf/perf-lib.sh
t/perf/run

index 9cdccba2228f685849cdd8b744be4ecd65991a98..b58a43ea4364a8e5a2c5b9af39b41ec9f0b94f5b 100644 (file)
@@ -27,6 +27,17 @@ TEST_NO_MALLOC_CHECK=t
 
 . ../test-lib.sh
 
+if test -n "$GIT_TEST_INSTALLED" -a -z "$PERF_SET_GIT_TEST_INSTALLED"
+then
+       error "Do not use GIT_TEST_INSTALLED with the perf tests.
+
+Instead use:
+
+    ./run <path-to-git> -- <tests>
+
+See t/perf/README for details."
+fi
+
 # Variables from test-lib that are normally internal to the tests; we
 # need to export them for test_perf subshells
 export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP
index cd3882b117e56d5068d2d776596cf30b27d8161f..c7b86104e12a6637b1084d6e02743f6c36df9265 100755 (executable)
@@ -84,6 +84,8 @@ set_git_test_installed () {
                GIT_TEST_INSTALLED=$mydir_abs
        fi
        export GIT_TEST_INSTALLED
+       PERF_SET_GIT_TEST_INSTALLED=true
+       export PERF_SET_GIT_TEST_INSTALLED
 }
 
 run_dirs_helper () {