[SCM] Samba Shared Repository - branch master updated
Jelmer Vernooij
jelmer at samba.org
Tue Mar 30 18:20:50 MDT 2010
The branch, master has been updated
via 197c982... subunit: Also import copies of filters and perl module.
via 9fe4b01... selftest: Use boolean types in Python.
via 6c299d2... selftest: Use standard subunit command for progress reporting.
via 7f1360d... selftest: Support parsing progress in format-subunit/filter-subunit.
via b2eb609... selftest: Use standard subunit commands for progress reporting.
via beb630b... s4-selftest: Fix xfail for base.delete.
via 12e34ea... selftest: Use absolute tests names in knownfail.
via 08161e0... selftest: Convert filter-subunit to Python so the subunit Python module can be used later.
via ae5381d... format-subunit: Avoid printing backtrace on Ctrl-C.
from 2699db3... s4-torture: removed more uses of typeof()
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 197c98292bd838e27da6692ba8e7984f12a66fef
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 15:03:41 2010 +0200
subunit: Also import copies of filters and perl module.
commit 9fe4b01ca682b57cf7c79775abacf135d0c87d42
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 14:44:37 2010 +0200
selftest: Use boolean types in Python.
commit 6c299d28b56dd237792cc80c15c6169e701b4a97
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 14:42:23 2010 +0200
selftest: Use standard subunit command for progress reporting.
commit 7f1360db5123b61cd4473f54d4fb55746c5d8245
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 14:36:25 2010 +0200
selftest: Support parsing progress in format-subunit/filter-subunit.
commit b2eb609d4de39c1359142bc0562daf36e4dee08c
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 14:30:08 2010 +0200
selftest: Use standard subunit commands for progress reporting.
commit beb630b69051acfb6e92ae8ed86007999e7937cd
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 14:15:38 2010 +0200
s4-selftest: Fix xfail for base.delete.
commit 12e34eafb82822a80dbe9dc12b4695ab665644a7
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 14:02:36 2010 +0200
selftest: Use absolute tests names in knownfail.
commit 08161e093d38f0d7b54841f5572a024f228408fa
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 12:46:26 2010 +0200
selftest: Convert filter-subunit to Python so the subunit Python module
can be used later.
commit ae5381d34c75918f7fa49654585d277bbfe66f49
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Mar 30 02:39:50 2010 +0200
format-subunit: Avoid printing backtrace on Ctrl-C.
-----------------------------------------------------------------------
Summary of changes:
lib/subunit/filters/subunit-filter | 105 ++++++++++++++
lib/subunit/filters/subunit-ls | 93 ++++++++++++
lib/subunit/filters/subunit-notify | 65 +++++++++
lib/subunit/filters/subunit-stats | 41 ++++++
lib/subunit/filters/subunit-tags | 26 ++++
lib/subunit/filters/subunit2gtk | 259 ++++++++++++++++++++++++++++++++++
lib/subunit/filters/subunit2junitxml | 65 +++++++++
lib/subunit/filters/subunit2pyunit | 48 +++++++
lib/subunit/perl/Makefile.PL.in | 20 +++
lib/subunit/perl/lib/Subunit.pm | 162 +++++++++++++++++++++
lib/subunit/perl/lib/Subunit/Diff.pm | 85 +++++++++++
lib/subunit/perl/subunit-diff | 31 ++++
lib/subunit/update.sh | 3 +-
selftest/Subunit.pm | 29 +++-
selftest/filter-subunit | 44 ++++++
selftest/filter-subunit.pl | 100 -------------
selftest/format-subunit | 24 +++-
selftest/selftest.pl | 6 +-
selftest/subunithelper.py | 164 ++++++++++++++++++++-
source3/Makefile.in | 2 +-
source4/selftest/config.mk | 2 +-
source4/selftest/knownfail | 86 ++++++------
22 files changed, 1292 insertions(+), 168 deletions(-)
create mode 100755 lib/subunit/filters/subunit-filter
create mode 100755 lib/subunit/filters/subunit-ls
create mode 100755 lib/subunit/filters/subunit-notify
create mode 100755 lib/subunit/filters/subunit-stats
create mode 100755 lib/subunit/filters/subunit-tags
create mode 100755 lib/subunit/filters/subunit2gtk
create mode 100755 lib/subunit/filters/subunit2junitxml
create mode 100755 lib/subunit/filters/subunit2pyunit
create mode 100755 lib/subunit/perl/Makefile.PL.in
create mode 100644 lib/subunit/perl/lib/Subunit.pm
create mode 100644 lib/subunit/perl/lib/Subunit/Diff.pm
create mode 100755 lib/subunit/perl/subunit-diff
create mode 100755 selftest/filter-subunit
delete mode 100755 selftest/filter-subunit.pl
Changeset truncated at 500 lines:
diff --git a/lib/subunit/filters/subunit-filter b/lib/subunit/filters/subunit-filter
new file mode 100755
index 0000000..c06a03a
--- /dev/null
+++ b/lib/subunit/filters/subunit-filter
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+# subunit: extensions to python unittest to get test results from subprocesses.
+# Copyright (C) 2008 Robert Collins <robertc at robertcollins.net>
+# (C) 2009 Martin Pool
+#
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
+#
+
+"""Filter a subunit stream to include/exclude tests.
+
+The default is to strip successful tests.
+
+Tests can be filtered by Python regular expressions with --with and --without,
+which match both the test name and the error text (if any). The result
+contains tests which match any of the --with expressions and none of the
+--without expressions. For case-insensitive matching prepend '(?i)'.
+Remember to quote shell metacharacters.
+"""
+
+from optparse import OptionParser
+import sys
+import unittest
+import re
+
+from subunit import (
+ DiscardStream,
+ ProtocolTestCase,
+ TestProtocolClient,
+ )
+from subunit.test_results import TestResultFilter
+
+parser = OptionParser(description=__doc__)
+parser.add_option("--error", action="store_false",
+ help="include errors", default=False, dest="error")
+parser.add_option("-e", "--no-error", action="store_true",
+ help="exclude errors", dest="error")
+parser.add_option("--failure", action="store_false",
+ help="include failures", default=False, dest="failure")
+parser.add_option("-f", "--no-failure", action="store_true",
+ help="include failures", dest="failure")
+parser.add_option("--no-passthrough", action="store_true",
+ help="Hide all non subunit input.", default=False, dest="no_passthrough")
+parser.add_option("-s", "--success", action="store_false",
+ help="include successes", dest="success")
+parser.add_option("--no-skip", action="store_true",
+ help="exclude skips", dest="skip")
+parser.add_option("--no-success", action="store_true",
+ help="exclude successes", default=True, dest="success")
+parser.add_option("-m", "--with", type=str,
+ help="regexp to include (case-sensitive by default)",
+ action="append", dest="with_regexps")
+parser.add_option("--without", type=str,
+ help="regexp to exclude (case-sensitive by default)",
+ action="append", dest="without_regexps")
+
+(options, args) = parser.parse_args()
+
+
+def _compile_re_from_list(l):
+ return re.compile("|".join(l), re.MULTILINE)
+
+
+def _make_regexp_filter(with_regexps, without_regexps):
+ """Make a callback that checks tests against regexps.
+
+ with_regexps and without_regexps are each either a list of regexp strings,
+ or None.
+ """
+ with_re = with_regexps and _compile_re_from_list(with_regexps)
+ without_re = without_regexps and _compile_re_from_list(without_regexps)
+
+ def check_regexps(test, outcome, err, details):
+ """Check if this test and error match the regexp filters."""
+ test_str = str(test) + outcome + str(err) + str(details)
+ if with_re and not with_re.search(test_str):
+ return False
+ if without_re and without_re.search(test_str):
+ return False
+ return True
+ return check_regexps
+
+
+regexp_filter = _make_regexp_filter(options.with_regexps,
+ options.without_regexps)
+result = TestProtocolClient(sys.stdout)
+result = TestResultFilter(result, filter_error=options.error,
+ filter_failure=options.failure, filter_success=options.success,
+ filter_skip=options.skip,
+ filter_predicate=regexp_filter)
+if options.no_passthrough:
+ passthrough_stream = DiscardStream()
+else:
+ passthrough_stream = None
+test = ProtocolTestCase(sys.stdin, passthrough=passthrough_stream)
+test.run(result)
+sys.exit(0)
diff --git a/lib/subunit/filters/subunit-ls b/lib/subunit/filters/subunit-ls
new file mode 100755
index 0000000..15ec4b0
--- /dev/null
+++ b/lib/subunit/filters/subunit-ls
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+# subunit: extensions to python unittest to get test results from subprocesses.
+# Copyright (C) 2008 Robert Collins <robertc at robertcollins.net>
+#
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
+#
+
+"""List tests in a subunit stream."""
+
+from optparse import OptionParser
+import sys
+import unittest
+
+from subunit import DiscardStream, ProtocolTestCase
+
+class TestIdPrintingResult(unittest.TestResult):
+
+ def __init__(self, stream, show_times=False):
+ """Create a FilterResult object outputting to stream."""
+ unittest.TestResult.__init__(self)
+ self._stream = stream
+ self.failed_tests = 0
+ self.__time = 0
+ self.show_times = show_times
+ self._test = None
+ self._test_duration = 0
+
+ def addError(self, test, err):
+ self.failed_tests += 1
+ self._test = test
+
+ def addFailure(self, test, err):
+ self.failed_tests += 1
+ self._test = test
+
+ def addSuccess(self, test):
+ self._test = test
+
+ def reportTest(self, test, duration):
+ if self.show_times:
+ seconds = duration.seconds
+ seconds += duration.days * 3600 * 24
+ seconds += duration.microseconds / 1000000.0
+ self._stream.write(test.id() + ' %0.3f\n' % seconds)
+ else:
+ self._stream.write(test.id() + '\n')
+
+ def startTest(self, test):
+ self._start_time = self._time()
+
+ def stopTest(self, test):
+ test_duration = self._time() - self._start_time
+ self.reportTest(self._test, test_duration)
+
+ def time(self, time):
+ self.__time = time
+
+ def _time(self):
+ return self.__time
+
+ def wasSuccessful(self):
+ "Tells whether or not this result was a success"
+ return self.failed_tests == 0
+
+
+parser = OptionParser(description=__doc__)
+parser.add_option("--times", action="store_true",
+ help="list the time each test took (requires a timestamped stream)",
+ default=False)
+parser.add_option("--no-passthrough", action="store_true",
+ help="Hide all non subunit input.", default=False, dest="no_passthrough")
+(options, args) = parser.parse_args()
+result = TestIdPrintingResult(sys.stdout, options.times)
+if options.no_passthrough:
+ passthrough_stream = DiscardStream()
+else:
+ passthrough_stream = None
+test = ProtocolTestCase(sys.stdin, passthrough=passthrough_stream)
+test.run(result)
+if result.wasSuccessful():
+ exit_code = 0
+else:
+ exit_code = 1
+sys.exit(exit_code)
diff --git a/lib/subunit/filters/subunit-notify b/lib/subunit/filters/subunit-notify
new file mode 100755
index 0000000..758e7fc
--- /dev/null
+++ b/lib/subunit/filters/subunit-notify
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# subunit: extensions to python unittest to get test results from subprocesses.
+# Copyright (C) 2010 Jelmer Vernooij <jelmer at samba.org>
+#
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
+#
+
+"""Notify the user of a finished test run."""
+
+from optparse import OptionParser
+import sys
+
+import pygtk
+pygtk.require('2.0')
+import pynotify
+
+from subunit import DiscardStream, ProtocolTestCase, TestResultStats
+
+if not pynotify.init("Subunit-notify"):
+ sys.exit(1)
+
+parser = OptionParser(description=__doc__)
+parser.add_option("--no-passthrough", action="store_true",
+ help="Hide all non subunit input.", default=False, dest="no_passthrough")
+parser.add_option("-f", "--forward", action="store_true", default=False,
+ help="Forward subunit stream on stdout.")
+(options, args) = parser.parse_args()
+result = TestResultStats(sys.stdout)
+if options.no_passthrough:
+ passthrough_stream = DiscardStream()
+else:
+ passthrough_stream = None
+if options.forward:
+ forward_stream = sys.stdout
+else:
+ forward_stream = None
+test = ProtocolTestCase(sys.stdin, passthrough=passthrough_stream,
+ forward=forward_stream)
+test.run(result)
+if result.failed_tests > 0:
+ summary = "Test run failed"
+else:
+ summary = "Test run successful"
+body = "Total tests: %d; Passed: %d; Failed: %d" % (
+ result.total_tests,
+ result.passed_tests,
+ result.failed_tests,
+ )
+nw = pynotify.Notification(summary, body)
+nw.show()
+
+if result.wasSuccessful():
+ exit_code = 0
+else:
+ exit_code = 1
+sys.exit(exit_code)
diff --git a/lib/subunit/filters/subunit-stats b/lib/subunit/filters/subunit-stats
new file mode 100755
index 0000000..4734988
--- /dev/null
+++ b/lib/subunit/filters/subunit-stats
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# subunit: extensions to python unittest to get test results from subprocesses.
+# Copyright (C) 2009 Robert Collins <robertc at robertcollins.net>
+#
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
+#
+
+"""Filter a subunit stream to get aggregate statistics."""
+
+from optparse import OptionParser
+import sys
+import unittest
+
+from subunit import DiscardStream, ProtocolTestCase, TestResultStats
+
+parser = OptionParser(description=__doc__)
+parser.add_option("--no-passthrough", action="store_true",
+ help="Hide all non subunit input.", default=False, dest="no_passthrough")
+(options, args) = parser.parse_args()
+result = TestResultStats(sys.stdout)
+if options.no_passthrough:
+ passthrough_stream = DiscardStream()
+else:
+ passthrough_stream = None
+test = ProtocolTestCase(sys.stdin, passthrough=passthrough_stream)
+test.run(result)
+result.formatStats()
+if result.wasSuccessful():
+ exit_code = 0
+else:
+ exit_code = 1
+sys.exit(exit_code)
diff --git a/lib/subunit/filters/subunit-tags b/lib/subunit/filters/subunit-tags
new file mode 100755
index 0000000..edbbfce
--- /dev/null
+++ b/lib/subunit/filters/subunit-tags
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# subunit: extensions to python unittest to get test results from subprocesses.
+# Copyright (C) 2009 Robert Collins <robertc at robertcollins.net>
+#
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
+#
+
+"""A filter to change tags on a subunit stream.
+
+subunit-tags foo -> adds foo
+subunit-tags foo -bar -> adds foo and removes bar
+"""
+
+import sys
+
+from subunit import tag_stream
+sys.exit(tag_stream(sys.stdin, sys.stdout, sys.argv[1:]))
diff --git a/lib/subunit/filters/subunit2gtk b/lib/subunit/filters/subunit2gtk
new file mode 100755
index 0000000..c2cb2de
--- /dev/null
+++ b/lib/subunit/filters/subunit2gtk
@@ -0,0 +1,259 @@
+#!/usr/bin/env python
+# subunit: extensions to python unittest to get test results from subprocesses.
+# Copyright (C) 2009 Robert Collins <robertc at robertcollins.net>
+#
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
+#
+
+### The GTK progress bar __init__ function is derived from the pygtk tutorial:
+# The PyGTK Tutorial is Copyright (C) 2001-2005 John Finlay.
+#
+# The GTK Tutorial is Copyright (C) 1997 Ian Main.
+#
+# Copyright (C) 1998-1999 Tony Gale.
+#
+# Permission is granted to make and distribute verbatim copies of this manual
+# provided the copyright notice and this permission notice are preserved on all
+# copies.
+#
+# Permission is granted to copy and distribute modified versions of this
+# document under the conditions for verbatim copying, provided that this
+# copyright notice is included exactly as in the original, and that the entire
+# resulting derived work is distributed under the terms of a permission notice
+# identical to this one.
+#
+# Permission is granted to copy and distribute translations of this document
+# into another language, under the above conditions for modified versions.
+#
+# If you are intending to incorporate this document into a published work,
+# please contact the maintainer, and we will make an effort to ensure that you
+# have the most up to date information available.
+#
+# There is no guarantee that this document lives up to its intended purpose.
+# This is simply provided as a free resource. As such, the authors and
+# maintainers of the information provided within can not make any guarantee
+# that the information is even accurate.
+
+"""Display a subunit stream in a gtk progress window."""
+
+import sys
+import unittest
+
+import pygtk
+pygtk.require('2.0')
+import gtk, gtk.gdk, gobject
+
+from subunit import (
+ PROGRESS_POP,
+ PROGRESS_PUSH,
+ PROGRESS_SET,
+ TestProtocolServer,
+ )
+from subunit.progress_model import ProgressModel
+
+
+class GTKTestResult(unittest.TestResult):
+
+ def __init__(self):
+ super(GTKTestResult, self).__init__()
+ # Instance variables (in addition to TestResult)
+ self.window = None
+ self.run_label = None
+ self.ok_label = None
+ self.not_ok_label = None
+ self.total_tests = None
+
+ self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ self.window.set_resizable(True)
+
+ self.window.connect("destroy", gtk.main_quit)
+ self.window.set_title("Tests...")
+ self.window.set_border_width(0)
+
+ vbox = gtk.VBox(False, 5)
+ vbox.set_border_width(10)
+ self.window.add(vbox)
+ vbox.show()
+
+ # Create a centering alignment object
+ align = gtk.Alignment(0.5, 0.5, 0, 0)
+ vbox.pack_start(align, False, False, 5)
+ align.show()
+
+ # Create the ProgressBar
+ self.pbar = gtk.ProgressBar()
+ align.add(self.pbar)
+ self.pbar.set_text("Running")
+ self.pbar.show()
+ self.progress_model = ProgressModel()
+
+ separator = gtk.HSeparator()
+ vbox.pack_start(separator, False, False, 0)
+ separator.show()
+
+ # rows, columns, homogeneous
+ table = gtk.Table(2, 3, False)
+ vbox.pack_start(table, False, True, 0)
+ table.show()
+ # Show summary details about the run. Could use an expander.
+ label = gtk.Label("Run:")
+ table.attach(label, 0, 1, 1, 2, gtk.EXPAND | gtk.FILL,
+ gtk.EXPAND | gtk.FILL, 5, 5)
+ label.show()
+ self.run_label = gtk.Label("N/A")
+ table.attach(self.run_label, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL,
+ gtk.EXPAND | gtk.FILL, 5, 5)
+ self.run_label.show()
+
+ label = gtk.Label("OK:")
+ table.attach(label, 0, 1, 2, 3, gtk.EXPAND | gtk.FILL,
+ gtk.EXPAND | gtk.FILL, 5, 5)
+ label.show()
+ self.ok_label = gtk.Label("N/A")
+ table.attach(self.ok_label, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL,
+ gtk.EXPAND | gtk.FILL, 5, 5)
+ self.ok_label.show()
+
+ label = gtk.Label("Not OK:")
+ table.attach(label, 0, 1, 3, 4, gtk.EXPAND | gtk.FILL,
+ gtk.EXPAND | gtk.FILL, 5, 5)
+ label.show()
+ self.not_ok_label = gtk.Label("N/A")
+ table.attach(self.not_ok_label, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL,
+ gtk.EXPAND | gtk.FILL, 5, 5)
+ self.not_ok_label.show()
+
--
Samba Shared Repository
More information about the samba-cvs
mailing list