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
|
#!/usr/bin/perl
package output::buildfarm;
use Exporter;
@ISA = qw(Exporter);
use strict;
sub new($$$$) {
my ($class, $statistics) = @_;
my $self = {
statistics => $statistics,
test_output => {}
};
bless($self, $class);
}
sub start_testsuite($$)
{
my ($self, $state) = @_;
my $out = "";
my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME};
$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
$out .= "Running test $state->{NAME} (level 0 stdout)\n";
$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
$out .= scalar(localtime())."\n";
$out .= "SELFTEST RUNTIME: " . $duration . "s\n";
$out .= "NAME: $state->{NAME}\n";
$out .= "CMD: $state->{CMD}\n";
$self->{test_output}->{$state->{NAME}} = "";
print $out;
}
sub output_msg($$$)
{
my ($self, $state, $output) = @_;
$self->{test_output}->{$state->{NAME}} .= $output;
}
sub control_msg($$$)
{
my ($self, $state, $output) = @_;
$self->{test_output}->{$state->{NAME}} .= $output;
}
sub end_testsuite($$$$$)
{
my ($self, $state, $expected_ret, $ret, $envlog) = @_;
my $out = "";
$out .= "TEST RUNTIME: " . (time() - $state->{START_TIME}) . "s\n";
if ($ret == $expected_ret) {
$out .= "ALL OK\n";
} else {
$out .= "ERROR: $ret\n";
$out .= $self->{test_output}->{$state->{NAME}};
}
$out .= "PCAP FILE: $state->{PCAP_FILE}\n" if defined($state->{PCAP_FILE});
$out .= $envlog;
$out .= "==========================================\n";
if ($ret == $expected_ret) {
$out .= "TEST PASSED: $state->{NAME}\n";
} else {
$out .= "TEST FAILED: $state->{NAME} (status $ret)\n";
}
$out .= "==========================================\n";
print $out;
}
sub start_test($$$)
{
my ($self, $state, $testname) = @_;
}
sub end_test($$$$$$)
{
my ($self, $state, $testname, $result, $unexpected, $reason) = @_;
return unless ($unexpected);
$self->{test_output}->{$state->{NAME}} .= "UNEXPECTED($result): $testname\n";
}
sub summary($)
{
my ($self) = @_;
}
sub missing_env($$$)
{
my ($self, $name, $envname) = @_;
print "FAIL: $name (ENV[$envname] not available!)\n";
}
sub skip_testsuite($$$$)
{
my ($self, $envname, $name, $reason) = @_;
# Ignore skipped tests
}
1;
|