Skip to content

Commit

Permalink
Updated compliance suite to output error-messages (for hudson)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16344 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jun 13, 2013
1 parent 7be8776 commit 2a65306
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 13 additions & 1 deletion Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -1779,9 +1779,21 @@ public function stringReplace
input String target;
output String res;
external "builtin";
annotation(preferredView="text");
annotation(Documentation(info="<html>
Replaces all occurances of the string <em>source</em> with <em>target</em>.
</html>"),preferredView="text");
end stringReplace;

public function escapeXML
input String inStr;
output String outStr;
algorithm
outStr := stringReplace(inStr, "&", "&amp;");
outStr := stringReplace(outStr, "<", "&lt;");
outStr := stringReplace(outStr, ">", "&gt;");
outStr := stringReplace(outStr, "\"", "&quot;");
end escapeXML;

type ExportKind = enumeration(Absyn "Normal Absyn",SCode "Normal SCode",Internal "True unparsing of the Absyn");

function list "Lists the contents of the given class, or all loaded classes."
Expand Down
10 changes: 8 additions & 2 deletions Examples/ComplianceSuite.mos
Expand Up @@ -16,7 +16,12 @@ deleteClass(ModelicaCompliance.Components.Declarations.DoubleDeclarationMixed);g
deleteClass(ModelicaCompliance.Components.Declarations.TypeNameAsComponentName);getErrorString();
system("rm -f ModelicaCompliance.*.res");getErrorString();

echo(false);
allClasses:={cl for cl guard classAnnotationExists(cl,__ModelicaAssociation.TestCase.shouldPass) in getClassNames(recursive=true)};getErrorString();
commands:={"ulimit -t 120 && omc " + OpenModelica.Scripting.typeNameString(cl) + ".mos > /dev/null 2>&1" for cl in allClasses};
echo(true);
String(size(allClasses,1)) + " number of classes";

min(writeFile(typeNameString(cl)+".mos","
writeFile(\""+typeNameString(cl)+".res\",\"<testcase name=\\\""+last(OpenModelica.Scripting.typeNameStrings(cl))+"\\\"><error type=\\\"killed\\\"/></testcase>\");
loadModel(ModelicaCompliance);getErrorString();
Expand All @@ -25,11 +30,12 @@ deleteClass(ModelicaCompliance.Components.Declarations.DoubleDeclarationMixed);g
deleteClass(ModelicaCompliance.Components.Declarations.TypeNameAsComponentName);getErrorString();
rec:=simulate("+OpenModelica.Scripting.typeNameString(cl)+");getErrorString();
resultFile := rec.resultFile;
messages := rec.messages;
messages := escapeXML(messages);
success := resultFile "+(if OpenModelica.Scripting.getBooleanClassAnnotation(cl,__ModelicaAssociation.TestCase.shouldPass) then"<>"else"==")+" \"\";
writeFile(\""+typeNameString(cl)+".res\",\"<testcase name=\\\""+last(OpenModelica.Scripting.typeNameStrings(cl))+"\\\">\"+(if not success then \"<error type=\\\""+(if OpenModelica.Scripting.getBooleanClassAnnotation(cl,__ModelicaAssociation.TestCase.shouldPass) then "expected failure" else "failed")+"\\\" message=\\\"\\\"/>\" else \"\")+\"</testcase>\");
writeFile(\""+typeNameString(cl)+".res\",\"<testcase name=\\\""+last(OpenModelica.Scripting.typeNameStrings(cl))+"\\\">\"+(if not success then \"<error type=\\\""+(if OpenModelica.Scripting.getBooleanClassAnnotation(cl,__ModelicaAssociation.TestCase.shouldPass) then "expected failure" else "failed")+"\\\" message=\\\"\"+messages+\"\\\"/>\" else \"\")+\"</testcase>\");
") for cl in allClasses);
getErrorString();
commands:={"ulimit -t 120 && omc " + OpenModelica.Scripting.typeNameString(cl) + ".mos > /dev/null" for cl in allClasses};
system_parallel(commands);getErrorString();

writeFile("ComplianceSuite.sh","#!/bin/bash
Expand Down

0 comments on commit 2a65306

Please sign in to comment.