Skip to content

Commit e163f73

Browse files
committed
Merge branch 'ps/perf-with-separate-output-directory'
Test update. * ps/perf-with-separate-output-directory: perf: fix when running with TEST_OUTPUT_DIRECTORY
2 parents 8a49dfa + 3663e59 commit e163f73

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

t/perf/aggregate.perl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ sub usage {
5858
Options:
5959
--codespeed * Format output for Codespeed
6060
--reponame <str> * Send given reponame to codespeed
61+
--results-dir <str> * Directory where test results are located
6162
--sort-by <str> * Sort output (only "regression" criteria is supported)
6263
--subsection <str> * Use results from given subsection
6364
@@ -91,11 +92,13 @@ sub sane_backticks {
9192

9293
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
9394
$codespeed, $sortby, $subsection, $reponame);
95+
my $resultsdir = "test-results";
9496

9597
Getopt::Long::Configure qw/ require_order /;
9698

9799
my $rc = GetOptions("codespeed" => \$codespeed,
98100
"reponame=s" => \$reponame,
101+
"results-dir=s" => \$resultsdir,
99102
"sort-by=s" => \$sortby,
100103
"subsection=s" => \$subsection);
101104
usage() unless $rc;
@@ -137,8 +140,6 @@ sub sane_backticks {
137140
@tests = glob "p????-*.sh";
138141
}
139142

140-
my $resultsdir = "test-results";
141-
142143
if (! $subsection and
143144
exists $ENV{GIT_PERF_SUBSECTION} and
144145
$ENV{GIT_PERF_SUBSECTION} ne "") {

t/perf/perf-lib.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP
4545
MODERN_GIT=$GIT_BUILD_DIR/bin-wrappers/git
4646
export MODERN_GIT
4747

48-
perf_results_dir=$TEST_OUTPUT_DIRECTORY/test-results
48+
perf_results_dir=$TEST_RESULTS_DIR
4949
test -n "$GIT_PERF_SUBSECTION" && perf_results_dir="$perf_results_dir/$GIT_PERF_SUBSECTION"
5050
mkdir -p "$perf_results_dir"
5151
rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests
@@ -253,7 +253,10 @@ test_size () {
253253
# and does it after running everything)
254254
test_at_end_hook_ () {
255255
if test -z "$GIT_PERF_AGGREGATING_LATER"; then
256-
( cd "$TEST_DIRECTORY"/perf && ./aggregate.perl $(basename "$0") )
256+
(
257+
cd "$TEST_DIRECTORY"/perf &&
258+
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $(basename "$0")
259+
)
257260
fi
258261
}
259262

t/perf/run

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ run_subsection () {
188188

189189
if test -z "$GIT_PERF_SEND_TO_CODESPEED"
190190
then
191-
./aggregate.perl $codespeed_opt "$@"
191+
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" $codespeed_opt "$@"
192192
else
193-
json_res_file="test-results/$GIT_PERF_SUBSECTION/aggregate.json"
194-
./aggregate.perl --codespeed "$@" | tee "$json_res_file"
193+
json_res_file=""$TEST_RESULTS_DIR"/$GIT_PERF_SUBSECTION/aggregate.json"
194+
./aggregate.perl --results-dir="$TEST_RESULTS_DIR" --codespeed "$@" | tee "$json_res_file"
195195
send_data_url="$GIT_PERF_SEND_TO_CODESPEED/result/add/json/"
196196
curl -v --request POST --data-urlencode "json=$(cat "$json_res_file")" "$send_data_url"
197197
fi
@@ -203,10 +203,17 @@ get_var_from_env_or_config "GIT_PERF_SEND_TO_CODESPEED" "perf" "sendToCodespeed"
203203
cd "$(dirname $0)"
204204
. ../../GIT-BUILD-OPTIONS
205205

206-
mkdir -p test-results
207-
get_subsections "perf" >test-results/run_subsections.names
206+
if test -n "$TEST_OUTPUT_DIRECTORY"
207+
then
208+
TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/test-results"
209+
else
210+
TEST_RESULTS_DIR=test-results
211+
fi
212+
213+
mkdir -p "$TEST_RESULTS_DIR"
214+
get_subsections "perf" >"$TEST_RESULTS_DIR"/run_subsections.names
208215

209-
if test $(wc -l <test-results/run_subsections.names) -eq 0
216+
if test $(wc -l <"$TEST_RESULTS_DIR"/run_subsections.names) -eq 0
210217
then
211218
if test -n "$GIT_PERF_SUBSECTION"
212219
then
@@ -222,10 +229,10 @@ then
222229
)
223230
elif test -n "$GIT_PERF_SUBSECTION"
224231
then
225-
egrep "^$GIT_PERF_SUBSECTION\$" test-results/run_subsections.names >/dev/null ||
232+
egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null ||
226233
die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
227234

228-
egrep "^$GIT_PERF_SUBSECTION\$" test-results/run_subsections.names | while read -r subsec
235+
egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec
229236
do
230237
(
231238
GIT_PERF_SUBSECTION="$subsec"
@@ -243,5 +250,5 @@ else
243250
echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
244251
run_subsection "$@"
245252
)
246-
done <test-results/run_subsections.names
253+
done <"$TEST_RESULTS_DIR"/run_subsections.names
247254
fi

0 commit comments

Comments
 (0)