From febf1a0cd942f2d222e1d1349eb9551ef36f4f48 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 25 Aug 2011 20:55:00 +0000 Subject: Recent icode checking tests were leaving a bit ... 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. --- src/partest/scala/tools/partest/DirectTest.scala | 4 ++++ src/partest/scala/tools/partest/IcodeTest.scala | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/partest/scala/tools/partest/DirectTest.scala b/src/partest/scala/tools/partest/DirectTest.scala index 95a8ae57dd..e6e817f96d 100644 --- a/src/partest/scala/tools/partest/DirectTest.scala +++ b/src/partest/scala/tools/partest/DirectTest.scala @@ -19,6 +19,10 @@ abstract class DirectTest extends App { // 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 = "" // a default Settings object diff --git a/src/partest/scala/tools/partest/IcodeTest.scala b/src/partest/scala/tools/partest/IcodeTest.scala index 5a8ec2890f..28891f9bbf 100644 --- a/src/partest/scala/tools/partest/IcodeTest.scala +++ b/src/partest/scala/tools/partest/IcodeTest.scala @@ -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()) -- cgit v1.2.3