aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Koenig2021-09-14 14:11:05 -0700
committerGitHub2021-09-14 14:11:05 -0700
commitb8a0ecf1203a487a922f8a15d88716b69469094f (patch)
tree34436981403d115dca353b361f2b2e0008b53c5c
parent8421e96f04831fc61ddd5efa30f0ebc84f27c596 (diff)
Fix multi-protobuf test when run multiple times (#2357)
The test was leaving the test directory in a dirty state that would fail on a rerun. Fix the test so that it can be run multiple times in a row.
-rw-r--r--src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala b/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala
index 30e03b3c..240724ab 100644
--- a/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala
+++ b/src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala
@@ -342,7 +342,7 @@ class FirrtlMainSpec
And("some input multi-module FIRRTL IR")
val inputFile: Array[String] = {
- val in = new File(td.dir, c.main)
+ val in = new File(td.dir, s"${c.main}.fir")
val pw = new PrintWriter(in)
pw.write(c.input)
pw.close()
@@ -360,18 +360,20 @@ class FirrtlMainSpec
out should (exist)
}
+ // NOTE the .fir out needs to be a different directory than the multi proto out because
+ // reruns will pick up the .fir and try to parse as .pb
When("the user compiles the Protobufs to a single FIRRTL IR")
f.stage.main(
- Array("-I", td.buildDir.toString, "-X", "none", "-E", "chirrtl", "-td", td.buildDir.toString, "-o", "Foo")
+ Array("-I", td.buildDir.toString, "-X", "none", "-E", "chirrtl", "-td", td.dir.toString, "-o", "Foo")
)
Then("one single FIRRTL file should be emitted")
- val outFile = new File(td.buildDir + "/Foo.fir")
+ val outFile = new File(td.dir + "/Foo.fir")
outFile should (exist)
And("it should be the same as using FIRRTL input")
firrtl.Utils.orderAgnosticEquality(
firrtl.Parser.parse(c.input),
- firrtl.Parser.parseFile(td.buildDir + "/Foo.fir", firrtl.Parser.IgnoreInfo)
+ firrtl.Parser.parseFile(td.dir + "/Foo.fir", firrtl.Parser.IgnoreInfo)
) should be(true)
}