summaryrefslogtreecommitdiff
path: root/selftest/BuildFarm.pm
blob: 80a91ac154041c4c213402fb1c562c3413c58b33 (plain)
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
#!/usr/bin/perl
# Convenience functions for writing output expected by the buildfarm
# Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL, v3 or later

package BuildFarm;

use Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(start_testsuite end_testsuite skip_testsuite summary);

use strict;

sub start_testsuite($$)
{
	my ($name, $duration) = @_;
	my $out = "";

	$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
	$out .= "Running test $name (level 0 stdout)\n";
	$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
	$out .= scalar(localtime())."\n";
	$out .= "SELFTEST RUNTIME: " . $duration . "s\n";
	$out .= "NAME: $name\n";

	print $out;
}

sub end_testsuite($$$$$)
{
	my ($name, $duration, $ok, $output, $reason) = @_;
	my $out = "";

	$out .= "TEST RUNTIME: " . $duration . "s\n";
	if ($ok) {
		$out .= "ALL OK\n";
	} else {
		$out .= "ERROR: $reason\n";
	}
	$out .= "==========================================\n";
	if ($ok) {
		$out .= "TEST PASSED: $name\n";
	} else {
		$out .= "TEST FAILED: $name (status $reason)\n";
	}
	$out .= "==========================================\n";

	print $out;
}

sub skip_testsuite($)
{
	my ($name) = @_;

	print "SKIPPED: $name\n";
}

sub summary($)
{
	my ($duration) = @_;

	print "DURATION: " . $duration . " seconds\n";
}

1;