[PATCH] remove unused code from docs test

Michael Adam obnox at samba.org
Tue Feb 2 17:07:21 UTC 2016


Review / Push appreciated.

Thanks - Michael
-------------- next part --------------
From e361758121078d2f9a6ee038953d3d4bdc63117f Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Tue, 2 Feb 2016 15:32:26 +0100
Subject: [PATCH] test:docs: remove unused param_table/get_param_table_full()

No tests use this any more, hence we should not
parse the file anymore either. It is generated
directly from the parametersr.all.xml file.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 python/samba/tests/docs.py | 64 ----------------------------------------------
 1 file changed, 64 deletions(-)

diff --git a/python/samba/tests/docs.py b/python/samba/tests/docs.py
index e7123b6..238b5c7 100644
--- a/python/samba/tests/docs.py
+++ b/python/samba/tests/docs.py
@@ -59,64 +59,6 @@ def get_documented_parameters(sourcedir):
     p.close()
 
 
-def get_param_table_full(sourcedir, filename="lib/param/param_table_static.c"):
-    # Reading entries from source code
-    f = open(os.path.join(sourcedir, filename), "r")
-    try:
-        # burn through the preceding lines
-        while True:
-            l = f.readline()
-            if l.startswith("struct parm_struct parm_table"):
-                break
-
-        for l in f.readlines():
-
-            if re.match("^\s*\}\;\s*$", l):
-                # end of the table reached
-                break
-
-            if re.match("^\s*\{\s*$", l):
-                # start a new entry
-                _label = ""
-                _type = ""
-                _class = ""
-                _offset = ""
-                _special = ""
-                _enum_list = ""
-                _flags = ""
-                continue
-
-            if re.match("^\s*\},\s*$", l):
-                # finish the entry
-                yield _label, _type, _class, _offset, _special, _enum_list, _flags
-                continue
-
-            m = re.match("^\s*\.([^\s]+)\s*=\s*(.*),.*", l)
-            if not m:
-                continue
-
-            attrib = m.group(1)
-            value = m.group(2)
-
-            if attrib == "label":
-                _label = value
-            elif attrib == "type":
-                _type = value
-            elif attrib == "p_class":
-                _class = value
-            elif attrib == "offset":
-                _offset = value
-            elif attrib == "special":
-                _special = value
-            elif attrib == "enum_list":
-                _special = value
-            elif attrib == "flags":
-                _flags = value
-
-    finally:
-        f.close()
-
-
 def get_documented_tuples(sourcedir, omit_no_default=True):
     path = os.path.join(sourcedir, "bin", "default", "docs-xml", "smbdotconf")
     if not os.path.exists(os.path.join(path, "parameters.all.xml")):
@@ -195,12 +137,6 @@ class SmbDotConfTests(TestCase):
             self.fail("Unable to load documented parameters")
 
         try:
-            self.table_gen = set(get_param_table_full(self.topdir,
-                                 "bin/default/lib/param/param_table_gen.c"))
-        except:
-            self.fail("Unable to load generated parameter table")
-
-        try:
             self.defaults = set(get_documented_tuples(self.topdir))
         except:
             self.fail("Unable to load parameters")
-- 
2.5.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160202/7b76b4b4/signature.sig>


More information about the samba-technical mailing list