Skip to content

Commit 3515f53

Browse files
authored
display the revision of the result files if available (#136)
1 parent f52568d commit 3515f53

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,23 @@ def cpu_name():
999999
print(str(e))
10001000
gitloglibrarytesting = "<table><tr><td>could not get the git log for OpenModelicaLibraryTesting</td></tr></table>"
10011001

1002+
# adrpo: attempt to get the revision of the reference files if possible
1003+
if conf.get("referenceFiles"):
1004+
try:
1005+
gitReferenceFiles = conf.get("referenceFiles")
1006+
sys.stdout.flush()
1007+
try:
1008+
gitReferenceFilesURL = check_output_log(["git", "config", "get", "remote.origin.url"], cwd=gitReferenceFiles).decode("utf-8")
1009+
except subprocess.CalledProcessError as e:
1010+
print(str(e))
1011+
gitReferenceFilesURL = gitReferenceFiles
1012+
gitReferenceFilesVersion = check_output_log(["git", "log", '--pretty=<table><tr><th>Commit</th><th>Date</th><th>Author</th><th>Summary</th></tr><tr><td><a href="%s/%%h">%%h</a></td><td>%%ai</td><td>%%an</td><td>%%s</td></tr></table>' % (gitReferenceFilesURL), "-1"], cwd=gitReferenceFiles).decode("utf-8")
1013+
except subprocess.CalledProcessError as e:
1014+
print(str(e))
1015+
gitReferenceFilesVersion = ""
1016+
else:
1017+
gitReferenceFilesVersion = ""
1018+
10021019
replacements = (
10031020
(u"#sysInfo#", html.escape(sysInfo)),
10041021
(u"#omcVersion#", html.escape(omc_version)),
@@ -1014,7 +1031,7 @@ def cpu_name():
10141031
(u"#ulimitExe#", html.escape(str(conf["ulimitExe"]))),
10151032
(u"#default_tolerance#", html.escape(str(conf["default_tolerance"]))),
10161033
(u"#simFlags#", html.escape(conf.get("simFlags") or "")),
1017-
(u"#referenceFiles#", ('<p>Reference Files: %s</p>' % conf["referenceFilesURL"].replace(os.path.dirname(os.path.realpath(__file__)),"")) if ((conf.get("referenceFilesURL") or "") != "") else ""),
1034+
(u"#referenceFiles#", ('<p>Reference Files: %s</p>%s' % ((conf["referenceFilesURL"].replace(os.path.dirname(os.path.realpath(__file__)),"")), gitReferenceFilesVersion)) if ((conf.get("referenceFilesURL") or "") != "") else ""),
10181035
(u"#referenceTool#", ('<p>Verified using: %s (diffSimulationResults)</p>' % html.escape(ompython_omc_version)) if ((conf.get("referenceFiles") or "") != "") else ""),
10191036
(u"#Total#", html.escape(str(numSucceeded[0]))),
10201037
(u"#FrontendColor#", checkNumSucceeded(numSucceeded, 1)),

0 commit comments

Comments
 (0)