Skip to content

Commit 7fb29a7

Browse files
committed
Clean up
1 parent 0d87d2c commit 7fb29a7

File tree

4 files changed

+64
-34
lines changed

4 files changed

+64
-34
lines changed

single-model.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
import sys, argparse
5-
import simplejson as json
4+
import argparse
65
import shared
76

87
parser = argparse.ArgumentParser(description='OpenModelica model testing report generation tool')
@@ -21,8 +20,7 @@
2120

2221
libs = {}
2322

24-
import cgi, sqlite3, time, datetime
25-
from omcommon import friendlyStr, multiple_replace
23+
import sqlite3, datetime
2624

2725
conn = sqlite3.connect('sqlite3.db')
2826
cursor = conn.cursor()

test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
if (sys.version_info < (3, 0)):
99
raise Exception("Python2 is no longer supported")
1010

11-
import html, shutil, os, re, glob, time, argparse, sqlite3, datetime, math, platform
11+
import html, shutil, os, re, glob, time, argparse, sqlite3, datetime, math
1212
from joblib import Parallel, delayed
1313
import simplejson as json
1414
import psutil, subprocess, threading, hashlib
15-
from subprocess import call
1615
from monotonic import monotonic
1716
from omcommon import friendlyStr, multiple_replace
1817
from natsort import natsorted

testmodel.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# -*- coding: utf-8 -*-
33

44
import argparse, os, sys, signal, threading, psutil, subprocess, shutil
5-
from asyncio.subprocess import STDOUT
65
import simplejson as json
76
from monotonic import monotonic
87
from OMPython import OMCSessionZMQ, OMCProcessDocker
@@ -58,7 +57,7 @@ def writeResult():
5857

5958
startJob=monotonic()
6059

61-
def quit_omc(omc):
60+
def quit_omc(omc: OMCSessionZMQ | None):
6261
if omc is None:
6362
return omc
6463
try:
@@ -72,7 +71,7 @@ def quit_omc(omc):
7271
omc = None
7372
return omc
7473

75-
def writeResultAndExit(exitStatus, useOsExit=False, omc=None, omc_new=None):
74+
def writeResultAndExit(exitStatus: int, useOsExit: bool = False, omc: OMCSessionZMQ | None = None, omc_new: OMCSessionZMQ | None = None):
7675
writeResult()
7776
print("Calling exit ...")
7877
with open(errFile, 'a+') as fp:
@@ -90,7 +89,7 @@ def writeResultAndExit(exitStatus, useOsExit=False, omc=None, omc_new=None):
9089
else:
9190
sys.exit(exitStatus)
9291

93-
def sendExpressionTimeout(omc, cmd, timeout):
92+
def sendExpressionTimeout(omc: OMCSessionZMQ, cmd: str, timeout: int):
9493
with open(errFile, 'a+') as fp:
9594
fp.write("%s [Timeout %s]\n" % (cmd, timeout))
9695
def target(res):

testresults.md

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,76 @@
22

33
## Test reports
44

5-
- **Overview with library test results across OMC versions**: These reports shows how libraries with full or partial support level
6-
(see [here](https://github.com/OpenModelica/OMPackageManager/blob/master/README.md#library-support-levels-in-openmodelica) for more details)
7-
are handled by released versions of OpenModelica and by the development version on the master branch. Regressions are marked in orange,
5+
- **Overview with library test results across OMC versions**:
6+
These reports shows how libraries with full or partial support level (see
7+
[OMPackageManager, Library support levels](https://github.com/OpenModelica/OMPackageManager/blob/master/README.md#library-support-levels-in-openmodelica)
8+
for more details) are handled by released versions of OpenModelica and by the
9+
development version on the master branch. Regressions are marked in orange,
810
improvements in green.
9-
- [Default settings](https://libraries.openmodelica.org/branches/overview.html): simulation with C runtime and default settings
10-
- [daeMode](https://libraries.openmodelica.org/branches/overview-dae.html): simulation with daeMode (compiler flag [--daeMode](https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/omchelptext.html#omcflag-daemode))
11-
- [C++](https://libraries.openmodelica.org/branches/overview-c++.html): simulation with C++ runtime
12-
- [FMI](https://libraries.openmodelica.org/branches/overview-fmi.html): simulation with FMI and C runtime
13-
- [FMI C++](https://libraries.openmodelica.org/branches/overview-c++.html): simulation with FMI and C++ runtime
14-
- **Regression reports and history plots**: regression reports are periodically generated, using the latest development version of OMC.
15-
Changes w.r.t. the previous report are shown. For each tested library, .svg plots are also provided, showing the trends of the
16-
results of each step over time.
17-
- [Default settings](https://libraries.openmodelica.org/branches/history/master/): default omc settings, C runtime
18-
- [daeMode](https://libraries.openmodelica.org/branches/history/daemode/): simulation with --daeMode
19-
- [C++](https://libraries.openmodelica.org/branches/history/cpp/): simulation with C++ runtime
20-
- [FMI](https://libraries.openmodelica.org/branches/history/master-fmi/): simulation with FMI, C runtime
11+
12+
- [Default settings](https://libraries.openmodelica.org/branches/overview.html):
13+
simulation with C runtime and default settings
14+
- [daeMode](https://libraries.openmodelica.org/branches/overview-dae.html):
15+
simulation with daeMode (compiler flag
16+
[--daeMode](https://openmodelica.org/doc/OpenModelicaUsersGuide/latest/omchelptext.html#omcflag-daemode))
17+
- [C++](https://libraries.openmodelica.org/branches/overview-c++.html):
18+
simulation with C++ runtime
19+
- [FMI](https://libraries.openmodelica.org/branches/overview-fmi.html):
20+
simulation with FMI and C runtime
21+
- [FMI C++](https://libraries.openmodelica.org/branches/overview-c++.html):
22+
simulation with FMI and C++ runtime
23+
24+
- **Regression reports and history plots**:
25+
Regression reports are periodically generated, using the latest development
26+
version of OMC. Changes w.r.t. the previous report are shown. For each tested
27+
library, .svg plots are also provided, showing the trends of the results of
28+
each step over time.
29+
30+
- [Default settings](https://libraries.openmodelica.org/branches/history/master/):
31+
default omc settings, C runtime
32+
- [daeMode](https://libraries.openmodelica.org/branches/history/daemode/):
33+
simulation with --daeMode
34+
- [C++](https://libraries.openmodelica.org/branches/history/cpp/):
35+
simulation with C++ runtime
36+
- [FMI](https://libraries.openmodelica.org/branches/history/master-fmi/):
37+
simulation with FMI, C runtime
2138

2239
## How to read the test reports
2340

24-
The library testsuite job is run every night on the OSMC servers, testing open-source Modelica libraries covered by the
25-
[Package Manager](https://github.com/OpenModelica/OMPackageManager#readme) with various versions of OpenModelica,
26-
including the development version on the master branch. The simulations are run with the C-runtime, unless specified differently.
41+
The library testsuite job is run every night on the OSMC servers, testing
42+
open-source Modelica libraries covered by the
43+
[Package Manager](https://github.com/OpenModelica/OMPackageManager#readme)
44+
with various versions of OpenModelica, including the development version on the
45+
master branch. The simulations are run with the C-runtime, unless specified
46+
differently.
47+
48+
Within each library, all models with an experiment(StopTime) annotations are
49+
run. For each tested model, the results of the following steps are reported:
2750

28-
Within each library, all models with an experiment(StopTime) annotations are run. For each tested model, the results of the following steps are reported:
2951
- _parsing_
3052
- _frontend_: flattening the model
31-
- _backend_: structural analysis, index reduction, causalization, tearing, and all kind of symbolic manipulations and optimization to solve the model efficiently
53+
- _backend_: structural analysis, index reduction, causalization, tearing, and
54+
all kind of symbolic manipulations and optimization to solve the model
55+
efficiently
3256
- _simcode_: intermediate stap towards simulation code generation
3357
- _templates_: generation of the actual C code
3458
- _compilation_: compilation of the C code into a simulation executable
3559
- _simulation_: the simulation is actually run to produce simulation results
36-
- _verification_: if reference results file are available, they are compared with the simulation results
60+
- _verification_: if reference results file are available, they are compared
61+
with the simulation results
3762

38-
Clicking on the model name shows the log of phases from parsing to compilation. Clicking on the (sim) link shows the log of the runtime simulation.
63+
Clicking on the model name shows the log of phases from parsing to compilation.
64+
Clicking on the (sim) link shows the log of the runtime simulation.
3965

4066
## How to get your open-source library in the testsuite
4167

42-
If you are actively developing an open-source Modelica library using a GIT repository, you can easily get it included in the OpenModelica library testsuite. Please open a request on the [OpenModelica issue tracker](https://github.com/OpenModelica/OpenModelica/issues/new/choose).
43-
Ideally, you should have two tests for it: one testing the latest official release, which can be used to check if changes to OMC cause regressions to the existing library, another one testing the development version, which also checks regressions caused by changes to the library code. You can then bookmark the page with the regression reports and the page with the test results obtained with your favourite settings.
68+
If you are actively developing an open-source Modelica library using a GIT
69+
repository, you can easily get it included in the OpenModelica library
70+
testsuite. Please open a request on the
71+
[OpenModelica issue tracker](https://github.com/OpenModelica/OpenModelica/issues/new/choose).
72+
Ideally, you should have two tests for it: one testing the latest official
73+
release, which can be used to check if changes to OMC cause regressions to the
74+
existing library, another one testing the development version, which also checks
75+
regressions caused by changes to the library code. You can then bookmark the
76+
page with the regression reports and the page with the test results obtained
77+
with your favourite settings.

0 commit comments

Comments
 (0)