Merge branch 'master' of ssh://git.samba.org/data/git/samba
[ira/wip.git] / lib / subunit / harness2subunit.pl
1 #!/usr/bin/perl
2 # Simple script that converts Perl test harness output to 
3 # Subunit
4 # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
5 # Published under the GNU GPL, v3 or later
6
7 my $firstline = 1;
8 my $error = 0;
9 while(<STDIN>) {
10         if ($firstline) {
11                 $firstline = 0;
12                 next;
13         }
14         if (/^not ok (\d+) - (.*)$/) {
15                 print "test: $2\n";
16                 print "failure: $2\n";
17                 $error = 1;
18         } elsif (/^ok (\d+) - (.*)$/) {
19                 print "test: $2\n";
20                 print "success: $2\n";
21         } elsif (/^ok (\d+)$/) {
22                 print "test: $1\n";
23                 print "success: $1\n";
24         } elsif (/^ok (\d+) # skip (.*)$/) {
25                 print "test: $1\n";
26                 print "skip: $1 [\n$2\n]\n";
27         } elsif (/^not ok (\d+)$/) {
28                 print "test: $1\n";
29                 print "failure: $1\n";
30                 $error = 1;
31         } else {
32                 print;
33         }
34 }
35 exit $error;
36