aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchuyler Eldridge2020-04-12 16:45:05 -0400
committerSchuyler Eldridge2020-04-13 16:03:25 -0400
commitffee96ba0069c105764c3a57dd83a7709f1b672e (patch)
tree956b2cfa31cd0e6bc6b99f6ae0e1e098d0cc9969 /src
parenta49a2f5ebf5f61fc3d66798d5c81d91029fcc8db (diff)
Add test of mixing -e with -E in FirrtlMainSpec
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala b/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala
index 15f7a021..9529507d 100644
--- a/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala
+++ b/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala
@@ -22,11 +22,12 @@ class FirrtlMainSpec extends AnyFeatureSpec with GivenWhenThen with Matchers wit
with BackendCompilationUtilities {
/** Parameterizes one test of [[FirrtlMain]]. Running the [[FirrtlMain]] `main` with certain args should produce
- * certain files.
+ * certain files and not produce others.
* @param args arguments to pass
* @param circuit a [[FirrtlCircuitFixture]] to use. This will generate an appropriate '-i $targetDir/$main.fi'
* argument.
* @param files expected files that will be created
+ * @param files files that should NOT be created
* @param stdout expected stdout string, None if no output expected
* @param stderr expected stderr string, None if no output expected
* @param result expected exit code
@@ -35,6 +36,7 @@ class FirrtlMainSpec extends AnyFeatureSpec with GivenWhenThen with Matchers wit
args: Array[String],
circuit: Option[FirrtlCircuitFixture] = Some(new SimpleFirrtlCircuitFixture),
files: Seq[String] = Seq.empty,
+ notFiles: Seq[String] = Seq.empty,
stdout: Option[String] = None,
stderr: Option[String] = None,
result: Int = 0) {
@@ -66,6 +68,7 @@ class FirrtlMainSpec extends AnyFeatureSpec with GivenWhenThen with Matchers wit
}
p.files.foreach( f => new File(td.buildDir + s"/$f").delete() )
+ p.notFiles.foreach( f => new File(td.buildDir + s"/$f").delete() )
When(s"""the user tries to compile with '${p.argsString}'""")
val (stdout, stderr, result) =
@@ -103,6 +106,12 @@ class FirrtlMainSpec extends AnyFeatureSpec with GivenWhenThen with Matchers wit
val out = new File(td.buildDir + s"/$f")
out should (exist)
}
+
+ p.notFiles.foreach { f =>
+ And(s"file '$f' should NOT be emitted in the target directory")
+ val out = new File(td.buildDir + s"/$f")
+ out should not (exist)
+ }
}
}
@@ -207,6 +216,11 @@ class FirrtlMainSpec extends AnyFeatureSpec with GivenWhenThen with Matchers wit
files = Seq("Top.sv", "Child.sv"),
stdout = Some("SystemVerilog Compiler behaves the same as the Verilog Compiler!")),
+ /* Test mixing of -E with -e */
+ FirrtlMainTest(args = Array("-X", "middle", "-E", "high", "-e", "middle"),
+ files = Seq("Top.hi.fir", "Top.mid.fir", "Child.mid.fir"),
+ notFiles = Seq("Child.hi.fir")),
+
/* Test changes to output file name */
FirrtlMainTest(args = Array("-X", "none", "-E", "chirrtl", "-o", "foo"),
files = Seq("foo.fir")),