Skip to content

Commit 30641b7

Browse files
Don't crash on unsatisfiable configurations. (#2765)
* Don't crash on unsatisfiable configurations. See #2751. * Added unit test for unsatisfiable patterns. Co-authored-by: rv-jenkins <admin@runtimeverification.com>
1 parent d3b7bd2 commit 30641b7

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

kore/src/Kore/Exec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ exec
258258
, (ExecDepth 0, Start initialConfig)
259259
)
260260
let (depths, finalConfigs) = unzip finals
261-
infoExecDepth (maximum depths)
261+
infoExecDepth (maximum (ExecDepth 0 : depths))
262262
let finalConfigs' =
263263
MultiOr.make $
264264
catMaybes $

kore/test/Test/Kore/Exec.hs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Test.Kore.Exec (
22
test_exec,
33
test_execPriority,
4+
test_execBottom,
45
test_searchPriority,
56
test_searchExceedingBreadthLimit,
67
test_execGetExitCode,
@@ -194,6 +195,30 @@ test_exec = testCase "exec" $ actual >>= assertEqual "" expected
194195
inputPattern = applyToNoArgs mySort "b"
195196
expected = (ExitSuccess, applyToNoArgs mySort "d")
196197

198+
test_execBottom :: TestTree
199+
test_execBottom = testCase "exec returns bottom on unsatisfiable input patterns." $
200+
do
201+
((_, actual), _) <- result
202+
assertEqual "" expected actual
203+
where
204+
expected = mkBottom mySort
205+
result =
206+
exec
207+
Unlimited
208+
Unlimited
209+
verifiedModule
210+
Any
211+
inputPattern
212+
& runTestLog runNoSMT
213+
verifiedModule =
214+
verifiedMyModule
215+
Module
216+
{ moduleName = ModuleName "MY-MODULE"
217+
, moduleSentences = []
218+
, moduleAttributes = Attributes []
219+
}
220+
inputPattern = mkBottom mySort
221+
197222
test_searchPriority :: [TestTree]
198223
test_searchPriority =
199224
[makeTestCase searchType | searchType <- [ONE, STAR, PLUS, FINAL]]

0 commit comments

Comments
 (0)