From b8a0ecf1203a487a922f8a15d88716b69469094f Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 14 Sep 2021 14:11:05 -0700 Subject: 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.--- src/test/scala/firrtlTests/stage/FirrtlMainSpec.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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) } -- cgit v1.2.3