selftest: skip smb2.ioctl tests on ntvfs
[nivanova/samba-autobuild/.git] / selftest / filter-subunit
index ef3172171e864a1c640f135bc53997567f8362d1..2ed1430b695b8b4366af99d9126ebeea04fcfb7a 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
@@ -25,6 +40,8 @@ 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")
+parser.add_option("--suffix", type="string",
+       help="Add suffix to all test names")
 parser.add_option("--fail-on-empty", default=False,
        action="store_true", help="Fail if there was no subunit output")
 parser.add_option("--list", default=False,
@@ -33,10 +50,13 @@ opts, args = parser.parse_args()
 
 if opts.list:
        prefix = opts.prefix
+       suffix = opts.suffix
        if not prefix:
                prefix = ""
+       if not suffix:
+               suffix = ""
        for l in sys.stdin:
-               sys.stdout.write("%s%s\n" % (prefix, l.rstrip()))
+               sys.stdout.write("%s%s%s\n" % (prefix, l.rstrip(), suffix))
        sys.exit(0)
 
 if opts.expected_failures:
@@ -48,7 +68,7 @@ else:
 if opts.flapping:
        flapping = subunithelper.read_test_regexes(opts.flapping)
 else:
-       flapping = []
+       flapping = {}
 
 statistics = {
        'TESTS_UNEXPECTED_OK': 0,
@@ -64,7 +84,7 @@ def handle_sigint(sig, stack):
 signal.signal(signal.SIGINT, handle_sigint)
 
 out = subunithelper.SubunitOps(sys.stdout)
-msg_ops = subunithelper.FilterOps(out, opts.prefix, expected_failures,
+msg_ops = subunithelper.FilterOps(out, opts.prefix, opts.suffix, expected_failures,
                                  opts.strip_passed_output,
                                  fail_immediately=opts.fail_immediately,
                                  flapping=flapping)