Skip to content

Commit

Permalink
Use Treadle (on pull requests only) to speed up CI (backport #2341) (#…
Browse files Browse the repository at this point in the history
…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 7d39b7b)

* Use Treadle for CI on pull requests

(cherry picked from commit 8266067)

Co-authored-by: Jack Koenig <koenig@sifive.com>
  • Loading branch information
mergify[bot] and jackkoenig authored Sep 27, 2022
1 parent c11eead commit f195568
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/test/scala/chiselTests/ChiselSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/chiselTests/Vec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit f195568

Please sign in to comment.