diff --git a/library.html.tpl b/library.html.tpl index 1dca0b84..82067c76 100644 --- a/library.html.tpl +++ b/library.html.tpl @@ -65,13 +65,14 @@ Config:
#config#
diff --git a/shared.py b/shared.py index 949bc040..53f094f9 100644 --- a/shared.py +++ b/shared.py @@ -34,6 +34,20 @@ def simCodeTargetFromCommands(target, commands): target = found[-1] return target +def diffSimulationResultsOptions(conf): + """The named arguments of the diffSimulationResults call that verifies a result.""" + opts = [("relTol", conf["reference_reltol"]), ("relTolDiffMinMax", conf["reference_reltolDiffMinMax"])] + tube = conf.get("reference_tube") + # Without reference_tolerance, the csv-compare tubes get the default of diffSimulationResults, which is csv-compare's. + if tube not in ("rectangle", "ellipse"): + opts.append(("rangeDelta", conf["reference_rangeDelta"])) + elif "reference_tolerance" in conf: + opts.append(("rangeDelta", conf["reference_tolerance"])) + # Only passed when set: an omc without the tube argument fails the call. + if tube: + opts.append(("tube", tube)) + return opts + def fixData(data,abortSimulationFlag,alarmFlag,overrideDefaults,defaultCustomCommands,extrasimflags,environmentTranslation,environmentSimulation): data["configFromFile"] = dict(data) for (key,default) in overrideDefaults: diff --git a/test.py b/test.py index 873aa610..4a5ac3a6 100755 --- a/test.py +++ b/test.py @@ -1676,7 +1676,8 @@ def publishLibrary(libname): (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"#omplot#", json.dumps(args.omplot)) + (u"#omplot#", json.dumps(args.omplot)), + (u"#omplotOptions#", json.dumps("".join("&%s=%s" % ("algorithm" if k == "tube" else k, v if k == "tube" else "%g" % v) for (k, v) in shared.diffSimulationResultsOptions(conf)))) ) open(os.path.join(stageRoot, "%s.html" % libname), "w").write(multiple_replace(htmltpl, *replacements)) diff --git a/testmodel.py b/testmodel.py index f0b98b90..1201e691 100755 --- a/testmodel.py +++ b/testmodel.py @@ -1300,15 +1300,8 @@ def verifyAgainstReference(resFile, prefix, stat): start=monotonic() try: # An empty diffPrefix: no per-variable CSV, the two filtered files below are the report. - # Only passed when set: an omc without the tube argument fails the call. - tube = conf.get("reference_tube") - # Without reference_tolerance, the csv-compare tubes get the default of diffSimulationResults, which is csv-compare's. - if tube in ("rectangle", "ellipse"): - rangeDelta = ',rangeDelta=%g' % conf["reference_tolerance"] if "reference_tolerance" in conf else "" - else: - rangeDelta = ',rangeDelta=%g' % conf["reference_rangeDelta"] - (referenceOK,diffVars) = sendExpressionTimeout(omc_new, 'diffSimulationResults("%s","%s","",relTol=%g,relTolDiffMinMax=%g%s%s)' % - (resFile, referenceFile, conf["reference_reltol"],conf["reference_reltolDiffMinMax"], rangeDelta, ',tube=OpenModelica.Scripting.TubeAlgorithm.%s' % tube if tube else ""), conf["ulimitOmc"]) + diffArgs = "".join(",%s=%s" % (k, "OpenModelica.Scripting.TubeAlgorithm." + v if k == "tube" else "%g" % v) for (k, v) in shared.diffSimulationResultsOptions(conf)) + (referenceOK,diffVars) = sendExpressionTimeout(omc_new, 'diffSimulationResults("%s","%s",""%s)' % (resFile, referenceFile, diffArgs), conf["ulimitOmc"]) except TimeoutError as e: with open(errFile, 'a+') as fp: fp.write("Timeout error for diffSimulationResults")