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
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ Options:
- `--branch=master`: Branch of OpenModelica
- `--fmi=False`: Test FMI
- `--output=''`: Result location
- `--omplot=URL`: OMPlot page a failed verification links to, by default the
one on the playground. That page must be able to fetch the report's files, so
a report behind a login or on a private network needs its own copy
(see [below](#plotting-failed-verifications-in-a-private-report)).
- `--libraries=~/.openmodelica/libraries/`: Location of Modelica libraries
- `--extraflags=''`: Extra compiler flags.
- `--extrasimflags=''`: Extra simulation flags.
Expand All @@ -211,6 +215,28 @@ Options:
`procCCompile` above for more insight into individual test
parallelization.

### Plotting failed verifications in a private report

The OMPlot page is static files and reads the result files in the browser, so
it can be hosted with the report. Build it from
[OpenModelica](https://github.com/OpenModelica/OpenModelica) (needs
`rustup target add wasm32-unknown-unknown`):

```sh
R=OMCompiler/SimulationRuntime/rust
W=OMCompiler/Compiler/OpenModelica.rs/wasm
cargo run --release --manifest-path $R/openmodelica_result_web_embed/Cargo.toml \
--bin install-result-web -- $OUTPUT/../omplot-web/omplot
cp $W/omplot/index.html $OUTPUT/../omplot-web/omplot/
cp $W/plot.js $W/units.js $W/ui.js $W/theme.css $OUTPUT/../omplot-web/
```

`$OUTPUT` is the `--output` directory. Then run `test.py` with
`--omplot=../../omplot-web/omplot/index.html`, relative to
`$OUTPUT/<library>/<library>.html`, and serve the results over HTTP, e.g.
`python3 -m http.server -d $OUTPUT/..`. A page opened from `file://` cannot fetch
files, so there the link downloads the `.mat` file instead.

### Simulation timeouts

A simulation is killed after `ulimitExe` seconds, 240 by default - 99.5% of the
Expand Down
13 changes: 8 additions & 5 deletions library.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ Config: <pre>#config#</pre>
<script>
// A failed verification links its two .mat files (the differing variables of
// the result and of the reference) to the OMPlot page, which plots the tube
// comparison of each variable. The page needs absolute URLs.
const omplot = 'https://playground.openmodelica.org/latest/omplot/';
for (const a of document.querySelectorAll('a[data-omplot]')) {
const abs = (f) => encodeURIComponent(new URL(f, location.href).href);
a.href = omplot + '?result=' + abs(a.dataset.omplot + '.mat') + '&reference=' + abs(a.dataset.omplot + '.ref.mat');
// comparison of each variable. The page needs absolute URLs. It cannot fetch
// files from file://, so there the link stays a download of the .mat file.
if (location.protocol !== 'file:') {
const omplot = new URL(#omplot#, location.href).href;
for (const a of document.querySelectorAll('a[data-omplot]')) {
const abs = (f) => encodeURIComponent(new URL(f, location.href).href);
a.href = omplot + '?result=' + abs(a.dataset.omplot + '.mat') + '&reference=' + abs(a.dataset.omplot + '.ref.mat');
}
}
</script>
</body>
Expand Down
4 changes: 3 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
parser.add_argument('-v', '--verbose', action="store_true", help="Verbose mode.", default=False)
parser.add_argument('--execAllTests', action="store_true", help="Force all tests to be executed", default=False)
parser.add_argument('--noSync', action="store_true", help="Move files using python instead of rsync", default=False)
parser.add_argument('--omplot', default='https://playground.openmodelica.org/latest/omplot/', help="OMPlot page a failed verification links to. A relative URL is resolved against the library's report page. The page must be able to fetch the report's files, so use a copy hosted with the report if that is private.")
parser.add_argument('--timeout', default=0, help="=[value] timeout in seconds for each test, it overrides the timeout calculated by the script")
parser.add_argument('--msysEnvironment', help = 'MSYS2 environment used by OpenModelica on Windows.', default = 'ucrt64')
parser.add_argument('--debug', action="store_true", help="turn on the DEBUG mode", default=False)
Expand Down Expand Up @@ -1643,7 +1644,8 @@ def publishLibrary(libname):
(u"#Verification#", html.escape(str(numSucceeded[7]))),
(u"#totalTime#", html.escape(str(datetime.timedelta(seconds=int(sum(s[3].get("exectime") or 0.0 for s in stats)))))),
(u"#config#", html.escape(json.dumps(conf["configFromFile"], indent=1, sort_keys=True))),
(u"#testsHTML#", testsHTML)
(u"#testsHTML#", testsHTML),
(u"#omplot#", json.dumps(args.omplot))
)
open(os.path.join(stageRoot, "%s.html" % libname), "w").write(multiple_replace(htmltpl, *replacements))

Expand Down
Loading