Skip to content

Commit

Permalink
Merge pull request #2962 from apalache-mc/th/flush-logs
Browse files Browse the repository at this point in the history
Flush SMT logs and SMT profiling logs before (check-sat)
  • Loading branch information
konnov authored Aug 23, 2024
2 parents afd4e4e + a988030 commit 9c4c03a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .unreleased/bug-fixes/2962-fix-trunc-smt-log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix truncation of SMT logs, see #2962
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ class SymbStateRewriterImpl(
}

override def flushStatistics(): Unit = {
profilerListener.foreach { _.dumpToFile() }
statListener.locator.writeStats()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ class Z3SolverContext(val config: SolverConfig) extends SolverContext with LazyL

override def sat(): Boolean = {
log("(check-sat)")
flushLogs() // good time to flush
val status = z3solver.check()
log(s";; sat = ${status.name()}")
flushLogs() // good time to flush
Expand Down Expand Up @@ -513,11 +514,12 @@ class Z3SolverContext(val config: SolverConfig) extends SolverContext with LazyL
// temporarily, change the timeout
setTimeout(timeoutSec * 1000)
log("(check-sat)")
flushLogs() // good time to flush
val status = z3solver.check()
log(s";; sat = ${status.name()}")
flushLogs() // good time to flush
// return timeout to maximum
setTimeout(Int.MaxValue)
flushLogs() // good time to flush
status match {
case Status.SATISFIABLE => Some(true)
case Status.UNSATISFIABLE => Some(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ class TransitionExecutorImpl[ExecCtxT](consts: Set[String], vars: Set[String], c
* timed out or reported *unknown*.
*/
override def sat(timeoutSec: Int): Option[Boolean] = {
ctx.rewriter.flushStatistics()
ctx.rewriter.solverContext.satOrTimeout(timeoutSec)
}

Expand Down

0 comments on commit 9c4c03a

Please sign in to comment.