diff options
| author | Jack Koenig | 2019-02-22 13:59:33 -0800 |
|---|---|---|
| committer | mergify[bot] | 2019-02-22 21:59:33 +0000 |
| commit | 0ace0218d3151df2d102463dd682128a88ae7be6 (patch) | |
| tree | 1e7728ceb4b7cd160e3547decc4be1ef77d5aeda /src/test/scala/firrtlTests/CustomTransformSpec.scala | |
| parent | 50d9571bc26c445fd9ebaeb3c06d80d598397405 (diff) | |
Stop reporting exceptions in custom transformations as internal errors (#867)
Instead, just forward the exception
Diffstat (limited to 'src/test/scala/firrtlTests/CustomTransformSpec.scala')
| -rw-r--r-- | src/test/scala/firrtlTests/CustomTransformSpec.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/CustomTransformSpec.scala b/src/test/scala/firrtlTests/CustomTransformSpec.scala index d1ff6fd1..1b0e8190 100644 --- a/src/test/scala/firrtlTests/CustomTransformSpec.scala +++ b/src/test/scala/firrtlTests/CustomTransformSpec.scala @@ -46,5 +46,30 @@ class CustomTransformSpec extends FirrtlFlatSpec { runFirrtlTest("CustomTransform", "/features", customTransforms = List(new ReplaceExtModuleTransform)) } + + they should "not cause \"Internal Errors\"" in { + val input = """ + |circuit test : + | module test : + | output out : UInt + | out <= UInt(123)""".stripMargin + val errorString = "My Custom Transform failed!" + class ErroringTransform extends Transform { + def inputForm = HighForm + def outputForm = HighForm + def execute(state: CircuitState): CircuitState = { + require(false, errorString) + state + } + } + val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions { + firrtlOptions = FirrtlExecutionOptions( + firrtlSource = Some(input), + customTransforms = List(new ErroringTransform)) + } + (the [java.lang.IllegalArgumentException] thrownBy { + Driver.execute(optionsManager) + }).getMessage should include (errorString) + } } |
