aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/Properties.scala
blob: 70db82092619f92c3db8cc11066610e5355d80a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package dotty

/** Runtime properties from defines or environmnent */
object Properties {

  /** If property is unset or "TRUE" we consider it `true` */
  private[this] def propIsNullOrTrue(prop: String): Boolean = {
    val prop = System.getProperty("dotty.tests.interactive")
    prop == null || prop == "TRUE"
  }

  /** Are we running on the Drone CI? */
  val isRunByDrone: Boolean = sys.env.isDefinedAt("DRONE")

  /** Tests should run interactive? */
  val testsInteractive: Boolean = propIsNullOrTrue("dotty.tests.interactive")

  /** Filter out tests not matching the regex supplied by "dotty.tests.filter"
   *  define
   */
  val testsFilter: Option[String] = sys.props.get("dotty.tests.filter")

  /** When set, the run tests are only compiled - not run, a warning will be
   *  issued
   */
  val testsNoRun: Boolean = sys.props.get("dotty.tests.norun").isDefined

  /** Should Unit tests run in safe mode?
   *
   *  For run tests this means that we respawn child JVM processes after each
   *  test, so that they are never reused.
   */
  val testsSafeMode: Boolean = sys.props.isDefinedAt("dotty.tests.safemode")

  /** Dotty compiler path provided through define */
  def dottyCompiler: String = sys.props("dotty.tests.classes.compiler")

  /** Dotty classpath extras provided through define */
  def dottyExtras: List[String] =
    Option(sys.props("dotty.tests.extraclasspath"))
      .map(_.split(":").toList)
      .getOrElse(Nil)

  /** Dotty interfaces path provided through define */
  def dottyInterfaces: String = sys.props("dotty.tests.classes.interfaces")

  /** Dotty library path provided through define */
  def dottyLib: String = sys.props("dotty.tests.classes.library")
}