s4-provision: dns: Add txt DNS record
[sfrench/samba-autobuild/.git] / selftest / filter-subunit
index 5f062d12a29e22d5c8d830d78000b8443faf40be..bced14b101cedb00c9e613f2e3243d1a3d506480 100755 (executable)
@@ -1,7 +1,22 @@
 #!/usr/bin/env python
 # Filter a subunit stream
-# Copyright (C) Jelmer Vernooij <jelmer@samba.org>
-# Published under the GNU GPL, v3 or later
+# Copyright (C) 2009-2011 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
+# 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/>.
+
+# NOTE: This script is a hack, meant as a placeholder until we can migrate
+# to upstream subunit's filtering tools.
 
 import optparse
 import os
@@ -17,9 +32,11 @@ parser = optparse.OptionParser("filter-subunit [options] < instream > outstream"
 parser.add_option("--expected-failures", type="string", 
        help="File containing list of regexes matching tests to consider known "
             "failures")
-parser.add_option("--strip-passed-output", action="store_true", 
+parser.add_option("--flapping", type="string",
+       help="File containing list of flapping tests, of which to ignore results.")
+parser.add_option("--strip-passed-output", action="store_true",
     help="Whether to strip output from tests that passed")
-parser.add_option("--fail-immediately", action="store_true", 
+parser.add_option("--fail-immediately", action="store_true",
     help="Whether to stop on the first error", default=False)
 parser.add_option("--prefix", type="string",
        help="Add prefix to all test names")
@@ -42,6 +59,12 @@ if opts.expected_failures:
 else:
        expected_failures = {}
 
+
+if opts.flapping:
+       flapping = subunithelper.read_test_regexes(opts.flapping)
+else:
+       flapping = {}
+
 statistics = {
        'TESTS_UNEXPECTED_OK': 0,
        'TESTS_EXPECTED_OK': 0,
@@ -58,7 +81,8 @@ signal.signal(signal.SIGINT, handle_sigint)
 out = subunithelper.SubunitOps(sys.stdout)
 msg_ops = subunithelper.FilterOps(out, opts.prefix, expected_failures,
                                  opts.strip_passed_output,
-                                 fail_immediately=opts.fail_immediately)
+                                 fail_immediately=opts.fail_immediately,
+                                 flapping=flapping)
 
 try:
        ret = subunithelper.parse_results(msg_ops, statistics, sys.stdin)