Skip to content

Commit

Permalink
- Adding a flag to run the MathCore testsuite
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15634 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Leonardo Laguna committed Mar 25, 2013
1 parent d847a98 commit 48764ec
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Compiler/Util/Config.mo
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ algorithm
runningTestsuite := not stringEq(Flags.getConfigString(Flags.RUNNING_TESTSUITE),"");
end getRunningTestsuite;

public function getRunningWSMTestsuite
output Boolean runningTestsuite;
algorithm
runningTestsuite := Flags.getConfigBool(Flags.RUNNING_WSM_TESTSUITE);
end getRunningWSMTestsuite;

public function getRunningTestsuiteFile
output String tempFile "File containing a list of files created by running this test so rtest can remove them after";
algorithm
Expand Down
6 changes: 5 additions & 1 deletion Compiler/Util/Flags.mo
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,9 @@ constant ConfigFlag TEARING_METHOD = CONFIG_FLAG(46, "tearingMethod",
constant ConfigFlag SCALARIZE_MINMAX = CONFIG_FLAG(47, "scalarizeMinMax",
NONE(), EXTERNAL(), BOOL_FLAG(false), NONE(),
Util.gettext("Scalarizes the builtin min/max reduction operators if true."));
constant ConfigFlag RUNNING_WSM_TESTSUITE = CONFIG_FLAG(48, "wsm-testsuite",
NONE(), EXTERNAL(), BOOL_FLAG(false), NONE(),
Util.gettext("Used when running the WSM testsuite."));

// This is a list of all configuration flags. A flag can not be used unless it's
// in this list, and the list is checked at initialization so that all flags are
Expand Down Expand Up @@ -824,7 +827,8 @@ constant list<ConfigFlag> allConfigFlags = {
DUMP_TARGET,
DELAY_BREAK_LOOP,
TEARING_METHOD,
SCALARIZE_MINMAX
SCALARIZE_MINMAX,
RUNNING_WSM_TESTSUITE
};

public function new
Expand Down
30 changes: 25 additions & 5 deletions Compiler/Util/Util.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3661,9 +3661,22 @@ public function testsuiteFriendly "Testsuite friendly name (start after testsuit
input String name;
output String friendly;
algorithm
friendly := testsuiteFriendly2(Config.getRunningTestsuite(),name);
friendly := matchcontinue(name)
local
String outStr;
case(_)
equation
true = Config.getRunningWSMTestsuite();
outStr = testsuiteFriendlyWSM(name);
then outStr;
case(_)
equation
outStr = testsuiteFriendly2(Config.getRunningTestsuite(),name);
then outStr;
end matchcontinue;
end testsuiteFriendly;


protected function testsuiteFriendly2 "Testsuite friendly name (start after testsuite/ or build/)"
input Boolean cond;
input String name;
Expand All @@ -3674,26 +3687,33 @@ algorithm
Integer i;
list<String> strs;
String newName;

case (true,_)
equation
true = "Windows_NT" ==& System.os();
// replace \\ with / for Windows.
newName = System.stringReplace(name, "\\", "/");
newName = System.stringReplace(name, "\\", "/");
(i,strs) = System.regex(newName, "^(.*/testsuite/)?(.*/build/)?(.*)$", 4, true, false);
friendly = listGet(strs,i);
then
friendly;

case (true,_)
equation
false = "Windows_NT" ==& System.os();
(i,strs) = System.regex(name, "^(.*/testsuite/)?(.*/build/)?(.*)$", 4, true, false);
friendly = listGet(strs,i);
then friendly;

else name;
end matchcontinue;
end testsuiteFriendly2;

protected function testsuiteFriendlyWSM "This function is the special case for MathCore WSM"
input String name;
output String friendly;
algorithm
friendly:=System.basename(name);
end testsuiteFriendlyWSM;

end Util;

0 comments on commit 48764ec

Please sign in to comment.