@@ -36,7 +36,8 @@ sub format_times {
36
36
return $out ;
37
37
}
38
38
39
- my (@dirs , %dirnames , %dirabbrevs , %prefixes , @tests , $codespeed );
39
+ my (@dirs , %dirnames , %dirabbrevs , %prefixes , @tests ,
40
+ $codespeed , $subsection , $reponame );
40
41
while (scalar @ARGV ) {
41
42
my $arg = $ARGV [0];
42
43
my $dir ;
@@ -45,6 +46,24 @@ sub format_times {
45
46
shift @ARGV ;
46
47
next ;
47
48
}
49
+ if ($arg eq " --subsection" ) {
50
+ shift @ARGV ;
51
+ $subsection = $ARGV [0];
52
+ shift @ARGV ;
53
+ if (! $subsection ) {
54
+ die " empty subsection" ;
55
+ }
56
+ next ;
57
+ }
58
+ if ($arg eq " --reponame" ) {
59
+ shift @ARGV ;
60
+ $reponame = $ARGV [0];
61
+ shift @ARGV ;
62
+ if (! $reponame ) {
63
+ die " empty reponame" ;
64
+ }
65
+ next ;
66
+ }
48
67
last if -f $arg or $arg eq " --" ;
49
68
if (! -d $arg ) {
50
69
my $rev = Git::command_oneline(qw( rev-parse --verify) , $arg );
@@ -76,10 +95,15 @@ sub format_times {
76
95
}
77
96
78
97
my $resultsdir = " test-results" ;
79
- my $results_section = " " ;
80
- if (exists $ENV {GIT_PERF_SUBSECTION } and $ENV {GIT_PERF_SUBSECTION } ne " " ) {
81
- $resultsdir .= " /" . $ENV {GIT_PERF_SUBSECTION };
82
- $results_section = $ENV {GIT_PERF_SUBSECTION };
98
+
99
+ if (! $subsection and
100
+ exists $ENV {GIT_PERF_SUBSECTION } and
101
+ $ENV {GIT_PERF_SUBSECTION } ne " " ) {
102
+ $subsection = $ENV {GIT_PERF_SUBSECTION };
103
+ }
104
+
105
+ if ($subsection ) {
106
+ $resultsdir .= " /" . $subsection ;
83
107
}
84
108
85
109
my @subtests ;
@@ -183,19 +207,21 @@ sub print_default_results {
183
207
}
184
208
185
209
sub print_codespeed_results {
186
- my ($results_section ) = @_ ;
210
+ my ($subsection ) = @_ ;
187
211
188
212
my $project = " Git" ;
189
213
190
214
my $executable = ` uname -s -m` ;
191
215
chomp $executable ;
192
216
193
- if ($results_section ne " " ) {
194
- $executable .= " , " . $results_section ;
217
+ if ($subsection ) {
218
+ $executable .= " , " . $subsection ;
195
219
}
196
220
197
221
my $environment ;
198
- if (exists $ENV {GIT_PERF_REPO_NAME } and $ENV {GIT_PERF_REPO_NAME } ne " " ) {
222
+ if ($reponame ) {
223
+ $environment = $reponame ;
224
+ } elsif (exists $ENV {GIT_PERF_REPO_NAME } and $ENV {GIT_PERF_REPO_NAME } ne " " ) {
199
225
$environment = $ENV {GIT_PERF_REPO_NAME };
200
226
} elsif (exists $ENV {GIT_TEST_INSTALLED } and $ENV {GIT_TEST_INSTALLED } ne " " ) {
201
227
$environment = $ENV {GIT_TEST_INSTALLED };
@@ -227,13 +253,13 @@ sub print_codespeed_results {
227
253
}
228
254
}
229
255
230
- print to_json(\@data , {utf8 => 1, pretty => 1}), " \n " ;
256
+ print to_json(\@data , {utf8 => 1, pretty => 1, canonical => 1 }), " \n " ;
231
257
}
232
258
233
259
binmode STDOUT , " :utf8" or die " PANIC on binmode: $! " ;
234
260
235
261
if ($codespeed ) {
236
- print_codespeed_results($results_section );
262
+ print_codespeed_results($subsection );
237
263
} else {
238
264
print_default_results();
239
265
}
0 commit comments