diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-03-06 10:12:09 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-05-07 19:49:15 +0200 |
commit | 8e9d2626eb2fc6f0041ddda7210ef22ba8205df6 (patch) | |
tree | ed195bf3ebcf16d30b9cdd4ed88c3fd1b9ac70a4 /python | |
parent | 07f01b19c6029ff530683e0a0b5156fea931f4bb (diff) | |
download | samba-8e9d2626eb2fc6f0041ddda7210ef22ba8205df6.tar.gz samba-8e9d2626eb2fc6f0041ddda7210ef22ba8205df6.tar.xz samba-8e9d2626eb2fc6f0041ddda7210ef22ba8205df6.zip |
docs: change docs.py to test the setting of parameters to defaults
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/tests/docs.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/python/samba/tests/docs.py b/python/samba/tests/docs.py index afa9fdd2246..d9f123e7781 100644 --- a/python/samba/tests/docs.py +++ b/python/samba/tests/docs.py @@ -170,9 +170,11 @@ class SmbDotConfTests(TestCase): def test_default_s3(self): self._test_default(['bin/testparm']) + self._set_defaults(['bin/testparm']) def test_default_s4(self): self._test_default(['bin/samba-tool', 'testparm']) + self._set_defaults(['bin/samba-tool', 'testparm']) def _test_default(self, program): topdir = os.path.abspath(samba.source_tree_topdir()) @@ -206,3 +208,40 @@ class SmbDotConfTests(TestCase): if len(failset) > 0: self.fail(self._format_message(failset, "Parameters that do not have matching defaults:")) + + def _set_defaults(self, program): + topdir = os.path.abspath(samba.source_tree_topdir()) + try: + defaults = set(get_default_triples(topdir)) + except: + self.fail("Unable to load parameters") + bindir = os.path.join(topdir, "bin") + failset = set() + count = 0 + + for triple in defaults: + param, default, context = triple + + # temporarily remove parametric options - no dump available in s4 + if param in ['printing'] or ':' in param: + continue + + section = None + if context == "G": + section = "global" + elif context == "S": + section = "test" + else: + self.fail("%s has no valid context" % param) + p = subprocess.Popen(program + ["-s", self.smbconf, + "--section-name", section, "--parameter-name", param, + "--option", "%s = %s" % (param, default)], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=topdir).communicate() + if p[0].upper().strip() != default.upper(): + if not (p[0].upper().strip() == "" and default == '""'): + doc_triple = "%s\n Expected: %s" % (param, default) + failset.add("%s\n Got: %s" % (doc_triple, p[0].upper().strip())) + + if len(failset) > 0: + self.fail(self._format_message(failset, + "Parameters that do not have matching defaults:")) |