-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NullPointerException when last state of the trace is *not* in
the model. If the final state of a counterexample is excluded from the model because state- or action-constraints evaluate to false, it is not written to the trace file. This omission causes a NullPointerException when attempting to read the final state from the trace file during counterexample reconstruction. To address this issue, the final state is now explicitly appended to the counterexample to ensure completeness and avoid runtime errors. [Bug][TLC] Signed-off-by: Markus Alexander Kuppe <[email protected]>
- Loading branch information
Showing
15 changed files
with
186 additions
and
9 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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
INIT Init | ||
NEXT Next | ||
ACTION_CONSTRAINT ActionConstraint | ||
INVARIANT Inv | ||
INVARIANT Inv | ||
POSTCONDITION PostCondition |
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,5 @@ | ||
INIT Init2 | ||
NEXT Next | ||
ACTION_CONSTRAINT ActionConstraint | ||
INVARIANT Inv | ||
POSTCONDITION PostCondition2 |
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
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
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
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
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
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
77 changes: 77 additions & 0 deletions
77
tlatools/org.lamport.tlatools/test/tlc2/tool/Github1087Test.java
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,77 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Microsoft Corp. All rights reserved. | ||
* | ||
* The MIT License (MIT) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
* of the Software, and to permit persons to whom the Software is furnished to do | ||
* so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Contributors: | ||
* Markus Alexander Kuppe - initial API and implementation | ||
******************************************************************************/ | ||
package tlc2.tool; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.junit.Test; | ||
|
||
import tlc2.TLCGlobals; | ||
import tlc2.output.EC; | ||
import tlc2.output.EC.ExitStatus; | ||
import tlc2.tool.liveness.ModelCheckerTestCase; | ||
import tlc2.value.IValue; | ||
import tlc2.value.impl.IntValue; | ||
|
||
public class Github1087Test extends ModelCheckerTestCase { | ||
|
||
public Github1087Test() { | ||
super("Github602", new String[] { "-config", "Github1087.cfg" }, ExitStatus.VIOLATION_SAFETY); | ||
} | ||
|
||
@Test | ||
public void testSpec() { | ||
assertTrue(recorder.recorded(EC.TLC_FINISHED)); | ||
assertFalse(recorder.recorded(EC.GENERAL)); | ||
|
||
assertTrue(recorder.recordedWithStringValues(EC.TLC_STATS, "2", "1", "0")); | ||
|
||
// Assert it has found the temporal violation and also a counter example | ||
assertTrue(recorder.recorded(EC.TLC_INVARIANT_VIOLATED_BEHAVIOR)); | ||
|
||
// Assert the error trace | ||
assertTrue(recorder.recorded(EC.TLC_STATE_PRINT2)); | ||
final List<String> expectedTrace = new ArrayList<String>(2); | ||
expectedTrace.add("x = 1"); | ||
expectedTrace.add("x = -1"); | ||
assertTraceWith(recorder.getRecords(EC.TLC_STATE_PRINT2), expectedTrace); | ||
|
||
// Check that POSTCONDITION wrote the number of generated states to a TLCSet | ||
// register. | ||
final List<IValue> allValue = TLCGlobals.mainChecker.getAllValue(42); | ||
assertTrue(!allValue.isEmpty()); | ||
assertEquals(IntValue.gen(2), allValue.get(0)); | ||
|
||
// Assert POSTCONDITION. | ||
assertFalse(recorder.recorded(EC.TLC_ASSUMPTION_FALSE)); | ||
assertFalse(recorder.recorded(EC.TLC_ASSUMPTION_EVALUATION_ERROR)); | ||
} | ||
} |
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
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
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
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