-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrun-tests
134 lines (115 loc) · 2.93 KB
/
run-tests
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
unit sub MAIN(
:a($author),
:i($install),
:$rmd,
:$disable-spesh,
:$disable-spesh-inline,
:$disable-JIT,
:$enable-spesh-nodelay,
:$enable-spesh-blocking,
:$enable-spesh-log,
);
say run(<raku --version>, :out).out.slurp.chomp;
say "Running on $*DISTRO.gist().\n";
if $rmd {
%*ENV<RAKUDO_MODULE_DEBUG> := 1;
say "RAKUDO_MODULE_DEBUG=1";
}
if $disable-spesh {
%*ENV<MVM_SPESH_DISABLE> := 1;
say "MVM_SPESH_DISABLE=1";
}
if $disable-spesh-inline {
%*ENV<MVM_SPESH_INLINE_DISABLE> := 1;
say "MVM_SPESH_INLINE_DISABLE=1";
}
if $disable-JIT {
%*ENV<MVM_JIT_DISABLE> := 1;
say "MVM_JIT_DISABLE=1";
}
if $enable-spesh-nodelay {
%*ENV<MVM_SPESH_NODELAY> := 1;
say "MVM_SPESH_NODELAY=1";
}
if $enable-spesh-blocking {
%*ENV<MVM_SPESH_BLOCKING> := 1;
say "MVM_SPESH_BLOCKING=1";
}
my $spesh-log;
if $enable-spesh-log {
$spesh-log = (
$enable-spesh-log ~~ Bool ?? "spesh-log" !! $enable-spesh-log
).IO;
%*ENV<MVM_SPESH_LOG> := $spesh-log.absolute;
say "MVM_SPESH_LOG=$spesh-log.relative()";
}
say ""
if $rmd
|| $disable-spesh
|| $disable-spesh-inline
|| $disable-JIT
|| $enable-spesh-nodelay
|| $enable-spesh-blocking
|| $enable-spesh-log;
say "Testing {
"dist.ini".IO.lines.head.substr(7)
}{
" including author tests" if $author
}";
my @failed;
my $done = 0;
sub process($proc, $filename) {
if $proc {
$proc.out.slurp;
$spesh-log.unlink if $spesh-log;
}
else {
@failed.push($filename);
if $proc.out.slurp -> $stdout {
my @lines = $stdout.lines;
with @lines.first(
*.starts-with(" from gen/moar/stage2"),:k)
-> $index {
say @lines[^$index].join("\n");
}
else {
say $stdout;
}
}
else {
say "No output received, exit-code $proc.exitcode() ($proc.signal()):\n$proc.os-error()";
}
if $spesh-log {
say "\nSpesh log requested, showing last 20000 lines:";
say $spesh-log.lines(:!chomp).tail(20000).join;
$spesh-log.unlink;
}
}
}
sub install() {
my $zef := $*DISTRO.is-win ?? 'zef.bat' !! 'zef';
my $proc := run $zef, "install", ".", "--verbose", "--/test", :out,:err,:merge;
process($proc, "*installation*");
}
sub test-dir($dir) {
for $dir.IO.dir(:test(*.ends-with: '.t' | '.rakutest')).map(*.Str).sort {
say "=== $_";
my $proc := run "raku", "--ll-exception", "-I.", $_, :out,:err,:merge;
process($proc, $_);
$done++;
}
}
test-dir("t");
test-dir($_) for dir("t", :test({ !.starts-with(".") && "t/$_".IO.d})).map(*.Str).sort;
test-dir("xt") if $author && "xt".IO.e;
if $install {
install;
++$done;
}
if @failed {
say "\nFAILED: {+@failed} of $done:";
say " $_" for @failed;
exit +@failed;
}
say "\nALL {"$done " if $done > 1}OK";
# vim: expandtab shiftwidth=4