summaryrefslogtreecommitdiff
path: root/source4/selftest/output/buildfarm.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-12 00:50:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:40 -0500
commit4da477d4fa891703497608c6b93402c4fc278f95 (patch)
treee932c07a9879d5fbac6c2244d89d82be7b63e0a4 /source4/selftest/output/buildfarm.pm
parent7ce6a75f4b7c0fc282fbc0d4387843a278430eb1 (diff)
downloadsamba-4da477d4fa891703497608c6b93402c4fc278f95.tar.gz
samba-4da477d4fa891703497608c6b93402c4fc278f95.tar.bz2
samba-4da477d4fa891703497608c6b93402c4fc278f95.zip
r24339: Move output functions to separate files.
(This used to be commit f4ff4c5f61189c71ab60a5455272302add9e1d97)
Diffstat (limited to 'source4/selftest/output/buildfarm.pm')
-rw-r--r--source4/selftest/output/buildfarm.pm95
1 files changed, 95 insertions, 0 deletions
diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm
new file mode 100644
index 0000000000..11d65d7306
--- /dev/null
+++ b/source4/selftest/output/buildfarm.pm
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+package output::buildfarm;
+
+use Exporter;
+@ISA = qw(Exporter);
+
+use strict;
+
+sub new($$) {
+ my ($class) = @_;
+ my $self = {
+ start => time(),
+ test_output => {}
+ };
+ bless($self, $class);
+}
+
+sub start_testsuite($$)
+{
+ my ($self, $state) = @_;
+ my $out = "";
+
+ $out .= "--==--==--==--==--==--==--==--==--==--==--\n";
+ $out .= "Running test $state->{NAME} (level 0 stdout)\n";
+ $out .= "--==--==--==--==--==--==--==--==--==--==--\n";
+ $out .= scalar(localtime())."\n";
+ $out .= "SELFTEST RUNTIME: " . ($state->{START_TIME} - $self->{START_TIME}) . "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 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";
+ $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, $expected) = @_;
+}
+
+sub summary($)
+{
+ my ($self) = @_;
+}
+
+sub missing_env($$$)
+{
+ my ($self, $name, $envname) = @_;
+
+ print "FAIL: $name (ENV[$envname] not available!)\n";
+}
+
+1;