Testing macro usage

86 views
Skip to first unread message

Stefan Zeiger

unread,
May 4, 2012, 4:46:49 AM5/4/12
to simple-b...@googlegroups.com
Hi,

Is anyone testing macro code successfully with sbt? We're running into
what seems to be a classloader issue:

[info] Test scala.slick.test.queryable.QueryableTest.test[0] started
[Using test database jdbc:h2:mem:test1]
[error] Test scala.slick.test.queryable.QueryableTest.test[0] failed:
class scala.slick.test.queryable.QueryableTest not found.
[error] at
scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16)
[error] at
scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17)
[error] at
scala.reflect.internal.Definitions$DefinitionsClass$$anonfun$getModuleOrClass$3.apply(Definitions.scala:1134)
[error] at
scala.reflect.internal.Definitions$DefinitionsClass.getModuleOrClass(Definitions.scala:1133)
[error] at
scala.reflect.internal.Definitions$DefinitionsClass.getModuleOrClass(Definitions.scala:1142)
[error] at
scala.reflect.internal.Definitions$DefinitionsClass.getClassByName(Definitions.scala:1145)
[error] at
scala.reflect.internal.Definitions$DefinitionsClass.getRequiredClass(Definitions.scala:1040)
[error] at
scala.reflect.runtime.ClassLoaders$class.staticClass(ClassLoaders.scala:7)
[error] at scala.reflect.runtime.Universe.staticClass(Universe.scala:11)
[error] at scala.reflect.runtime.Universe.staticClass(Universe.scala:11)
[error] at
scala.slick.test.queryable.QueryableTest.test(QueryableTest.scala:78)
[error] ...

I thought maybe forked tests (either using some built-in mechanism in
sbt or custom code which constructs the right classpath and launches the
thing) would help but I wanted to check if anyone else has already run
into this and implemented a solution.

Cheers,
Stefan

Eugene Vigdorchik

unread,
May 4, 2012, 6:28:10 AM5/4/12
to simple-b...@googlegroups.com
Not answering you question, but I'd appreciate it if you could try
forking tests in sbt-0.12-beta2 for a solution.

Thanks,
Eugene.
> or
> custom code which constructs the right classpath and launches the thing)
> would help but I wanted to check if anyone else has already run into this
> and implemented a solution.
>
> Cheers,
> Stefan
>
> --
> You received this message because you are subscribed to the Google Groups
> "simple-build-tool" group.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to
> simple-build-t...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/simple-build-tool?hl=en.
>

Stefan Zeiger

unread,
May 4, 2012, 6:35:01 AM5/4/12
to simple-b...@googlegroups.com
On 2012-05-04 12:28, Eugene Vigdorchik wrote:
> Not answering you question, but I'd appreciate it if you could try
> forking tests in sbt-0.12-beta2 for a solution.

I can't run any tests with forking:

[error] Execution of test scala.slick.test.ql.UnionTest failed
[error] at com.novocode.junit.JUnitRunner.run(JUnitRunner.java:76)
[error] at sbt.ForkMain$Run.run(ForkMain.java:134)
[error] at sbt.ForkMain.main(ForkMain.java:70)

The line in question is here:
https://github.com/szeiger/junit-interface/blob/0.9-RC1/src/main/java/com/novocode/junit/JUnitRunner.java#L76

Unfortunately, the stack trace printed by sbt is not very helpful
(where's the actual error message?), so I'll have to debug this further.

I also tried running a forked test with test:run-main but that failed in
the same way as a regular non-forked test run. sbt seems to create a
classloader hierarchy for these forked runs which has the same problem
as the one in sbt itself.

-sz

Stefan Zeiger

unread,
May 4, 2012, 6:46:54 AM5/4/12
to simple-b...@googlegroups.com
On 2012-05-04 12:35, Stefan Zeiger wrote:
> Unfortunately, the stack trace printed by sbt is not very helpful
> (where's the actual error message?), so I'll have to debug this further.

Ah, here we go:

java.lang.ClassCastException: sbt.ForkMain$AnnotatedFingerscan cannot be
cast to com.novocode.junit.AbstractFingerprint

So I don't get my own fingerprints when running in forked mode. But then
I can't tell anymore by which of my fingerprints a test was matched,
right? I need to decide whether to run them at all depending on the
fingerprint because some classes will be matched by multiple fingerprints.

-sz

Eugene Vigdorchik

unread,
May 4, 2012, 6:50:56 AM5/4/12
to simple-b...@googlegroups.com
On Fri, May 4, 2012 at 2:46 PM, Stefan Zeiger <szei...@googlemail.com> wrote:
> On 2012-05-04 12:35, Stefan Zeiger wrote:
>>
>> Unfortunately, the stack trace printed by sbt is not very helpful (where's
>> the actual error message?), so I'll have to debug this further.
>
>
> Ah, here we go:
>
> java.lang.ClassCastException: sbt.ForkMain$AnnotatedFingerscan cannot be
> cast to com.novocode.junit.AbstractFingerprint
>
> So I don't get my own fingerprints when running in forked mode. But then I
> can't tell anymore by which of my fingerprints a test was matched, right?
True, but the decision what tests to run are made by the framework in
sbt process, so everything that goes to subprocess should be run.

Eugene.
> I need to decide whether to run them at all depending on the fingerprint
> because some classes will be matched by multiple fingerprints.
>
>
> -sz
>

Stefan Zeiger

unread,
May 4, 2012, 7:05:31 AM5/4/12
to simple-b...@googlegroups.com
On 2012-05-04 12:50, Eugene Vigdorchik wrote:
> True, but the decision what tests to run are made by the framework in
> sbt process, so everything that goes to subprocess should be run.

That doesn't work as long as we don't get properly delineated test runs
(with the new test-interface). Take this test case for example:

@RunWith[classOf[JUnit]]
class MyTest {
@Test def myTest() {
assertTrue(true)
}
}

It will be matched by 2 different fingerprints (@RunWith, @Test) because
each of these criteria alone would be enough to define a test. Even
though they point to the same thing ("run MyTest with JUnitCore"), sbt
will send junit-interface 2 independent requests to run the test, one
per fingerprint. To work around this issue, I examine the test class and
the fingerprint and if it was matched by the fingerprint for @Test but
it also has a @RunWith annotation, I don't run it.

Anyway, after posting my previous reply I realized that I can do that
based on the public API of Fingerprint, and implementing a fix
(https://github.com/szeiger/junit-interface/commit/bc42bfc9a551620d8a74a7e19d6c9394fc270977)
took less time than writing this message. Forked tests are working fine
now, including the macro test case which failed due to classloader
issues in the non-forking setup.

-sz

Stefan Zeiger

unread,
May 4, 2012, 7:10:10 AM5/4/12
to simple-b...@googlegroups.com
On 2012-05-04 13:05, Stefan Zeiger wrote:
> Forked tests are working fine now, including the macro test case which
> failed due to classloader issues in the non-forking setup.

Spoken too soon. sbt only forks for "test" but not for the much more
essential "test-only". Is that also implemented in the beta?

-sz

Eugene Vigdorchik

unread,
May 4, 2012, 7:13:41 AM5/4/12
to simple-b...@googlegroups.com
It is. I'll check, thank you for letting me know.

Eugene.

Eugene Vigdorchik

unread,
May 4, 2012, 7:19:28 AM5/4/12
to simple-b...@googlegroups.com
On Fri, May 4, 2012 at 3:13 PM, Eugene Vigdorchik
<eugene.v...@gmail.com> wrote:
> On Fri, May 4, 2012 at 3:10 PM, Stefan Zeiger <szei...@googlemail.com> wrote:
>> On 2012-05-04 13:05, Stefan Zeiger wrote:
>>>
>>> Forked tests are working fine now, including the macro test case which
>>> failed due to classloader issues in the non-forking setup.
>>
>>
>> Spoken too soon. sbt only forks for "test" but not for the much more
>> essential "test-only". Is that also implemented in the beta?
> It is. I'll check, thank you for letting me know.
It is currently configured separately for test, testOnly and testQuick, so
fork in testOnly := true
should help. Maybe such distinction does not make sense, and we should
use fork in test always.

Eugene.

Mark Harrah

unread,
May 4, 2012, 7:52:08 AM5/4/12
to simple-b...@googlegroups.com
On Fri, 4 May 2012 15:19:28 +0400
Eugene Vigdorchik <eugene.v...@gmail.com> wrote:

> On Fri, May 4, 2012 at 3:13 PM, Eugene Vigdorchik
> <eugene.v...@gmail.com> wrote:
> > On Fri, May 4, 2012 at 3:10 PM, Stefan Zeiger <szei...@googlemail.com> wrote:
> >> On 2012-05-04 13:05, Stefan Zeiger wrote:
> >>>
> >>> Forked tests are working fine now, including the macro test case which
> >>> failed due to classloader issues in the non-forking setup.
> >>
> >>
> >> Spoken too soon. sbt only forks for "test" but not for the much more
> >> essential "test-only". Is that also implemented in the beta?
> > It is. I'll check, thank you for letting me know.
> It is currently configured separately for test, testOnly and testQuick, so
> fork in testOnly := true
> should help. Maybe such distinction does not make sense, and we should
> use fork in test always.

fork in Test := true should be the recommended setting as it will fork testOnly and testQuick. It will fork test:run as well, but that is probably ok.

-Mark

Eugene Vigdorchik

unread,
May 4, 2012, 7:58:24 AM5/4/12
to simple-b...@googlegroups.com
I agree that should be implemented. However currently, I afraid, it's not.

Eugene.
>  It will fork test:run as well, but that is probably ok.
>
> -Mark
>

Mark Harrah

unread,
May 4, 2012, 8:17:36 AM5/4/12
to simple-b...@googlegroups.com
On Fri, 4 May 2012 15:58:24 +0400
Eugene Vigdorchik <eugene.v...@gmail.com> wrote:

> On Fri, May 4, 2012 at 3:52 PM, Mark Harrah <dmha...@gmail.com> wrote:
> > On Fri, 4 May 2012 15:19:28 +0400
> > Eugene Vigdorchik <eugene.v...@gmail.com> wrote:
> >
> >> On Fri, May 4, 2012 at 3:13 PM, Eugene Vigdorchik
> >> <eugene.v...@gmail.com> wrote:
> >> > On Fri, May 4, 2012 at 3:10 PM, Stefan Zeiger <szei...@googlemail.com> wrote:
> >> >> On 2012-05-04 13:05, Stefan Zeiger wrote:
> >> >>>
> >> >>> Forked tests are working fine now, including the macro test case which
> >> >>> failed due to classloader issues in the non-forking setup.
> >> >>
> >> >>
> >> >> Spoken too soon. sbt only forks for "test" but not for the much more
> >> >> essential "test-only". Is that also implemented in the beta?
> >> > It is. I'll check, thank you for letting me know.
> >> It is currently configured separately for test, testOnly and testQuick, so
> >> fork in testOnly := true
> >> should help. Maybe such distinction does not make sense, and we should
> >> use fork in test always.
> >
> > fork in Test := true should be the recommended setting as it will fork testOnly and testQuick.
> I agree that should be implemented. However currently, I afraid, it's not.

testExecution is defined for each task and configures itself from 'fork in (Test,<task>)'. So, if you set fork in Test to true, fork in (Test, <task>) will also be true and testExecution will fork. What am I missing?

-Mark

Eugene Vigdorchik

unread,
May 4, 2012, 8:31:08 AM5/4/12
to simple-b...@googlegroups.com
On Fri, May 4, 2012 at 4:17 PM, Mark Harrah <dmha...@gmail.com> wrote:
> On Fri, 4 May 2012 15:58:24 +0400
> Eugene Vigdorchik <eugene.v...@gmail.com> wrote:
>
>> On Fri, May 4, 2012 at 3:52 PM, Mark Harrah <dmha...@gmail.com> wrote:
>> > On Fri, 4 May 2012 15:19:28 +0400
>> > Eugene Vigdorchik <eugene.v...@gmail.com> wrote:
>> >
>> >> On Fri, May 4, 2012 at 3:13 PM, Eugene Vigdorchik
>> >> <eugene.v...@gmail.com> wrote:
>> >> > On Fri, May 4, 2012 at 3:10 PM, Stefan Zeiger <szei...@googlemail.com> wrote:
>> >> >> On 2012-05-04 13:05, Stefan Zeiger wrote:
>> >> >>>
>> >> >>> Forked tests are working fine now, including the macro test case which
>> >> >>> failed due to classloader issues in the non-forking setup.
>> >> >>
>> >> >>
>> >> >> Spoken too soon. sbt only forks for "test" but not for the much more
>> >> >> essential "test-only". Is that also implemented in the beta?
>> >> > It is. I'll check, thank you for letting me know.
>> >> It is currently configured separately for test, testOnly and testQuick, so
>> >> fork in testOnly := true
>> >> should help. Maybe such distinction does not make sense, and we should
>> >> use fork in test always.
>> >
>> > fork in Test := true should be the recommended setting as it will fork testOnly and testQuick.
>> I agree that should be implemented. However currently, I afraid, it's not.
>
> testExecution is defined for each task and configures itself from 'fork in (Test,<task>)'.  So, if you set fork in Test to true, fork in (Test, <task>) will also be true and testExecution will fork.  What am I missing?
Yes, you are right. I missed the 'fork in Test' part and tried 'fork
in test'. Notice however that it's not testExecution, but a test group
that decides whether to fork. BTW, the code in testExecutionTask that
maps over fork can drop fork there.

Eugene.

Stefan Zeiger

unread,
May 9, 2012, 7:52:32 AM5/9/12
to simple-b...@googlegroups.com
I ran into another issue with forking: The test report in the end is
wrong. If you look at the attached log, you'll see failure events for
the following tests:

scala.slick.test.ql.UnionTest.test[1]
scala.slick.test.ql.UnionTest.testUnionWithoutProjection[1]
scala.slick.test.ql.TemplateTest.test[1]
scala.slick.test.ql.ql.DataTypeTest.testNumeric[1]
scala.slick.test.ql.ScalarFunctionTest.test[1]
scala.slick.test.ql.MainTest.test[0]
scala.slick.test.ql.MapperTest.testMappedEntity[1]
scala.slick.test.ql.MapperTest.testUpdate[1]
scala.slick.test.ql.UUIDTest.test[1]

But the summary printed by sbt at the end shows these failed tests instead:

[error] Failed tests:
[error] scala.slick.test.ql.UnionTest.test[0]
[error] scala.slick.test.ql.ql.DataTypeTest.testNumeric[0]
[error] scala.slick.test.ql.MainTest.test[0]
[error] scala.slick.test.ql.TemplateTest.test[0]
[error] scala.slick.test.ql.UUIDTest.test[0]
[error] scala.slick.test.ql.MapperTest.testMappedEntity[0]
[error] scala.slick.test.ql.ScalarFunctionTest.test[0]

If I run without forking, I get the following report:

[error] Failed tests:
[error] scala.slick.test.queryable.QueryableTest // this one
fails because it needs to be forked
[error] scala.slick.test.ql.ql.DataTypeTest
[error] scala.slick.test.ql.MapperTest
[error] scala.slick.test.ql.MainTest
[error] scala.slick.test.ql.UUIDTest
[error] scala.slick.test.ql.TemplateTest
[error] scala.slick.test.ql.UnionTest
[error] scala.slick.test.ql.ScalarFunctionTest

So if you take just the class name, the report is correct in both bases,
but the forked test run tries to be more specific and print the actual
test case names, and these are completly wrong.
test.log

Stefan Zeiger

unread,
May 9, 2012, 8:14:37 AM5/9/12
to simple-b...@googlegroups.com
On 2012-05-09 13:52, Stefan Zeiger wrote:
> I ran into another issue with forking: The test report in the end is
> wrong. If you look at the attached log, you'll see failure events for
> the following tests:

Another issue: "logBuffered := false" seems to have no effect on forked
test runs. The output from the sbt logging and my replayed console
output is mixed up.

Eugene Vigdorchik

unread,
May 9, 2012, 11:12:50 AM5/9/12
to simple-b...@googlegroups.com
I don't quite understand: isn't 'logBuffered := false' supposed to
make logging immediate rather than buffered, so mix it with console
output?
However it's true that forking uses LoggedOutput to log everything
that the subprocess writes to its stdout. Is it your problem?

Cheers,
Eugene.

Eugene Vigdorchik

unread,
May 9, 2012, 11:14:22 AM5/9/12
to simple-b...@googlegroups.com
On Wed, May 9, 2012 at 3:52 PM, Stefan Zeiger <szei...@googlemail.com> wrote:
> I ran into another issue with forking: The test report in the end is wrong.
> If you look at the attached log, you'll see failure events for the following
> tests:
I'll look into this,
Thank you very much for the report,
Eugene.

Eugene Vigdorchik

unread,
May 9, 2012, 11:56:02 AM5/9/12
to simple-b...@googlegroups.com
By the way, you can configure multiple test groups, that will have
each own fork options in the same project. --Eugene.

Stefan Zeiger

unread,
May 10, 2012, 6:11:20 AM5/10/12
to simple-b...@googlegroups.com
On 2012-05-09 17:12, Eugene Vigdorchik wrote:
> On Wed, May 9, 2012 at 4:14 PM, Stefan Zeiger<szei...@googlemail.com> wrote:
>> On 2012-05-09 13:52, Stefan Zeiger wrote:
>>> I ran into another issue with forking: The test report in the end is
>>> wrong. If you look at the attached log, you'll see failure events for the
>>> following tests:
>>
>> Another issue: "logBuffered := false" seems to have no effect on forked test
>> runs. The output from the sbt logging and my replayed console output is
>> mixed up.
> I don't quite understand: isn't 'logBuffered := false' supposed to
> make logging immediate rather than buffered, so mix it with console
> output?
> However it's true that forking uses LoggedOutput to log everything
> that the subprocess writes to its stdout. Is it your problem?

Ah, you're right, it must be a different issue. I thought I needed
logBuffered := false but without forked tests, things works nicely
either way. I have junit-interface configured to buffer stdout and only
replay it if a test fails. Here's a sample output from a failed test
without forking:

[info] Test scala.slick.test.ql.UnionTest.testUnionWithoutProjection[0]
started
[Using test database jdbc:sqlite::memory:]
q: Union
left @1875208213: Wrapped
in: Filter
from @1387101257: [1] Table managers
where: Is
0: Wrapped
in: InRef @1387101257
value: <1>
what: RawNamedColumn name
1: ConstColumn[java.lang.String] Peter
what: <1>
right @154432519: Wrapped
in: Filter
from @2075838214: <1>
where: Is
0: Wrapped
in: InRef @2075838214
value: <1>
what: RawNamedColumn name
1: ConstColumn[java.lang.String] Amy
what: <1>
select * from (select a5."id", a5."name", a5."department" from
"managers" a5 where (a5."name"='Peter')) union (select a11."id", a11."name",
a11."department" from "managers" a11 where (a11."name"='Amy'))
[error] Test scala.slick.test.ql.UnionTest.testUnionWithoutProjection[0]
failed: [SQLITE_ERROR] SQL error or missing database (near "(": syntax
error)
[error] at org.sqlite.DB.newSQLException(DB.java:374)
[error] at org.sqlite.DB.newSQLException(DB.java:378)
[error] at org.sqlite.DB.throwex(DB.java:365)
[error] at org.sqlite.NestedDB.prepare(NestedDB.java:126)
[error] at org.sqlite.DB.prepare(DB.java:123)
[error] at org.sqlite.PrepStmt.this(PrepStmt.java:44)
[error] at org.sqlite.Conn.prepareStatement(Conn.java:403)
[error] at org.sqlite.Conn.prepareStatement(Conn.java:398)
[error] at
scala.slick.session.Session$class.prepareStatement(Session.scala:27)
[error] at
scala.slick.session.BaseSession.prepareStatement(Session.scala:94)
[error] at
scala.slick.jdbc.StatementInvoker.results(StatementInvoker.scala:29)
[error] at
scala.slick.jdbc.StatementInvoker.elementsTo(StatementInvoker.scala:17)
[error] at scala.slick.jdbc.Invoker$class.foreach(Invoker.scala:96)
[error] at
scala.slick.jdbc.StatementInvoker.foreach(StatementInvoker.scala:10)
[error] at scala.slick.jdbc.Invoker$class.build(Invoker.scala:65)
[error] at
scala.slick.jdbc.StatementInvoker.build(StatementInvoker.scala:10)
[error] at scala.slick.jdbc.Invoker$class.list(Invoker.scala:55)
[error] at
scala.slick.jdbc.StatementInvoker.list(StatementInvoker.scala:10)
[error] at scala.slick.jdbc.UnitInvoker$class.list(Invoker.scala:156)
[error] at
scala.slick.driver.BasicInvokerComponent$QueryInvoker.list(BasicInvokerComponent.scala:13)
[error] at
scala.slick.test.ql.UnionTest$$anonfun$testUnionWithoutProjection$1.apply$mcV$sp(UnionTest.scala:84)
[error] at
scala.slick.test.ql.UnionTest$$anonfun$testUnionWithoutProjection$1.apply(UnionTest.scala:71)
[error] at
scala.slick.test.ql.UnionTest$$anonfun$testUnionWithoutProjection$1.apply(UnionTest.scala:71)
[error] at
scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
[error] at
scala.slick.session.Database$$anonfun$withSession$1.apply(Database.scala:46)
[error] at
scala.slick.session.Database$$anonfun$withSession$1.apply(Database.scala:46)
[error] at scala.slick.session.Database.withSession(Database.scala:38)
[error] at scala.slick.session.Database.withSession(Database.scala:46)
[error] at
scala.slick.test.ql.UnionTest.testUnionWithoutProjection(UnionTest.scala:71)
[error] ...
[info] Test run finished: 2 failed, 0 ignored, 2 total, 0.155s

Stdout from the test goes directly to the console (not through the sbt
logger) and everything is nicely ordered (provided you set
parallelExecution in Test := false, of course, otherwise all bets are
off). With forked tests, I get something like this instead:

[info] Test scala.slick.test.ql.UnionTest.testUnionWithoutProjection[0]
started
[info] in: <8>
[info] what: RawNamedColumn name
[info] what: Wrapped
[info] in: <7>
[info] what: Wrapped
[info] in: <8>
[info] what: RawNamedColumn id
[info] 1: [9] Wrapped
[info] in: <4>
[info] what: Wrapped
[info] in: <7>
[info] what: Wrapped
[info] in: <8>
[info] what: RawNamedColumn name
[info] right @378689909: ProductNode
[info] 0: Wrapped
[info] in: [10] Bind
[info] from @1700966106: [11] Wrapped
[info] in: Filter
[info] from @835034678: [12] Table employees
[info] where: In
[info] 0: Wrapped
[info] in: InRef @835034678
[info] value: <12>
[info] what: RawNamedColumn manager
[info] 1: Bind
[info] from @622200001: [13] Wrapped
[info] in: Filter
[info] from @1217539564: <6>
[info] where: Is
[info] 0: Wrapped
[info] in: InRef @1217539564
[info] value: <6>
[info] what: RawNamedColumn department
[info] 1: ConstColumn[java.lang.String] IT
[info] what: <6>
[info] select: Pure
[info] value: Wrapped
[info] in: InRef @622200001
[info] value: <13>
[info] what: RawNamedColumn id
[info] what: <12>
[info] select: [14] Pure
[info] value: ProductNode
[info] 0: Wrapped
[info] in: [15] InRef @1700966106
[info] value: <11>
[info] what: RawNamedColumn id
[info] 1: Wrapped
[info] in: <15>
[info] what: RawNamedColumn name
[info] what: Wrapped
[info] in: <14>
[info] what: Wrapped
[info] in: <15>
[info] what: RawNamedColumn id
[info] 1: Wrapped
[info] in: <10>
[info] what: Wrapped
[info] in: <14>
[info] what: Wrapped
[info] in: <15>
[info] what: RawNamedColumn name
[info] what: <3>
[info] 1: [16] Wrapped
[info] in: <2>
[info] what: <9>
[info] select: Bind
[info] from @875322190: Wrapped
[info] in: OrderBy List((InRef
@1185181745,Ordering(Asc,NullsDefault)))
[info] from @1277065380: Pure
[info] value: ConstColumn[Unit] ()
[info] by0: [17] InRef @1185181745
[info] value: <16>
[info] what: Pure
[info] value: ConstColumn[Unit] ()
[info] select: Pure
[info] value: ProductNode
[info] 0: InRef @1185181745
[info] value: <1>
[info] 1: <17>
[info]
[info] Combined and sorted: select a1.a10, a1.a11 from (select * from
(select a6."id" as a10, a6."name" as a11 from "managers" a6 where
(a6."department"='IT')) union (select a14."id" as a10, a14."name" as a11
from "employees" a14 where (a14."manager" in (select a20."id" from
"managers" a20 where (a20."department"='IT'))))) a1 order by a1.a11
[info] [Using test database jdbc:sqlite::memory:]
[error] Test scala.slick.test.ql.UnionTest.testUnionWithoutProjection[0]
failed: [SQLITE_ERROR] SQL error or missing database (near "(": syntax
error)
[info] q: Union
[error] at org.sqlite.DB.newSQLException(DB.java:374)
[info] left @1329066519: Wrapped
[error] at org.sqlite.DB.newSQLException(DB.java:378)
[info] in: Filter
[error] at org.sqlite.DB.throwex(DB.java:365)
[info] from @438940141: [1] Table managers
[error] at org.sqlite.NativeDB.prepare(Native Method)
[info] where: Is
[error] at org.sqlite.DB.prepare(DB.java:123)
[info] 0: Wrapped
[error] at org.sqlite.PrepStmt.this(PrepStmt.java:44)
[info] in: InRef @438940141
[error] at org.sqlite.Conn.prepareStatement(Conn.java:403)
[info] value: <1>
[error] at org.sqlite.Conn.prepareStatement(Conn.java:398)
[info] what: RawNamedColumn name
[error] at
scala.slick.session.Session$class.prepareStatement(Session.scala:27)
[info] 1: ConstColumn[java.lang.String] Peter
[error] at
scala.slick.session.BaseSession.prepareStatement(Session.scala:94)
[info] what: <1>
[error] at
scala.slick.jdbc.StatementInvoker.results(StatementInvoker.scala:29)
[info] right @1643572386: Wrapped
[error] at
scala.slick.jdbc.StatementInvoker.elementsTo(StatementInvoker.scala:17)
[info] in: Filter
[error] at scala.slick.jdbc.Invoker$class.foreach(Invoker.scala:96)
[info] from @660622342: <1>
[error] at
scala.slick.jdbc.StatementInvoker.foreach(StatementInvoker.scala:10)
[info] where: Is
[error] at scala.slick.jdbc.Invoker$class.build(Invoker.scala:65)
[info] 0: Wrapped
[error] at
scala.slick.jdbc.StatementInvoker.build(StatementInvoker.scala:10)
[info] in: InRef @660622342
[error] at scala.slick.jdbc.Invoker$class.list(Invoker.scala:55)
[info] value: <1>
[error] at
scala.slick.jdbc.StatementInvoker.list(StatementInvoker.scala:10)
[info] what: RawNamedColumn name
[error] at scala.slick.jdbc.UnitInvoker$class.list(Invoker.scala:156)
[info] 1: ConstColumn[java.lang.String] Amy
[error] at
scala.slick.driver.BasicInvokerComponent$QueryInvoker.list(BasicInvokerComponent.scala:13)
[info] what: <1>
[error] at
scala.slick.test.ql.UnionTest$$anonfun$testUnionWithoutProjection$1.apply$mcV$sp(UnionTest.scala:84)
[info] select * from (select a5."id", a5."name", a5."department" from
"managers" a5 where (a5."name"='Peter')) union (select a11."id",
a11."name", a11."department" from "managers" a11 where (a11."name"='Amy'))
[error] at
scala.slick.test.ql.UnionTest$$anonfun$testUnionWithoutProjection$1.apply(UnionTest.scala:71)
[error] at
scala.slick.test.ql.UnionTest$$anonfun$testUnionWithoutProjection$1.apply(UnionTest.scala:71)
[error] at
scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
[error] at
scala.slick.session.Database$$anonfun$withSession$1.apply(Database.scala:46)
[error] at
scala.slick.session.Database$$anonfun$withSession$1.apply(Database.scala:46)
[error] at scala.slick.session.Database.withSession(Database.scala:38)
[error] at scala.slick.session.Database.withSession(Database.scala:46)
[error] at
scala.slick.test.ql.UnionTest.testUnionWithoutProjection(UnionTest.scala:71)
[error] ...
[info] Test run finished: 2 failed, 0 ignored, 2 total, 1.303s

All output goes through sbt's logger and it's all mixed up, even between
different tests. Maybe it's not executing them serially?

Stefan Zeiger

unread,
May 10, 2012, 6:24:39 AM5/10/12
to simple-b...@googlegroups.com
On 2012-05-09 17:56, Eugene Vigdorchik wrote:
> By the way, you can configure multiple test groups, that will have
> each own fork options in the same project. --Eugene.

Can you give an example? It's not clear to me from the short example in
the sbt wiki how I would split tests into one group that should be
forked and another one that should be run in the same JVM.

-sz

Eugene Vigdorchik

unread,
May 10, 2012, 7:49:15 AM5/10/12
to simple-b...@googlegroups.com
Mark has integrated a change that I believe will fix both of the
problems you listed:
https://github.com/harrah/xsbt/commit/04d53c05d56dfcd0d73eea4a5038f6d737781a25

Cheers,
Eugene.

Eugene Vigdorchik

unread,
May 10, 2012, 8:03:18 AM5/10/12
to simple-b...@googlegroups.com
Here it goes:

testGrouping <<= definedTests in Test map partitionTests

def partitionTests(tests: Seq[TestDefinition]) = {
val (fork, notFork) = tests partition (_.name contains "Fork")
Seq(
new Group("fork", fork, SubProcess(Seq())),
new Group("inProcess", notFork, InProcess)
)
}

HTH,

Stefan Zeiger

unread,
May 10, 2012, 10:38:54 AM5/10/12
to simple-b...@googlegroups.com
On 2012-05-10 14:03, Eugene Vigdorchik wrote:
> Here it goes:
>
> testGrouping<<= definedTests in Test map partitionTests
>
> def partitionTests(tests: Seq[TestDefinition]) = {
> val (fork, notFork) = tests partition (_.name contains "Fork")
> Seq(
> new Group("fork", fork, SubProcess(Seq())),
> new Group("inProcess", notFork, InProcess)
> )
> }

That somehow only runs the inProcess tests. The tests all get assigned
to the right group but the one I have in the fork group does not get run
at all.

-sz

Eugene Vigdorchik

unread,
May 10, 2012, 11:22:27 AM5/10/12
to simple-b...@googlegroups.com
Maybe they get run, but the tests expect some jvm options, that you
otherwise pass as javaOptions in Test?
You can map with those to obtain the SubProcess group rather than
using an empty Seq for jvm options that I used for an example. Else
I'm a bit lost and will need a project where you see the problem.

Cheers,

Stefan Zeiger

unread,
May 10, 2012, 11:47:56 AM5/10/12
to simple-b...@googlegroups.com
On 2012-05-10 17:22, Eugene Vigdorchik wrote:
> On Thu, May 10, 2012 at 6:38 PM, Stefan Zeiger<szei...@googlemail.com> wrote:
>> On 2012-05-10 14:03, Eugene Vigdorchik wrote:
>>> Here it goes:
>>>
>>> testGrouping<<= definedTests in Test map partitionTests
>>>
>>> def partitionTests(tests: Seq[TestDefinition]) = {
>>> val (fork, notFork) = tests partition (_.name contains "Fork")
>>> Seq(
>>> new Group("fork", fork, SubProcess(Seq())),
>>> new Group("inProcess", notFork, InProcess)
>>> )
>>> }
>>
>> That somehow only runs the inProcess tests. The tests all get assigned to
>> the right group but the one I have in the fork group does not get run at
>> all.
> Maybe they get run, but the tests expect some jvm options, that you
> otherwise pass as javaOptions in Test?

Sorry, that was a false alarm. They do in fact get run, I just had the
specific parameterization for them disabled so there were no actual
tests to run for the discovered class. Now they do get run properly.
They seem to run in parallel with the non-forked tests though, even with
"parallelExecution in Test := false". Is there a way to change that?

Cheers,
Stefan

Eugene Vigdorchik

unread,
May 10, 2012, 11:53:28 AM5/10/12
to simple-b...@googlegroups.com
Currently there isn't. I think the ForkedTestGroup tag could be
changed to place a limit on any group running concurrently,
or a new tag could be introduced. Thank you for bringing up this issue.

Cheers,
Eugene.
>
> Cheers,
> Stefan
Reply all
Reply to author
Forward
0 new messages