summaryrefslogtreecommitdiff
path: root/src/partest
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-04-12 16:37:39 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-04-12 16:37:39 +0000
commitd61d2c93d788fdf01ad2497b9c6bb69ab9d6a397 (patch)
tree99fb5dd5a796f4701067e49cf74992335a9126e9 /src/partest
parentf31eaf606f2f1f524621dacd280abfccb9110f59 (diff)
downloadscala-d61d2c93d788fdf01ad2497b9c6bb69ab9d6a397.tar.gz
scala-d61d2c93d788fdf01ad2497b9c6bb69ab9d6a397.tar.bz2
scala-d61d2c93d788fdf01ad2497b9c6bb69ab9d6a397.zip
Merged revisions 21467,21471-21482,21486-21487 ...
Merged revisions 21467,21471-21482,21486-21487 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r21467 | plocinic | 2010-04-12 10:09:26 +0200 (Mon, 12 Apr 2010) | 1 line Closes #2757. No review. ........ r21471 | odersky | 2010-04-12 13:52:39 +0200 (Mon, 12 Apr 2010) | 1 line Closes #3224. Review by retronym. ........ r21472 | odersky | 2010-04-12 13:53:05 +0200 (Mon, 12 Apr 2010) | 1 line Cosmetic renamings. No review. ........ r21473 | phaller | 2010-04-12 13:59:29 +0200 (Mon, 12 Apr 2010) | 1 line actors.UncaughtException stores most recent sender. Default output for unhandled exceptions can be disabled using actors.Debug. Review by plocinic. ........ r21474 | phaller | 2010-04-12 14:00:10 +0200 (Mon, 12 Apr 2010) | 1 line Improved deprecation warnings in actors package object. No review. ........ r21475 | phaller | 2010-04-12 14:02:51 +0200 (Mon, 12 Apr 2010) | 1 line Another test for see #2017. No review. ........ r21476 | phaller | 2010-04-12 15:25:57 +0200 (Mon, 12 Apr 2010) | 1 line Attempting to unblock partest by handling AssertionErrors. No review. ........ r21477 | dubochet | 2010-04-12 15:29:05 +0200 (Mon, 12 Apr 2010) | 1 line [scaladoc] meta-documentation (attributes, definition classes, etc.) is available for members that do not have a comment. No review. ........ r21478 | dubochet | 2010-04-12 16:16:01 +0200 (Mon, 12 Apr 2010) | 1 line [scaladoc] Dangerous HTML (that can break Scaladoc) is stripped out of comments and replaced by corresponding wiki syntax when possible. No review. ........ r21479 | dubochet | 2010-04-12 16:29:47 +0200 (Mon, 12 Apr 2010) | 1 line [scaladoc] Not all 23 AbstractFunction classes are listed in the left list. No review. ........ r21480 | dubochet | 2010-04-12 16:38:16 +0200 (Mon, 12 Apr 2010) | 1 line [scaladoc] More mitigation code for dangerous HTML tags. No review. ........ r21481 | malayeri | 2010-04-12 16:52:39 +0200 (Mon, 12 Apr 2010) | 1 line Move constructors to beginning of scaladoc html page; show implicit modifier in main list. Review by dubochet. ........ r21482 | rytz | 2010-04-12 17:12:56 +0200 (Mon, 12 Apr 2010) | 1 line fixed LOAD_MODULE for companions of primitive types. fixes .net build. review by dragos. ........ r21486 | odersky | 2010-04-12 17:26:20 +0200 (Mon, 12 Apr 2010) | 1 line changed testfile, to satisfy new diff algo (which should be reverted IMO). review by extempore. ........ r21487 | extempore | 2010-04-12 18:11:36 +0200 (Mon, 12 Apr 2010) | 1 line Some modifications to partest to improve output. Review by phaller. ........
Diffstat (limited to 'src/partest')
-rw-r--r--src/partest/scala/tools/partest/Actions.scala2
-rw-r--r--src/partest/scala/tools/partest/Compilable.scala7
-rw-r--r--src/partest/scala/tools/partest/Dispatcher.scala19
-rw-r--r--src/partest/scala/tools/partest/Results.scala20
-rw-r--r--src/partest/scala/tools/partest/io/Logging.scala5
5 files changed, 33 insertions, 20 deletions
diff --git a/src/partest/scala/tools/partest/Actions.scala b/src/partest/scala/tools/partest/Actions.scala
index 48b80cface..15351db2a7 100644
--- a/src/partest/scala/tools/partest/Actions.scala
+++ b/src/partest/scala/tools/partest/Actions.scala
@@ -54,7 +54,7 @@ trait Actions {
proc = Process.exec(toArgs(cmd), execEnv, execCwd.orNull, true)
proc.slurp()
}
- proc.waitFor() == 0
+ proc != null && (proc.waitFor() == 0)
}
result getOrElse {
warning("Process never terminated: '%s'" format cmd)
diff --git a/src/partest/scala/tools/partest/Compilable.scala b/src/partest/scala/tools/partest/Compilable.scala
index c11532f278..d7365c1620 100644
--- a/src/partest/scala/tools/partest/Compilable.scala
+++ b/src/partest/scala/tools/partest/Compilable.scala
@@ -81,7 +81,10 @@ trait PartestCompilation {
class PartestGlobal(settings: Settings, val creporter: ConsoleReporter) extends Global(settings, creporter) {
def partestCompile(files: List[String], printSummary: Boolean): Boolean = {
try { new Run compile files }
- catch { case FatalError(msg) => creporter.error(null, "fatal error: " + msg) }
+ catch {
+ case FatalError(msg) => creporter.error(null, "fatal error: " + msg)
+ case ae: AssertionError => creporter.error(null, ""+ae)
+ }
if (printSummary)
creporter.printSummary
@@ -102,4 +105,4 @@ trait PartestCompilation {
(new PartestGlobal(command.settings, reporter), command.files)
}
}
-} \ No newline at end of file
+}
diff --git a/src/partest/scala/tools/partest/Dispatcher.scala b/src/partest/scala/tools/partest/Dispatcher.scala
index 2c7d9d6a2f..2a9d99ab60 100644
--- a/src/partest/scala/tools/partest/Dispatcher.scala
+++ b/src/partest/scala/tools/partest/Dispatcher.scala
@@ -31,14 +31,14 @@ trait Dispatcher {
val groups = selected groupBy (_.category)
val count = selected.size
- if (count == 0) return CombinedTestResults(0, 0, 0)
+ if (count == 0) return CombinedTestResults(0, 0, 0, Nil)
else if (count == allTests.size) verbose("Running all %d tests." format count)
else verbose("Running %d/%d tests: %s".format(count, allTests.size, toStringTrunc(selected map (_.label) mkString ", ")))
allCategories collect { case x if groups contains x => runCategory(x, groups(x)) } reduceLeft (_ ++ _)
}
- private def parallelizeTests(tests: List[TestEntity]): immutable.Map[TestEntity, Int] = {
+ private def parallelizeTests(tests: List[TestEntity]): immutable.Map[TestEntity, TestResult] = {
// propagate verbosity
if (isDebug) scala.actors.Debug.level = 3
@@ -63,9 +63,9 @@ trait Dispatcher {
case ResultsOfRun(resultMap) => resultMap
case TIMEOUT =>
warning("Worker %d timed out." format w.workerNum)
- immutable.Map[TestEntity, Int]()
// mark all the worker's tests as having timed out - should be hard to miss
- groups(w.workerNum) map (_ -> 2) toMap
+ // immutable.Map[TestEntity, TestResult]()
+ groups(w.workerNum) map (x => (x -> new Timeout(x))) toMap
}
}) reduceLeft (_ ++ _)
}
@@ -75,9 +75,10 @@ trait Dispatcher {
normal("%s (%s tests in %s)\n".format(category.startMessage, tests.size, category))
val (milliSeconds, resultMap) = timed2(parallelizeTests(tests))
- val (passed, failed) = resultsToStatistics(resultMap)
+ val (passed, failed) = resultsToStatistics(resultMap mapValues (_.state))
+ val failures = resultMap.values filterNot (_.passed) toList
- CombinedTestResults(passed, failed, milliSeconds)
+ CombinedTestResults(passed, failed, milliSeconds, failures)
}
/** A Worker is given a bundle of tests and runs them all sequentially.
@@ -92,8 +93,8 @@ trait Dispatcher {
/** Runs the tests. Passes the result Map to onCompletion when done.
*/
- private def runTests(tests: List[TestEntity])(onCompletion: immutable.Map[TestEntity, Int] => Unit) {
- var results = new immutable.HashMap[TestEntity, Int] // maps tests to results
+ private def runTests(tests: List[TestEntity])(onCompletion: immutable.Map[TestEntity, TestResult] => Unit) {
+ var results = new immutable.HashMap[TestEntity, TestResult] // maps tests to results
val numberOfTests = tests.size
val testIterator = tests.iterator
def processed = results.size
@@ -122,7 +123,7 @@ trait Dispatcher {
return warning("Received duplicate result for %s: was %s, now %s".format(test, results(test), state))
// increment the counter for this result state
- results += (test -> state)
+ results += (test -> result)
// show on screen
if (isDryRun) normal("\n") // blank line between dry run traces
diff --git a/src/partest/scala/tools/partest/Results.scala b/src/partest/scala/tools/partest/Results.scala
index 4e0c446788..8078e7bf85 100644
--- a/src/partest/scala/tools/partest/Results.scala
+++ b/src/partest/scala/tools/partest/Results.scala
@@ -16,7 +16,7 @@ trait Results {
/** The response from a Worker who has been given TestsToRun.
*/
- case class ResultsOfRun(results: immutable.Map[TestEntity, Int])
+ case class ResultsOfRun(results: immutable.Map[TestEntity, TestResult])
/** The result of a single test. (0: OK, 1: FAILED, 2: TIMEOUT)
*/
@@ -39,7 +39,7 @@ trait Results {
case _ => false
}
override def hashCode = entity.hashCode
- override def toString = "%s (%s)".format(entity, if (passed) "passed" else "failed")
+ override def toString = "%s [%s]".format(entity, description)
}
class Success(val entity: TestEntity) extends TestResult(0, " OK ") {
@@ -58,6 +58,7 @@ trait Results {
if (isShowLog || isTrace)
normal(toStringTrunc(entity.failureMessage(), 1600))
}
+ override def toString = List(super.toString, toStringTrunc(entity.failureMessage(), 400)) mkString "\n"
}
class Timeout(val entity: TestEntity) extends TestResult(2, "TIME OUT") {
def colorize(s: String) = markFailure(s)
@@ -84,7 +85,8 @@ trait Results {
case class CombinedTestResults(
passed: Int,
failed: Int,
- elapsedMilliseconds: Long
+ elapsedMilliseconds: Long,
+ failures: List[TestResult]
) {
// housekeeping
val elapsedSecs = elapsedMilliseconds / 1000
@@ -100,14 +102,20 @@ trait Results {
def ++(x: CombinedTestResults) = CombinedTestResults(
passed + x.passed,
failed + x.failed,
- elapsedMilliseconds + x.elapsedMilliseconds
+ elapsedMilliseconds + x.elapsedMilliseconds,
+ failures ::: x.failures
)
- def elapsedString = "%02d:%02d:%02d".format(elapsedHrs, dispMins, dispSecs)
+ def elapsedString = "%02d:%02d:%02d".format(elapsedHrs, dispMins, dispSecs)
+ def failuresString = {
+ if (failures.isEmpty) ""
+ else "Summary of failures:" :: failures mkString ("\n", "\n", "")
+ }
+
override def toString =
if (total == 0) "There were no tests to run."
else if (isDryRun) "%d tests would be run." format total
- else if (hasFailures) "%d of %d tests failed (elapsed time: %s)".format(failed, total, elapsedString)
+ else if (hasFailures) "%d of %d tests failed (elapsed time: %s)".format(failed, total, elapsedString) + failuresString
else "All %d tests were successful (elapsed time: %s)".format(total, elapsedString)
}
} \ No newline at end of file
diff --git a/src/partest/scala/tools/partest/io/Logging.scala b/src/partest/scala/tools/partest/io/Logging.scala
index 3d1b0fa0b4..3667faaf3d 100644
--- a/src/partest/scala/tools/partest/io/Logging.scala
+++ b/src/partest/scala/tools/partest/io/Logging.scala
@@ -75,8 +75,9 @@ trait Logging {
def loggingResult(body: => String) =
try returning(true)(_ => logFile writeAll body)
catch {
- case x: ControlThrowable => throw x
- case x: Throwable => logException(x)
+ case x: ControlThrowable => throw x
+ case x: InterruptedException => normal(this + " received interrupt, failing.\n") ; false
+ case x: Throwable => logException(x)
}
def throwableToString(x: Throwable): String = {