1#!/usr/bin/perl 2# Convenience functions for writing output expected by the buildfarm 3# Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org> 4# Published under the GNU GPL, v3 or later 5 6package BuildFarm; 7 8use Exporter; 9@ISA = qw(Exporter); 10@EXPORT_OK = qw(start_testsuite end_testsuite skip_testsuite summary); 11 12use strict; 13 14sub start_testsuite($$) 15{ 16 my ($name, $duration) = @_; 17 my $out = ""; 18 19 $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; 20 $out .= "Running test $name (level 0 stdout)\n"; 21 $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; 22 $out .= scalar(localtime())."\n"; 23 $out .= "SELFTEST RUNTIME: " . $duration . "s\n"; 24 $out .= "NAME: $name\n"; 25 26 print $out; 27} 28 29sub end_testsuite($$$$$) 30{ 31 my ($name, $duration, $ok, $output, $reason) = @_; 32 my $out = ""; 33 34 $out .= "TEST RUNTIME: " . $duration . "s\n"; 35 if ($ok) { 36 $out .= "ALL OK\n"; 37 } else { 38 $out .= "ERROR: $reason\n"; 39 } 40 $out .= "==========================================\n"; 41 if ($ok) { 42 $out .= "TEST PASSED: $name\n"; 43 } else { 44 $out .= "TEST FAILED: $name (status $reason)\n"; 45 } 46 $out .= "==========================================\n"; 47 48 print $out; 49} 50 51sub skip_testsuite($) 52{ 53 my ($name) = @_; 54 55 print "SKIPPED: $name\n"; 56} 57 58sub summary($) 59{ 60 my ($duration) = @_; 61 62 print "DURATION: " . $duration . " seconds\n"; 63} 64 651; 66