Turn off parallel testing on sbt command line

When I run my test suites in the GitLab CI/CD pipeline, I get a java out of memory error which I don’t get when I run them inside IntelliJ. Unfortunately the tests are being run in parallel and all the test output is interwoven in the output so I can’t figure out which test is the culprit.

I found this stackoverflow issue about turning off parallel testing in sbt.

parallelExecution in Test := false

How can I specify this on the sbt command line?

Here is the command line I’m currently using

sbt -Dsbt.log.noformat=true test
1 Like

Here is the kind of output I’m seeing in the GitLab pipeline log.


465 n=26 st=DC
466 Exception in thread "classloader-cache-cleanup-0" java.lang.OutOfMemoryError: Java heap space
467 [info] MapColoringTestSuite:
468 [info] TreeReduceSuite:
469 [info] - coloring
470 [info] - lorem ipsum
471 [info] - europe
472 [info] - sets
473 [info] bdd.MapColoringTestSuite *** ABORTED ***
474 [info] - intervals
475 [info]   java.lang.OutOfMemoryError: Java heap space
476 [info] treereduce.TreeReduceSuite *** ABORTED ***
477 [info]   at scala.collection.mutable.HashMap.get(HashMap.scala:76)
478 [info]   java.lang.OutOfMemoryError: Java heap space
479 [info]   at bdd.BinaryOperation.memoize(BinaryOperation.scala:70)
480 [info]   at java.base/java.math.MutableBigInteger.toBigInteger(MutableBigInteger.java:186)
481 [info]   at bdd.And$.apply(BinaryOperation.scala:117)
482 [info]   at java.base/java.math.BigInteger.gcd(BigInteger.java:2581)
483 [info]   at bdd.BinaryOperation.bddOp(BinaryOperation.scala:102)
484 [info]   at spire.math.SafeLongBigInteger.gcd(SafeLong.scala:483)
485 [info]   at bdd.And$.$anonfun$apply$3(BinaryOperation.scala:117)
486 [info]   at spire.math.Rational$.apply(Rational.scala:332)
487 [info]   at bdd.And$$$Lambda$7670/0x00000008421e6840.apply(Unknown Source)
488 [info]   at spire.math.Rational$LongRational.$plus(Rational.scala:497)
489 [info]   at bdd.BinaryOperation.memoize(BinaryOperation.scala:74)
490 [info]   at spire.math.Rational$BigRational.$plus(Rational.scala:729)
491 [info]   at bdd.And$.apply(BinaryOperation.scala:117)
492 [info]   at treereduce.TreeReduceSuite.$anonfun$new$48(TreeReduceSuite.scala:144)
493 [info]   at bdd.BinaryOperation.bddOp(BinaryOperation.scala:102)
494 [info]   at treereduce.TreeReduceSuite$$Lambda$8199/0x00000008423a6840.apply(Unknown Source)
495 [info]   at bdd.And$.$anonfun$apply$3(BinaryOperation.scala:117)
496 [info]   at scala.collection.TraversableOnce.$anonfun$foldLeft$1(TraversableOnce.scala:160)
497 [info]   ...
498 [info]   at scala.collection.TraversableOnce.$anonfun$foldLeft$1$adapted(TraversableOnce.scala:160)
499 [info]   ...
500 java.lang.OutOfMemoryError: Java heap space
501 	at java.base/java.math.MutableBigInteger.toBigInteger(MutableBigInteger.java:186)
502 	at java.base/java.math.BigInteger.gcd(BigInteger.java:2581)
503 	at spire.math.SafeLongBigInteger.gcd(SafeLong.scala:483)
504 	at spire.math.Rational$.apply(Rational.scala:332)

this should work:

sbt -Dsbt.log.noformat=true "set parallelExecution in Test := false" test

2 Likes

works well. thanks.

I’m now getting a message that this is deprecated syntax:

390<set>:1: warning: method in in trait ScopingSetting is deprecated (since 1.5.0): `in` is deprecated; migrate to slash syntax - https://www.scala-sbt.org/1.x/docs/Migrating-from-sbt-013x.html#slash
391parallelExecution in Test := false

I tried to follow the instructions on the indicated web page, but can’t get it right.
I tried the following command line, but it is apparently still wrong:

sbt -Dsbt.log.noformat=true "Test / parallelExecution := false" "testOnly -- -l enhancement"

Here is the error

391[error] Expected whitespace character
392[error] Expected '/'
393[error] Test / parallelExecution := false
394[error]                          ^
395[error] Expected whitespace character
396[error] Expected '/'
397[error] Test / parallelExecution := false

adding a set works

sbt -Dsbt.log.noformat=true "set Test / parallelExecution := false" "testOnly -- -l enhancement"
2 Likes