Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ The scripts from this repository can be used to run regression tests for public,
{
"library":"MyModelicaLibrary",
"libraryVersion":"main",
"libraryVersionExactMatch":true, // to be sure that the exact version is loaded, not the latest compatible
"libraryVersionLatestInPackageManager":true, // load the latest from the package manager
"referenceFileExtension":"mat",
"referenceFileNameDelimiter":"/",
"referenceFileNameExtraName":"$ClassName",
Expand Down
2 changes: 2 additions & 0 deletions configs/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{
"library":"Modelica",
"libraryVersion":"4.1.0",
"libraryVersionExactMatch":true,
"referenceFileExtension":"csv",
"referenceFileNameDelimiter":"/",
"referenceFileNameExtraName":"$ClassName",
Expand All @@ -20,6 +21,7 @@
{
"library":"Modelica",
"libraryVersion":"4.0.0",
"libraryVersionExactMatch":true,
"referenceFileExtension":"csv",
"referenceFileNameDelimiter":"/",
"referenceFileNameExtraName":"$ClassName",
Expand Down
1 change: 1 addition & 0 deletions shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def fixData(data,abortSimulationFlag,alarmFlag,overrideDefaults,defaultCustomCom
data["environmentTranslation"] = environmentTranslation
data["libraryVersion"] = data.get("libraryVersion") or "default"
data["libraryVersionLatestInPackageManager"] = data.get("libraryVersionLatestInPackageManager") or False
data["libraryVersionExactMatch"] = data.get("libraryVersionExactMatch") or False
data["alarmFlag"] = data.get("alarmFlag") or (alarmFlag if data["simCodeTarget"]=="C" else "")
data["abortSlowSimulation"] = data.get("abortSlowSimulation") or (abortSimulationFlag if data["simCodeTarget"]=="C" else "")
if "changeHash" in data: # Force rebuilding the library due to change in the testing script
Expand Down
9 changes: 8 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,14 @@ def hashReferenceFiles(s):
versions = "{" + ",".join(['"'+v+'"' for v in availableVersions]) + "}"
else:
versions = '{"%s"}' % version
if not omc.sendExpression('loadModel(%s,%s)' % (lib,versions)):

exactMatch=''
if conf["libraryVersionExactMatch"]:
if conf["libraryVersionLatestInPackageManager"]:
raise Exception("Library %s has both libraryVersionLatestInPackageManager:true and libraryVersionExactMatch:true! Make up your mind." % libName)
exactMatch=', requireExactVersion=true'

if not omc.sendExpression('loadModel(%s,%s%s)' % (lib,versions,exactMatch)):
try:
print("Failed to load library %s %s: %s" % (library,versions,omc.sendExpression('OpenModelica.Scripting.getErrorString()')))
except:
Expand Down
Loading