s3:charcnv Remove unused unistr2 functions
[Samba.git] / selftest / output / buildfarm.pm
blobcee6c1e63a8f4609eaabd36b19923eb8420f5289
1 #!/usr/bin/perl
3 package output::buildfarm;
5 use Exporter;
6 @ISA = qw(Exporter);
8 use FindBin qw($RealBin);
9 use lib "$RealBin/..";
11 use Subunit qw(parse_results);
13 use strict;
15 sub new($$$) {
16 my ($class) = @_;
17 my $self = {
18 test_output => {},
19 start_time => time()
21 bless($self, $class);
24 sub start_testsuite($$)
26 my ($self, $name) = @_;
27 my $out = "";
29 $self->{NAME} = $name;
30 $self->{START_TIME} = time();
32 my $duration = $self->{START_TIME} - $self->{start_time};
33 $out .= "--==--==--==--==--==--==--==--==--==--==--\n";
34 $out .= "Running test $name (level 0 stdout)\n";
35 $out .= "--==--==--==--==--==--==--==--==--==--==--\n";
36 $out .= scalar(localtime())."\n";
37 $out .= "SELFTEST RUNTIME: " . $duration . "s\n";
38 $out .= "NAME: $name\n";
40 $self->{test_output}->{$name} = "";
42 print $out;
45 sub output_msg($$)
47 my ($self, $output) = @_;
49 $self->{test_output}->{$self->{NAME}} .= $output;
52 sub control_msg($$)
54 my ($self, $output) = @_;
56 $self->{test_output}->{$self->{NAME}} .= $output;
59 sub end_testsuite($$$$$$)
61 my ($self, $name, $result, $unexpected, $reason) = @_;
62 my $out = "";
64 $out .= "TEST RUNTIME: " . (time() - $self->{START_TIME}) . "s\n";
66 if (not $unexpected) {
67 $out .= "ALL OK\n";
68 } else {
69 $out .= "ERROR: $reason\n";
70 $out .= $self->{test_output}->{$name};
73 $out .= "==========================================\n";
74 if (not $unexpected) {
75 $out .= "TEST PASSED: $name\n";
76 } else {
77 $out .= "TEST FAILED: $name (status $reason)\n";
79 $out .= "==========================================\n";
81 print $out;
84 sub start_test($$$)
86 my ($self, $parents, $testname) = @_;
88 if ($#$parents == -1) {
89 $self->start_testsuite($testname);
93 sub end_test($$$$$)
95 my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
97 if ($unexpected) {
98 $self->{test_output}->{$self->{NAME}} .= "UNEXPECTED($result): $testname\n";
101 if ($#$parents == -1) {
102 $self->end_testsuite($testname, $result, $unexpected, $reason);
106 sub summary($)
108 my ($self) = @_;
110 print "DURATION: " . (time() - $self->{start_time}) . " seconds\n";
113 sub skip_testsuite($$$$)
115 my ($self, $name, $reason) = @_;
117 print "SKIPPED: $name\n";