summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormergify[bot]2022-09-27 19:36:39 +0000
committerGitHub2022-09-27 19:36:39 +0000
commitf19556801137091fa79a6d79395985474527b72d (patch)
treea3727f78e6cac8a57531e47b16d827009f0649ca
parentc11eead29545799baf8c57e8c1b8b7351b98a258 (diff)
Use Treadle (on pull requests only) to speed up CI (backport #2341) (#2748)
* Support using Treadle for 'sbt test' Treadle will be used as the "defaultBackend" when the environment variable CHISEL3_CI_USE_TREADLE is set. The intent is to set this variable during CI for pre-merge CI (aka on pull requests). (cherry picked from commit 7d39b7bd2b6f38dac90fe25064744ffc0ada0fe4) * Use Treadle for CI on pull requests (cherry picked from commit 82660673e56a816e68fcc068e3e04e127f076faf) Co-authored-by: Jack Koenig <koenig@sifive.com>
-rw-r--r--.github/workflows/test.yml3
-rw-r--r--src/test/scala/chiselTests/ChiselSpec.scala5
-rw-r--r--src/test/scala/chiselTests/Vec.scala4
3 files changed, 9 insertions, 3 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9ace173e..139d5908 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -50,6 +50,9 @@ jobs:
- name: Documentation (Scala 2.12 only)
if: startsWith(matrix.scala, '2.12')
run: sbt ++${{ matrix.scala }} docs/mdoc unidoc
+ - name: Use Treadle for Pull Requests
+ if: github.event_name == 'pull_request'
+ run: echo "CHISEL3_CI_USE_TREADLE=1" >> $GITHUB_ENV
- name: Test
run: sbt ++${{ matrix.scala }} test
- name: Binary compatibility
diff --git a/src/test/scala/chiselTests/ChiselSpec.scala b/src/test/scala/chiselTests/ChiselSpec.scala
index 6f560b94..e00afcf6 100644
--- a/src/test/scala/chiselTests/ChiselSpec.scala
+++ b/src/test/scala/chiselTests/ChiselSpec.scala
@@ -38,7 +38,10 @@ trait ChiselRunners extends Assertions with BackendCompilationUtilities {
annotations: AnnotationSeq = Seq()
): Boolean = {
// Change this to enable Treadle as a backend
- val defaultBackend = chisel3.testers.TesterDriver.defaultBackend
+ val defaultBackend = {
+ val useTreadle = sys.env.get("CHISEL3_CI_USE_TREADLE").isDefined
+ if (useTreadle) chisel3.testers.TreadleBackend else chisel3.testers.TesterDriver.defaultBackend
+ }
val hasBackend = TestUtils.containsBackend(annotations)
val annos: Seq[Annotation] = if (hasBackend) annotations else defaultBackend +: annotations
TesterDriver.execute(() => t, additionalVResources, annos)
diff --git a/src/test/scala/chiselTests/Vec.scala b/src/test/scala/chiselTests/Vec.scala
index 02743187..4a871890 100644
--- a/src/test/scala/chiselTests/Vec.scala
+++ b/src/test/scala/chiselTests/Vec.scala
@@ -6,7 +6,7 @@ import org.scalacheck._
import chisel3._
import chisel3.stage.ChiselStage
-import chisel3.testers.BasicTester
+import chisel3.testers.{BasicTester, TesterDriver}
import chisel3.util._
import org.scalacheck.Shrink
import scala.annotation.tailrec
@@ -456,7 +456,7 @@ class VecSpec extends ChiselPropSpec with Utils {
}
property("Infering widths on huge Vecs should not cause a stack overflow") {
- assertTesterPasses { new HugeVecTester(10000) }
+ assertTesterPasses(new HugeVecTester(10000), annotations = TesterDriver.verilatorOnly)
}
property("A Reg of a Vec of a single 1 bit element should compile and work") {