From 54e67889f10b39323fb729808b8cd22b4c832910 Mon Sep 17 00:00:00 2001 From: chick Date: Thu, 1 Aug 2019 09:21:52 -0700 Subject: 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() --- src/test/scala/firrtlTests/transforms/BlackBoxSourceHelperSpec.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/test/scala/firrtlTests/transforms/BlackBoxSourceHelperSpec.scala') diff --git a/src/test/scala/firrtlTests/transforms/BlackBoxSourceHelperSpec.scala b/src/test/scala/firrtlTests/transforms/BlackBoxSourceHelperSpec.scala index 089e837a..6e63317b 100644 --- a/src/test/scala/firrtlTests/transforms/BlackBoxSourceHelperSpec.scala +++ b/src/test/scala/firrtlTests/transforms/BlackBoxSourceHelperSpec.scala @@ -6,6 +6,7 @@ import firrtl.annotations.{Annotation, CircuitName, ModuleName} import firrtl.transforms._ import firrtl.{FIRRTLException, Transform, VerilogCompiler, VerilogEmitter} import firrtlTests.{HighTransformSpec, LowTransformSpec} +import firrtl.FileUtils import org.scalacheck.Test.Failed import org.scalatest.{FreeSpec, Matchers, Succeeded} @@ -132,9 +133,7 @@ class BlacklBoxSourceHelperTransformSpec extends LowTransformSpec { // but our file list should not include the verilog header file. val fileListFile = new java.io.File(s"test_run_dir/${BlackBoxSourceHelper.defaultFileListName}") fileListFile.exists should be (true) - val fileListFileSource = io.Source.fromFile(fileListFile) - val fileList = fileListFileSource.getLines.mkString - fileListFileSource.close() + val fileList = FileUtils.getText(fileListFile) fileList.contains("ParameterizedViaHeaderAdderExtModule.v") should be (true) fileList.contains("VerilogHeaderFile.vh") should be (false) } -- cgit v1.2.3