]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/perf: use configured PERL_PATH
authorPatrick Steinhardt <ps@pks.im>
Mon, 28 Apr 2025 07:30:47 +0000 (09:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Apr 2025 20:13:51 +0000 (13:13 -0700)
Our benchmarks use a couple of Perl scripts to compute results. These
Perl scripts get executed directly, and as the shebang is hardcoded to
"/usr/bin/perl" this will fail on any system where the Perl interpreter
is located in a different path.

Our build infrastructure already lets users configure the location of
Perl, which ultimately gets written into the GIT-BUILD-OPTIONS file.
This file is being sourced by "test-lib.sh", and consequently we already
have the "PERL_PATH" variable available that contains its configured
location.

Use "PERL_PATH" to execute Perl scripts, which makes them work on more
esoteric systems like NixOS. Furthermore, adapt the shebang to use
env(1) to execute Perl so that users who have Perl in PATH, but in a
non-standard location can execute the script directly.

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

index 575d2000cc168426bea205b9ee5dc31b667ad935..1791c7528a9f22b0ec5652d6244491065f05b490 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use lib '../../perl/build/lib';
 use strict;
index 1a9a51ca3ccb5c9b3b3670e943147d3d1e85378e..4173eee4def0eb9a794ceb699557f68f92268ecd 100644 (file)
@@ -276,7 +276,7 @@ test_perf_ () {
        else
                test_ok_ "$1"
        fi
-       "$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".result
+       "$PERL_PATH" "$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".result
        rm test_time.*
 }
 
@@ -324,7 +324,7 @@ test_at_end_hook_ () {
        if test -z "$GIT_PERF_AGGREGATING_LATER"; then
                (
                        cd "$TEST_DIRECTORY"/perf &&
-                       ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $(basename "$0")
+                       "$PERL_PATH" ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $(basename "$0")
                )
        fi
 }
index 486ead21980ec27de640745fe2b67fe869a08b4c..073bcb2affffc3baa098f2c6f82155a73e2e1e88 100755 (executable)
@@ -192,10 +192,10 @@ run_subsection () {
 
        if test -z "$GIT_PERF_SEND_TO_CODESPEED"
        then
-               ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $codespeed_opt "$@"
+               "$PERL_PATH" ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $codespeed_opt "$@"
        else
                json_res_file=""$TEST_RESULTS_DIR"/$GIT_PERF_SUBSECTION/aggregate.json"
-               ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" --codespeed "$@" | tee "$json_res_file"
+               "$PERL_PATH" ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" --codespeed "$@" | tee "$json_res_file"
                send_data_url="$GIT_PERF_SEND_TO_CODESPEED/result/add/json/"
                curl -v --request POST --data-urlencode "json=$(cat "$json_res_file")" "$send_data_url"
        fi