-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script to run the compliance suite (to be added to hudson?)
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16319 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Runs the ModelicaCompliance suite | ||
// Output is the files "openmodelica.xml" and "openmodelica.html", which is a valid jUnit testcase and possible to generate html reports from (the generated file is one example, using the default xsl) | ||
|
||
loadModel(ModelicaCompliance);getErrorString(); | ||
writeFile("version","omc "+getVersion()+" compliance suite "+getVersion(ModelicaCompliance));getErrorString(); | ||
|
||
loadString(" | ||
function last | ||
input String str[:]; | ||
output String ostr := str[end]; | ||
end last; | ||
");getErrorString(); | ||
|
||
deleteClass(ModelicaCompliance.Components.Declarations.DoubleDeclarationComps);getErrorString(); | ||
deleteClass(ModelicaCompliance.Components.Declarations.DoubleDeclarationMixed);getErrorString(); | ||
deleteClass(ModelicaCompliance.Components.Declarations.TypeNameAsComponentName);getErrorString(); | ||
// system("rm -f ModelicaCompliance.*.res");getErrorString(); | ||
|
||
allClasses:={cl for cl guard classAnnotationExists(cl,__ModelicaAssociation.TestCase.shouldPass) in getClassNames(recursive=true)};getErrorString(); | ||
min(writeFile(typeNameString(cl)+".mos"," | ||
writeFile(\""+typeNameString(cl)+".res\",\"<testcase name=\\\""+last(OpenModelica.Scripting.typeNameStrings(cl))+"\\\"><error type=\\\"killed\\\"/></testcase>\"); | ||
loadModel(ModelicaCompliance);getErrorString(); | ||
deleteClass(ModelicaCompliance.Components.Declarations.DoubleDeclarationComps);getErrorString(); | ||
deleteClass(ModelicaCompliance.Components.Declarations.DoubleDeclarationMixed);getErrorString(); | ||
deleteClass(ModelicaCompliance.Components.Declarations.TypeNameAsComponentName);getErrorString(); | ||
rec:=simulate("+OpenModelica.Scripting.typeNameString(cl)+");getErrorString(); | ||
resultFile := rec.resultFile; | ||
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>\"); | ||
") for cl in allClasses); | ||
getErrorString(); | ||
commands:={"ulimit -t 120 && omc " + OpenModelica.Scripting.typeNameString(cl) + ".mos" for cl in allClasses}; | ||
// system_parallel(commands);getErrorString(); | ||
|
||
writeFile("ComplianceSuite.sh","#!/bin/bash | ||
OMCRESULT=openmodelica.xml | ||
echo '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' > \"$OMCRESULT\" | ||
echo '<testsuites name=\"'`cat version`'\">' >> \"$OMCRESULT\" | ||
for f in `ls ModelicaCompliance.*.res | sed 's/[.][^.]*[.]res$//' | sort -u`; do | ||
echo \"<testsuite name=\\\"$f\\\">\" >> \"$OMCRESULT\" | ||
for t in `ls $f.*.res | grep \"$f[.][^.]*[.]res\"`; do | ||
echo `cat $t` >> \"$OMCRESULT\" | ||
done | ||
echo \"</testsuite>\" >> \"$OMCRESULT\" | ||
done | ||
echo '</testsuites>' >> \"$OMCRESULT\" | ||
echo \"$OMCRESULT\" | ||
");getErrorString(); | ||
system("bash ComplianceSuite.sh"); | ||
(filename,error) := OpenModelica.Scripting.uriToFilename("modelica://ModelicaCompliance/Resources/tools/xml-report/report.xsl");getErrorString(); | ||
system("xsltproc -o openmodelica.html '" + filename + "' openmodelica.xml");getErrorString(); |