Skip to content

Commit

Permalink
Generate the list of releases to run automatically
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
MasterDuke17 committed Oct 16, 2016
1 parent 69ff223 commit 379fa80
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 57 deletions.
36 changes: 6 additions & 30 deletions Benchable.p6
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use Stats;

unit class Benchable is Whateverable;

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

method process($message, $config, $code is copy) {
my $start-time = now;
my @commits;
my $old-dir = $*CWD;

my $msg-response = '';
my %graph;

if $config ~~ / ‘,’ / {
@commits = $config.split: ,;
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
chdir RAKUDO; # goes back in LEAVE
if run(git, rev-parse, --verify, $<start>).exitcode != 0 {
return Bad start, cannot find a commit for “$<start>”;
}
if run(git, rev-parse, --verify, $<end>).exitcode != 0 {
return Bad end, cannot find a commit for “$<end>”;
}
my ($result, $exit-status, $exit-signal, $time) =
self.get-output(git, rev-list, $<start>^..$<end>); # TODO unfiltered input
return Couldn't find anything in the range if $exit-status != 0;
@commits = $result.split: \n;
my $num-commits = @commits.elems;
return Too many commits ($num-commits) in range, you're only allowed {LIMIT} if $num-commits > LIMIT;
} elsif $config ~~ /:i releases / {
@commits = @.releases;
} elsif $config ~~ /:i compare \s $<commit>=\S+ / {
@commits = $<commit>;
} else {
@commits = $config;
}
my ($commits-status, @commits) = self.get-commits($config);
return $commits-status unless @commits;

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

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

my $msg-response = '';
my %graph;

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

Expand Down
25 changes: 2 additions & 23 deletions Committable.p6
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use IRC::Client;

unit class Committable is Whateverable;

constant LIMIT = 1000;
constant TOTAL-TIME = 60*3;

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

method process($message, $config, $code is copy) {
my $start-time = now;
my @commits;
my $old-dir = $*CWD;
if $config ~~ / ‘,’ / {
@commits = $config.split: ,;
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
chdir RAKUDO; # goes back in LEAVE
if run(git, rev-parse, --verify, $<start>).exitcode != 0 {
return Bad start, cannot find a commit for “$<start>”;
}
if run(git, rev-parse, --verify, $<end>).exitcode != 0 {
return Bad end, cannot find a commit for “$<end>”;
}
my ($result, $exit-status, $exit-signal, $time) =
self.get-output(git, rev-list, $<start>^..$<end>); # TODO unfiltered input
return Couldn't find anything in the range if $exit-status != 0;
@commits = $result.split: \n;
my $num-commits = @commits.elems;
return Too many commits ($num-commits) in range, you're only allowed {LIMIT} if $num-commits > LIMIT;
} elsif $config ~~ /:i releases / {
@commits = @.releases;
} else {
@commits = $config;
}
my ($commits-status, @commits) = self.get-commits($config);
return $commits-status unless @commits;

my ($succeeded, $code-response) = self.process-code($code, $message);
return $code-response unless $succeeded;
Expand Down
54 changes: 53 additions & 1 deletion Whateverable.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ constant LEGACY-BUILDS-LOCATION = “{WORKING-DIRECTORY}/builds”.IO.absolute;
unit class Whateverable does IRC::Client::Plugin;

constant MESSAGE-LIMIT is export = 260;
constant COMMITS-LIMIT = 1000;

has $!timeout = 10;
has $!stdin = slurp stdin;
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>;
has %!bad-releases = '2016.01' => True, '2016.01.1' => True;

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

method get-commits($config) {
my @commits;

if $config.contains(,) {
@commits = $config.split: ,;
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
chdir RAKUDO; # goes back in LEAVE
if run(git, rev-parse, --verify, $<start>).exitcode != 0 {
return Bad start, cannot find a commit for “$<start>”;
}
if run(git, rev-parse, --verify, $<end>).exitcode != 0 {
return Bad end, cannot find a commit for “$<end>”;
}
my ($result, $exit-status, $exit-signal, $time) =
self.get-output(git, rev-list, $<start>^..$<end>); # TODO unfiltered input
return Couldn't find anything in the range if $exit-status != 0;
@commits = $result.lines;
my $num-commits = @commits.elems;
return Too many commits ($num-commits) in range, you're only allowed {COMMITS-LIMIT} if $num-commits > COMMITS-LIMIT;
} elsif $config ~~ /:i releases | v? 6 \.? c / {
@commits = self.get-tags('2015-12-25');
} elsif $config ~~ /:i all / {
@commits = self.get-tags('2014-01-01');
} elsif $config ~~ /:i compare \s $<commit>=\S+ / {
@commits = $<commit>;
} else {
@commits = $config;
}

return Nil, |@commits;
}

method get-tags($date) {
my $old-dir = $*CWD;
chdir RAKUDO;
LEAVE chdir $old-dir;

my @tags = <HEAD>;
my %seen;
for self.get-output('git', 'log', '--pretty="%d"', '--tags', '--no-walk', "--since=$date").lines -> $tag {
if $tag ~~ /:i "tag:" \s* ((\d\d\d\d\.\d\d)[\.\d\d?]?) / and
not %!bad-releases{$0}:exists and
not %seen{$0[0]}++
{
@tags.push($0)
}
}

return @tags.reverse;
}

method to-full-commit($commit, :$short = False) {
my $old-dir = $*CWD;
chdir RAKUDO;
Expand Down
19 changes: 16 additions & 3 deletions t/committable.t
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,20 @@ $t.test(‘stdin char count’,

$t.test(“releases” query,
commit: releases say $*PERL,
/^ <{$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»: ’ .* $/);
/^ <{$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)’] $/);

$t.test(“v6c” query,
commit: v6c say $*PERL,
/^ <{$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)’ $/);

$t.test(“6.c” query,
commit: 6.c say $*PERL,
/^ <{$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)’ $/);

$t.test(“all” query,
commit: all say 'hi',
{$t.our-nick}, https://whatever.able/fakeupload,
:20timeout);

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

$t.test(commit..commit range syntax,
commit: 2016.07~74..2016.07~72 say ‘a’ x 9999999999999999999,
/^ <{$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» $/);
commit: 2016.07~73..2016.07~72 say ‘a’ x 9999999999999999999,
/^ <{$t.our-nick}> ‘, ¦«8ea2ae8,586f784»: ␤¦«87e8067»: repeat count (-8446744073709551617) cannot be negative␤ in block <unit> at /tmp/’ \w+ line 1␤ «exit code = 1» $/);

# Special characters

Expand Down

0 comments on commit 379fa80

Please sign in to comment.