Improve submission verification scripts
Do not report warnings if git logs match exactly the release tag commit
Components: Framework
Change-Id: I9833026c5924bd22adfce8d26de2314a52fd88b9
(cherry picked from commit 244a26241b3887ccdca2eccbd45b914d3b5e6883)
diff --git a/external/openglcts/scripts/verify/verify_es.py b/external/openglcts/scripts/verify/verify_es.py
index e1a33a5..755cce7 100644
--- a/external/openglcts/scripts/verify/verify_es.py
+++ b/external/openglcts/scripts/verify/verify_es.py
@@ -24,6 +24,7 @@
import sys
import xml.dom.minidom
import re
+import subprocess
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", ".."))
sys.path.append(os.path.join(ROOT_DIR, "scripts", "verify"))
@@ -220,13 +221,61 @@
return messages
+def isGitLogFileEmpty (package, modulePath, gitLog):
+ logPath = os.path.join(package.basePath, gitLog)
+ log = readFile(logPath)
+
+ args = ['git', 'log', '-1', package.conformVersion]
+ process = subprocess.Popen(args, cwd=modulePath, stdout=subprocess.PIPE)
+ output = process.communicate()[0]
+ if process.returncode != 0:
+ raise Exception("Failed to execute '%s', got %d" % (str(args), process.returncode))
+
+ return log == output
+
+def verifyGitLogFile (package):
+ messages = []
+
+ if len(package.gitLog) > 0:
+ for log, path in package.gitLog:
+ try:
+ isEmpty = isGitLogFileEmpty(package, path, log)
+ except Exception, e:
+ print str(e)
+ isEmpty = False
+
+ if not isEmpty:
+ messages.append(warning(os.path.join(package.basePath, log), "Log is not empty"))
+ else:
+ messages.append(error(package.basePath, "Missing git log files"))
+
+ return messages
+
+def verifyPatchFiles (package):
+ messages = []
+ hasPatches = len(package.patches)
+ logEmpty = True
+ for log, path in package.gitLog:
+ logEmpty &= isGitLogFileEmpty(package, path, log)
+
+ if hasPatches and logEmpty:
+ messages.append(error(package.basePath, "Package includes patches but log is empty"))
+ elif not hasPatches and not logEmpty:
+ messages.append(error(package.basePath, "Test log is not empty but package doesn't contain patches"))
+
+ return messages
+
def verifyGitLogFiles (package):
messages = []
if len(package.gitLog) != 2:
messages.append(error(package.basePath, "Exactly two git log file must be present, found %s" % len(package.gitLog)))
- messages += verifyGitLog(package)
+ for i, gitLog in enumerate(package.gitLog):
+ if "kc-cts" in gitLog[0]:
+ package.gitLog[i] = gitLog[:1] + ("external/kc-cts/src",) + gitLog[2:]
+
+ messages += verifyGitLogFile(package)
return messages
@@ -236,7 +285,7 @@
messages += verifyStatement(package)
messages += verifyGitStatusFiles(package)
messages += verifyGitLogFiles(package)
- messages += verifyPatches(package)
+ messages += verifyPatchFiles(package)
for item in package.otherItems:
messages.append(warning(os.path.join(package.basePath, item), "Unknown file"))
diff --git a/scripts/verify/package.py b/scripts/verify/package.py
index d73c17f..e2de942 100644
--- a/scripts/verify/package.py
+++ b/scripts/verify/package.py
@@ -64,7 +64,7 @@
elif fnmatch(item, GIT_STATUS_PATTERN):
gitStatus.append(item)
elif fnmatch(item, GIT_LOG_PATTERN):
- gitLog.append(item)
+ gitLog.append((item, '.'))
elif fnmatch(item, PATCH_PATTERN):
patches.append(item)
elif fnmatch(item, SUMMARY_PATTERN):
diff --git a/scripts/verify/verify.py b/scripts/verify/verify.py
index e23f7f0..dff0f8f 100644
--- a/scripts/verify/verify.py
+++ b/scripts/verify/verify.py
@@ -166,7 +166,7 @@
messages = []
if len(package.gitLog) > 0:
- for log in package.gitLog:
+ for log, path in package.gitLog:
if not isGitLogEmpty(package, log):
messages.append(warning(os.path.join(package.basePath, log), "Log is not empty"))
else:
@@ -178,7 +178,7 @@
messages = []
hasPatches = len(package.patches)
logEmpty = True
- for log in package.gitLog:
+ for log, path in package.gitLog:
logEmpty &= isGitLogEmpty(package, log)
if hasPatches and logEmpty: