summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/DriverSpec.scala
diff options
context:
space:
mode:
authorJiuyang Liu2021-02-04 00:36:12 +0000
committerGitHub2021-02-03 16:36:12 -0800
commitf45216effc573d33d4aa4e525cff955ab332efbd (patch)
treeea4f52f98e4bf3746ee0b8b6df10f37c13941825 /src/test/scala/chiselTests/DriverSpec.scala
parent98ce9194e5d87fdd5be931b6cd516d180a6540cd (diff)
Remove Deprecated APIs (#1730)
Diffstat (limited to 'src/test/scala/chiselTests/DriverSpec.scala')
-rw-r--r--src/test/scala/chiselTests/DriverSpec.scala101
1 files changed, 0 insertions, 101 deletions
diff --git a/src/test/scala/chiselTests/DriverSpec.scala b/src/test/scala/chiselTests/DriverSpec.scala
deleted file mode 100644
index 3a78683b..00000000
--- a/src/test/scala/chiselTests/DriverSpec.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-
-package chiselTests
-
-import java.io.File
-
-import chisel3._
-import firrtl.FirrtlExecutionSuccess
-import org.scalacheck.Test.Failed
-import org.scalatest.Succeeded
-import org.scalatest.freespec.AnyFreeSpec
-import org.scalatest.matchers.should.Matchers
-
-class DummyModule extends Module {
- val io = IO(new Bundle {
- val in = Input(UInt(1.W))
- val out = Output(UInt(1.W))
- })
- io.out := io.in
-}
-
-class TypeErrorModule extends chisel3.Module {
- val in = IO(Input(UInt(1.W)))
- val out = IO(Output(SInt(1.W)))
- out := in
-}
-
-class DriverSpec extends AnyFreeSpec with Matchers with chiselTests.Utils {
- "Driver's execute methods are used to run chisel and firrtl" - {
- "options can be picked up from comand line with no args" in {
- // NOTE: Since we don't provide any arguments (notably, "--target-dir"),
- // the generated files will be created in the current directory.
- val targetDir = "."
- Driver.execute(Array.empty[String], () => new DummyModule) match {
- case ChiselExecutionSuccess(_, _, Some(_: FirrtlExecutionSuccess)) =>
- val exts = List("anno.json", "fir", "v")
- for (ext <- exts) {
- val dummyOutput = new File(targetDir, "DummyModule" + "." + ext)
- info(s"${dummyOutput.toString} exists")
- dummyOutput.exists() should be(true)
- dummyOutput.delete()
- }
- Succeeded
- case _ =>
- Failed
- }
- }
-
- "options can be picked up from comand line setting top name" in {
- val targetDir = "local-build"
- Driver.execute(Array("-tn", "dm", "-td", targetDir), () => new DummyModule) match {
- case ChiselExecutionSuccess(_, _, Some(_: FirrtlExecutionSuccess)) =>
- val exts = List("anno.json", "fir", "v")
- for (ext <- exts) {
- val dummyOutput = new File(targetDir, "dm" + "." + ext)
- info(s"${dummyOutput.toString} exists")
- dummyOutput.exists() should be(true)
- dummyOutput.delete()
- }
- Succeeded
- case _ =>
- Failed
- }
-
- }
-
- "execute returns a chisel execution result" in {
- val targetDir = "test_run_dir"
- val args = Array("--compiler", "low", "--target-dir", targetDir)
-
- info("Driver returned a ChiselExecutionSuccess")
- val result = Driver.execute(args, () => new DummyModule)
- result shouldBe a[ChiselExecutionSuccess]
-
- info("emitted circuit included 'circuit DummyModule'")
- val successResult = result.asInstanceOf[ChiselExecutionSuccess]
- successResult.emitted should include ("circuit DummyModule")
-
- val dummyOutput = new File(targetDir, "DummyModule.lo.fir")
- info(s"${dummyOutput.toString} exists")
- dummyOutput.exists() should be(true)
- dummyOutput.delete()
- }
-
- "user errors show a trimmed stack trace" in {
- val targetDir = "test_run_dir"
- val args = Array("--compiler", "low", "--target-dir", targetDir)
-
- val (stdout, stderr, result) = grabStdOutErr { Driver.execute(args, () => new TypeErrorModule) }
-
- info("stdout shows a trimmed stack trace")
- stdout should include ("Stack trace trimmed to user code only")
-
- info("stdout does not include FIRRTL information")
- stdout should not include ("firrtl.")
-
- info("Driver returned a ChiselExecutionFailure")
- result shouldBe a [ChiselExecutionFailure]
- }
- }
-}