Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineGautier committed May 18, 2023
1 parent 093d758 commit 176cd68
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Buildings/Resources/Scripts/travis/dymola/dymola
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
cur_dir=`pwd`
bas_nam=`basename ${cur_dir}`
sha_dir=`dirname ${cur_dir}`

echo 'DEBUG: Content of bas_nam'
ls $bas_nam
echo 'DEBUG: Content of sha_dir'
ls $sha_dir

# If the current directory is part of the argument list,
# replace it with . as the docker may have a different file structure
arg_lis=`echo $@ | sed -e "s|${cur_dir}|.|g"`
Expand Down
15 changes: 10 additions & 5 deletions Buildings/Resources/Scripts/travis/templates/BoilerPlant.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,20 @@ def simulateCase(arg, simulator):
output_dir_path = tempfile.mkdtemp(prefix=output_dir_prefix, dir=cwd)

# The following makes dymola worker cd into outputDirectory.
s = Simulator(arg[0], outputDirectory=os.path.relpath(output_dir_path))
# s = Simulator(arg[0], outputDirectory=os.path.relpath(output_dir_path))

if simulator == 'Dymola':
s.addPreProcessingStatement(r'Advanced.TranslationInCommandLog:=true;')
s = Simulator(arg[0])
s.addPreProcessingStatement(r'cd')
print(os.getcwd())
print(os.listdir(os.pardir))
s.addPreProcessingStatement(r'openModel(path="../package.mo", changeDirectory=false);')
s.addPreProcessingStatement(r'Advanced.TranslationInCommandLog:=true;')
# The following works locally.
s.addPreProcessingStatement(r'openModel("package.mo", changeDirectory=false)')
# The following is for docker run.
s.addPreProcessingStatement(r'openModel("/mnt/shared/Buildings/package.mo", changeDirectory=false)')
s.addPreProcessingStatement(r'openModel("/mnt/shared/package.mo", changeDirectory=false)')
s.addPreProcessingStatement(fr'cd("{os.path.relpath(output_dir_path)}")')
if simulator == 'Optimica':
s = Simulator(arg[0], outputDirectory=os.path.relpath(output_dir_path))
# Set MODELICAPATH (only in child process, so this won't affect main process).
os.environ['MODELICAPATH'] = os.path.abspath(os.path.pardir)

Expand Down

0 comments on commit 176cd68

Please sign in to comment.