diff options
author | Paul Phillips <paulp@improving.org> | 2012-11-12 23:21:47 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-11-19 11:53:44 -0800 |
commit | 645c2676dd6699ac24a57dfe750386bbdb827ee8 (patch) | |
tree | 8a7391c27b58da5ef5529ce17ce3b1f3178a21e9 /src/partest | |
parent | 345f937b3441f248ac9156484758fa17b1a78941 (diff) | |
download | scala-645c2676dd6699ac24a57dfe750386bbdb827ee8.tar.gz scala-645c2676dd6699ac24a57dfe750386bbdb827ee8.tar.bz2 scala-645c2676dd6699ac24a57dfe750386bbdb827ee8.zip |
Commenting out unused members.
I want to get this commit into the history because
the tests pass here, which demonstrates that every commented
out method is not only unnecessary internally but has zero
test coverage. Since I know (based on the occasional source
code comment, or more often based on knowing something about
other source bases) that some of these can't be removed
without breaking other things, I want to at least record
a snapshot of the identities of all these unused and
untested methods.
This commit will be reverted; then there will be another
commit which removes the subset of these methods which I
believe to be removable. The remainder are in great need of
tests which exercise the interfaces upon which other
repositories depend.
Diffstat (limited to 'src/partest')
13 files changed, 133 insertions, 132 deletions
diff --git a/src/partest/scala/tools/partest/CompilerTest.scala b/src/partest/scala/tools/partest/CompilerTest.scala index d73d99bc89..bb0732dcc6 100644 --- a/src/partest/scala/tools/partest/CompilerTest.scala +++ b/src/partest/scala/tools/partest/CompilerTest.scala @@ -21,7 +21,7 @@ abstract class CompilerTest extends DirectTest { lazy val global: Global = newCompiler() lazy val units = compilationUnits(global)(sources: _ *) import global._ - import definitions._ + import definitions.{ compilerTypeFromTag } override def extraSettings = "-usejavacp -d " + testOutput.path @@ -32,7 +32,6 @@ abstract class CompilerTest extends DirectTest { def sources: List[String] = List(code) // Utility functions - class MkType(sym: Symbol) { def apply[M](implicit t: ru.TypeTag[M]): Type = if (sym eq NoSymbol) NoType diff --git a/src/partest/scala/tools/partest/SecurityTest.scala b/src/partest/scala/tools/partest/SecurityTest.scala index 2d6f61d0b1..8d57e7e38d 100644 --- a/src/partest/scala/tools/partest/SecurityTest.scala +++ b/src/partest/scala/tools/partest/SecurityTest.scala @@ -11,8 +11,8 @@ import java.util._ abstract class SecurityTest extends App { def throwIt(x: Any) = throw new AccessControlException("" + x) - def readPerm(p: PropertyPermission) = p.getActions contains "read" - def writePerm(p: PropertyPermission) = p.getActions contains "write" + // def readPerm(p: PropertyPermission) = p.getActions contains "read" + // def writePerm(p: PropertyPermission) = p.getActions contains "write" def propertyCheck(p: PropertyPermission): Unit = throwIt(p) def check(perm: Permission): Unit = perm match { @@ -20,13 +20,13 @@ abstract class SecurityTest extends App { case _ => () } - lazy val sm = new SecurityManager { - // these two are the choke points for all permissions checks - override def checkPermission(perm: Permission): Unit = check(perm) - override def checkPermission(perm: Permission, context: Object): Unit = check(perm) - } - def securityOn(): Boolean = { - try { System.setSecurityManager(sm) ; true } - catch { case _: SecurityException => false } - } + // lazy val sm = new SecurityManager { + // // these two are the choke points for all permissions checks + // override def checkPermission(perm: Permission): Unit = check(perm) + // override def checkPermission(perm: Permission, context: Object): Unit = check(perm) + // } + // def securityOn(): Boolean = { + // try { System.setSecurityManager(sm) ; true } + // catch { case _: SecurityException => false } + // } } diff --git a/src/partest/scala/tools/partest/TestUtil.scala b/src/partest/scala/tools/partest/TestUtil.scala index 9bfd444180..bd5dc39498 100644 --- a/src/partest/scala/tools/partest/TestUtil.scala +++ b/src/partest/scala/tools/partest/TestUtil.scala @@ -24,13 +24,13 @@ trait TestUtil { } def nanos(body: => Unit): Long = alsoNanos(body)._1 - def verifySpeed(body1: => Unit, body2: => Unit, acceptableMultiple: Double) = { - val t1 = nanos(body1).toDouble - val t2 = nanos(body2).toDouble - val mult = if (t1 > t2) t1 / t2 else t2 / t1 + // def verifySpeed(body1: => Unit, body2: => Unit, acceptableMultiple: Double) = { + // val t1 = nanos(body1).toDouble + // val t2 = nanos(body2).toDouble + // val mult = if (t1 > t2) t1 / t2 else t2 / t1 - assert(mult <= acceptableMultiple, "Performance difference too great: multiple = " + mult) - } + // assert(mult <= acceptableMultiple, "Performance difference too great: multiple = " + mult) + // } def intercept[T <: Exception : ClassTag](code: => Unit): Unit = try { @@ -41,6 +41,6 @@ trait TestUtil { } } +// Used in tests. object TestUtil extends TestUtil { - } diff --git a/src/partest/scala/tools/partest/instrumented/Instrumentation.scala b/src/partest/scala/tools/partest/instrumented/Instrumentation.scala index 8a284b313b..18dd740208 100644 --- a/src/partest/scala/tools/partest/instrumented/Instrumentation.scala +++ b/src/partest/scala/tools/partest/instrumented/Instrumentation.scala @@ -78,6 +78,7 @@ object Instrumentation { !t.className.startsWith("scala/util/DynamicVariable") } + // Used in tests. def printStatistics(stats: Statistics = getStatistics, filter: MethodCallTrace => Boolean = standardFilter): Unit = { val stats = getStatistics println("Method call statistics:") diff --git a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala index 75aed449a8..d8ae4b2403 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleFileManager.scala @@ -79,7 +79,7 @@ class ConsoleFileManager extends FileManager { testClassesDir = Path(testClasses.get).toCanonical.toDirectory NestUI.verbose("Running with classes in "+testClassesDir) - latestFile = testClassesDir.parent / "bin" + // latestFile = testClassesDir.parent / "bin" latestLibFile = testClassesDir / "library" latestActorsFile = testClassesDir / "library" / "actors" latestReflectFile = testClassesDir / "reflect" @@ -90,7 +90,7 @@ class ConsoleFileManager extends FileManager { else if (testBuild.isDefined) { val dir = Path(testBuild.get) NestUI.verbose("Running on "+dir) - latestFile = dir / "bin" + // latestFile = dir / "bin" latestLibFile = dir / "lib/scala-library.jar" latestActorsFile = dir / "lib/scala-actors.jar" latestReflectFile = dir / "lib/scala-reflect.jar" @@ -101,7 +101,7 @@ class ConsoleFileManager extends FileManager { else { def setupQuick() { NestUI.verbose("Running build/quick") - latestFile = prefixFile("build/quick/bin") + // latestFile = prefixFile("build/quick/bin") latestLibFile = prefixFile("build/quick/classes/library") latestActorsFile = prefixFile("build/quick/classes/library/actors") latestReflectFile = prefixFile("build/quick/classes/reflect") @@ -112,7 +112,7 @@ class ConsoleFileManager extends FileManager { def setupInst() { NestUI.verbose("Running dist (installed)") val p = testParent.getParentFile - latestFile = prefixFileWith(p, "bin") + // latestFile = prefixFileWith(p, "bin") latestLibFile = prefixFileWith(p, "lib/scala-library.jar") latestActorsFile = prefixFileWith(p, "lib/scala-actors.jar") latestReflectFile = prefixFileWith(p, "lib/scala-reflect.jar") @@ -122,7 +122,7 @@ class ConsoleFileManager extends FileManager { def setupDist() { NestUI.verbose("Running dists/latest") - latestFile = prefixFile("dists/latest/bin") + // latestFile = prefixFile("dists/latest/bin") latestLibFile = prefixFile("dists/latest/lib/scala-library.jar") latestActorsFile = prefixFile("dists/latest/lib/scala-actors.jar") latestReflectFile = prefixFile("dists/latest/lib/scala-reflect.jar") @@ -132,7 +132,7 @@ class ConsoleFileManager extends FileManager { def setupPack() { NestUI.verbose("Running build/pack") - latestFile = prefixFile("build/pack/bin") + // latestFile = prefixFile("build/pack/bin") latestLibFile = prefixFile("build/pack/lib/scala-library.jar") latestActorsFile = prefixFile("build/pack/lib/scala-actors.jar") latestReflectFile = prefixFile("build/pack/lib/scala-reflect.jar") @@ -175,7 +175,7 @@ class ConsoleFileManager extends FileManager { var LATEST_PARTEST: String = "" var LATEST_ACTORS: String = "" - var latestFile: File = _ + // var latestFile: File = _ var latestLibFile: File = _ var latestActorsFile: File = _ var latestReflectFile: File = _ @@ -187,7 +187,7 @@ class ConsoleFileManager extends FileManager { // initialize above fields findLatest() - var testFiles: List[io.Path] = Nil + // var testFiles: List[io.Path] = Nil def getFiles(kind: String, cond: Path => Boolean): List[File] = { def ignoreDir(p: Path) = List("svn", "obj") exists (p hasExtension _) @@ -197,9 +197,7 @@ class ConsoleFileManager extends FileManager { if (dir.isDirectory) NestUI.verbose("look in %s for tests" format dir) else NestUI.failure("Directory '%s' not found" format dir) - val files = - if (testFiles.nonEmpty) testFiles filter (_.parent isSame dir) - else dir.list filterNot ignoreDir filter cond toList + val files = dir.list filterNot ignoreDir filter cond toList ( if (failed) files filter (x => logFileExists(x, kind)) else files ) map (_.jfile) } diff --git a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala index d23ee81e4d..35bce01684 100644 --- a/src/partest/scala/tools/partest/nest/ConsoleRunner.scala +++ b/src/partest/scala/tools/partest/nest/ConsoleRunner.scala @@ -51,7 +51,7 @@ class ConsoleRunner extends DirectRunner { private val testSetArgs = testSets map ("--" + _.kind) private val testSetArgMap = testSetArgs zip testSets toMap - def denotesTestSet(arg: String) = testSetArgs contains arg + // def denotesTestSet(arg: String) = testSetArgs contains arg private def printVersion() { NestUI outline (versionMsg + "\n") } diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala index 21fd314552..9e2a34a34e 100644 --- a/src/partest/scala/tools/partest/nest/FileManager.scala +++ b/src/partest/scala/tools/partest/nest/FileManager.scala @@ -74,15 +74,15 @@ trait FileManager extends FileUtil { var timeout = PartestDefaults.timeout // how can 15 minutes not be enough? What are you doing, run/lisp.scala? // You complete in 11 seconds on my machine. - var oneTestTimeout = 60 * 60 * 1000 + // var oneTestTimeout = 60 * 60 * 1000 /** Only when --debug is given. */ lazy val testTimings = new mutable.HashMap[String, Long] def recordTestTiming(name: String, milliseconds: Long) = synchronized { testTimings(name) = milliseconds } - def showTestTimings() { - testTimings.toList sortBy (-_._2) foreach { case (k, v) => println("%s: %s".format(k, v)) } - } + // def showTestTimings() { + // testTimings.toList sortBy (-_._2) foreach { case (k, v) => println("%s: %s".format(k, v)) } + // } def getLogFile(dir: File, fileBase: String, kind: String): File = new File(dir, fileBase + "-" + kind + ".log") diff --git a/src/partest/scala/tools/partest/nest/NestUI.scala b/src/partest/scala/tools/partest/nest/NestUI.scala index 70db6d0ed1..00aa27bd34 100644 --- a/src/partest/scala/tools/partest/nest/NestUI.scala +++ b/src/partest/scala/tools/partest/nest/NestUI.scala @@ -54,9 +54,9 @@ object NestUI { } def warning(msg: String) = print(_warning + msg + _default) - def warning(msg: String, wr: PrintWriter) = synchronized { - wr.print(_warning + msg + _default) - } + // def warning(msg: String, wr: PrintWriter) = synchronized { + // wr.print(_warning + msg + _default) + // } def normal(msg: String) = print(_default + msg) def normal(msg: String, wr: PrintWriter) = synchronized { @@ -104,7 +104,7 @@ object NestUI { } var _verbose = false - var _debug = false + // var _debug = false def verbose(msg: String) { if (_verbose) { @@ -112,10 +112,10 @@ object NestUI { println(msg) } } - def debug(msg: String) { - if (isPartestDebug) { - outline("debug: ") - println(msg) - } - } + // def debug(msg: String) { + // if (isPartestDebug) { + // outline("debug: ") + // println(msg) + // } + // } } diff --git a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala index 5cb8589d66..4b0ed1f82a 100644 --- a/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala +++ b/src/partest/scala/tools/partest/nest/ReflectiveRunner.scala @@ -3,8 +3,6 @@ * @author Philipp Haller */ -// $Id$ - package scala.tools.partest package nest @@ -12,7 +10,6 @@ import scala.tools.nsc.Properties.{ setProp, propOrEmpty } import scala.tools.nsc.util.ClassPath import scala.tools.nsc.io import io.Path -import RunnerUtils._ import java.net.URLClassLoader /* This class is used to load an instance of DirectRunner using @@ -28,6 +25,12 @@ class ReflectiveRunner { // was used to start the runner. val sepRunnerClassName = "scala.tools.partest.nest.ConsoleRunner" + private def searchPath(option: String, as: List[String]): Option[String] = as match { + case `option` :: r :: _ => Some(r) + case _ :: rest => searchPath(option, rest) + case Nil => None + } + def main(args: String) { val argList = (args.split("\\s")).toList diff --git a/src/partest/scala/tools/partest/nest/RunnerManager.scala b/src/partest/scala/tools/partest/nest/RunnerManager.scala index 548c5abbd9..2651088018 100644 --- a/src/partest/scala/tools/partest/nest/RunnerManager.scala +++ b/src/partest/scala/tools/partest/nest/RunnerManager.scala @@ -291,10 +291,10 @@ class RunnerManager(kind: String, val fileManager: FileManager, params: TestRunP ((swr, wr)) } - def fail(what: Any) = { - NestUI.verbose("scalac: compilation of "+what+" failed\n") - false - } + // def fail(what: Any) = { + // NestUI.verbose("scalac: compilation of "+what+" failed\n") + // false + // } def diffCheck(testFile: File, diff: String) = { testDiff = diff testDiff == "" diff --git a/src/partest/scala/tools/partest/nest/RunnerUtils.scala b/src/partest/scala/tools/partest/nest/RunnerUtils.scala index 6707a9338a..8a47989b7c 100644 --- a/src/partest/scala/tools/partest/nest/RunnerUtils.scala +++ b/src/partest/scala/tools/partest/nest/RunnerUtils.scala @@ -1,29 +1,29 @@ -/* NEST (New Scala Test) - * Copyright 2007-2013 LAMP/EPFL - * @author Philipp Haller - */ +// /* NEST (New Scala Test) +// * Copyright 2007-2013 LAMP/EPFL +// * @author Philipp Haller +// */ -// $Id$ +// // $Id$ -package scala.tools.partest -package nest +// package scala.tools.partest +// package nest -object RunnerUtils { - def splitArgs(str: String) = str split "\\s" filterNot (_ == "") toList +// object RunnerUtils { +// def splitArgs(str: String) = str split "\\s" filterNot (_ == "") toList - def searchPath(option: String, as: List[String]): Option[String] = as match { - case `option` :: r :: _ => Some(r) - case _ :: rest => searchPath(option, rest) - case Nil => None - } +// def searchPath(option: String, as: List[String]): Option[String] = as match { +// case `option` :: r :: _ => Some(r) +// case _ :: rest => searchPath(option, rest) +// case Nil => None +// } - def searchAndRemovePath(option: String, as: List[String]) = (as indexOf option) match { - case -1 => (None, as) - case idx => (Some(as(idx + 1)), (as take idx) ::: (as drop (idx + 2))) - } +// def searchAndRemovePath(option: String, as: List[String]) = (as indexOf option) match { +// case -1 => (None, as) +// case idx => (Some(as(idx + 1)), (as take idx) ::: (as drop (idx + 2))) +// } - def searchAndRemoveOption(option: String, as: List[String]) = (as indexOf option) match { - case -1 => (false, as) - case idx => (true, (as take idx) ::: (as drop (idx + 1))) - } -} +// def searchAndRemoveOption(option: String, as: List[String]) = (as indexOf option) match { +// case -1 => (false, as) +// case idx => (true, (as take idx) ::: (as drop (idx + 1))) +// } +// } diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala index 58cc7d5b0b..fa0c88a2b2 100644 --- a/src/partest/scala/tools/partest/package.scala +++ b/src/partest/scala/tools/partest/package.scala @@ -13,9 +13,9 @@ import java.util.concurrent.Callable package partest { class TestState { - def isOk = this eq TestState.Ok - def isFail = this eq TestState.Fail - def isTimeout = this eq TestState.Timeout + // def isOk = this eq TestState.Ok + // def isFail = this eq TestState.Fail + // def isTimeout = this eq TestState.Timeout } object TestState { val Ok = new TestState @@ -43,7 +43,7 @@ package object partest { def callable[T](body: => T): Callable[T] = new Callable[T] { override def call() = body } - def path2String(path: String) = file2String(new JFile(path)) + // def path2String(path: String) = file2String(new JFile(path)) def file2String(f: JFile) = try SFile(f).slurp(scala.io.Codec.UTF8) catch { case _: FileNotFoundException => "" } diff --git a/src/partest/scala/tools/partest/utils/PrintMgr.scala b/src/partest/scala/tools/partest/utils/PrintMgr.scala index d25be87c1e..56fdcda2ea 100644 --- a/src/partest/scala/tools/partest/utils/PrintMgr.scala +++ b/src/partest/scala/tools/partest/utils/PrintMgr.scala @@ -1,52 +1,52 @@ -/* __ *\ -** ________ ___ / / ___ Scala Parallel Testing ** -** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - -package scala.tools.partest -package utils - -/** - * @author Thomas Hofer - */ -object PrintMgr { - - val NONE = 0 - val SOME = 1 - val MANY = 2 - - var outline = "" - var success = "" - var failure = "" - var warning = "" - var default = "" - - def initialization(number: Int) = number match { - case MANY => - outline = Console.BOLD + Console.BLACK - success = Console.BOLD + Console.GREEN - failure = Console.BOLD + Console.RED - warning = Console.BOLD + Console.YELLOW - default = Console.RESET - case SOME => - outline = Console.BOLD + Console.BLACK - success = Console.RESET - failure = Console.BOLD + Console.BLACK - warning = Console.BOLD + Console.BLACK - default = Console.RESET - case _ => - } - - def printOutline(msg: String) = print(outline + msg + default) - - def printSuccess(msg: String) = print(success + msg + default) - - def printFailure(msg: String) = print(failure + msg + default) - - def printWarning(msg: String) = print(warning + msg + default) -} +// /* __ *\ +// ** ________ ___ / / ___ Scala Parallel Testing ** +// ** / __/ __// _ | / / / _ | (c) 2007-2013, LAMP/EPFL ** +// ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +// ** /____/\___/_/ |_/____/_/ | | ** +// ** |/ ** +// \* */ + +// // $Id$ + +// package scala.tools.partest +// package utils + +// /** +// * @author Thomas Hofer +// */ +// object PrintMgr { + +// val NONE = 0 +// val SOME = 1 +// val MANY = 2 + +// var outline = "" +// var success = "" +// var failure = "" +// var warning = "" +// var default = "" + +// def initialization(number: Int) = number match { +// case MANY => +// outline = Console.BOLD + Console.BLACK +// success = Console.BOLD + Console.GREEN +// failure = Console.BOLD + Console.RED +// warning = Console.BOLD + Console.YELLOW +// default = Console.RESET +// case SOME => +// outline = Console.BOLD + Console.BLACK +// success = Console.RESET +// failure = Console.BOLD + Console.BLACK +// warning = Console.BOLD + Console.BLACK +// default = Console.RESET +// case _ => +// } + +// def printOutline(msg: String) = print(outline + msg + default) + +// def printSuccess(msg: String) = print(success + msg + default) + +// def printFailure(msg: String) = print(failure + msg + default) + +// def printWarning(msg: String) = print(warning + msg + default) +// } |