-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathknown_bugs.pm
163 lines (118 loc) · 6.26 KB
/
known_bugs.pm
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Copyright 2015-2018 SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later
package known_bugs;
use base Exporter;
use Exporter;
use strict;
use warnings;
use testapi;
use Utils::Architectures;
use main_common;
use version_utils;
our @EXPORT = qw(
create_list_of_serial_failures
create_list_of_autoinst_failures
upload_journal
);
=head1 KNOWN_BUGS
=head1 SYNOPSIS
C<use lib::known_bugs>
Allows detection of known errors on the serial console
As we have reocurring problems that can be easily detected on serial level we have decided to detect and show them in opneQA to ease up review and where possible only softfail to not lose the whole test suite
=cut
=head2 create_list_of_serial_failures
Returns the list of known bug patterns on the serial logs
C<my $list = create_list_of_serial_failures();>
This will be used in main.pm to initialize the backend with that list:
C<$testapi::distri->set_expected_serial_failures($list);>
To add a known bug simply copy and adapt the following line:
C<push @$serial_failures, {type => soft/hard, message => 'Errormsg', pattern => quotemeta 'ErrorPattern', post_boot_type => soft/hard }>
LTP tests use post_boot_type to change failure type during job runtime so that
kernel warnings during boot don't immediately terminate LTP jobs but warnings
triggered by LTP tests get reported as failures.
=cut
sub create_list_of_serial_failures {
my $serial_failures = [];
# Detect rogue workqueue lockup
push @$serial_failures, {type => 'soft', message => 'rogue workqueue lockup bsc#1126782', pattern => quotemeta 'BUG: workqueue lockup'};
# Detect bsc#1093797 on aarch64
if (is_sle('=12-SP4') && is_aarch64) {
push @$serial_failures, {type => 'hard', message => 'bsc#1093797', pattern => quotemeta 'Internal error: Oops: 96000006'};
}
push @$serial_failures, {type => 'soft', message => 'bsc#1103199', pattern => qr/serial-getty.*service: Service hold-off time over, scheduling restart/};
if (is_kernel_test()) {
my $type = is_ltp_test() ? 'soft' : 'hard';
push @$serial_failures, {type => $type, message => 'Kernel Oops found', pattern => quotemeta 'Oops:', post_boot_type => 'hard'};
push @$serial_failures, {type => $type, message => 'Kernel BUG found', pattern => qr/kernel BUG at/i, post_boot_type => 'hard'};
push @$serial_failures, {type => $type, message => 'WARNING CPU in kernel messages', pattern => quotemeta 'WARNING: CPU', post_boot_type => 'hard', soft_on_expect_warn => 1};
push @$serial_failures, {type => $type, message => 'Kernel stack is corrupted', pattern => quotemeta 'stack-protector: Kernel stack is corrupted', post_boot_type => 'hard'};
push @$serial_failures, {type => $type, message => 'Kernel BUG found', pattern => quotemeta 'BUG: failure at', post_boot_type => 'hard'};
push @$serial_failures, {type => $type, message => 'Kernel Oops found', pattern => quotemeta '-[ cut here ]-', post_boot_type => 'hard', soft_on_expect_warn => 1};
# bsc#1229025, but must be soft because any LTP test which intentionally triggers OOM killer will produce this call trace as well
push @$serial_failures, {type => 'soft', message => 'Kernel Call Trace found', pattern => quotemeta 'Call Trace:'};
}
push @$serial_failures, {type => 'soft', message => 'Low memory problem detected bsc#1166955', pattern => quotemeta 'kswapd0 Kdump'};
# CPU soft lockup detection will lead to a message instead of a soft or hard failure
push @$serial_failures, {type => 'info', message => 'CPU soft lockup detected', pattern => quotemeta 'soft lockup - CPU'};
# Detect Out of Memory condition
push @$serial_failures, {type => 'hard', message => 'Out of memory', pattern => quotemeta 'Out of memory:'} if !(is_ltp_test());
return $serial_failures;
}
=head2 create_list_of_autoinst_failures
To add a known bug simply copy and adapt the following line:
C<push @$autoinst_failures, {type => soft/hard, message => 'Errormsg', pattern => quotemeta 'ErrorPattern' };>
type=soft will force the testmodule result to softfail
type=hard will just emit a soft fail message but the module will do a normal fail
type=info will message the user but the module will not fail
=cut
sub create_list_of_autoinst_failures {
my $autoinst_failures = [];
return $autoinst_failures;
}
=head2 create_list_of_journal_failures
To add a known bug simply copy and adapt the following line:
C<push @$journal_failures, {type => soft/hard, message => 'Errormsg', pattern => quotemeta 'ErrorPattern' };>
type=soft will force the testmodule result to softfail
type=hard will just emit a soft fail message but the module will do a normal fail
=cut
sub create_list_of_journal_failures {
my $journal_failures = [];
return $journal_failures;
}
=head2 upload_journal
Checks the journal for known patterns defined in $journal_failures
Do not touch unless you know what you're doing
=cut
sub upload_journal {
my ($file) = @_;
my $failures = create_list_of_journal_failures();
$file = upload_logs($file);
my $die = 0;
my %regexp_matched;
# loop line by line
open(my $journal, '<', "ulogs/$file") or die("Could not open uploaded journal: $file");
while (my $line = <$journal>) {
chomp $line;
for my $regexp_table (@{$failures}) {
my $regexp = $regexp_table->{pattern};
my $message = $regexp_table->{message};
my $type = $regexp_table->{type};
# Input parameters validation
die "Wrong type defined for journal failure. Only 'soft' or 'hard' allowed. Got: $type" if $type !~ /^soft|hard|fatal$/;
die "Message not defined for journal failure for the pattern: '$regexp', type: $type" if !defined $message;
# If you want to match a simple string please be sure that you create it with quotemeta
if (!exists $regexp_matched{$regexp} and $line =~ /$regexp/) {
$regexp_matched{$regexp} = 1;
my $fail_type = 'softfail';
if ($type eq 'hard') {
record_info('Softfail', $message . "\n\n" . "$line", result => 'softfail');
}
elsif ($type eq 'soft') {
force_soft_failure $message. "\n\n" . "$line";
}
}
}
}
close($journal);
}
1;