[PATCH] Address some -O3 issues on Ubuntu 10.04

Stefan Metzmacher metze at samba.org
Tue Aug 2 16:51:35 UTC 2016


Am 03.06.2016 um 00:28 schrieb Andrew Bartlett:
> G'Day,
> 
> These two patches address just some of the issues flagged by -O3 and
> -Werror on Ubuntu 10.04.  There are still many others, and I think we
> should either remove the -Werror or samba-o3 build from our autobuild
> on that platform, as otherwise we are not seeing any of the other
> failures.
> 
> There are still many, many other issues, which are all probably red
> herrings flagged by an older compiler however.

It seems to easier to just skip the samba-o3 target on older systems.
sn-devel-104 has AUTOBUILD_SKIP_SAMBA_O3=1 in buildnice now.

Please review the attached patches, the "tests:samba_tool" patches were
created
while debugging a failure in sanba-tool user syncpassword, they revealed
that
I had to install python-m2crypto.

With these patches I'm getting similar flakey results as on sn-devel-144.

Thanks!
metze
-------------- next part --------------
From 6cba0d8388b00ce294f4f7cd3b776ba5c407bce8 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Tue, 2 Aug 2016 12:33:34 +0200
Subject: [PATCH 1/3] tests:samba_tool: pass stdout and stderr to
 assertCmdSuccess()

This allows us to generate better assert messages and give the
developer some ideas why the command wasn't able to run.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 python/samba/tests/samba_tool/base.py              |  5 ++--
 python/samba/tests/samba_tool/fsmo.py              |  2 +-
 python/samba/tests/samba_tool/gpo.py               | 14 +++++-----
 python/samba/tests/samba_tool/group.py             | 10 +++----
 python/samba/tests/samba_tool/ntacl.py             | 24 ++++++++--------
 python/samba/tests/samba_tool/processes.py         |  4 +--
 python/samba/tests/samba_tool/rodc.py              | 14 +++++-----
 python/samba/tests/samba_tool/sites.py             |  4 +--
 python/samba/tests/samba_tool/timecmd.py           |  2 +-
 python/samba/tests/samba_tool/user.py              | 32 ++++++++++------------
 .../tests/samba_tool/user_check_password_script.py |  8 +++---
 source4/torture/drs/python/fsmo.py                 |  2 +-
 12 files changed, 60 insertions(+), 61 deletions(-)

diff --git a/python/samba/tests/samba_tool/base.py b/python/samba/tests/samba_tool/base.py
index de6cf18..8f00534 100644
--- a/python/samba/tests/samba_tool/base.py
+++ b/python/samba/tests/samba_tool/base.py
@@ -81,8 +81,9 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase):
         result = cmd._run("samba-tool %s %s" % (name, sub), *args)
         return (result, cmd.outf.getvalue(), cmd.errf.getvalue())
 
-    def assertCmdSuccess(self, val, msg=""):
-        self.assertIsNone(val, msg)
+    def assertCmdSuccess(self, exit, out, err, msg=""):
+        self.assertIsNone(exit, msg="exit[%s] stdout[%s] stderr[%s]: %s" % (
+                          exit, out, err, msg))
 
     def assertCmdFail(self, val, msg=""):
         self.assertIsNotNone(val, msg)
diff --git a/python/samba/tests/samba_tool/fsmo.py b/python/samba/tests/samba_tool/fsmo.py
index 207aa17..c985830 100644
--- a/python/samba/tests/samba_tool/fsmo.py
+++ b/python/samba/tests/samba_tool/fsmo.py
@@ -25,7 +25,7 @@ class FsmoCmdTestCase(SambaToolCmdTest):
         """Run fsmo show to see if it errors"""
         (result, out, err) = self.runsubcmd("fsmo", "show")
 
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
 
         # Check that the output is sensible
diff --git a/python/samba/tests/samba_tool/gpo.py b/python/samba/tests/samba_tool/gpo.py
index e20a977..cd22706 100644
--- a/python/samba/tests/samba_tool/gpo.py
+++ b/python/samba/tests/samba_tool/gpo.py
@@ -30,7 +30,7 @@ class GpoCmdTestCase(SambaToolCmdTest):
     def test_gpo_list(self):
         """Run gpo list against the server and make sure it looks accurate"""
         (result, out, err) = self.runsubcmd("gpo", "listall", "-H", "ldap://%s" % os.environ["SERVER"])
-        self.assertCmdSuccess(result, "Ensuring gpo listall ran successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring gpo listall ran successfully")
 
     def test_fetchfail(self):
         """Run against a non-existent GPO, and make sure it fails (this hard-coded UUID is very unlikely to exist"""
@@ -40,23 +40,23 @@ class GpoCmdTestCase(SambaToolCmdTest):
     def test_fetch(self):
         """Run against a real GPO, and make sure it passes"""
         (result, out, err) = self.runsubcmd("gpo", "fetch", self.gpo_guid, "-H", "ldap://%s" % os.environ["SERVER"], "--tmpdir", self.tempdir)
-        self.assertCmdSuccess(result, "Ensuring gpo fetched successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring gpo fetched successfully")
         shutil.rmtree(os.path.join(self.tempdir, "policy"))
 
     def test_show(self):
         """Show a real GPO, and make sure it passes"""
         (result, out, err) = self.runsubcmd("gpo", "show", self.gpo_guid, "-H", "ldap://%s" % os.environ["SERVER"])
-        self.assertCmdSuccess(result, "Ensuring gpo fetched successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring gpo fetched successfully")
 
     def test_show_as_admin(self):
         """Show a real GPO, and make sure it passes"""
         (result, out, err) = self.runsubcmd("gpo", "show", self.gpo_guid, "-H", "ldap://%s" % os.environ["SERVER"], "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
-        self.assertCmdSuccess(result, "Ensuring gpo fetched successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring gpo fetched successfully")
 
     def test_aclcheck(self):
         """Check all the GPOs on the remote server have correct ACLs"""
         (result, out, err) = self.runsubcmd("gpo", "aclcheck", "-H", "ldap://%s" % os.environ["SERVER"], "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
-        self.assertCmdSuccess(result, "Ensuring gpo checked successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring gpo checked successfully")
 
     def setUp(self):
         """set up a temporary GPO to work with"""
@@ -66,7 +66,7 @@ class GpoCmdTestCase(SambaToolCmdTest):
                                             "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]),
                                             "--tmpdir", self.tempdir)
         shutil.rmtree(os.path.join(self.tempdir, "policy"))
-        self.assertCmdSuccess(result, "Ensuring gpo created successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring gpo created successfully")
         try:
             self.gpo_guid = "{%s}" % out.split("{")[1].split("}")[0]
         except IndexError:
@@ -75,5 +75,5 @@ class GpoCmdTestCase(SambaToolCmdTest):
     def tearDown(self):
         """remove the temporary GPO to work with"""
         (result, out, err) = self.runsubcmd("gpo", "del", self.gpo_guid, "-H", "ldap://%s" % os.environ["SERVER"], "-U%s%%%s" % (os.environ["USERNAME"], os.environ["PASSWORD"]))
-        self.assertCmdSuccess(result, "Ensuring gpo deleted successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring gpo deleted successfully")
         super(GpoCmdTestCase, self).tearDown()
diff --git a/python/samba/tests/samba_tool/group.py b/python/samba/tests/samba_tool/group.py
index 2c0c46e..09ba59d 100644
--- a/python/samba/tests/samba_tool/group.py
+++ b/python/samba/tests/samba_tool/group.py
@@ -43,7 +43,7 @@ class GroupCmdTestCase(SambaToolCmdTest):
         for group in self.groups:
             (result, out, err) = self._create_group(group)
 
-            self.assertCmdSuccess(result)
+            self.assertCmdSuccess(result, out, err)
             self.assertEquals(err, "", "There shouldn't be any error message")
             self.assertIn("Added group %s" % group["name"], out)
 
@@ -73,7 +73,7 @@ class GroupCmdTestCase(SambaToolCmdTest):
         # try to delete all the groups we just added
         for group in self.groups:
             (result, out, err) = self.runsubcmd("group", "delete", group["name"])
-            self.assertCmdSuccess(result,
+            self.assertCmdSuccess(result, out, err,
                                   "Failed to delete group '%s'" % group["name"])
             found = self._find_group(group["name"])
             self.assertIsNone(found,
@@ -87,7 +87,7 @@ class GroupCmdTestCase(SambaToolCmdTest):
                                                  "-U%s%%%s" % (os.environ["DC_USERNAME"],
                                                  os.environ["DC_PASSWORD"]))
 
-            self.assertCmdSuccess(result)
+            self.assertCmdSuccess(result, out, err)
             self.assertEquals(err,"","There shouldn't be any error message")
             self.assertIn("Added group %s" % group["name"], out)
 
@@ -102,7 +102,7 @@ class GroupCmdTestCase(SambaToolCmdTest):
                                             "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                             "-U%s%%%s" % (os.environ["DC_USERNAME"],
                                                           os.environ["DC_PASSWORD"]))
-        self.assertCmdSuccess(result, "Error running list")
+        self.assertCmdSuccess(result, out, err, "Error running list")
 
         search_filter = "(objectClass=group)"
 
@@ -123,7 +123,7 @@ class GroupCmdTestCase(SambaToolCmdTest):
                                             "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                             "-U%s%%%s" % (os.environ["DC_USERNAME"],
                                                           os.environ["DC_PASSWORD"]))
-        self.assertCmdSuccess(result, "Error running listmembers")
+        self.assertCmdSuccess(result, out, err, "Error running listmembers")
 
         search_filter = "(|(primaryGroupID=513)(memberOf=CN=Domain Users,CN=Users,%s))" % self.samdb.domain_dn()
 
diff --git a/python/samba/tests/samba_tool/ntacl.py b/python/samba/tests/samba_tool/ntacl.py
index 2a329fe..c01d5ac 100644
--- a/python/samba/tests/samba_tool/ntacl.py
+++ b/python/samba/tests/samba_tool/ntacl.py
@@ -31,7 +31,7 @@ class NtACLCmdSysvolTestCase(SambaToolCmdTest):
     def test_ntvfs(self):
         (result, out, err) =  self.runsubcmd("ntacl", "sysvolreset",
                                              "--use-ntvfs")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(out,"","Shouldn't be any output messages")
         self.assertIn("Please note that POSIX permissions have NOT been changed, only the stored NT ACL", err)
 
@@ -39,19 +39,19 @@ class NtACLCmdSysvolTestCase(SambaToolCmdTest):
         (result, out, err) =  self.runsubcmd("ntacl", "sysvolreset",
                                              "--use-s3fs")
 
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertEquals(out,"","Shouldn't be any output messages")
 
     def test_ntvfs_check(self):
         (result, out, err) =  self.runsubcmd("ntacl", "sysvolreset",
                                              "--use-ntvfs")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(out,"","Shouldn't be any output messages")
         self.assertIn("Please note that POSIX permissions have NOT been changed, only the stored NT ACL", err)
         # Now check they were set correctly
         (result, out, err) =  self.runsubcmd("ntacl", "sysvolcheck")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertEquals(out,"","Shouldn't be any output messages")
 
@@ -59,13 +59,13 @@ class NtACLCmdSysvolTestCase(SambaToolCmdTest):
         (result, out, err) =  self.runsubcmd("ntacl", "sysvolreset",
                                              "--use-s3fs")
 
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertEquals(out,"","Shouldn't be any output messages")
 
         # Now check they were set correctly
         (result, out, err) =  self.runsubcmd("ntacl", "sysvolcheck")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertEquals(out,"","Shouldn't be any output messages")
 
@@ -82,7 +82,7 @@ class NtACLCmdGetSetTestCase(SambaToolCmdTest):
 
         (result, out, err) =  self.runsubcmd("ntacl", "set", self.acl, tempf,
                                              "--use-ntvfs")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(out,"","Shouldn't be any output messages")
         self.assertIn("Please note that POSIX permissions have NOT been changed, only the stored NT ACL", err)
 
@@ -94,7 +94,7 @@ class NtACLCmdGetSetTestCase(SambaToolCmdTest):
         (result, out, err) =  self.runsubcmd("ntacl", "set", self.acl, tempf,
                                              "--use-s3fs")
 
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertEquals(out,"","Shouldn't be any output messages")
 
@@ -105,14 +105,14 @@ class NtACLCmdGetSetTestCase(SambaToolCmdTest):
 
         (result, out, err) =  self.runsubcmd("ntacl", "set", self.acl, tempf,
                                              "--use-ntvfs")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(out,"","Shouldn't be any output messages")
         self.assertIn("Please note that POSIX permissions have NOT been changed, only the stored NT ACL", err)
 
         # Now check they were set correctly
         (result, out, err) =  self.runsubcmd("ntacl",  "get", tempf,
                                              "--use-ntvfs", "--as-sddl")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertEquals(self.acl+"\n", out, "Output should be the ACL")
 
@@ -123,13 +123,13 @@ class NtACLCmdGetSetTestCase(SambaToolCmdTest):
 
         (result, out, err) =  self.runsubcmd("ntacl", "set", self.acl, tempf,
                                              "--use-s3fs")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(out,"","Shouldn't be any output messages")
         self.assertEquals(err,"","Shouldn't be any error messages")
 
         # Now check they were set correctly
         (result, out, err) =  self.runsubcmd("ntacl",  "get", tempf,
                                              "--use-s3fs", "--as-sddl")
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertEquals(self.acl+"\n", out,"Output should be the ACL")
diff --git a/python/samba/tests/samba_tool/processes.py b/python/samba/tests/samba_tool/processes.py
index 91a5266..5b8f502 100644
--- a/python/samba/tests/samba_tool/processes.py
+++ b/python/samba/tests/samba_tool/processes.py
@@ -27,9 +27,9 @@ class ProcessCmdTestCase(SambaToolCmdTest):
     def test_name(self):
         """Run processes command"""
         (result, out, err) = self.runcmd("processes", "--name", "samba")
-        self.assertCmdSuccess(result, "Ensuring processes ran successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring processes ran successfully")
 
     def test_all(self):
         """Run processes command"""
         (result, out, err) = self.runcmd("processes")
-        self.assertCmdSuccess(result, "Ensuring processes ran successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring processes ran successfully")
diff --git a/python/samba/tests/samba_tool/rodc.py b/python/samba/tests/samba_tool/rodc.py
index 798bc17..4851a53 100644
--- a/python/samba/tests/samba_tool/rodc.py
+++ b/python/samba/tests/samba_tool/rodc.py
@@ -66,26 +66,26 @@ class RodcCmdTestCase(SambaToolCmdTest):
     def test_single_by_account_name(self):
         (result, out, err) = self.runsubcmd("rodc", "preload", "sambatool1",
                                             "--server", os.environ["DC_SERVER"])
-        self.assertCmdSuccess(result, "ensuring rodc prefetch ran successfully")
+        self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
         self.assertEqual(out, "Replicating DN CN=sambatool1,CN=Users,%s\n" % self.base_dn)
         self.assertEqual(err, "")
 
     def test_single_by_dn(self):
         (result, out, err) = self.runsubcmd("rodc", "preload", "cn=sambatool2,cn=users,%s" % self.base_dn,
                                             "--server", os.environ["DC_SERVER"])
-        self.assertCmdSuccess(result, "ensuring rodc prefetch ran successfully")
+        self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
         self.assertEqual(out, "Replicating DN CN=sambatool2,CN=Users,%s\n" % self.base_dn)
 
     def test_multi_by_account_name(self):
         (result, out, err) = self.runsubcmd("rodc", "preload", "sambatool1", "sambatool2",
                                             "--server", os.environ["DC_SERVER"])
-        self.assertCmdSuccess(result, "ensuring rodc prefetch ran successfully")
+        self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
         self.assertEqual(out, "Replicating DN CN=sambatool1,CN=Users,%s\nReplicating DN CN=sambatool2,CN=Users,%s\n" % (self.base_dn, self.base_dn))
 
     def test_multi_by_dn(self):
         (result, out, err) = self.runsubcmd("rodc", "preload", "cn=sambatool3,cn=users,%s" % self.base_dn, "cn=sambatool4,cn=users,%s" % self.base_dn,
                                             "--server", os.environ["DC_SERVER"])
-        self.assertCmdSuccess(result, "ensuring rodc prefetch ran successfully")
+        self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
         self.assertEqual(out, "Replicating DN CN=sambatool3,CN=Users,%s\nReplicating DN CN=sambatool4,CN=Users,%s\n" % (self.base_dn, self.base_dn))
 
     def test_multi_in_file(self):
@@ -93,7 +93,7 @@ class RodcCmdTestCase(SambaToolCmdTest):
         open(tempf, 'w').write("sambatool1\nsambatool2")
         (result, out, err) = self.runsubcmd("rodc", "preload", "--file", tempf,
                                             "--server", os.environ["DC_SERVER"])
-        self.assertCmdSuccess(result, "ensuring rodc prefetch ran successfully")
+        self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
         self.assertEqual(out, "Replicating DN CN=sambatool1,CN=Users,%s\nReplicating DN CN=sambatool2,CN=Users,%s\n" % (self.base_dn, self.base_dn))
         os.unlink(tempf)
 
@@ -103,7 +103,7 @@ class RodcCmdTestCase(SambaToolCmdTest):
                                             "nonexistentuser2",
                                             "--server", os.environ["DC_SERVER"],
                                             "--ignore-errors")
-        self.assertCmdSuccess(result, "ensuring rodc prefetch ran successfully")
+        self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
         self.assertEqual(out, "Replicating DN CN=sambatool5,CN=Users,%s\n" % self.base_dn)
 
     def test_multi_with_missing_name_failure(self):
@@ -118,7 +118,7 @@ class RodcCmdTestCase(SambaToolCmdTest):
                                             "sambatool6", "sambatool5",
                                             "--server", os.environ["DC_SERVER"],
                                             "--ignore-errors")
-        self.assertCmdSuccess(result, "ensuring rodc prefetch ran successfully")
+        self.assertCmdSuccess(result, out, err, "ensuring rodc prefetch ran successfully")
         self.assertEqual(out, "Replicating DN CN=sambatool6,CN=Users,%s\nReplicating DN CN=sambatool5,CN=Users,%s\n" % (self.base_dn, self.base_dn))
 
     def test_multi_without_group_failure(self):
diff --git a/python/samba/tests/samba_tool/sites.py b/python/samba/tests/samba_tool/sites.py
index ee28109..8f96bba 100644
--- a/python/samba/tests/samba_tool/sites.py
+++ b/python/samba/tests/samba_tool/sites.py
@@ -44,7 +44,7 @@ class SitesCmdTestCase(BaseSitesCmdTestCase):
 
         result, out, err = self.runsubcmd("sites", "create", sitename,
                                           "-H", self.dburl, self.creds_string)
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
 
         dnsites = ldb.Dn(self.samdb, "CN=Sites,%s" % self.config_dn)
         dnsite = ldb.Dn(self.samdb, "CN=%s,%s" % (sitename, dnsites))
@@ -89,7 +89,7 @@ class SitesSubnetCmdTestCase(BaseSitesCmdTestCase):
                                               cidr, sitename,
                                               "-H", self.dburl,
                                               self.creds_string)
-            self.assertCmdSuccess(result)
+            self.assertCmdSuccess(result, out, err)
 
             ret = self.samdb.search(base=self.config_dn,
                                     scope=ldb.SCOPE_SUBTREE,
diff --git a/python/samba/tests/samba_tool/timecmd.py b/python/samba/tests/samba_tool/timecmd.py
index 000f0f2..310f861 100644
--- a/python/samba/tests/samba_tool/timecmd.py
+++ b/python/samba/tests/samba_tool/timecmd.py
@@ -25,7 +25,7 @@ class TimeCmdTestCase(SambaToolCmdTest):
     def test_timeget(self):
         """Run time against the server and make sure it looks accurate"""
         (result, out, err) = self.runcmd("time", os.environ["SERVER"])
-        self.assertCmdSuccess(result, "Ensuring time ran successfully")
+        self.assertCmdSuccess(result, out, err, "Ensuring time ran successfully")
 
         timefmt = strptime(out, "%a %b %d %H:%M:%S %Y %Z\n")
         servertime = int(mktime(timefmt))
diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py
index 91e45c3..d2eb0e6 100644
--- a/python/samba/tests/samba_tool/user.py
+++ b/python/samba/tests/samba_tool/user.py
@@ -51,7 +51,7 @@ class UserCmdTestCase(SambaToolCmdTest):
         for user in self.users:
             (result, out, err) = user["createUserFn"](user)
 
-            self.assertCmdSuccess(result)
+            self.assertCmdSuccess(result, out, err)
             self.assertEquals(err,"","Shouldn't be any error messages")
             self.assertIn("User '%s' created successfully" % user["name"], out)
 
@@ -76,7 +76,7 @@ class UserCmdTestCase(SambaToolCmdTest):
         # try to delete all the 4 users we just added
         for user in self.users:
             (result, out, err) = self.runsubcmd("user", "delete", user["name"])
-            self.assertCmdSuccess(result, "Can we delete users")
+            self.assertCmdSuccess(result, out, err, "Can we delete users")
             found = self._find_user(user["name"])
             self.assertIsNone(found)
 
@@ -93,7 +93,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                  "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                                  "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
 
-            self.assertCmdSuccess(result)
+            self.assertCmdSuccess(result, out, err)
             self.assertEquals(err,"","Shouldn't be any error messages")
             self.assertIn("User '%s' created successfully" % user["name"], out)
 
@@ -193,7 +193,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 "--newpassword=%s" % newpasswd,
                                                 "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                                 "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
-            # self.assertCmdSuccess(result, "Ensure setpassword runs")
+            self.assertCmdSuccess(result, out, err, "Ensure setpassword runs")
             self.assertEquals(err,"","setpassword with url")
             self.assertMatch(out, "Changed password OK", "setpassword with url")
 
@@ -202,7 +202,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                             "--cache-ldb-initialize",
                                             "--attributes=%s" % attributes,
                                             "--decrypt-samba-gpg")
-        self.assertCmdSuccess(result, "Ensure syncpasswords --cache-ldb-initialize runs")
+        self.assertCmdSuccess(result, out, err, "Ensure syncpasswords --cache-ldb-initialize runs")
         self.assertEqual(err,"","getpassword without url")
         cache_attrs = {
             "objectClass": { "value": "userSyncPasswords" },
@@ -220,7 +220,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                 "syncpasswords --cache-ldb-initialize: %s: %s out[%s]" % (a, v, out))
 
         (result, out, err) = self.runsubcmd("user", "syncpasswords", "--no-wait")
-        self.assertCmdSuccess(result, "Ensure syncpasswords --no-wait runs")
+        self.assertCmdSuccess(result, out, err, "Ensure syncpasswords --no-wait runs")
         self.assertEqual(err,"","syncpasswords --no-wait")
         self.assertMatch(out, "dirsync_loop(): results 0",
             "syncpasswords --no-wait: 'dirsync_loop(): results 0': out[%s]" % (out))
@@ -241,12 +241,12 @@ class UserCmdTestCase(SambaToolCmdTest):
             (result, out, err) = self.runsubcmd("user", "setpassword",
                                                 user["name"],
                                                 "--newpassword=%s" % newpasswd)
-            self.assertCmdSuccess(result, "Ensure setpassword runs")
+            self.assertCmdSuccess(result, out, err, "Ensure setpassword runs")
             self.assertEquals(err,"","setpassword without url")
             self.assertMatch(out, "Changed password OK", "setpassword without url")
 
             (result, out, err) = self.runsubcmd("user", "syncpasswords", "--no-wait")
-            self.assertCmdSuccess(result, "Ensure syncpasswords --no-wait runs")
+            self.assertCmdSuccess(result, out, err, "Ensure syncpasswords --no-wait runs")
             self.assertEqual(err,"","syncpasswords --no-wait")
             self.assertMatch(out, "dirsync_loop(): results 0",
                 "syncpasswords --no-wait: 'dirsync_loop(): results 0': out[%s]" % (out))
@@ -272,7 +272,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 user["name"],
                                                 "--attributes=%s" % attributes,
                                                 "--decrypt-samba-gpg")
-            self.assertCmdSuccess(result, "Ensure getpassword runs")
+            self.assertCmdSuccess(result, out, err, "Ensure getpassword runs")
             self.assertEqual(err,"","getpassword without url")
             self.assertMatch(out, "Got password OK", "getpassword without url")
             self.assertMatch(out, "sAMAccountName: %s" % (user["name"]),
@@ -298,7 +298,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 "--must-change-at-next-login",
                                                 "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                                 "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
-            # self.assertCmdSuccess(result, "Ensure setpassword runs")
+            self.assertCmdSuccess(result, out, err, "Ensure setpassword runs")
             self.assertEquals(err,"","setpassword with forced change")
             self.assertMatch(out, "Changed password OK", "setpassword with forced change")
 
@@ -313,7 +313,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 "--days=2",
                                                 "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                                 "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
-            self.assertCmdSuccess(result, "Can we run setexpiry with names")
+            self.assertCmdSuccess(result, out, err, "Can we run setexpiry with names")
             self.assertIn("Expiry for user '%s' set to 2 days." % user["name"], out)
 
         for user in self.users:
@@ -333,7 +333,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 "--days=4",
                                                 "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                                 "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
-        self.assertCmdSuccess(result, "Can we run setexpiry with a filter")
+        self.assertCmdSuccess(result, out, err, "Can we run setexpiry with a filter")
 
         for user in self.users:
             found = self._find_user(user["name"])
@@ -350,7 +350,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                             "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                             "-U%s%%%s" % (os.environ["DC_USERNAME"],
                                                           os.environ["DC_PASSWORD"]))
-        self.assertCmdSuccess(result, "Error running list")
+        self.assertCmdSuccess(result, out, err, "Error running list")
 
         search_filter = ("(&(objectClass=user)(userAccountControl:%s:=%u))" %
                          (ldb.OID_COMPARATOR_AND, dsdb.UF_NORMAL_ACCOUNT))
@@ -410,8 +410,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                                 "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
 
-        msg = "command should return %s" % err
-        self.assertCmdSuccess(result, msg)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertIn("User '%s' created successfully" % user["name"], out)
 
@@ -440,8 +439,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                                                 "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                                 "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
 
-        msg = "command should return %s" % err
-        self.assertCmdSuccess(result, msg)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         self.assertIn("User '%s' created successfully" % user["name"], out)
 
diff --git a/python/samba/tests/samba_tool/user_check_password_script.py b/python/samba/tests/samba_tool/user_check_password_script.py
index 5d4fbae..f1deb88 100644
--- a/python/samba/tests/samba_tool/user_check_password_script.py
+++ b/python/samba/tests/samba_tool/user_check_password_script.py
@@ -54,12 +54,12 @@ class UserCheckPwdTestCase(SambaToolCmdTest):
         (result, out, err) = self.runsubcmd("user", "delete", user["name"],
                                             "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                             "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
-        self.assertCmdSuccess(result, "Should delete user with bad password.")
+        self.assertCmdSuccess(result, out, err, "Should delete user with bad password.")
 
         (result, out, err) = self.runsubcmd("user", "add", user["name"], good_password,
                                             "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                             "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
-        self.assertCmdSuccess(result, "Should succeed adding a user with good password.")
+        self.assertCmdSuccess(result, out, err, "Should succeed adding a user with good password.")
 
         # Set password
         (result, out, err) = self.runsubcmd("user", "setpassword", user["name"],
@@ -72,7 +72,7 @@ class UserCheckPwdTestCase(SambaToolCmdTest):
                                             "--newpassword=%s" % good_password,
                                             "-H", "ldap://%s" % os.environ["DC_SERVER"],
                                             "-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
-        self.assertCmdSuccess(result, "Should succeed setting a user's password to a good one.")
+        self.assertCmdSuccess(result, out, err, "Should succeed setting a user's password to a good one.")
 
         # Password=
 
@@ -86,7 +86,7 @@ class UserCheckPwdTestCase(SambaToolCmdTest):
                                             "--newpassword=%s" % good_password + 'XYZ',
                                             "--ipaddress", os.environ["DC_SERVER_IP"],
                                             "-U%s%%%s" % (user["name"], good_password))
-        self.assertCmdSuccess(result, "A user setting their own password to a good one should succeed.")
+        self.assertCmdSuccess(result, out, err, "A user setting their own password to a good one should succeed.")
 
     def _randomUser(self, base={}):
         """create a user with random attribute values, you can specify base attributes"""
diff --git a/source4/torture/drs/python/fsmo.py b/source4/torture/drs/python/fsmo.py
index df5a274..4dd652d 100644
--- a/source4/torture/drs/python/fsmo.py
+++ b/source4/torture/drs/python/fsmo.py
@@ -66,7 +66,7 @@ class DrsFsmoTestCase(drs_base.DrsBaseTestCase):
                                             "-H", "ldap://%s:389" % DC,
                                             cmd_line_auth)
 
-        self.assertCmdSuccess(result)
+        self.assertCmdSuccess(result, out, err)
         self.assertEquals(err,"","Shouldn't be any error messages")
         if noop == False:
             self.assertTrue("FSMO transfer of '%s' role successful" % role in out)
-- 
1.9.1


From c3391b354bca3b05639b2a24ff32c888d74aee23 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Tue, 2 Aug 2016 12:35:38 +0200
Subject: [PATCH 2/3] tests:samba_tool: make use of assertCmdFail() in gpo.py

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 python/samba/tests/samba_tool/gpo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/samba/tests/samba_tool/gpo.py b/python/samba/tests/samba_tool/gpo.py
index cd22706..6297e1a 100644
--- a/python/samba/tests/samba_tool/gpo.py
+++ b/python/samba/tests/samba_tool/gpo.py
@@ -35,7 +35,7 @@ class GpoCmdTestCase(SambaToolCmdTest):
     def test_fetchfail(self):
         """Run against a non-existent GPO, and make sure it fails (this hard-coded UUID is very unlikely to exist"""
         (result, out, err) = self.runsubcmd("gpo", "fetch", "c25cac17-a02a-4151-835d-fae17446ee43", "-H", "ldap://%s" % os.environ["SERVER"])
-        self.assertEquals(result, -1, "check for result code")
+        self.assertCmdFail(result, "check for result code")
 
     def test_fetch(self):
         """Run against a real GPO, and make sure it passes"""
-- 
1.9.1


From 5ebb3ff25ea40fb2701592576d4a3cd5d532de7e Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 1 Aug 2016 16:48:53 +0200
Subject: [PATCH 3/3] script/autobuild.py: check for AUTOBUILD_SKIP_SAMBA_O3
 environment variable

We need to skip the samba-o3 target on older systems like sn-devel-104.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 script/autobuild.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/script/autobuild.py b/script/autobuild.py
index 0af8166..811f906 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -41,6 +41,9 @@ builddirs = {
 
 defaulttasks = [ "ctdb", "samba", "samba-xc", "samba-o3", "samba-ctdb", "samba-libs", "samba-static", "ldb", "tdb", "talloc", "replace", "tevent", "pidl" ]
 
+if os.environ.get("AUTOBUILD_SKIP_SAMBA_O3", "0") == "1":
+    defaulttasks.remove("samba-o3")
+
 samba_configure_params = " --picky-developer ${PREFIX} ${EXTRA_PYTHON} --with-profiling-data"
 
 samba_libs_envvars =  "PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH"
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160802/fae7e40c/signature.sig>


More information about the samba-technical mailing list