Support reporting current time in selftest output.
[ira/wip.git] / selftest / selftest.pl
index 0be2e78de3c9dd2c2aaf0464470d280e0546e570..b786c9a50f549d1bd15f0b3b080c4619696be25d 100755 (executable)
@@ -1,7 +1,20 @@
 #!/usr/bin/perl
 # Bootstrap Samba and run a number of tests against it.
-# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org>
-# Published under the GNU GPL, v3 or later.
+# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org>
+# Copyright (C) 2007-2009 Stefan Metzmacher <metze@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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 =pod
 
@@ -241,6 +254,7 @@ sub run_testsuite($$$$$$)
        my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_;
        my $pcap_file = setup_pcap($name);
 
+       $msg_ops->report_time(time());
        $msg_ops->start_test([], $name);
 
        unless (open(RESULT, "$cmd 2>&1|")) {
@@ -263,6 +277,7 @@ sub run_testsuite($$$$$$)
 
        my $exitcode = $? >> 8;
 
+       $msg_ops->report_time(time());
        if ($ret == 1) {
                $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef); 
        } else {
@@ -287,6 +302,7 @@ sub ShowHelp()
 {
        print "Samba test runner
 Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
+Copyright (C) Stefan Metzmacher <metze\@samba.org>
 
 Usage: $Script [OPTIONS] TESTNAME-REGEX
 
@@ -672,10 +688,13 @@ if ($opt_format eq "buildfarm") {
        require output::html;
        mkdir("test-results", 0777);
        $msg_ops = new output::html("test-results", $statistics);
+} elsif ($opt_format eq "subunit") {
+       require output::subunit;
+       $msg_ops = new output::subunit();
 } else {
        die("Invalid output format '$opt_format'");
 }
-
+$msg_ops->report_time(time());
 
 foreach (@available) {
        my $name = $$_[0];
@@ -869,7 +888,8 @@ $envvarstr
                
                my $envvars = setup_env($envname);
                if (not defined($envvars)) {
-                       $msg_ops->skip_testsuite($name, "unable to set up environment $envname");
+                       $msg_ops->skip_testsuite($name, 
+                               "unable to set up environment $envname");
                        next;
                }