]> git.ipfire.org Git - thirdparty/git.git/commit
t/perf: fix benchmarks with out-of-tree builds
authorPatrick Steinhardt <ps@pks.im>
Mon, 28 Apr 2025 07:30:48 +0000 (09:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Apr 2025 20:13:52 +0000 (13:13 -0700)
commit5756ccd181d4cc938dfcd0fe96083ff6c1455afd
treef1b39e4c42a511b7fd0dd6010f003e1778fdb60e
parentd84b990883284920234f5bc951ea285161fc7bca
t/perf: fix benchmarks with out-of-tree builds

The "perf-lib.sh" script is sourced by all of our benchmarking suites to
make available common infrastructure. The script assumes that build and
source directory are the same, which works for our Makefile. But the
assumption breaks with both CMake and Meson, where the build directory
can be located in an arbitrary place.

Adapt the script so that it works with out-of-tree builds. Most
importantly, this requires us to figure out the location of the build
directory:

  - When running benchmarks via our Makefile the build directory is the
    same as the source directory. We already know to derive the test
    directory ("t/") via `$(pwd)/..`, which works because we chdir into
    "t/perf" before executing benchmarks. We can thus derive the build
    directory by appending another "/.." to that path.

  - When running benchmarks via Meson the build directory is located at
    an arbitrary location. The build system thus has to make the path
    known by exporting the `GIT_BUILD_DIR` environment variable.

This change prepares us for wiring up benchmarks in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/perf-lib.sh