From baea2da820e9ebff5ba1b6ad9573a7cc33aaacbd Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Wed, 14 Oct 2020 11:15:52 -0700 Subject: Provide user source locators in Builder.error errors (#1618) Package chisel3 was not properly marked as an internal package so source locators in reported errors would point to files like Bits.scala.--- src/test/scala/chiselTests/stage/ChiselMainSpec.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/test/scala/chiselTests/stage/ChiselMainSpec.scala b/src/test/scala/chiselTests/stage/ChiselMainSpec.scala index 0d400abd..679677d0 100644 --- a/src/test/scala/chiselTests/stage/ChiselMainSpec.scala +++ b/src/test/scala/chiselTests/stage/ChiselMainSpec.scala @@ -35,6 +35,11 @@ object ChiselMainSpec { require(false) } + /** A module that triggers a Builder.error (as opposed to exception) */ + class BuilderErrorModule extends RawModule { + val w = Wire(UInt(8.W)) + w(3, -1) + } } case class TestClassAspect() extends InspectorAspect[RawModule] ({ @@ -152,6 +157,14 @@ class ChiselMainSpec extends AnyFeatureSpec with GivenWhenThen with Matchers wit result = 1) ).foreach(runStageExpectFiles) } + Feature("Builder.error source locator") { + Seq( + ChiselMainTest(args = Array("-X", "none"), + generator = Some(classOf[BuilderErrorModule]), + stdout = Some("ChiselMainSpec.scala:41: Invalid bit range (3,-1) in class chiselTests.stage.ChiselMainSpec$BuilderErrorModule"), + result = 1) + ).foreach(runStageExpectFiles) + } Feature("Specifying a custom output file") { runStageExpectFiles(ChiselMainTest( -- cgit v1.2.3