diff options
| author | Schuyler Eldridge | 2020-03-11 14:45:18 -0400 |
|---|---|---|
| committer | Schuyler Eldridge | 2020-03-19 12:41:04 -0400 |
| commit | 18520bf16c38b4e8c5985c692baf9807c30459b7 (patch) | |
| tree | 9fdcc71cd2339fe24ff6d026dee0190729b86318 /src | |
| parent | 73974725f09338e265733c93866fd15e76a2bdd0 (diff) | |
Test nested ChiselException in ChiselMain
Adds two tests:
1. Test that an internal requirement failure (a bare exception) inside
a Builder is properly reported/trimmed by ChsielStage/ChiselMain
2. Test that the full stack trace includes the ChiselException
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/stage/ChiselMainSpec.scala | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/test/scala/chiselTests/stage/ChiselMainSpec.scala b/src/test/scala/chiselTests/stage/ChiselMainSpec.scala index 2b3b9c2c..f5b47982 100644 --- a/src/test/scala/chiselTests/stage/ChiselMainSpec.scala +++ b/src/test/scala/chiselTests/stage/ChiselMainSpec.scala @@ -25,6 +25,11 @@ object ChiselMainSpec { out := in } + /** A module that fails a requirement */ + class FailingRequirementModule extends RawModule { + require(false) + } + } case class TestClassAspect() extends InspectorAspect[RawModule] ({ @@ -128,7 +133,22 @@ class ChiselMainSpec extends FeatureSpec with GivenWhenThen with Matchers with c result = 1) ).foreach(runStageExpectFiles) } - feature("Aspect library") { + feature("Report properly trimmed stack traces") { + Seq( + ChiselMainTest(args = Array("-X", "low"), + generator = Some(classOf[FailingRequirementModule]), + stdout = Some("requirement failed"), + result = 1), + ChiselMainTest(args = Array("-X", "low", "--full-stacktrace"), + generator = Some(classOf[FailingRequirementModule]), + stdout = Some("chisel3.internal.ChiselException"), + result = 1) + ).foreach(runStageExpectFiles) + } + + info("As an aspect writer") + info("I write an aspect") + feature("Running aspects via the command line") { Seq( ChiselMainTest(args = Array( "-X", "high", "--with-aspect", "chiselTests.stage.TestClassAspect" ), generator = Some(classOf[SameTypesModule]), |
