Skip to content

Commit 23e9ae5

Browse files
Clean tests output
An environmental variable is assumed to be set on CI runs to distinguish them from local runs. Do not pollute the tests output with statements that a certain test was executed.
1 parent fd3e321 commit 23e9ae5

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Dotty CI
22

33
on: [push, pull_request]
44

5+
env:
6+
DOTTY_CI_RUN: true
7+
58
jobs:
69
test:
710
runs-on: self-hosted

compiler/test/dotty/Properties.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ object Properties {
1111
prop == null || prop == "TRUE"
1212
}
1313

14-
/** Are we running on the Drone CI? */
15-
val isRunByDrone: Boolean = sys.env.isDefinedAt("DRONE")
14+
/** Are we running on the CI? */
15+
val isRunByCI: Boolean = sys.env.isDefinedAt("DOTTY_CI_RUN")
16+
|| sys.env.isDefinedAt("DRONE") // TODO remove this when we drop Drone
1617

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

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,21 +417,15 @@ trait ParallelTesting extends RunnerOrchestration { self =>
417417
* if it did, the test should automatically fail.
418418
*/
419419
protected def tryCompile(testSource: TestSource)(op: => Unit): Unit =
420-
try {
421-
val testing = s"Testing ${testSource.title}"
422-
summaryReport.echoToLog(testing)
423-
if (!isInteractive) realStdout.println(testing)
424-
op
425-
} catch {
426-
case e: Throwable => {
420+
try op
421+
catch
422+
case e: Throwable =>
427423
// if an exception is thrown during compilation, the complete test
428424
// run should fail
429425
failTestSource(testSource)
430426
e.printStackTrace()
431427
registerCompletion()
432428
throw e
433-
}
434-
}
435429

436430
protected def compile(files0: Array[JFile], flags0: TestFlags, suppressErrors: Boolean, targetDir: JFile): TestReporter = {
437431
val flags = flags0.and("-d", targetDir.getPath)

compiler/test/dotty/tools/vulpix/SummaryReport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,5 @@ final class SummaryReport extends SummaryReporting {
147147
}
148148

149149
object SummaryReport {
150-
val isInteractive = Properties.testsInteractive && !Properties.isRunByDrone
150+
val isInteractive = Properties.testsInteractive && !Properties.isRunByCI
151151
}

0 commit comments

Comments
 (0)