Skip to content

Commit aa5823c

Browse files
committed
Adapt the FMI jobs to the Python OMSimulator CLI
OMSimulator's command line is now argparse-based: `-v` and `-r=` are rejected, so every FMI job died on the version check, and a bare FMU exports `<model>.<var>` unless `--stripRoot` is given. - Read the version flag from configs/fmi-simulators.json - Use `--version`, `--resultFile=` and `--stripRoot` - Install lxml in the image venv; the CLI runs on its python3 Assisted-by: Claude Opus 5.5
1 parent d1eb63f commit aa5823c

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎.CI/testing/Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ RUN python3 -m venv /opt/libtest-venv \
3939
# The simulator of the -fmi-fmpy targets, which test.py runs as `python3 -m fmpy`. Its version
4040
# is the image's: a job cannot pip install one over it that outlives the container.
4141
&& /opt/libtest-venv/bin/pip install --no-cache-dir FMPy \
42+
# OMSimulator's CLI is Python, run by the python3 on PATH.
43+
&& /opt/libtest-venv/bin/pip install --no-cache-dir lxml \
4244
&& rm /tmp/requirements.txt
4345
ENV PATH=/opt/libtest-venv/bin:$PATH
4446

‎configs/fmi-simulators.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"OMSimulator": {
2222
"branchSuffix": "",
2323
"resultExtension": "mat",
24-
"versionArgument": "-v",
25-
"arguments": "{resultArgument} --tempDir={tempDir} --startTime={startTime:g} --stopTime={stopTime:g}{stepSizeArgument} --timeout={timeout:g} --tolerance={tolerance:g} {fmu}",
24+
"versionArgument": "--version",
25+
"arguments": "{resultArgument} --stripRoot --tempDir={tempDir} --startTime={startTime:g} --stopTime={stopTime:g}{stepSizeArgument} --timeout={timeout:.0f} --tolerance={tolerance:g} {fmu}",
2626
"optionalArguments": {
27-
"resultArgument": "-r={requestedResult}",
27+
"resultArgument": "--resultFile={requestedResult}",
2828
"stepSizeArgument": " --stepSize={stepSize:g}"
2929
}
3030
},

‎test.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,12 @@ def timeSeconds(f):
446446

447447
sys.stdout.flush()
448448

449-
def fmiSimulatorVersion(command):
449+
def fmiSimulatorVersion(name, command):
450+
versionArgument = shared.fmiSimulator(name)["versionArgument"]
450451
try:
451452
if not isFMPy(command):
452-
return check_output_log([command, "-v"], stderr=subprocess.STDOUT).strip()
453-
return subprocess.getoutput(command + " --version").strip().encode('ascii')
453+
return check_output_log([command, versionArgument], stderr=subprocess.STDOUT).strip()
454+
return subprocess.getoutput(command + " " + versionArgument).strip().encode('ascii')
454455
except subprocess.CalledProcessError as e:
455456
print("Failure to run %s:\n%s" % (command, e.output))
456457
raise e
@@ -459,7 +460,7 @@ def fmiSimulatorVersion(command):
459460
fmisimulatorversion = None
460461
if fmisimulator:
461462
for (name, command) in fmisimulators:
462-
fmisimulatorversions[name] = fmiSimulatorVersion(command)
463+
fmisimulatorversions[name] = fmiSimulatorVersion(name, command)
463464
print("%s: %s" % (name, fmisimulatorversions[name]))
464465
# The version of the first one goes into the library version of every branch,
465466
# as it did when a job ran a single simulator.

0 commit comments

Comments
 (0)