This repository was archived by the owner on Sep 8, 2022. It is now read-only.
Commit 51bf4ba
committed
Add synchronization when sending events to sbt (fix ArrayIOBException).
Partest shows a single `Task` to sbt and does all the concurrency and
running subtasks itself, which isn't really how this should work, so sbt
doesn't expect the task to send back events concurrently:
`EventHandler.handle` adds events to an `ArrayList` when forking (see
[ForkMain][2]), and is called after each test, and if it happens on two
threads at exactly the wrong moment:
```
Caused by: sbt.ForkMain$ForkError: java.lang.ArrayIndexOutOfBoundsException: 15
at java.util.ArrayList.add(ArrayList.java:459)
at sbt.ForkMain$Run$2$1.handle(ForkMain.java:294)
at scala.tools.partest.sbt.SBTRunner$$anon$1.onFinishTest(SBTRunner.scala:70)
at scala.tools.partest.nest.SuiteRunner.runTest(Runner.scala:781)
at scala.tools.partest.nest.SuiteRunner.$anonfun$runTestsForFiles$2(Runner.scala:788)
at scala.tools.partest.package$$anon$2.call(package.scala:135)
```
See scala/scala#5663 ([build log][1] or the failed run).
[1]: https://scala-ci.typesafe.com/job/scala-2.12.x-validate-test/4300/consoleFull
[2]: https://github.com/sbt/sbt/blob/v0.13.13/testing/agent/src/main/java/sbt/ForkMain.java#L2941 parent 476e9d2 commit 51bf4ba
1 file changed
+10
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
0 commit comments