Skip to content

Commit d84b990

Browse files
pks-tgitster
authored andcommitted
t/perf: use configured PERL_PATH
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5a6b9c8 commit d84b990

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

t/perf/aggregate.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/perl
1+
#!/usr/bin/env perl
22

33
use lib '../../perl/build/lib';
44
use strict;

t/perf/perf-lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ test_perf_ () {
276276
else
277277
test_ok_ "$1"
278278
fi
279-
"$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".result
279+
"$PERL_PATH" "$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".result
280280
rm test_time.*
281281
}
282282

@@ -324,7 +324,7 @@ test_at_end_hook_ () {
324324
if test -z "$GIT_PERF_AGGREGATING_LATER"; then
325325
(
326326
cd "$TEST_DIRECTORY"/perf &&
327-
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $(basename "$0")
327+
"$PERL_PATH" ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $(basename "$0")
328328
)
329329
fi
330330
}

t/perf/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ run_subsection () {
192192

193193
if test -z "$GIT_PERF_SEND_TO_CODESPEED"
194194
then
195-
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $codespeed_opt "$@"
195+
"$PERL_PATH" ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $codespeed_opt "$@"
196196
else
197197
json_res_file=""$TEST_RESULTS_DIR"/$GIT_PERF_SUBSECTION/aggregate.json"
198-
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" --codespeed "$@" | tee "$json_res_file"
198+
"$PERL_PATH" ./aggregate.perl --results-dir="$TEST_RESULTS_DIR" --codespeed "$@" | tee "$json_res_file"
199199
send_data_url="$GIT_PERF_SEND_TO_CODESPEED/result/add/json/"
200200
curl -v --request POST --data-urlencode "json=$(cat "$json_res_file")" "$send_data_url"
201201
fi

0 commit comments

Comments
 (0)