-
Notifications
You must be signed in to change notification settings - Fork 0
/
hook.pl
62 lines (45 loc) · 1.16 KB
/
hook.pl
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
if (config()->{action} eq 'list-installed'){
run_story('list-installed');
exit;
}
my @list;
if (config()->{'pkg-list'}){
@list = split /,/, config()->{'pkg-list'};
} else {
@list = keys %$list;
open(my $fh, '-|', 'opkg list') or die "can't open `opkg list` for read: $!";
while ( my $l = <$fh>) {
chomp $l;
# wget - 1.15
$l=~/^(\S+?)\s+-\s/ or next;
push @list, $1;
}
close $fh;
}
my $smoke_test = config()->{'smoke_test'};
my %bad_packages = map { $_ => 1 } keys %{config()->{bad_packages}};
run_story("packages-snapshot");
for my $p (sort @list){
if ($bad_packages{$p}){
run_story("pkg/install-fail", { pkg => $p });
} else {
run_story("pkg/install", { pkg => $p });
run_story("pkg/test", { pkg => $p , command => $smoke_test->{$p}->{command}});
run_story("pkg/cleanup");
}
}
my @s;
select(STDERR);
for my $s (Outthentic::Story::Stat->failures){
@s = ( $s->{path}, ( join ' ', map { "$_:$s->{vars}->{$_}" } keys %{$s->{vars}} ) );
write;
}
format STDERR_TOP =
//////////////////////////////////
/// Custom Report ( Failures ) ///
//////////////////////////////////
.
format STDERR =
@* @*
$s[0], $s[1]
.