-
Notifications
You must be signed in to change notification settings - Fork 3
/
smoker
executable file
·79 lines (68 loc) · 2.05 KB
/
smoker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env perl6
use Panda;
use Shell::Command;
sub gen-result-success($project) {
{ prereq => True, build => True, test => True, warnings => (($project.build-stderr // '') ~~ / \S /).Bool }
}
sub gen-result-failure($ex) {
my %res = do given $ex.?stage {
when 'resolve' | 'fetch' {
{ prereq => False }
}
when 'build' {
{ prereq => True, build => False }
}
when 'test' {
{ prereq => True, build => True, test => False }
}
default {
say $ex.perl;
{ prereq => False }
}
};
%res<description> = $ex.?description // $ex.perl;
%res
}
sub MAIN ($projectsfile) {
try mkdir "installlib";
@*INC.push("{$*CWD}/installlib/lib");
%*ENV<PERL6LIB> = "{$*CWD}/installlib/lib:" ~ (%*ENV<PERL6LIB> // '');
try unlink "{$*CWD}/state";
my $e = Panda::Ecosystem.new(
statefile => "{$*CWD}/state",
projectsfile => $projectsfile,
) but role {
method flush-states { }
};
my $panda = Panda.new(
ecosystem => $e,
installer => Panda::Installer.new(destdir => "{$*CWD}/installlib")
);
my %log;
my $start = time;
for $panda.ecosystem.project-list -> $p {
my $x = $panda.ecosystem.get-project($p);
# don't waste time if it has already been installed once
if $panda.ecosystem.project-get-state($x) ne 'absent' {
%log{$p} = gen-result-success($p);
next;
}
try $panda.resolve($p);
%log{$p} = $! ?? gen-result-failure($!) !! gen-result-success($p);
}
my $end = time;
%log<_statistics> = {
runtime => $end - $start,
compiler => $*PERL.compiler.name,
version => $*PERL.compiler.version.Str,
datetime => DateTime.new(now).Str
}
shell 'rm -rf installlib/';
given open('results.json', :w) {
.say: to-json %log;
.close;
}
say '';
say 'Smoke test results have been written to results.json';
say '====================================================';
}