Hi Rich,
On Mon, 22 Jul 2013 17:31:01 -0700 (PDT)
Richard Johnson <
rjoh...@goaldesigns.com> wrote:
> Has this been fixed in 0.13?
>
> I am trying to create a "debug" testing configuration using 0.13.0-RC3 but
> it doesn't use the specified javaOptions when running "debug:test". I
> followed the instructions in
>
http://www.scala-sbt.org/0.13.0/docs/Detailed-Topics/Testing.html that
> describe adding a configuration to control testing. Here's a test project
> SBT file:
>
> lazy val TopProj = Project(id = "Top", base = file(".")).configs(TestDebug)
>
> lazy val TestDebug = config("debug") extend Test
>
> // Change the configuration from "TestDebug" to "Test" and it will work -
> for all testing...
> inConfig(TestDebug)(Seq(
> fork in ThisBuild := true,
> javaOptions in ThisBuild ++= Seq(
> "-Xdebug",
> "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005",
> "-Xms512M", "-Xmx1200M", "-Xss1M", "-XX:MaxPermSize=384M" )
> ))
>
> libraryDependencies in ThisBuild ++= Seq(
> "org.specs2" %% "specs2" % "2.1" % "test" withSources() withJavadoc()
> )
(Side note: the updateClassifiers task is recommended. withSources/withJavadoc was mainly used before updateClassifiers existed. IDE integration in particular will handle this automatically.)
> Make sure you add a valid test source file in "src/test/scala" so that
> testing actually starts the JVM. As I'm sure that you're aware, this will
> start the JVM and immediately suspend it waiting for a debugger to attach
> to the process.
>
> Running either "test" or "debug:test" runs the test without suspending. If
> I change the "inConfig(TestDebug)" to "inConfig(Test)" running either
> "test" or "debug:test" suspends and works as expected. However, this isn't
> a usable solution since all test execution now suspends. I plan on using
> "debug:testOnly aFailingTest" to run failing tests in the debugger.
The missing piece from the Testing page is putting:
inConfig(TestDebug)( Defaults.testTasks )
before the other settings (if following the shared sources section). This adds the actual test tasks to that configuration. Otherwise, debug:test is just delegating to test:test.
You can verify this with `inspect debug:test` and looking at Provided By. You can also see that the debug settings are unused with `inspect debug:javaOptions` and seeing no reverse dependencies. Then, look at `inspect test:javaOptions` and see that it gets used by testGrouping.
(I've thought about not delegating from the command line to avoid this confusion, but I'm not sure of the side effects yet.)
> BTW, the new features in 0.13 are great.
Thanks for the feedback!
-Mark
> Rich
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
simple-build-t...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/simple-build-tool.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>