diff --git a/README.md b/README.md index eea7b38..3fe9235 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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//.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 diff --git a/library.html.tpl b/library.html.tpl index 76b9ef2..da90853 100644 --- a/library.html.tpl +++ b/library.html.tpl @@ -58,11 +58,14 @@ Config:
#config#
diff --git a/test.py b/test.py index 18694fe..b17befb 100755 --- a/test.py +++ b/test.py @@ -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) @@ -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))