Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-4944: smoke tester detects duplicate sections in changes.html

Michael McCandless452c1d468314
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index d8c9fd970d0..41e8537c5bd 100644
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -420,7 +420,9 @@ def testChangesText(dir, version, project):
fullPath = '%s/CHANGES.txt' % root
#print 'CHECK %s' % fullPath
checkChangesContent(open(fullPath, encoding='UTF-8').read(), version, fullPath, project, False)
-
+
+reChangesSectionHREF = re.compile('<a id="(.*?)".*?>(.*?)</a>', re.IGNORECASE)
+
def checkChangesContent(s, version, name, project, isHTML):
if isHTML and s.find('Release %s' % version) == -1:
@@ -440,6 +442,23 @@ def checkChangesContent(s, version, name, project, isHTML):
if name.find('/benchmark/') == -1:
raise RuntimeError('did not see "%s" in %s' % (sub, name))
+ if isHTML:
+ # Make sure a section only appears once under each release:
+ seenIDs = set()
+ seenText = set()
+
+ release = None
+ for id, text in reChangesSectionHREF.findall(s):
+ if text.lower().startswith('release '):
+ release = text[8:].strip()
+ seenText.clear()
+ if id in seenIDs:
+ raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text, release))
+ seenIDs.add(id)
+ if text in seenText:
+ raise RuntimeError('%s has duplicate section "%s" under release "%s"' % (name, text, release))
+ seenText.add(text)
+
reUnixPath = re.compile(r'\b[a-zA-Z_]+=(?:"(?:\\"|[^"])*"' + '|(?:\\\\.|[^"\'\\s])*' + r"|'(?:\\'|[^'])*')" \
+ r'|(/(?:\\.|[^"\'\s])*)' \
+ r'|("/(?:\\.|[^"])*")' \