diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-01-16 16:31:52 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-01-16 16:31:52 +0000 |
commit | 4666857e6cc7f82913a4b2c069e7909e98633e93 (patch) | |
tree | 60f5c9bbeef79d0578f51108f74779eae83926cc | |
parent | 98ae895a95731e32019c706c35dbc82f71ce5674 (diff) | |
download | scala-4666857e6cc7f82913a4b2c069e7909e98633e93.tar.gz scala-4666857e6cc7f82913a4b2c069e7909e98633e93.tar.bz2 scala-4666857e6cc7f82913a4b2c069e7909e98633e93.zip |
Fixed ant test.suite target for jvm tests that ...
Fixed ant test.suite target for jvm tests that contain directories.
Added additional test for #1143.
-rw-r--r-- | build.xml | 4 | ||||
-rw-r--r-- | src/build/four.xml | 4 | ||||
-rw-r--r-- | src/partest/scala/tools/partest/PartestTask.scala | 14 | ||||
-rw-r--r-- | test/files/jvm/t1143-2.check | 1 | ||||
-rw-r--r-- | test/files/jvm/t1143-2/Marker.java | 4 | ||||
-rw-r--r-- | test/files/jvm/t1143-2/t1143-2.scala | 66 |
6 files changed, 89 insertions, 4 deletions
@@ -1298,8 +1298,8 @@ BOOTRAPING TEST AND TEST SUITE <negtests dir="${test.dir}/files/neg" includes="*.scala"/> <runtests dir="${test.dir}/files"> <include name="run/**/*.scala"/> - <include name="jvm/**/*.scala"/> </runtests> + <jvmtests dir="${test.dir}/files/jvm" includes="*.scala"/> <jvm5tests dir="${test.dir}/files/jvm5" includes="*.scala"/> <residenttests dir="${test.dir}/files/res" includes="*.res"/> <!-- <scripttests dir="${test.dir}/files/script" includes="*.scala"/> --> @@ -1321,8 +1321,8 @@ BOOTRAPING TEST AND TEST SUITE <negtests dir="${test.dir}/files/neg" includes="*.scala"/> <runtests dir="${test.dir}/files"> <include name="run/**/*.scala"/> - <include name="jvm/**/*.scala"/> </runtests> + <jvmtests dir="${test.dir}/files/jvm" includes="*.scala"/> <jvm5tests dir="${test.dir}/files/jvm5" includes="*.scala"/> <residenttests dir="${test.dir}/files/res" includes="*.res"/> <!-- <scripttests dir="${test.dir}/files/script" includes="*.scala"/> --> diff --git a/src/build/four.xml b/src/build/four.xml index 7e5506d067..8d046df9c8 100644 --- a/src/build/four.xml +++ b/src/build/four.xml @@ -347,8 +347,8 @@ work on a JVM 1.5. <negtests dir="${test.dir}/files/neg" includes="*.scala"/> <runtests dir="${test.dir}/files"> <include name="run/**/*.scala"/> - <include name="jvm/**/*.scala"/> </runtests> + <jvmtests dir="${test.dir}/files/jvm" includes="*.scala"/> <residenttests dir="${test.dir}/files/res" includes="*.res"/> </partest> </target> @@ -385,8 +385,8 @@ work on a JVM 1.4. <negtests dir="${test.dir}/files/neg" includes="*.scala"/> <runtests dir="${test.dir}/files"> <include name="run/**/*.scala"/> - <include name="jvm/**/*.scala"/> </runtests> + <jvmtests dir="${test.dir}/files/jvm" includes="*.scala"/> <residenttests dir="${test.dir}/files/res" includes="*.res"/> </partest> </target> diff --git a/src/partest/scala/tools/partest/PartestTask.scala b/src/partest/scala/tools/partest/PartestTask.scala index 118e50ffd0..b619eaa9ca 100644 --- a/src/partest/scala/tools/partest/PartestTask.scala +++ b/src/partest/scala/tools/partest/PartestTask.scala @@ -32,6 +32,9 @@ class PartestTask extends Task { def addConfiguredRunTests(input: FileSet): Unit = runFiles = Some(input) + def addConfiguredJvmTests(input: FileSet): Unit = + jvmFiles = Some(input) + def addConfiguredJvm5Tests(input: FileSet): Unit = jvm5Files = Some(input) @@ -92,6 +95,7 @@ class PartestTask extends Task { private var pos5Files: Option[FileSet] = None private var negFiles: Option[FileSet] = None private var runFiles: Option[FileSet] = None + private var jvmFiles: Option[FileSet] = None private var jvm5Files: Option[FileSet] = None private var residentFiles: Option[FileSet] = None private var scriptFiles: Option[FileSet] = None @@ -140,6 +144,9 @@ class PartestTask extends Task { else Array() + private def getJvmFiles: Array[File] = + getFilesAndDirs(jvmFiles) + private def getJvm5Files: Array[File] = getFilesAndDirs(jvm5Files) @@ -258,6 +265,13 @@ class PartestTask extends Task { allFailures += failures } + if (getJvmFiles.size > 0) { + log("Compiling and running files") + val (successes, failures) = runTestsForFiles(getJvmFiles, "jvm") + allSucesses += successes + allFailures += failures + } + if (getJvm5Files.size > 0) { log("Compiling and running files") val (successes, failures) = runTestsForFiles(getJvm5Files, "jvm5") diff --git a/test/files/jvm/t1143-2.check b/test/files/jvm/t1143-2.check new file mode 100644 index 0000000000..2ae28399f5 --- /dev/null +++ b/test/files/jvm/t1143-2.check @@ -0,0 +1 @@ +pass diff --git a/test/files/jvm/t1143-2/Marker.java b/test/files/jvm/t1143-2/Marker.java new file mode 100644 index 0000000000..e9ac045b83 --- /dev/null +++ b/test/files/jvm/t1143-2/Marker.java @@ -0,0 +1,4 @@ +import java.io.Serializable; + +public interface Marker extends Serializable { +} diff --git a/test/files/jvm/t1143-2/t1143-2.scala b/test/files/jvm/t1143-2/t1143-2.scala new file mode 100644 index 0000000000..58bc1d763e --- /dev/null +++ b/test/files/jvm/t1143-2/t1143-2.scala @@ -0,0 +1,66 @@ +object Serialize { + @throws(classOf[java.io.IOException]) + def write[A](o: A): Array[Byte] = { + val ba = new java.io.ByteArrayOutputStream(512) + val out = new java.io.ObjectOutputStream(ba) + out.writeObject(o) + out.close() + ba.toByteArray() + } + @throws(classOf[java.io.IOException]) + @throws(classOf[ClassNotFoundException]) + def read[A](buffer: Array[Byte]): A = { + val in = + new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(buffer)) + in.readObject().asInstanceOf[A] + } +} + +@serializable +@SerialVersionUID(1L) +class VarModel[T]( getter: => T, setter: T => Unit ) +{ + Serialize.write(getter) + Serialize.write(setter) + + def this( getter: => T ) = this( getter, null ) + + def getObject: AnyRef = getter.asInstanceOf[AnyRef] + + def setObject( v: AnyRef ) = { + if( setter==null ) + throw new RuntimeException( "Tried to set readonly model!") + setter( v.asInstanceOf[T] ) + } + + def detach = () +} + +@serializable +@SerialVersionUID(1L) +class Printer( p: VarModel[String] ) { + def print = println( p.getObject ); +} + +class Component extends Marker { } + +class Form extends Component { } + +@serializable +@SerialVersionUID(1L) +class Main { + var pass = "pass" + def main(args : Array[String]) : Unit = { + val f = new Form { + val p = new Printer( new VarModel( pass, pass=_ ) ); + p.print + } + () + } +} + +object Test { + def main(args: Array[String]) { + (new Main).main(Array[String]()) + } +} |