[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1984-g7fddc71

Jelmer Vernooij jelmer at samba.org
Wed Jun 3 14:28:19 GMT 2009


The branch, master has been updated
       via  7fddc71caa89ce5303b5f9fc84d2c50ed84f32de (commit)
       via  4828f75fedd62559c6907bf5f4ace3f1118e6efb (commit)
       via  4bbef3bcd8e0e7b5c2ffef05fe2f43c06c74e3b5 (commit)
       via  e72be91ebad00af4c6b07d361ec0535a6bbec710 (commit)
       via  1dac17f9413c028916946488f27db05ac2314bf6 (commit)
       via  641f8d62df2d7ba0e80f3c8d78c3f8185dcf7048 (commit)
       via  53aeb7f4cf4935fbf48d745e6f38a9793120c1a9 (commit)
       via  87bbae7b0768d3606877a79155e42be0fa2843d8 (commit)
       via  4bf988105b444cecb8b61be33d6b4d3a5c243732 (commit)
      from  e285bb2da57d1da7b5f471399d34fa01dae187dd (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7fddc71caa89ce5303b5f9fc84d2c50ed84f32de
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Jun 3 16:22:20 2009 +0200

    selftest: Run tests for Samba4 target in the samba 4 testsuite.

commit 4828f75fedd62559c6907bf5f4ace3f1118e6efb
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Jun 3 16:09:16 2009 +0200

    selftest: Fix target/Samba4 tests.

commit 4bbef3bcd8e0e7b5c2ffef05fe2f43c06c74e3b5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Jun 3 16:07:06 2009 +0200

    Remove empty unit test.

commit e72be91ebad00af4c6b07d361ec0535a6bbec710
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu May 21 17:21:41 2009 +0200

    selftest/README: Fix formatting.

commit 1dac17f9413c028916946488f27db05ac2314bf6
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed May 13 20:10:57 2009 +0200

    selftest: Factor generic functionality for buildfarm output into a
    separate perl module.

commit 641f8d62df2d7ba0e80f3c8d78c3f8185dcf7048
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed May 13 19:57:58 2009 +0200

    Support reporting current time in selftest output.

commit 53aeb7f4cf4935fbf48d745e6f38a9793120c1a9
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed May 13 19:42:41 2009 +0200

    selftest: Add subunit output format.

commit 87bbae7b0768d3606877a79155e42be0fa2843d8
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed May 13 18:48:44 2009 +0200

    Rename harness2subunit.pl -> tap2subunit to be consistent with the
    subunit tools.

commit 4bf988105b444cecb8b61be33d6b4d3a5c243732
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed May 13 18:20:34 2009 +0200

    README: Fix indentation of bullet point.
    README.Coding: Use consistent header.

-----------------------------------------------------------------------

Summary of changes:
 README                                          |    8 +-
 README.Coding                                   |    2 +-
 lib/subunit/{harness2subunit.pl => tap2subunit} |    0 
 selftest/BuildFarm.pm                           |   65 ++++++++++++++
 selftest/README                                 |   18 +++-
 selftest/output/buildfarm.pm                    |   58 +++++-------
 selftest/output/html.pm                         |   10 ++-
 selftest/output/plain.pm                        |   13 +++-
 selftest/output/subunit.pm                      |  109 +++++++++++++++++++++++
 selftest/selftest.pl                            |   12 ++-
 selftest/test_samba4.pl                         |    5 +-
 selftest/test_subunit.pl                        |    7 --
 source4/selftest/tests.sh                       |    3 +-
 13 files changed, 248 insertions(+), 62 deletions(-)
 rename lib/subunit/{harness2subunit.pl => tap2subunit} (100%)
 create mode 100644 selftest/BuildFarm.pm
 create mode 100644 selftest/output/subunit.pm
 delete mode 100755 selftest/test_subunit.pl


Changeset truncated at 500 lines:

diff --git a/README b/README
index e6634fe..ea75cc0 100644
--- a/README
+++ b/README
@@ -83,12 +83,12 @@ http://samba.org/samba, and browse the user survey.
 Related packages include:
 
 - smbfs, a Linux-only filesystem allowing you to mount remote SMB
-filesystems from PCs on your Linux box. This is included as standard with
-Linux 2.0 and later.
+  filesystems from PCs on your Linux box. This is included as standard with
+  Linux 2.0 and later.
 
 - cifsvfs, a more advanced Linux-only filesystem allowing you to mount 
-remote SMB filesystems from PCs on your Linux box. This is included 
-as standard with Linux 2.5 and later.
+  remote SMB filesystems from PCs on your Linux box. This is included 
+  as standard with Linux 2.5 and later.
 
 
 
diff --git a/README.Coding b/README.Coding
index c1b6641..36dcb18 100644
--- a/README.Coding
+++ b/README.Coding
@@ -1,5 +1,5 @@
 Coding conventions in the Samba tree
-------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 .. contents::
 
diff --git a/lib/subunit/harness2subunit.pl b/lib/subunit/tap2subunit
similarity index 100%
rename from lib/subunit/harness2subunit.pl
rename to lib/subunit/tap2subunit
diff --git a/selftest/BuildFarm.pm b/selftest/BuildFarm.pm
new file mode 100644
index 0000000..80a91ac
--- /dev/null
+++ b/selftest/BuildFarm.pm
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+# Convenience functions for writing output expected by the buildfarm
+# Copyright (C) 2009 Jelmer Vernooij <jelmer at samba.org>
+# Published under the GNU GPL, v3 or later
+
+package BuildFarm;
+
+use Exporter;
+ at ISA = qw(Exporter);
+ at EXPORT_OK = qw(start_testsuite end_testsuite skip_testsuite summary);
+
+use strict;
+
+sub start_testsuite($$)
+{
+	my ($name, $duration) = @_;
+	my $out = "";
+
+	$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
+	$out .= "Running test $name (level 0 stdout)\n";
+	$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
+	$out .= scalar(localtime())."\n";
+	$out .= "SELFTEST RUNTIME: " . $duration . "s\n";
+	$out .= "NAME: $name\n";
+
+	print $out;
+}
+
+sub end_testsuite($$$$$)
+{
+	my ($name, $duration, $ok, $output, $reason) = @_;
+	my $out = "";
+
+	$out .= "TEST RUNTIME: " . $duration . "s\n";
+	if ($ok) {
+		$out .= "ALL OK\n";
+	} else {
+		$out .= "ERROR: $reason\n";
+	}
+	$out .= "==========================================\n";
+	if ($ok) {
+		$out .= "TEST PASSED: $name\n";
+	} else {
+		$out .= "TEST FAILED: $name (status $reason)\n";
+	}
+	$out .= "==========================================\n";
+
+	print $out;
+}
+
+sub skip_testsuite($)
+{
+	my ($name) = @_;
+
+	print "SKIPPED: $name\n";
+}
+
+sub summary($)
+{
+	my ($duration) = @_;
+
+	print "DURATION: " . $duration . " seconds\n";
+}
+
+1;
diff --git a/selftest/README b/selftest/README
index f8be20a..3fe6af5 100644
--- a/selftest/README
+++ b/selftest/README
@@ -11,7 +11,7 @@ the name of the test, the command to run and the environment that should be
 provided. Use the included "plantest" function to generate the required output.
 
 Testsuite behaviour
-================================
+===================
 
 Exit code
 ------------
@@ -31,27 +31,35 @@ for the last announced test.
 Accepted commands are:
 
 test
-~~~~~~~~~~~~
+~~~~
 test: <NAME>
 
 Announce that a new test with the specified name is starting
 
 success
-~~~~~~~~~~~~~~~
+~~~~~~~
 success: <NAME> 
 
 Announce that the test with the specified name is done and ran successfully.
 
 failure
-~~~~~~~~~~~~~~~
+~~~~~~~
 failure: <NAME> 
 failure: <NAME> [ REASON ]
 
 Announce that the test with the specified name failed. Optionally, it is 
 possible to specify a reason it failed.
 
+xfail
+~~~~~
+xfail: <NAME>
+xfail: <NAME> [ REASON ]
+
+Announce that the test with the specified name failed but that the failure
+was expected, e.g. it's a test for a known bug that hasn't been fixed yet.
+
 skip
-~~~~~~~~~~~~
+~~~~
 skip: <NAME>
 skip: <NAME> [ REASON ]
 
diff --git a/selftest/output/buildfarm.pm b/selftest/output/buildfarm.pm
index 77ea266..f4daf69 100644
--- a/selftest/output/buildfarm.pm
+++ b/selftest/output/buildfarm.pm
@@ -24,6 +24,7 @@ use FindBin qw($RealBin);
 use lib "$RealBin/..";
 
 use Subunit qw(parse_results);
+use BuildFarm;
 
 use strict;
 
@@ -31,30 +32,33 @@ sub new($$$) {
 	my ($class) = @_;
 	my $self = {
 		test_output => {},
-		start_time => time()
+		last_time => 0,
+		start_time => undef,
 	};
 	bless($self, $class);
 }
 
+sub report_time($$)
+{
+	my ($self, $time) = @_;
+
+	unless ($self->{start_time}) {
+		$self->{start_time} = $time;
+	}
+
+	$self->{last_time} = $time;
+}
+
 sub start_testsuite($$)
 {
 	my ($self, $name) = @_;
-	my $out = "";
 
 	$self->{NAME} = $name;
-	$self->{START_TIME} = time();
+	$self->{START_TIME} = $self->{last_time};
 
 	my $duration = $self->{START_TIME} - $self->{start_time};
-	$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
-	$out .= "Running test $name (level 0 stdout)\n";
-	$out .= "--==--==--==--==--==--==--==--==--==--==--\n";
-	$out .= scalar(localtime())."\n";
-	$out .= "SELFTEST RUNTIME: " . $duration . "s\n";
-	$out .= "NAME: $name\n";
-
+	BuildFarm::start_testsuite($name, $duration);
 	$self->{test_output}->{$name} = "";
-
-	print $out;
 }
 
 sub output_msg($$)
@@ -74,26 +78,10 @@ sub control_msg($$)
 sub end_testsuite($$$$$$)
 {
 	my ($self, $name, $result, $unexpected, $reason) = @_;
-	my $out = "";
-
-	$out .= "TEST RUNTIME: " . (time() - $self->{START_TIME}) . "s\n";
-
-	if (not $unexpected) {
-		$out .= "ALL OK\n";
-	} else {
-		$out .= "ERROR: $reason\n";
-		$out .= $self->{test_output}->{$name};
-	}
 
-	$out .= "==========================================\n";
-	if (not $unexpected) {
-		$out .= "TEST PASSED: $name\n";
-	} else {
-		$out .= "TEST FAILED: $name (status $reason)\n";
-	}
-	$out .= "==========================================\n";
-
-	print $out;
+	BuildFarm::end_testsuite($name, ($self->{last_time} - $self->{START_TIME}), 
+		                     (not $unexpected), $self->{test_output}->{$name}, 
+							 $reason);
 }
 
 sub start_test($$$)
@@ -121,15 +109,15 @@ sub end_test($$$$$)
 sub summary($)
 {
 	my ($self) = @_;
-
-	print "DURATION: " . (time() - $self->{start_time}) . " seconds\n";
+	
+	BuildFarm::summary($self->{last_time} - $self->{start_time});
 }
 
-sub skip_testsuite($$$$)
+sub skip_testsuite($$$)
 {
 	my ($self, $name, $reason) = @_;
 
-	print "SKIPPED: $name\n";
+	BuildFarm::skip_testsuite($name);
 }
 
 1;
diff --git a/selftest/output/html.pm b/selftest/output/html.pm
index e490765..d4d8204 100644
--- a/selftest/output/html.pm
+++ b/selftest/output/html.pm
@@ -138,7 +138,7 @@ sub end_testsuite($$$$)
 
 	print TEST "</table>\n";
 
-	print TEST "<div class=\"duration\">Duration: " . (time() - $self->{START_TIME}) . "s</div>\n";
+	print TEST "<div class=\"duration\">Duration: " . ($self->{last_time} - $self->{START_TIME}) . "s</div>\n";
 
 	$self->print_html_footer(*TEST);
 
@@ -192,12 +192,18 @@ sub end_testsuite($$$$)
 	print INDEX "</tr>\n";
 }
 
+sub report_time($$)
+{
+	my ($self, $time) = @_;
+	$self->{last_time} = $time;
+}
+
 sub start_test($$)
 {
 	my ($self, $parents, $testname) = @_;
 
 	if ($#$parents == -1) {
-		$self->{START_TIME} = time();
+		$self->{START_TIME} = $self->{last_time};
 		$self->start_testsuite($testname);
 		return;
 	}
diff --git a/selftest/output/plain.pm b/selftest/output/plain.pm
index 5312a9e..2605603 100644
--- a/selftest/output/plain.pm
+++ b/selftest/output/plain.pm
@@ -29,7 +29,7 @@ sub new($$$$$$$) {
 		verbose => $verbose, 
 		immediate => $immediate, 
 		statistics => $statistics,
-		start_time => time(),
+		start_time => undef,
 		test_output => {},
 		suitesfailed => [],
 		suites_ok => 0,
@@ -41,6 +41,15 @@ sub new($$$$$$$) {
 	bless($self, $class);
 }
 
+sub report_time($$)
+{
+	my ($self, $time) = @_;
+	unless ($self->{start_time}) {
+		$self->{start_time} = $time;
+	}
+	$self->{last_time} = $time;
+}
+
 sub output_msg($$);
 
 sub start_testsuite($$)
@@ -49,7 +58,7 @@ sub start_testsuite($$)
 
 	$self->{index}++;
 	$self->{NAME} = $name;
-	$self->{START_TIME} = time();
+	$self->{START_TIME} = $self->{last_time};
 
 	my $duration = $self->{START_TIME} - $self->{start_time};
 
diff --git a/selftest/output/subunit.pm b/selftest/output/subunit.pm
new file mode 100644
index 0000000..e99b76c
--- /dev/null
+++ b/selftest/output/subunit.pm
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+# Subunit output for selftest
+# Copyright (C) 2009 Jelmer Vernooij <jelmer at 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/>.
+
+package output::subunit;
+
+use Exporter;
+ at ISA = qw(Exporter);
+
+use FindBin qw($RealBin);
+use lib "$RealBin/..";
+
+use Subunit qw(parse_results);
+
+use strict;
+
+sub new($) {
+	my ($class) = @_;
+	my $self = { };
+	bless($self, $class);
+}
+
+sub report_time($$)
+{
+	my ($self, $time) = @_;
+	my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time);
+	printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec;
+}
+
+sub start_testsuite($$)
+{
+	my ($self, $name) = @_;
+
+	$self->{NAME} = $name;
+	
+	print "test: $self->{NAME}\n";
+}
+
+sub output_msg($$)
+{
+	my ($self, $output) = @_;
+
+	print $output;
+}
+
+sub control_msg($$)
+{
+	my ($self, $output) = @_;
+}
+
+sub end_testsuite($$$$$$)
+{
+	my ($self, $name, $result, $unexpected, $reason) = @_;
+
+	if ($result eq "failure" and not $unexpected) { $result = "xfail"; }
+
+	if ($reason) {
+		print "$result: $name [ $reason ]\n";
+	} else {
+		print "$result: $name\n";
+	}
+}
+
+sub start_test($$$)
+{
+	my ($self, $parents, $testname) = @_;
+
+	print "test: $testname\n";
+}
+
+sub end_test($$$$$)
+{
+	my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
+
+	if ($result eq "fail" and not $unexpected) { $result = "xfail"; }
+
+	if ($reason) {
+		print "$result: $testname [ $reason ]\n";
+	} else {
+		print "$result: $testname\n";
+	}
+}
+
+sub summary($)
+{
+	my ($self) = @_;
+}
+
+sub skip_testsuite($$$$)
+{
+	my ($self, $name, $reason) = @_;
+
+	print "skip: $name\n";
+}
+
+1;
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 3653523..b786c9a 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # Bootstrap Samba and run a number of tests against it.
-# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer at samba.org>
+# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer at samba.org>
 # Copyright (C) 2007-2009 Stefan Metzmacher <metze at samba.org>
 
 # This program is free software; you can redistribute it and/or modify
@@ -254,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|")) {
@@ -276,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 {
@@ -686,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];
@@ -883,7 +888,8 @@ $envvarstr
 		
 		my $envvars = setup_env($envname);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list