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 dcd4453
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion frontend/src/main/scala/bloop/engine/State.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object State {
val opts = CommonOptions.default
val cwd = opts.workingPath
val clientInfo = ClientInfo.CliClientInfo(useStableCliDirs = true, () => true)
val results = ResultsCache.load(build, cwd, cleanOrphanedInternalDirs = false, logger)
val results = ResultsCache.load(build, cwd, cleanOrphanedInternalDirs = true, logger)
State(
build,
results,
Expand Down
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 dcd4453

Please sign in to comment.