Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mathadon issue202 name conflict #209

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 19 additions & 2 deletions buildingspy/development/regressiontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,19 +842,22 @@ def _get_attribute_value(line, keyword, dat):

def _checkDataDictionary(self):
""" Check if the data used to run the regression tests do not have duplicate ``*.fmu`` files
and ``*.mat`` names.
and ``*.mat`` names, or model names.

Since Dymola writes all ``*.fmu`` and ``*.mat`` files to the current working directory,
duplicate file names would cause a translation or simulation to overwrite the files
of a previous test. This would make it impossible to check the FMU export
and to compare the results to previously obtained results.
Duplicate model names are not allowed since this can cause a conflict when writing
translation log files on multicore systems.

If there are duplicate ``.fmu`` and ``*.mat`` file names used, then this method raises
If there are duplicate ``.fmu`` and ``*.mat`` file names or model names used, then this method raises
a ``ValueError`` exception.

"""
s_fmu = set()
s_mat = set()
s_tra = set()
errMes = ""
for data in self._data:
if 'ResultFile' in data:
Expand All @@ -865,6 +868,20 @@ def _checkDataDictionary(self):
" You need to make sure that all scripts use unique result file names.\n" % resFil
else:
s_mat.add(resFil)

# Using the same model for multiple unit tests can lead to a conflict when writing the translation log file
# on a multicore test setup. This is therefore not allowed.
# See https://github.com/lbl-srg/BuildingsPy/issues/202 for a discussion.
for data in self._data:
if 'modelName' in data:
modelName = data['modelName']
if data['mustSimulate']:
if modelName in s_tra:
errMes += "*** Error: Model name %s is used by more than one script.\n" \
" You need to make sure that all scripts use each model only once.\n" % modelName
else:
s_tra.add(modelName)

for data in self._data:
if 'FMUName' in data:
fmuFil = data['FMUName']
Expand Down