summaryrefslogtreecommitdiff
path: root/test/pending/script
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-04-05 06:24:22 +0000
committerPaul Phillips <paulp@improving.org>2010-04-05 06:24:22 +0000
commite8a121e9e1ade3f283f42fceb3c18f30a8468f57 (patch)
treefc58111a69bb8940f7c5bd341fa3a8f097955403 /test/pending/script
parent28ed5c6b216463a6e5bd8f06986c35a2036bda3f (diff)
downloadscala-e8a121e9e1ade3f283f42fceb3c18f30a8468f57.tar.gz
scala-e8a121e9e1ade3f283f42fceb3c18f30a8468f57.tar.bz2
scala-e8a121e9e1ade3f283f42fceb3c18f30a8468f57.zip
If I work on this patch any longer without chec...
If I work on this patch any longer without checking in I will go stark raving mad. It is broken up into a couple pieces. This one is the changes to test/. It includes fixing a bunch of tests, removing deprecated constructs, moving jars used by tests to the most specific plausible location rather than having all jars on the classpath of all tests, and some filesystem layout change (continuations get their whole own srcpath.) This would be the world's most tedious review, so let's say no review. [Note: after this commit, I doubt things will build very smoothly until the rest of the partest changes follow. Which should only be seconds, but just in case.]
Diffstat (limited to 'test/pending/script')
-rw-r--r--test/pending/script/bug2365.javaopts1
-rw-r--r--test/pending/script/bug2365/Test.scala35
-rwxr-xr-xtest/pending/script/bug2365/bug2365.scala9
3 files changed, 45 insertions, 0 deletions
diff --git a/test/pending/script/bug2365.javaopts b/test/pending/script/bug2365.javaopts
new file mode 100644
index 0000000000..357e033c1c
--- /dev/null
+++ b/test/pending/script/bug2365.javaopts
@@ -0,0 +1 @@
+-XX:MaxPermSize=25M
diff --git a/test/pending/script/bug2365/Test.scala b/test/pending/script/bug2365/Test.scala
new file mode 100644
index 0000000000..53581d256b
--- /dev/null
+++ b/test/pending/script/bug2365/Test.scala
@@ -0,0 +1,35 @@
+import scala.tools.nsc.io._
+import java.net.URL
+
+object A { def apply(d: { def apply(): Int}) = d.apply() }
+object A2 { def apply(d: { def apply(): Int}) = d.apply() }
+object A3 { def apply(d: { def apply(): Int}) = d.apply() }
+object A4 { def apply(d: { def apply(): Int}) = d.apply() }
+
+class B extends Function0[Int] {
+ def apply() = 3
+}
+
+object Test
+{
+ type StructF0 = { def apply(): Int }
+ def main(args: Array[String]) {
+ for(i <- 0 until 150)
+ println(i + " " + test(A.apply) + " " + test(A2.apply) + " " + test(A3.apply) + " " + test(A3.apply))
+ }
+
+ def test(withF0: StructF0 => Int): Int = {
+ // Some large jar
+ val jar = File("../../../../lib/scalacheck.jar").toURL
+ // load a class in a separate loader that will be passed to A
+ val loader = new java.net.URLClassLoader(Array(File(".").toURL, jar))
+ // load a real class to fill perm gen space
+ Class.forName("org.scalacheck.Properties", true, loader).newInstance
+ // create a class from another class loader with an apply: Int method
+ val b = Class.forName("B", true, loader).newInstance
+
+ // pass instance to a, which will call apply using structural type reflection.
+ // This should hold on to the class for B, which means bLoader will not get collected
+ withF0(b.asInstanceOf[StructF0])
+ }
+}
diff --git a/test/pending/script/bug2365/bug2365.scala b/test/pending/script/bug2365/bug2365.scala
new file mode 100755
index 0000000000..b5e05325cf
--- /dev/null
+++ b/test/pending/script/bug2365/bug2365.scala
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# This script should fail with any build of scala where #2365
+# is not fixed, and otherwise succeed. Failure means running out
+# of PermGen space.
+#
+
+scalac -cp .:/local/lib/java/ivy.jar Test.scala
+JAVA_OPTS="-XX:MaxPermSize=25M -verbose:gc" scalac -cp $CP Test