Skip to content

Commit 379fa80

Browse files
committed
Generate the list of releases to run automatically
There is also a behavior change in the 'releases' command and the addition of 'v?6\.?c' and 'all' commands. 'releases' and 'v?6\.?c' run for all tags since 2015-12, while 'all' runs for all tags that use MoarVM (starts at 2014-01).
1 parent 69ff223 commit 379fa80

File tree

4 files changed

+77
-57
lines changed

4 files changed

+77
-57
lines changed

Benchable.p6

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use Stats;
2828

2929
unit class Benchable is Whateverable;
3030

31-
constant LIMIT = 300;
3231
constant TOTAL-TIME = 60*3;
3332
constant ITERATIONS = 5;
3433
constant LIB-DIR = '.'.IO.absolute;
@@ -94,42 +93,19 @@ multi method irc-to-me($message where { .text !~~ /:i ^ [help|source|url] ‘?
9493

9594
method process($message, $config, $code is copy) {
9695
my $start-time = now;
97-
my @commits;
9896
my $old-dir = $*CWD;
99-
100-
my $msg-response = '';
101-
my %graph;
102-
103-
if $config ~~ / ‘,’ / {
104-
@commits = $config.split: ,;
105-
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
106-
chdir RAKUDO; # goes back in LEAVE
107-
if run(git, rev-parse, --verify, $<start>).exitcode != 0 {
108-
return Bad start, cannot find a commit for “$<start>”;
109-
}
110-
if run(git, rev-parse, --verify, $<end>).exitcode != 0 {
111-
return Bad end, cannot find a commit for “$<end>”;
112-
}
113-
my ($result, $exit-status, $exit-signal, $time) =
114-
self.get-output(git, rev-list, $<start>^..$<end>); # TODO unfiltered input
115-
return Couldn't find anything in the range if $exit-status != 0;
116-
@commits = $result.split: \n;
117-
my $num-commits = @commits.elems;
118-
return Too many commits ($num-commits) in range, you're only allowed {LIMIT} if $num-commits > LIMIT;
119-
} elsif $config ~~ /:i releases / {
120-
@commits = @.releases;
121-
} elsif $config ~~ /:i compare \s $<commit>=\S+ / {
122-
@commits = $<commit>;
123-
} else {
124-
@commits = $config;
125-
}
97+
my ($commits-status, @commits) = self.get-commits($config);
98+
return $commits-status unless @commits;
12699

127100
my ($succeeded, $code-response) = self.process-code($code, $message);
128101
return $code-response unless $succeeded;
129102
$code = $code-response;
130103

131104
my $filename = self.write-code($code);
132105

106+
my $msg-response = '';
107+
my %graph;
108+
133109
my %times;
134110
for @commits -> $commit {
135111
FIRST my $once = 'Give me a ping, Vasili. One ping only, please.';
@@ -161,7 +137,7 @@ method process($message, $config, $code is copy) {
161137
# for these two config options, check if there are any large speed differences between two commits and if so,
162138
# recursively find the commit in the middle until there are either no more large speed differences or no
163139
# more commits inbetween (i.e., the next commit is the exact one that caused the difference)
164-
if $config ~~ /:i releases / or $config ~~ / ',' / {
140+
if $config ~~ /:i releases / or $config.contains(',') {
165141
$message.reply: 'benchmarked the given commits, now zooming in on performance differences';
166142
chdir RAKUDO;
167143

Committable.p6

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use IRC::Client;
2323

2424
unit class Committable is Whateverable;
2525

26-
constant LIMIT = 1000;
2726
constant TOTAL-TIME = 60*3;
2827

2928
method help($message) {
@@ -39,29 +38,9 @@ multi method irc-to-me($message where { .text !~~ /:i ^ [help|source|url] ‘?
3938

4039
method process($message, $config, $code is copy) {
4140
my $start-time = now;
42-
my @commits;
4341
my $old-dir = $*CWD;
44-
if $config ~~ / ‘,’ / {
45-
@commits = $config.split: ,;
46-
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
47-
chdir RAKUDO; # goes back in LEAVE
48-
if run(git, rev-parse, --verify, $<start>).exitcode != 0 {
49-
return Bad start, cannot find a commit for “$<start>”;
50-
}
51-
if run(git, rev-parse, --verify, $<end>).exitcode != 0 {
52-
return Bad end, cannot find a commit for “$<end>”;
53-
}
54-
my ($result, $exit-status, $exit-signal, $time) =
55-
self.get-output(git, rev-list, $<start>^..$<end>); # TODO unfiltered input
56-
return Couldn't find anything in the range if $exit-status != 0;
57-
@commits = $result.split: \n;
58-
my $num-commits = @commits.elems;
59-
return Too many commits ($num-commits) in range, you're only allowed {LIMIT} if $num-commits > LIMIT;
60-
} elsif $config ~~ /:i releases / {
61-
@commits = @.releases;
62-
} else {
63-
@commits = $config;
64-
}
42+
my ($commits-status, @commits) = self.get-commits($config);
43+
return $commits-status unless @commits;
6544

6645
my ($succeeded, $code-response) = self.process-code($code, $message);
6746
return $code-response unless $succeeded;

Whateverable.pm6

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ constant LEGACY-BUILDS-LOCATION = “{WORKING-DIRECTORY}/builds”.IO.absolute;
3737
unit class Whateverable does IRC::Client::Plugin;
3838

3939
constant MESSAGE-LIMIT is export = 260;
40+
constant COMMITS-LIMIT = 1000;
4041

4142
has $!timeout = 10;
4243
has $!stdin = slurp stdin;
43-
has $.releases = <2015.10 2015.11 2015.12 2016.02 2016.03 2016.04 2016.05 2016.06 2016.07.1 2016.08.1 HEAD>;
44+
has %!bad-releases = '2016.01' => True, '2016.01.1' => True;
4445

4546
class ResponseStr is Str is export {
4647
# I know it looks crazy, but we will subclass a Str and hope
@@ -136,6 +137,57 @@ method run-snippet($full-commit-hash, $file, :$timeout = $!timeout) {
136137
return @out
137138
}
138139

140+
method get-commits($config) {
141+
my @commits;
142+
143+
if $config.contains(,) {
144+
@commits = $config.split: ,;
145+
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
146+
chdir RAKUDO; # goes back in LEAVE
147+
if run(git, rev-parse, --verify, $<start>).exitcode != 0 {
148+
return Bad start, cannot find a commit for “$<start>”;
149+
}
150+
if run(git, rev-parse, --verify, $<end>).exitcode != 0 {
151+
return Bad end, cannot find a commit for “$<end>”;
152+
}
153+
my ($result, $exit-status, $exit-signal, $time) =
154+
self.get-output(git, rev-list, $<start>^..$<end>); # TODO unfiltered input
155+
return Couldn't find anything in the range if $exit-status != 0;
156+
@commits = $result.lines;
157+
my $num-commits = @commits.elems;
158+
return Too many commits ($num-commits) in range, you're only allowed {COMMITS-LIMIT} if $num-commits > COMMITS-LIMIT;
159+
} elsif $config ~~ /:i releases | v? 6 \.? c / {
160+
@commits = self.get-tags('2015-12-25');
161+
} elsif $config ~~ /:i all / {
162+
@commits = self.get-tags('2014-01-01');
163+
} elsif $config ~~ /:i compare \s $<commit>=\S+ / {
164+
@commits = $<commit>;
165+
} else {
166+
@commits = $config;
167+
}
168+
169+
return Nil, |@commits;
170+
}
171+
172+
method get-tags($date) {
173+
my $old-dir = $*CWD;
174+
chdir RAKUDO;
175+
LEAVE chdir $old-dir;
176+
177+
my @tags = <HEAD>;
178+
my %seen;
179+
for self.get-output('git', 'log', '--pretty="%d"', '--tags', '--no-walk', "--since=$date").lines -> $tag {
180+
if $tag ~~ /:i "tag:" \s* ((\d\d\d\d\.\d\d)[\.\d\d?]?) / and
181+
not %!bad-releases{$0}:exists and
182+
not %seen{$0[0]}++
183+
{
184+
@tags.push($0)
185+
}
186+
}
187+
188+
return @tags.reverse;
189+
}
190+
139191
method to-full-commit($commit, :$short = False) {
140192
my $old-dir = $*CWD;
141193
chdir RAKUDO;

t/committable.t

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,20 @@ $t.test(‘stdin char count’,
122122

123123
$t.test(“releases” query,
124124
commit: releases say $*PERL,
125-
/^ <{$t.our-nick}> ‘, ¦«2015.10,2015.11»: Perl 6 (6.b)␤¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,’ <-[‘»’]>* ‘HEAD»: ’ .* $/);
125+
/^ <{$t.our-nick}> ‘, ¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,2016.09,’ <-[‘»’]>* [‘HEAD»: Perl 6 (6.c)’ | ‘»: Perl 6 (6.c)␤¦«’ <-[‘»’]>* ‘HEAD»: Perl 6 (6.d)’] $/);
126+
127+
$t.test(“v6c” query,
128+
commit: v6c say $*PERL,
129+
/^ <{$t.our-nick}> ‘, ¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,2016.09,’ <-[‘»’]>* ‘HEAD»: Perl 6 (6.c)’ $/);
130+
131+
$t.test(“6.c” query,
132+
commit: 6.c say $*PERL,
133+
/^ <{$t.our-nick}> ‘, ¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07.1,2016.08.1,2016.09,’ <-[‘»’]>* ‘HEAD»: Perl 6 (6.c)’ $/);
134+
135+
$t.test(“all” query,
136+
commit: all say 'hi',
137+
{$t.our-nick}, https://whatever.able/fakeupload,
138+
:20timeout);
126139

127140
$t.test(multiple commits separated by comma,
128141
commit: 2016.02,2016.03,9ccd848,HEAD say ‘hello’,
@@ -137,8 +150,8 @@ $t.test(‘commit^^^ syntax’,
137150
{$t.our-nick}, ¦«2016.03^^^,2016.03^^,2016.03^,2016.03»: 42);
138151

139152
$t.test(commit..commit range syntax,
140-
commit: 2016.07~74..2016.07~72 say ‘a’ x 9999999999999999999,
141-
/^ <{$t.our-nick}> ‘, ¦«8ea2ae8,586f784»: ␤¦«87e8067,b31be7b,17e2679,2cc0f06,7242188,5d57154,6524d45,45c205a,d4b71b7,7799dbf,7e45d6b,abe034b,f772323,cbf1171,b11477f»: repeat count (-8446744073709551617) cannot be negative␤ in block <unit> at /tmp/’ \w+ line 1␤ «exit code = 1» $/);
153+
commit: 2016.07~73..2016.07~72 say ‘a’ x 9999999999999999999,
154+
/^ <{$t.our-nick}> ‘, ¦«8ea2ae8,586f784»: ␤¦«87e8067»: repeat count (-8446744073709551617) cannot be negative␤ in block <unit> at /tmp/’ \w+ line 1␤ «exit code = 1» $/);
142155

143156
# Special characters
144157

0 commit comments

Comments
 (0)