-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathraku-test-all
More file actions
executable file
·45 lines (34 loc) · 1.12 KB
/
raku-test-all
File metadata and controls
executable file
·45 lines (34 loc) · 1.12 KB
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
#! /usr/bin/env -S nice raku
use v6;
use Shell::Piping;
use Shell::Piping::Whereceptions;
my int $exitcode = 0;
multi sub MAIN(‚test‘, $dir = ‚.‘, Bool :$verbose?) {
constant cores = $*KERNEL.cpu-cores - 1;
constant NL = $?NL;
my &RED = { „\e[31m$_\e[0m“ };
my &BOLD = { „\e[1m$_\e[0m“ };
&RED = &BOLD = { $_ } unless $*OUT.t;
sub run-test(IO::Path $file where &it-is-a-file) {
my @out;
my @err;
my $failed;
px«raku -Ilib $file» |» @out :stderr(@err) :done({$exitcode ⚛= 1 if .exitcodes.so});
(„Testing: {$file}“.&BOLD, @out, @err».&RED).flat.join(NL);
}
my \test-files = gather {
for „$dir/t“.IO.d ?? „$dir/t“ !! $dir {
if .IO.l && !.IO.e {
warn „WARN: dangling symlink in ⟨$_⟩.“;
next;
}
.take when .IO.extension eq ‚t‘ && !.IO.d;
.IO.dir()».&?BLOCK when .IO.d;
}
}
.put for test-files.sort.hyper(:batch(1), :degree(cores)).map(*.&run-test);
exit $exitcode;
}
multi sub MAIN() {
MAIN(‚test‘, ‚.‘)
}