perf: store subsection results in "test-results/$GIT_PERF_SUBSECTION/"

When tests are run for a subsection defined in a config file, it is better if the results for the current subsection are not overwritting the results of a previous subsection. So let's store the results for a subsection in a subdirectory of "test-results/" with the subsection name. The aggregate.perl, when it is run for a subsection, should then aggregate the results found in "test-results/$GIT_PERF_SUBSECTION/". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Sep 23, 2017 at 19:55 UTC 5d445f3416ef916c519e7d2a7796c4541e766033
2 files changed +9 -3
t/perf/aggregate.perl
+8 -3
@@ -69,12 +69,17 @@ if (not @tests) {
69 @tests = glob "p????-*.sh";
70 }
71
72 +my $resultsdir = "test-results";
73 +if ($ENV{GIT_PERF_SUBSECTION} ne "") {
74 + $resultsdir .= "/" . $ENV{GIT_PERF_SUBSECTION};
75 +}
76 +
77 my @subtests;
78 my %shorttests;
79 for my $t (@tests) {
80 $t =~ s{(?:.*/)?(p(\d+)-[^/]+)\.sh$}{$1} or die "bad test name: $t";
81 my $n = $2;
77 - my $fname = "test-results/$t.subtests";
82 + my $fname = "$resultsdir/$t.subtests";
83 open my $fp, "<", $fname or die "cannot open $fname: $!";
84 for (<$fp>) {
85 chomp;
@@ -98,7 +103,7 @@ sub read_descr {
103 my %descrs;
104 my $descrlen = 4; # "Test"
105 for my $t (@subtests) {
101 - $descrs{$t} = $shorttests{$t}.": ".read_descr("test-results/$t.descr");
106 + $descrs{$t} = $shorttests{$t}.": ".read_descr("$resultsdir/$t.descr");
107 $descrlen = length $descrs{$t} if length $descrs{$t}>$descrlen;
108 }
109
@@ -138,7 +143,7 @@ for my $t (@subtests) {
143 my $firstr;
144 for my $i (0..$#dirs) {
145 my $d = $dirs[$i];
141 - $times{$prefixes{$d}.$t} = [get_times("test-results/$prefixes{$d}$t.times")];
146 + $times{$prefixes{$d}.$t} = [get_times("$resultsdir/$prefixes{$d}$t.times")];
147 my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
148 my $w = length format_times($r,$u,$s,$firstr);
149 $colwidth[$i] = $w if $w > $colwidth[$i];
t/perf/perf-lib.sh
+1
@@ -56,6 +56,7 @@ MODERN_GIT=$GIT_BUILD_DIR/bin-wrappers/git
56 export MODERN_GIT
57
58 perf_results_dir=$TEST_OUTPUT_DIRECTORY/test-results
59 +test -n "$GIT_PERF_SUBSECTION" && perf_results_dir="$perf_results_dir/$GIT_PERF_SUBSECTION"
60 mkdir -p "$perf_results_dir"
61 rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests
62