Recent icode checking tests were leaving a bit of a mess in the

filesystem.  Taught them to clean up after themselves.  I knew I'd
pick up a few useful tricks from my kids.  No review.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25568 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
extempore 2011-08-25 20:55:00 +00:00
parent 6a0290fa35
commit 03397dd669
2 changed files with 7 additions and 3 deletions

View File

@ -18,6 +18,10 @@ abstract class DirectTest extends App {
def code: String
// produce the output to be compared against a checkfile
def show(): Unit
// the test file or dir, and output directory
def testPath = io.File(sys.props("partest.test-path"))
def testOutput = io.Directory(sys.props("partest.output"))
// override to add additional settings with strings
def extraSettings: String = ""

View File

@ -21,14 +21,14 @@ abstract class IcodeTest extends DirectTest {
// override to check icode at a different point.
def printIcodeAfterPhase = "icode"
// override to use source code other than the file being tested.
def code = io.File(sys.props("partest.test-path")).slurp()
def code = testPath.slurp()
override def extraSettings: String = "-usejavacp -Xprint-icode:" + printIcodeAfterPhase
// Compile, read in all the *.icode files, delete them, and return their contents
def collectIcode(args: String*): List[String] = {
compile(args: _*)
val icodeFiles = Directory(".").files.toList filter (_ hasExtension "icode")
compile("-d" :: testOutput.path :: args.toList : _*)
val icodeFiles = testOutput.files.toList filter (_ hasExtension "icode")
try icodeFiles sortBy (_.name) flatMap (f => f.lines.toList)
finally icodeFiles foreach (f => f.delete())