mirror of https://github.com/sbt/sbt.git
Improve test failure message for #1390.
This commit is contained in:
parent
aa28240139
commit
2c3f40eb02
|
|
@ -25,7 +25,7 @@ object Sbt extends Build {
|
|||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||
incOptions := incOptions.value.withNameHashing(true),
|
||||
commands += Command.command("setupBuildScala211") { state =>
|
||||
"""set scalaVersion in ThisBuild := "2.11.0" """ ::
|
||||
"""set scalaVersion in ThisBuild := "2.11.1" """ ::
|
||||
"set Util.includeTestDependencies in ThisBuild := true" ::
|
||||
state
|
||||
},
|
||||
|
|
@ -46,12 +46,12 @@ object Sbt extends Build {
|
|||
def lameAgregateTask(task: String): String =
|
||||
s"all control/$task collections/$task io/$task completion/$task"
|
||||
"setupBuildScala211" ::
|
||||
/// First test
|
||||
lameAgregateTask("test") ::
|
||||
// Note: You need the sbt-pgp plugin installed to release.
|
||||
lameAgregateTask("publishSigned") ::
|
||||
// Now restore the defaults.
|
||||
"reload" :: state
|
||||
/// First test
|
||||
lameAgregateTask("test") ::
|
||||
// Note: You need the sbt-pgp plugin installed to release.
|
||||
lameAgregateTask("publishSigned") ::
|
||||
// Now restore the defaults.
|
||||
"reload" :: state
|
||||
},
|
||||
commands += Command.command("release-sbt") { state =>
|
||||
// TODO - Any sort of validation
|
||||
|
|
|
|||
|
|
@ -9,11 +9,20 @@ object ConcurrentCache extends Properties("ClassLoaderCache concurrent access")
|
|||
implicit lazy val concurrentArb: Arbitrary[Int] = Arbitrary(Gen.choose(1, 1000))
|
||||
implicit lazy val filenameArb: Arbitrary[String] = Arbitrary(Gen.alphaStr)
|
||||
|
||||
private[this] object DifferentClassloader {
|
||||
def unapply(loaders: Seq[ClassLoader]): Option[(ClassLoader, ClassLoader)] =
|
||||
if (loaders.size > 1) loaders.sliding(2).find { case Seq(x, y) => x != y } map { case Seq(x, y) => (x, y) }
|
||||
else None
|
||||
}
|
||||
|
||||
property("Same class loader for same classpaths concurrently processed") = forAll { (names: List[String], concurrent: Int) =>
|
||||
withcp(names.distinct) { files =>
|
||||
val cache = new ClassLoaderCache(null)
|
||||
val loaders = (1 to concurrent).par.map(_ => cache(files)).toList
|
||||
sameClassLoader(loaders)
|
||||
loaders match {
|
||||
case DifferentClassloader(left, right) => false :| s"$left != $right"
|
||||
case _ => true :| ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -25,6 +34,4 @@ object ConcurrentCache extends Properties("ClassLoaderCache concurrent access")
|
|||
}
|
||||
f(files)
|
||||
}
|
||||
private[this] def sameClassLoader(loaders: Seq[ClassLoader]): Boolean = loaders.size < 2 ||
|
||||
loaders.sliding(2).forall { case Seq(x, y) => x == y }
|
||||
}
|
||||
Loading…
Reference in New Issue