Skip to content
Snippets Groups Projects
Commit d56753d2 authored by Jan Gruteser's avatar Jan Gruteser
Browse files

adapt handled error messages for TLC 2.18

and related minor changes
parent 183810ac
No related branches found
No related tags found
No related merge requests found
...@@ -41,8 +41,8 @@ public class TLCRunner { ...@@ -41,8 +41,8 @@ public class TLCRunner {
System.arraycopy(args, 1, parameters, 0, parameters.length); System.arraycopy(args, 1, parameters, 0, parameters.length);
try { try {
TLC.main(parameters); TLC.main(parameters);
} catch (UnknownHostException | FileNotFoundException e) { } catch (Exception e) {
e.printStackTrace(); throw new RuntimeException(e);
} }
} }
......
...@@ -315,10 +315,6 @@ public class TLCResults implements ToolGlobals { ...@@ -315,10 +315,6 @@ public class TLCResults implements ToolGlobals {
} }
break; break;
case EC.TLC_ASSUMPTION_EVALUATION_ERROR:
tlcResult = evaluatingParameter(m.getParameters());
break;
case EC.TLC_VALUE_ASSERT_FAILED: case EC.TLC_VALUE_ASSERT_FAILED:
tlcResult = WellDefinednessError; tlcResult = WellDefinednessError;
break; break;
...@@ -329,6 +325,21 @@ public class TLCResults implements ToolGlobals { ...@@ -329,6 +325,21 @@ public class TLCResults implements ToolGlobals {
} }
break; break;
case EC.TLC_CONFIG_ID_HAS_VALUE: // LTL errors, Assertion violations
String kind = m.getParameters()[0];
String id = m.getParameters()[1];
// third param should be "FALSE" (we are already in error case here)
if (kind.contains("property") && id.startsWith("ASSERT_LTL")) {
tlcResult = TemporalPropertyViolation;
} else if (kind.contains("invariant") && id.startsWith("Assertion")) {
tlcResult = AssertionError;
} else {
// just as fall-back
tlcResult = evaluatingParameter(m.getParameters());
}
break;
case EC.TLC_ASSUMPTION_EVALUATION_ERROR:
case EC.GENERAL: case EC.GENERAL:
tlcResult = evaluatingParameter(m.getParameters()); tlcResult = evaluatingParameter(m.getParameters());
break; break;
...@@ -356,17 +367,18 @@ public class TLCResults implements ToolGlobals { ...@@ -356,17 +367,18 @@ public class TLCResults implements ToolGlobals {
return AssertionError; return AssertionError;
} else if (s.contains("The invariant of Invariant")) { } else if (s.contains("The invariant of Invariant")) {
return InvariantViolation; return InvariantViolation;
} else if (s.contains("In applying the function")) { } else if (s.contains("In applying the function")
return WellDefinednessError; || s.contains("which is not in the domain of the function")
} else if (s.contains("which is not in the domain of the function")) { || s.contains("tlc2.module.TLC.Assert")
return WellDefinednessError; || (s.contains("CHOOSE x \\in S: P, but no element of S satisfied P") && s.contains("module FunctionsAsRelations"))
} else if (s.contains("tlc2.module.TLC.Assert")) { // messages from BBuiltIns:
|| s.contains("Both operands of the modulo operator must be natural numbers")
|| s.contains("Division by zero")
|| s.contains("Applied the inter operator to an empty set")
|| s.replace("\n","").matches(".*The.*argument.*operator should be.*sequence.*")
|| s.replace("\n","").matches(".*The.*argument.*operator is an invalid number.*")) {
return WellDefinednessError; return WellDefinednessError;
} else if (s } else if (s.contains("ASSERT_LTL")) {
.contains("CHOOSE x \\in S: P, but no element of S satisfied P")
&& s.contains("module FunctionsAsRelations")) {
return tlcResult = WellDefinednessError;
} else if (s.contains("The property of ASSERT_LTL")) {
return TemporalPropertyViolation; return TemporalPropertyViolation;
} }
} }
......
...@@ -11,27 +11,7 @@ import de.tlc4b.exceptions.NotSupportedException; ...@@ -11,27 +11,7 @@ import de.tlc4b.exceptions.NotSupportedException;
import tla2sany.semantic.OpDeclNode; import tla2sany.semantic.OpDeclNode;
import tlc2.tool.TLCState; import tlc2.tool.TLCState;
import tlc2.tool.TLCStateInfo; import tlc2.tool.TLCStateInfo;
import tlc2.value.FcnLambdaValue; import tlc2.value.impl.*;
import tlc2.value.FcnRcdValue;
import tlc2.value.IntervalValue;
import tlc2.value.LazyValue;
import tlc2.value.ModelValue;
import tlc2.value.RecordValue;
import tlc2.value.SetCapValue;
import tlc2.value.SetCupValue;
import tlc2.value.SetDiffValue;
import tlc2.value.SetEnumValue;
import tlc2.value.SetOfFcnsValue;
import tlc2.value.SetOfRcdsValue;
import tlc2.value.SetOfTuplesValue;
import tlc2.value.SetPredValue;
import tlc2.value.StringValue;
import tlc2.value.SubsetValue;
import tlc2.value.TupleValue;
import tlc2.value.UnionValue;
import tlc2.value.Value;
import tlc2.value.ValueEnumeration;
import tlc2.value.ValueVec;
import util.UniqueString; import util.UniqueString;
import static tlc2.value.ValueConstants.*; import static tlc2.value.ValueConstants.*;
...@@ -111,8 +91,7 @@ public class TracePrinter { ...@@ -111,8 +91,7 @@ public class TracePrinter {
UniqueString var = constants.get(i).getName(); UniqueString var = constants.get(i).getName();
String bName = tlcOutputInfo.getBName(var.toString()); String bName = tlcOutputInfo.getBName(var.toString());
BType type = tlcOutputInfo.getBType(var.toString()); BType type = tlcOutputInfo.getBType(var.toString());
String value = parseValue(state.lookup(var), type) String value = parseValue((Value) state.lookup(var), type).toString();
.toString();
expression.append(bName).append(" = ").append(value); expression.append(bName).append(" = ").append(value);
} }
} }
...@@ -131,7 +110,7 @@ public class TracePrinter { ...@@ -131,7 +110,7 @@ public class TracePrinter {
UniqueString var = variables.get(i).getName(); UniqueString var = variables.get(i).getName();
String bName = tlcOutputInfo.getBName(var.toString()); String bName = tlcOutputInfo.getBName(var.toString());
BType type = tlcOutputInfo.getBType(var.toString()); BType type = tlcOutputInfo.getBType(var.toString());
String value = parseValue(state.lookup(var), type).toString(); String value = parseValue((Value) state.lookup(var), type).toString();
expression.append(bName).append(" = ").append(value); expression.append(bName).append(" = ").append(value);
} }
return expression; return expression;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment