派生测试失败,因为javaOptions似乎配置错​​误 [英] Forking tests fail because javaOptions seems to be misconfigured

查看:95
本文介绍了派生测试失败,因为javaOptions似乎配置错​​误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Play 2.X,我希望我的测试在默认情况下是分叉的(Play 2.X的新方法),并且运行得特别好.

Using Play 2.X, I expect my tests to be forked by default (new way from Play 2.X) and especially well run.

但是,当在我的Build.scala中使用此SBT配置时,由于permgen空间,我观察到一个OOM,如下所示:

However, when using this SBT configuration in my Build.scala, I observe an OOM due to permgen space, like the following:

Uncaught exception when running myspecs.AllSpecs: java.lang.OutOfMemoryError: PermGen space
sbt.ForkMain$ForkError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at scala.collection.parallel.immutable.LazyParVectorCombiner.result(ParVector.scala:129)
    at scala.collection.parallel.immutable.LazyParVectorCombiner.result(ParVector.scala:105)
    at scala.collection.Parallelizable$class.par(Parallelizable.scala:42)
    at scala.collection.AbstractTraversable.par(Traversable.scala:105)
    at org.specs2.reporter.AllExporting$$anonfun$export$1$$anonfun$2.apply(AllExporting.scala:28)
    at org.specs2.reporter.AllExporting$$anonfun$export$1$$anonfun$2.apply(AllExporting.scala:27)
    at scalaz.syntax.IdOps$class.$bar$greater(IdOps.scala:15)
    at scalaz.syntax.ToIdOps$$anon$1.$bar$greater(IdOps.scala:82)
    at org.specs2.reporter.AllExporting$$anonfun$export$1.apply(AllExporting.scala:32)
    at org.specs2.reporter.AllExporting$$anonfun$export$1.apply(AllExporting.scala:24)
    at scalaz.syntax.IdOps$class.$bar$greater(IdOps.scala:15)
    at scalaz.syntax.ToIdOps$$anon$1.$bar$greater(IdOps.scala:82)
    at org.specs2.reporter.AllExporting$class.report(AllExporting.scala:17)
    at org.specs2.reporter.SbtConsoleReporter.report(SbtReporter.scala:20)
    at org.specs2.runner.SbtRunner.org$specs2$runner$SbtRunner$$specificationRun(SbtRunner.scala:75)
    at org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$5.execute(SbtRunner.scala:59)
    at sbt.ForkMain$Run.runTest(ForkMain.java:239)
    at sbt.ForkMain$Run.runTestSafe(ForkMain.java:211)
    at sbt.ForkMain$Run.runTests(ForkMain.java:187)
    at sbt.ForkMain$Run.run(ForkMain.java:251)

我的配置如下:
-我的ApplicationBuild.scala此处
-我的plugins.sbt存在此处
-我的build.properties存在此处

My configuration is the following:
- My ApplicationBuild.scala is present here
- My plugins.sbt is present here
- My build.properties is present here

但是,如果我只是更改这一行:

But if I just change this line:

javaOptions in (Test,run) ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled")

通过此行:

javaOptions ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled")

整个作品.

为什么指定(Test, run)会使整体失败?

Why specifying (Test, run) make the whole fail?

我是否错过了除Testrun之外的某些指定任务?

Am I missing some specified tasks other than Test and run?

我真的很想弄清楚:)

推荐答案

在您的配置中

javaOptions in (Test,run) ++= Seq(...)

说配置测试和用于键运行,但是运行测试不是通过键运行来完成,而是通过键测试来完成,因此您已经定义了除运行测试之外的其他设置

says configuration Test and for key run, but running the tests are not done with the key run, it is done with the key test, so you have defined the setting for something else than running the tests

javaOptions in (Test,test) ++= Seq(...)

或者只是

javaOptions in (Test) ++= Seq(...)

应该带你到那里!

这篇关于派生测试失败,因为javaOptions似乎配置错​​误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆