More work supporting prefixes.
[garming/samba-autobuild/.git] / selftest / Subunit.pm
index 7feb5de9a43858d88b1b8289564eee3410f6b353..ddecfe4369bab1bcfe847cb7dc23a249b4905482 100644 (file)
@@ -1,5 +1,5 @@
-# Simple Perl module for parsing the Subunit protocol
-# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+# Perl module for parsing and generating the Subunit protocol
+# Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ sub parse_results($$$$)
        my $unexpected_ok = 0;
        my $expected_fail = 0;
        my $unexpected_fail = 0;
+       my $prefix = "";
        my $unexpected_err = 0;
        my $orig_open_len = $#$open_tests;
 
@@ -39,6 +40,8 @@ sub parse_results($$$$)
                        push (@$open_tests, $1);
                } elsif (/^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)Z\n/) {
                        $msg_ops->report_time(mktime($6, $5, $4, $3, $2, $1));
+               } elsif (/^prefix: (.*)\n/) {
+                       $prefix = $1;
                } elsif (/^(success|successful|failure|fail|skip|knownfail|error|xfail): (.*?)( \[)?([ \t]*)\n/) {
                        $msg_ops->control_msg($_);
                        my $result = $1;
@@ -133,4 +136,10 @@ sub report_time($)
        printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec;
 }
 
+sub prefix($)
+{
+       my ($prefix) = @_;
+       print "prefix: $prefix\n";
+}
+
 1;