Skip to content

Commit

Permalink
add support for --alarm on command line ticket:3928
Browse files Browse the repository at this point in the history
  • Loading branch information
adrpo committed May 26, 2016
1 parent 5a28893 commit 1d03f63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Compiler/Main/Main.mo
Expand Up @@ -809,13 +809,18 @@ public function main
protected
list<String> args_1;
GC.ProfStats stats;
Integer seconds;
algorithm
try
try
args_1 := init(args);
if Flags.isSet(Flags.GC_PROF) then
print(GC.profStatsStr(GC.getProfStats(), head="GC stats after initialization:") + "\n");
end if;
seconds := Flags.getConfigInt(Flags.ALARM);
if seconds > 0 then
System.alarm(seconds);
end if;
main2(args_1);
else
ErrorExt.clearMessages();
Expand Down
6 changes: 5 additions & 1 deletion Compiler/Util/Flags.mo
Expand Up @@ -1297,6 +1297,9 @@ constant ConfigFlag IGNORE_COMMAND_LINE_OPTIONS_ANNOTATION = CONFIG_FLAG(99, "ig
constant ConfigFlag CALCULATE_SENSITIVITIES = CONFIG_FLAG(100, "calculateSensitivities",
NONE(), EXTERNAL(), BOOL_FLAG(false), NONE(),
Util.gettext("Generates sensitivities variables and matrixes."));
constant ConfigFlag ALARM = CONFIG_FLAG(101, "alarm",
SOME("r"), EXTERNAL(), INT_FLAG(0), NONE(),
Util.gettext("Sets the number seconds until omc timeouts and exits. Used by the testing framework to terminate infinite running processes."));

protected
// This is a list of all configuration flags. A flag can not be used unless it's
Expand Down Expand Up @@ -1402,7 +1405,8 @@ constant list<ConfigFlag> allConfigFlags = {
SET_TEARING_VARS,
SET_RESIDUAL_EQNS,
IGNORE_COMMAND_LINE_OPTIONS_ANNOTATION,
CALCULATE_SENSITIVITIES
CALCULATE_SENSITIVITIES,
ALARM
};

public function new
Expand Down

0 comments on commit 1d03f63

Please sign in to comment.