Skip to content

Commit

Permalink
display the revision of the result files if available (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrpo authored Oct 15, 2024
1 parent f52568d commit 3515f53
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,23 @@ def cpu_name():
print(str(e))
gitloglibrarytesting = "<table><tr><td>could not get the git log for OpenModelicaLibraryTesting</td></tr></table>"

# adrpo: attempt to get the revision of the reference files if possible
if conf.get("referenceFiles"):
try:
gitReferenceFiles = conf.get("referenceFiles")
sys.stdout.flush()
try:
gitReferenceFilesURL = check_output_log(["git", "config", "get", "remote.origin.url"], cwd=gitReferenceFiles).decode("utf-8")
except subprocess.CalledProcessError as e:
print(str(e))
gitReferenceFilesURL = gitReferenceFiles
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")
except subprocess.CalledProcessError as e:
print(str(e))
gitReferenceFilesVersion = ""
else:
gitReferenceFilesVersion = ""

replacements = (
(u"#sysInfo#", html.escape(sysInfo)),
(u"#omcVersion#", html.escape(omc_version)),
Expand All @@ -1014,7 +1031,7 @@ def cpu_name():
(u"#ulimitExe#", html.escape(str(conf["ulimitExe"]))),
(u"#default_tolerance#", html.escape(str(conf["default_tolerance"]))),
(u"#simFlags#", html.escape(conf.get("simFlags") or "")),
(u"#referenceFiles#", ('<p>Reference Files: %s</p>' % conf["referenceFilesURL"].replace(os.path.dirname(os.path.realpath(__file__)),"")) if ((conf.get("referenceFilesURL") or "") != "") else ""),
(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 ""),
(u"#referenceTool#", ('<p>Verified using: %s (diffSimulationResults)</p>' % html.escape(ompython_omc_version)) if ((conf.get("referenceFiles") or "") != "") else ""),
(u"#Total#", html.escape(str(numSucceeded[0]))),
(u"#FrontendColor#", checkNumSucceeded(numSucceeded, 1)),
Expand Down

0 comments on commit 3515f53

Please sign in to comment.