selftest: Place the test environment at the end of the failure lines
authorAndrew Bartlett <abartlet@samba.org>
Fri, 27 Apr 2012 02:50:36 +0000 (12:50 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 27 Apr 2012 12:51:05 +0000 (14:51 +0200)
This allows a knownfail entry to be added for only one environment, rather than
all environments.

Andrew Bartlett

selftest/filter-subunit
selftest/knownfail
selftest/selftesthelpers.py
selftest/subunithelper.py

index bced14b101cedb00c9e613f2e3243d1a3d506480..2ed1430b695b8b4366af99d9126ebeea04fcfb7a 100755 (executable)
@@ -40,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,
@@ -48,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:
@@ -79,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)
index 14dac54ecebb0f13cee0338efb3e862eb21c9075..440304f0db06b5e6928168068f05839ed54ad7ac 100644 (file)
@@ -35,7 +35,7 @@
 ^samba3.blackbox.rpcclient over ncacn_np with \[spnego,smb2,bigendian\]
 ^samba3.blackbox.rpcclient over ncacn_np with \[spnego,connect,smb2\]
 ^samba3.blackbox.rpcclient over ncacn_np with \[spnego,connect,smb2,bigendian\]
-^samba3.raw.composite.appendacl # This needs ACL and IDMAP behaviour that smbd cannot provide, including mapping of arbitary sids.
+^samba3.raw.composite.appendacl\(s3dc\)# This needs ACL and IDMAP behaviour that smbd cannot provide, including mapping of arbitary sids.
 # these show that we still have some differences between our system
 # with our internal iconv because it passes except when we bypass our
 # internal iconv modules
@@ -58,8 +58,8 @@
 ^samba4.rpc.netlogon.*.LogonUasLogoff
 ^samba4.rpc.netlogon.*.DatabaseSync
 ^samba4.rpc.netlogon.*.DatabaseSync2
-^samba4.rpc.netlogon.*.LogonControl$
-^samba4.rpc.netlogon.*.LogonControl2$
+^samba4.rpc.netlogon.*.LogonControl\(.*\)$
+^samba4.rpc.netlogon.*.LogonControl2\(.*\)$
 ^samba4.rpc.netlogon.*.NetrEnumerateTrustedDomains
 ^samba4.rpc.netlogon.*.NetrEnumerateTrustedDomainsEx
 ^samba4.rpc.netlogon.*.GetPassword
 ^samba4.rap.*netsessiongetinfo
 ^samba4.rap.*netremotetod
 # SMB2 in s4 does not seem to support rename correctly
-^samba4.smb2.rename.simple$
-^samba4.smb2.rename.no_sharing$
-^samba4.smb2.rename.share_delete_and_delete_access$
-^samba4.smb2.rename.no_share_delete_but_delete_access$
-^samba4.smb2.rename.share_delete_no_delete_access$
-^samba4.smb2.rename.no_share_delete_no_delete_access$
+^samba4.smb2.rename.simple\(.*\)$
+^samba4.smb2.rename.no_sharing\(.*\)$
+^samba4.smb2.rename.share_delete_and_delete_access\(.*\)$
+^samba4.smb2.rename.no_share_delete_but_delete_access\(.*\)$
+^samba4.smb2.rename.share_delete_no_delete_access\(.*\)$
+^samba4.smb2.rename.no_share_delete_no_delete_access\(.*\)$
 ^samba4.smb2.rename.msword
 ^samba4.winbind.struct.*.show_sequence     # Not yet working in winbind
-^samba4.*base.delaywrite.*update of write time and SMBwrite truncate$
-^samba4.*base.delaywrite.*update of write time and SMBwrite truncate expand$
-^samba4.*base.delaywrite.*delayed update of write time 3a$
-^samba4.*base.delaywrite.*delayed update of write time 3c$
-^samba4.*base.delaywrite.*update of write time using SET_END_OF_FILE$
-^samba4.*base.delaywrite.*update of write time using SET_ALLOCATION_SIZE$
-^samba4.ldap.python \(dc\).Test add_ldif\(\) with BASE64 security descriptor input using WRONG domain SID$
+^samba4.*base.delaywrite.*update of write time and SMBwrite truncate\(.*\)$
+^samba4.*base.delaywrite.*update of write time and SMBwrite truncate expand\(.*\)$
+^samba4.*base.delaywrite.*delayed update of write time 3a\(.*\)$
+^samba4.*base.delaywrite.*delayed update of write time 3c\(.*\)$
+^samba4.*base.delaywrite.*update of write time using SET_END_OF_FILE\(.*\)$
+^samba4.*base.delaywrite.*update of write time using SET_ALLOCATION_SIZE\(.*\)$
+^samba4.ldap.python \(dc\).Test add_ldif\(\) with BASE64 security descriptor input using WRONG domain SID\(.*\)$
 # some operations don't work over the CIFS NTVFS backend yet (eg. root_fid)
 ^samba4.ntvfs.cifs.*.base.createx_sharemodes_dir
 ^samba4.raw.lock.*.async # bug 6960
 ^samba4.smb2.lock.*.multiple-unlock # bug 6959
-^samba4.raw.sfileinfo.*.end-of-file$ # bug 6962
+^samba4.raw.sfileinfo.*.end-of-file\(.*\)$ # bug 6962
 ^samba4.raw.oplock.*.batch22 # bug 6963
 ^samba4.raw.lock.*.zerobyteread # bug 6974
 ^samba4.smb2.lock.*.zerobyteread # bug 6974
 #^samba4.ldap.dirsync.python.dc..__main__.ExtendedDirsyncTests.*
 ^samba4.drs.fsmo.python
 ^samba4.libsmbclient.opendir.opendir # This requires netbios browsing
-^samba4.rpc.drsuapi.*.drsuapi.DsGetDomainControllerInfo$
-^samba4.rpc.drsuapi.*.drsuapi.DsCrackNames$
-^samba4.smb2.oplock.exclusive2$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.exclusive5$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.exclusive6$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.brl3$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.levelii500$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.brl1$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch22$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch19$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch12$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch11$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch1$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch6$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch9$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch10$ # samba 4 oplocks are a mess
-^samba4.smb2.oplock.batch20$ # samba 4 oplocks are a mess
+^samba4.rpc.drsuapi.*.drsuapi.DsGetDomainControllerInfo\(.*\)$
+^samba4.rpc.drsuapi.*.drsuapi.DsCrackNames\(.*\)$
+^samba4.smb2.oplock.exclusive2\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.exclusive5\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.exclusive6\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.brl3\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.levelii500\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.brl1\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch22\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch19\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch12\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch11\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch1\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch6\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch9\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch10\(.*\)$ # samba 4 oplocks are a mess
+^samba4.smb2.oplock.batch20\(.*\)$ # samba 4 oplocks are a mess
 ^samba4.smb2.getinfo.getinfo # streams on directories does not work
-^samba4.ntvfs.cifs.krb5.base.createx_access.createx_access$
-^samba4.ldap.acl.*.AclSearchTests.test_search_anonymous3$  # ACL search behaviour not enabled by default
-^samba4.ldap.acl.*.AclSearchTests.test_search1$  # ACL search behaviour not enabled by default
-^samba4.ldap.acl.*.AclSearchTests.test_search2$  # ACL search behaviour not enabled by default
-^samba4.ldap.acl.*.AclSearchTests.test_search3$  # ACL search behaviour not enabled by default
-^samba4.ldap.acl.*.AclSearchTests.test_search4$  # ACL search behaviour not enabled by default
-^samba4.ldap.acl.*.AclSearchTests.test_search5$  # ACL search behaviour not enabled by default
-^samba4.ldap.acl.*.AclSearchTests.test_search6$  # ACL search behaviour not enabled by default
+^samba4.ntvfs.cifs.krb5.base.createx_access.createx_access\(.*\)$
+^samba4.ldap.acl.*.AclSearchTests.test_search_anonymous3\(.*\)$  # ACL search behaviour not enabled by default
+^samba4.ldap.acl.*.AclSearchTests.test_search1\(.*\)$  # ACL search behaviour not enabled by default
+^samba4.ldap.acl.*.AclSearchTests.test_search2\(.*\)$  # ACL search behaviour not enabled by default
+^samba4.ldap.acl.*.AclSearchTests.test_search3\(.*\)$  # ACL search behaviour not enabled by default
+^samba4.ldap.acl.*.AclSearchTests.test_search4\(.*\)$  # ACL search behaviour not enabled by default
+^samba4.ldap.acl.*.AclSearchTests.test_search5\(.*\)$  # ACL search behaviour not enabled by default
+^samba4.ldap.acl.*.AclSearchTests.test_search6\(.*\)$  # ACL search behaviour not enabled by default
 ^samba4.rpc.lsa.forest.trust #Not fully provided by Samba4
 ^samba3.smb2.create.gentest
 ^samba3.smb2.create.blob
index 991574e05f62a1be4f05c2d9dc257a032f5d8a1f..7fc085477d8484f4c0ec7f1dcdfdeca93d24ed17 100644 (file)
@@ -101,20 +101,20 @@ def plantestsuite(name, env, cmdline, allow_empty_output=False):
         filter_subunit_args.append("--fail-on-empty")
     if "$LISTOPT" in cmdline:
         filter_subunit_args.append("$LISTOPT")
-    print "%s 2>&1 | %s/selftest/filter-subunit %s --prefix=\"%s.\"" % (cmdline,
+    print "%s 2>&1 | %s/selftest/filter-subunit %s --prefix=\"%s.\" --suffix=\"(%s)\"" % (cmdline,
                                                                         srcdir(),
                                                                         " ".join(filter_subunit_args),
-                                                                        name)
+                                                                        name, env)
     if allow_empty_output:
         print >>sys.stderr, "WARNING: allowing empty subunit output from %s" % name
 
 
-def add_prefix(prefix, support_list=False):
+def add_prefix(prefix, env, support_list=False):
     if support_list:
         listopt = "$LISTOPT "
     else:
         listopt = ""
-    return "%s/selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\"" % (srcdir(), listopt, prefix)
+    return "%s/selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\" --suffix=\"(%s)\"" % (srcdir(), listopt, prefix, env)
 
 
 def plantestsuite_loadlist(name, env, cmdline):
@@ -128,7 +128,7 @@ def plantestsuite_loadlist(name, env, cmdline):
     if isinstance(cmdline, list):
         cmdline = " ".join(cmdline)
     support_list = ("$LISTOPT" in cmdline)
-    print "%s $LOADLIST 2>&1 | %s" % (cmdline, add_prefix(name, support_list))
+    print "%s $LOADLIST 2>&1 | %s" % (cmdline, add_prefix(name, env, support_list))
 
 
 def plantestsuite_idlist(name, env, cmdline):
index b498878c59aef04648d6ea2c6a9c23e043f032ab..057e1390508a57740c837bf35d5f9fb67152c244 100644 (file)
@@ -270,10 +270,14 @@ class FilterOps(testtools.testresult.TestResult):
         self._ops.startTest(test)
 
     def _add_prefix(self, test):
+        prefix = ""
+        suffix = ""
         if self.prefix is not None:
-            return subunit.RemotedTestCase(self.prefix + test.id())
-        else:
-            return test
+            prefix = self.prefix
+        if self.suffix is not None:
+            suffix = self.suffix
+
+        return subunit.RemotedTestCase(prefix + test.id() + suffix)
 
     def addError(self, test, details=None):
         test = self._add_prefix(test)
@@ -378,13 +382,14 @@ class FilterOps(testtools.testresult.TestResult):
 
         self._ops.end_testsuite(name, result, reason)
 
-    def __init__(self, out, prefix=None, expected_failures=None,
+    def __init__(self, out, prefix=None, suffix=None, expected_failures=None,
                  strip_ok_output=False, fail_immediately=False,
                  flapping=None):
         self._ops = out
         self.seen_output = False
         self.output = None
         self.prefix = prefix
+        self.suffix = suffix
         if expected_failures is not None:
             self.expected_failures = expected_failures
         else: