* Remove @switch when it doesn't take effect * Use ActorRef.noSender * Minor tweaks to SchedulerSpec * Disambiguate TypedActor for Scala 3 * Bump ScalaTest to a version compatible with Scala 3 * Bump ScalaCheck * Disambiguate Event in SupervisorHierarchySpec * Scala 3 compatible EventBusSpec * Prevent private unused variables to be erased by Scala 3 * Bump mockito * Explicit actorRef2Scala import * restore original .scalafix.conf * Scala 3 compatible tailrec * Reminder to re add switch annotation in case * Move to nowarn instead of silencer * Bump to Scala 2.12.13 * Cross compatible annotations * fix docs generation * adapt the build for Scala 3 * fix errors but bus * remove more SerialVersion from trait * scalacheck only from scalatest * cross-compile akka-actor-tests * restore cross-compilation * early initializers workaround * scalacheck switch * cross compatible FSM.State class * cross compatible LARS spec * Change results to pass LineNumberSpec * fix stackoverflow in AsyncDnsResolverIntegrationSpec * FSM.State unapply * fix Scala 2.13 mima * SerialVersionRemover compiler plugin * removed unused nowarns
75 lines
3 KiB
Scala
75 lines
3 KiB
Scala
/*
|
|
* Copyright (C) 2016-2021 Lightbend Inc. <https://www.lightbend.com>
|
|
*/
|
|
|
|
package akka
|
|
|
|
import sbt.Keys._
|
|
import sbt._
|
|
|
|
object TestExtras {
|
|
|
|
object Filter {
|
|
object Keys {
|
|
val excludeTestNames = settingKey[Set[String]](
|
|
"Names of tests to be excluded. Not supported by MultiJVM tests. Example usage: -Dakka.test.names.exclude=TimingSpec")
|
|
val excludeTestTags = settingKey[Set[String]](
|
|
"Tags of tests to be excluded. It will not be used if you specify -Dakka.test.tags.only. Example usage: -Dakka.test.tags.exclude=long-running")
|
|
val onlyTestTags =
|
|
settingKey[Set[String]]("Tags of tests to be ran. Example usage: -Dakka.test.tags.only=long-running")
|
|
|
|
val checkTestsHaveRun = taskKey[Unit]("Verify a number of notable tests have actually run");
|
|
}
|
|
|
|
import Keys._
|
|
|
|
private[Filter] object Params {
|
|
val testNamesExclude = systemPropertyAsSeq("akka.test.names.exclude").toSet
|
|
val testTagsExlcude = systemPropertyAsSeq("akka.test.tags.exclude").toSet
|
|
val testTagsOnly = systemPropertyAsSeq("akka.test.tags.only").toSet
|
|
}
|
|
|
|
def settings = {
|
|
Seq(
|
|
excludeTestNames := Params.testNamesExclude,
|
|
excludeTestTags := {
|
|
if (onlyTestTags.value.isEmpty) Params.testTagsExlcude
|
|
else Set.empty
|
|
},
|
|
onlyTestTags := Params.testTagsOnly,
|
|
// add filters for tests excluded by name
|
|
testOptions in Test ++= excludeTestNames.value.toSeq.map(exclude =>
|
|
Tests.Filter(test => !test.contains(exclude))),
|
|
// add arguments for tests excluded by tag
|
|
testOptions in Test ++= {
|
|
val tags = excludeTestTags.value
|
|
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument("-l", tags.mkString(" ")))
|
|
},
|
|
// add arguments for running only tests by tag
|
|
testOptions in Test ++= {
|
|
val tags = onlyTestTags.value
|
|
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument("-n", tags.mkString(" ")))
|
|
},
|
|
checkTestsHaveRun := {
|
|
def shouldExist(description: String, filename: String): Unit =
|
|
require(file(filename).exists, s"$description should be run as part of the build")
|
|
|
|
List(
|
|
"The java JavaExtension.java" -> "akka-actor-tests/target/test-reports/TEST-akka.actor.JavaExtension.xml",
|
|
"The jdk9-only FlowPublisherSinkSpec.scala" -> "akka-stream-tests/target/test-reports/TEST-akka.stream.scaladsl.FlowPublisherSinkSpec.xml",
|
|
"The jdk9-only JavaFlowSupportCompileTest.java" -> "akka-stream-tests/target/test-reports/TEST-akka.stream.javadsl.JavaFlowSupportCompileTest.xml")
|
|
.foreach((shouldExist _).tupled)
|
|
})
|
|
}
|
|
|
|
def containsOrNotExcludesTag(tag: String) = {
|
|
Params.testTagsOnly.contains(tag) || !Params.testTagsExlcude(tag)
|
|
}
|
|
|
|
def systemPropertyAsSeq(name: String): Seq[String] = {
|
|
val prop = sys.props.get(name).getOrElse("")
|
|
if (prop.isEmpty) Seq.empty else prop.split(",").toSeq
|
|
}
|
|
}
|
|
|
|
}
|