Skip to content

Commit

Permalink
added diagniostics for sopecific failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rssh committed Jul 17, 2024
1 parent 3568c5a commit 91511d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions native/src/test/scala/cps/ComputationBound.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,21 @@ trait ComputationBound[+T] {
case Error(e) => Future.failed(e)
case Thunk(x) =>
x().runTicksDeadline(deadline)
case Wait(ref, op) =>
case w@Wait(ref, op) =>
val timeRest = deadline - System.currentTimeMillis
if (timeRest > 0) then
ComputationBound.advanceDeferredQueueTicks(timeRest, ref.get().isDefined).flatMap{ r =>
ref.get match
case Some(v) => op(v).runTicksDeadline(deadline)
case None => Future failed (new TimeoutException())
case None =>
Future failed (new TimeoutException(s"ref $ref is empty"))
}
else
Future failed (new TimeoutException())
println(s"failed: wwaiting for $ref in $w")
Future failed (new TimeoutException("timedRest < 0 when processing $w"))
else
Future failed (new TimeoutException())
println(s"failed because we behind deadline")
Future failed (new TimeoutException("rest <= 0"))


def checkProgress(timeout: Duration = Duration.Inf): Either[Try[T],ComputationBound[T]] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TestAccidentContextResolving {
val x = await(fun())
x+1
}
val fr = c.runTicks(1.second)
val fr = c.runTicks(2.second)
val r = fr.map(x => assert(x == 2))
FutureCompleter(r)

Expand Down

0 comments on commit 91511d1

Please sign in to comment.