Skip to content

Commit

Permalink
test: Debug failing tests on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Oct 31, 2024
1 parent ede1b04 commit 8fbaec4
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions frontend/src/test/scala/bloop/bsp/BspCompileSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import bloop.util.TestProject
import bloop.util.TestUtil

import coursierapi.Fetch
import scala.util.control.NonFatal

object TcpBspCompileSpec extends BspCompileSpec(BspProtocol.Tcp)
object LocalBspCompileSpec extends BspCompileSpec(BspProtocol.Local)
Expand Down Expand Up @@ -207,22 +208,28 @@ class BspCompileSpec(
val _ = bspState.scalaOptions(`A`)
}

// Wait until the extra directory is finally deleted at the end of the bsp session
TestUtil.await(
FiniteDuration(10, TimeUnit.SECONDS),
bloop.engine.ExecutionContext.ioScheduler
) {
Task {
var check: Boolean = true
while (check) {
// The task cleaning up client classes directories should have removed the extra dir
check = orphanClientClassesDir.exists && orphanInternalClassesDir.exists
Thread.sleep(100)
}
}.timeoutTo(
FiniteDuration(5, TimeUnit.SECONDS),
Task(sys.error(s"Expected deletion of $orphanClientClassesDir"))
)
try {
// Wait until the extra directory is finally deleted at the end of the bsp session
TestUtil.await(
FiniteDuration(10, TimeUnit.SECONDS),
bloop.engine.ExecutionContext.ioScheduler
) {
Task {
var check: Boolean = true
while (check) {
// The task cleaning up client classes directories should have removed the extra dir
check = orphanClientClassesDir.exists && orphanInternalClassesDir.exists
Thread.sleep(100)
}
}.timeoutTo(
FiniteDuration(5, TimeUnit.SECONDS),
Task(sys.error(s"Expected deletion of $orphanClientClassesDir"))
)
}
} catch {
case NonFatal(e) =>
println(logger.render)
throw e
}
}
}
Expand Down

0 comments on commit 8fbaec4

Please sign in to comment.