aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Lawson2016-12-08 09:49:07 -0800
committerJack Koenig2016-12-08 09:49:07 -0800
commit4d5e6fc509203efc46713f6aaf1129f72d447d76 (patch)
tree03d46e9192132eb46c9848b01e4c0787aa3a86a1
parentcfb3a48986500422cbf6ba8887030dee3a973933 (diff)
Copy (explicitly) test resource to targetdir. (#392)
If we execute tests somewhere other than the root of the firrtl project directory (in a parent project directory for examples), the resource file may not be where we expect it. Also clean up imports.
-rw-r--r--src/test/scala/firrtlTests/DriverSpec.scala17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/test/scala/firrtlTests/DriverSpec.scala b/src/test/scala/firrtlTests/DriverSpec.scala
index f0b5e403..cdabc28c 100644
--- a/src/test/scala/firrtlTests/DriverSpec.scala
+++ b/src/test/scala/firrtlTests/DriverSpec.scala
@@ -2,19 +2,14 @@
package firrtlTests
-import java.io.File
+import java.io.{File, FileNotFoundException, FileOutputStream}
+import org.scalatest.{FreeSpec, Matchers}
-import firrtl.annotations.Annotation
-import org.scalatest.{Matchers, FreeSpec}
-
-import firrtl._
import firrtl.passes.InlineInstances
-import firrtl.passes.memlib.{ReplSeqMem, InferReadWrite}
-import org.scalatest.{Matchers, FreeSpec}
-
+import firrtl.passes.memlib.{InferReadWrite, ReplSeqMem}
import firrtl._
-class DriverSpec extends FreeSpec with Matchers {
+class DriverSpec extends FreeSpec with Matchers with BackendCompilationUtilities {
"CommonOptions are some simple options available across the chisel3 ecosystem" - {
"CommonOption provide an scopt implementation of an OptionParser" - {
"Options can be set from an Array[String] as is passed into a main" - {
@@ -133,9 +128,11 @@ class DriverSpec extends FreeSpec with Matchers {
val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions {
commonOptions = commonOptions.copy(topName = "a.fir")
firrtlOptions = firrtlOptions.copy(
- annotationFileNameOverride = "src/test/resources/annotations/SampleAnnotations"
+ annotationFileNameOverride = "SampleAnnotations"
)
}
+ val annotationsTestFile = new File(optionsManager.commonOptions.targetDirName, optionsManager.firrtlOptions.annotationFileNameOverride + ".anno")
+ copyResourceToFile("/annotations/SampleAnnotations.anno", annotationsTestFile)
optionsManager.firrtlOptions.annotations.length should be (0)
Driver.loadAnnotations(optionsManager)
optionsManager.firrtlOptions.annotations.length should be (9)