Skip to content

Commit

Permalink
Skip generating the column for verified results if we don't have any …
Browse files Browse the repository at this point in the history
…result files set

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17717 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 16, 2013
1 parent c3c8d6f commit e617dd0
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Examples/BuildModelRecursive.mos
Expand Up @@ -29,14 +29,19 @@ getErrorString();
// writeFile("x",sum(s + "\n" for s in a));

print("Number of classes to build: " + String(size(a,1)));
system("rm -rf files/ "+libraryString+"* " + log);
system("rm -f *.o");
system("rm -f *.c");
system("rm -f *.h");
system("rm -rf "+libraryString+"*");
system("rm -rf files/ "+log);
mkdir("files");

/*** This is the stuff executed for each model ***/

min(writeFile(s + ".mos","
\""+s+"\";
echo(false);
runScript(\"common.mos\");
statFile := \""+s+".stat\";
writeFile(\""+log+"\",\""+s+"\n\",append=true);
writeFile(statFile,\"<tr><td bgcolor=\\\"#ff0000\\\">"+s+"</td></tr>\");getErrorString();
Expand Down Expand Up @@ -120,11 +125,12 @@ simRes := if not buildRes then false else 0 == system(\"ulimit -t "+ulimitExe+"
system(\"sed -i '300,$ d' '\" + simFile + \"'\"); // Only keep the top 300 lines
timeSim := OpenModelica.Scripting.Internal.Time.timerTock(OpenModelica.Scripting.Internal.Time.RT_CLOCK_USER_RESERVED);
referenceExists := false;
referenceCell := \"<td bgcolor=\\\"#0000FF\\\">&nbsp;</td>\";
referenceFiles := \""+referenceFiles+"\";
referenceCell := if referenceFiles == \"\" then \"\" else \"<td>&nbsp;</td>\";
if simRes then
system(\"touch "+s+".simsuccess\");
reference := \""+referenceFiles+"/"+s+".mat\";
referenceExists := regularFileExists(reference);
referenceExists := referenceFiles <> \"\" and regularFileExists(reference);
prefix := \"files/"+s+".diff\";
if referenceExists then
OpenModelica.Scripting.Internal.Time.timerTick(OpenModelica.Scripting.Internal.Time.RT_CLOCK_USER_RESERVED);
Expand Down Expand Up @@ -153,8 +159,6 @@ unset multiplot
referenceCell := \"<td bgcolor=\\\"#00FF00\\\">\"+OpenModelica.Scripting.Internal.Time.readableTime(timeDiff)+\"</td>\";
end if;
end if;
else
referenceCell := \"<td bgcolor=\\\"#FF0000\\\">&nbsp;</td>\";
end if;

sim:=readFile(simFile);
Expand Down Expand Up @@ -191,10 +195,10 @@ str:="<h1>Recursive BuildModel Test</h1>
<p>BuildModel time limit: "+ulimitOmc+"s</p>
<p>Simulation time limit: "+ulimitExe+"s</p>
<p>Flags: setCommandLineOptions(\"+d=nogen,initialization\"); setMatchingAlgorithm(\"PFPlusExt\"); setIndexReductionMethod(\"dynamicStateSelection\");</p>
<p>Links are provided if getErrorString() or the simulation generates output. <font style=\"background-color:#00FF00\">Green</font> means success, <font style=\"background-color:#FFFF00\">yellow</font> means success if +d=scodeInstShortcut was used. <font style=\"background-color:#0000FF\">Blue</font> means there was no reference file to compare simulation results against. <font style=\"background-color:#FF0000\">Red</font> is bad and in general signifies a failure.</p>
<p>Links are provided if getErrorString() or the simulation generates output. <font style=\"background-color:#00FF00\">Green</font> means success, <font style=\"background-color:#FFFF00\">yellow</font> means success if +d=scodeInstShortcut was used. <font style=\"background-color:#FF0000\">Red</font> is bad and in general signifies a failure.</p>
";
writeFile(log,"<html><head><title>BuildModel Results</title></head><body>" + str);
writeFile(log,"<table><tr><th>Model</th><th>Verified</th><th>Simulate</th><th>Total buildModel</th><th>Frontend</th><th>Backend</th><th>SimCode</th><th>Templates</th><th>Compile</th></tr>\n",append=true);getErrorString();
writeFile(log,"<table><tr><th>Model</th>"+(if referenceFiles == "" then "" else "<th>Verified</th>")+"<th>Simulate</th><th>Total buildModel</th><th>Frontend</th><th>Backend</th><th>SimCode</th><th>Templates</th><th>Compile</th></tr>\n",append=true);getErrorString();
writeFile(log,sum(readFile(s + ".stat") + "\n" for s in a),append=true);getErrorString();
writeFile(log,"</table><hr /><p><a href=\"BuildModelRecursive.tar.gz\">Offline version</a></p></body></html>",append=true);getErrorString();

Expand Down

0 comments on commit e617dd0

Please sign in to comment.