Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Compliance-Suite: Fix crash when simulation fails
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - #2590
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Aug 6, 2018
1 parent 7d6cb6d commit 9ebd34b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Examples/ComplianceSuite.mos
Expand Up @@ -31,7 +31,7 @@ end fixName;
system("rm -f ModelicaCompliance.*.res");getErrorString();

echo(false);
allClasses:={cl for cl guard classAnnotationExists(cl,__ModelicaAssociation.TestCase.shouldPass) in getClassNames(recursive=true)};getErrorString();
allClasses:={cl for cl guard classAnnotationExists(cl,__ModelicaAssociation.TestCase.shouldPass) in getClassNames(ModelicaCompliance.Algorithms.Assert, recursive=true)};getErrorString();
commands:={"ulimit -t 120 && ("+getInstallationDirectoryPath()+"/bin/omc -d=nogen "+COMPLIANCEEXTRAOMFLAGS+" \"" + fixName(OpenModelica.Scripting.typeNameString(cl)) + ".mos\" > /dev/null 2>&1)" for cl in allClasses};
echo(true);
String(size(allClasses,1)) + " number of classes";
Expand Down Expand Up @@ -70,7 +70,11 @@ messages := messages + err;
messages := messages + (if not success and not shouldPass /* This is correct; try to figure out why (hint: success is a poor name) */ then \"\nSucceeded, but expected failure\" else \"\");
messages := stringReplace(stringReplace(firstPart(messages),\"\\\"\",\"\\\\\\\"\"),\"\n\",\"\\\\n\");
errorType := if shouldPass then \"failed\" else \"expected failure\";
time := rec.timeTotal;
if resultFile <> \"\" then
time := rec.timeTotal;
else
time := OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_SIMULATE_TOTAL);
end if;
writeFile(\""+fixName(typeNameString(cl))+".res\",\"{\\\"time\\\":\"+String(time)+\", \\\"success\\\":\"+String(success)+\", \\\"messages\\\":\\\"\"+messages+\"\\\", \\\"shouldPass\\\":\"+String(shouldPass)+\"}\n\");
") for cl in allClasses);
getErrorString();
Expand Down
2 changes: 2 additions & 0 deletions Examples/ComplianceSuite.py
Expand Up @@ -54,7 +54,9 @@ def readTest(f, expectedFailures):
if expectedFailuresFile:
with open(expectedFailuresFile) as fin:
expectedFailures = set(l.strip() for l in fin.readlines())
print("=== Expected Failures ===")
print(expectedFailures)
print("=== End Expected Failures ===")

res = [readTest(f, expectedFailures) for f in natsorted(glob.glob("*.res"))]

Expand Down

0 comments on commit 9ebd34b

Please sign in to comment.