1
# Perl module for parsing and generating the Subunit protocol
2
# Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
4
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
5
# license at the users choice. A copy of both licenses are available in the
6
# project source as Apache-2.0 and BSD. You may not use this file except in
7
# compliance with one of these two licences.
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# license you chose for the specific language governing permissions and
13
# limitations under that license.
18
use vars qw ( $VERSION );
23
my $SUBUNIT_OUT= 'test_results.subunit';
25
open(SUBUNITOUT, ">$SUBUNIT_OUT");
28
sub subunit_start_test($)
31
open(SUBUNITOUT, ">>$SUBUNIT_OUT");
32
print SUBUNITOUT "test: $testname\n";
37
sub subunit_end_test($$;$)
42
open(SUBUNITOUT, ">>$SUBUNIT_OUT");
44
print SUBUNITOUT "$result: $name [\n";
45
print SUBUNITOUT "$reason\n";
46
print SUBUNITOUT "]\n";
48
print SUBUNITOUT "$result: $name\n";
54
sub subunit_skip_test($;$)
58
subunit_end_test($name, "skip", $reason);
61
sub subunit_fail_test($;$)
65
subunit_end_test($name, "failure", $reason);
68
sub subunit_pass_test($;$)
72
subunit_end_test($name, "success", $reason);
75
sub subunit_xfail_test($;$)
79
subunit_end_test($name, "xfail", $reason);
85
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time);
86
open(SUBUNITOUT, ">>$SUBUNIT_OUT");
87
printf SUBUNITOUT "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec;