diff options
| author | chick | 2019-08-01 09:21:52 -0700 |
|---|---|---|
| committer | chick | 2019-08-01 10:52:22 -0700 |
| commit | 54e67889f10b39323fb729808b8cd22b4c832910 (patch) | |
| tree | 4b5916fe8e6cee619ab5dfc3549bfb625b5b8214 /src/test/scala/firrtlTests/AnnotationTests.scala | |
| parent | 86d2470d8294a4dba37d33ba021558ba33da4d65 (diff) | |
Followup to PR #1142
Fixes a threading bug in where lazy reading of file
caused a problem for multithreaded access to the that was read.
Changes all uses of io.Source to use new API
getText
getLines
getTextResource
getLinesResouce
Make style to only import FileUtils and not its methods
So code is more explicit as e.g. FileUtils.getText()
Diffstat (limited to 'src/test/scala/firrtlTests/AnnotationTests.scala')
| -rw-r--r-- | src/test/scala/firrtlTests/AnnotationTests.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/scala/firrtlTests/AnnotationTests.scala b/src/test/scala/firrtlTests/AnnotationTests.scala index 6b492148..7b944470 100644 --- a/src/test/scala/firrtlTests/AnnotationTests.scala +++ b/src/test/scala/firrtlTests/AnnotationTests.scala @@ -7,6 +7,7 @@ import java.io.{File, FileWriter, Writer} import firrtl.annotations.AnnotationYamlProtocol._ import firrtl.annotations._ import firrtl._ +import firrtl.FileUtils import firrtl.transforms.OptimizableExtModuleAnnotation import firrtl.passes.InlineAnnotation import firrtl.passes.memlib.PinAnnotation @@ -472,8 +473,7 @@ class LegacyAnnotationTests extends AnnotationTests { Annotation(ModuleName(mod, CircuitName("Top")), classOf[Transform], "some value") "LegacyAnnotations" should "be readable from file" in { - val annotationStream = getClass.getResourceAsStream("/annotations/SampleAnnotations.anno") - val annotationsYaml = scala.io.Source.fromInputStream(annotationStream).getLines().mkString("\n").parseYaml + val annotationsYaml = FileUtils.getTextResource("/annotations/SampleAnnotations.anno").parseYaml val annotationArray = annotationsYaml.convertTo[Array[LegacyAnnotation]] annotationArray.length should be (9) annotationArray(0).targetString should be ("ModC") @@ -538,7 +538,7 @@ class JsonAnnotationTests extends AnnotationTests with BackendCompilationUtiliti writer.write(JsonProtocol.serialize(annos)) writer.close() - val text = io.Source.fromFile(annoFile).getLines().mkString("\n") + val text = FileUtils.getText(annoFile) annoFile.delete() val readAnnos = JsonProtocol.deserializeTry(text).get |
