From 3c8e22dc9e4f033be167aa721e6d8ad54330ca3c Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Fri, 29 Nov 2019 15:59:08 -0800 Subject: Redirect testing shell commands to logger This includes the built-in functions in BackendCompilationUtilities which are a public API --- .../scala/firrtl/util/BackendCompilationUtilities.scala | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/scala/firrtl/util/BackendCompilationUtilities.scala b/src/main/scala/firrtl/util/BackendCompilationUtilities.scala index beb44ad0..20a65895 100644 --- a/src/main/scala/firrtl/util/BackendCompilationUtilities.scala +++ b/src/main/scala/firrtl/util/BackendCompilationUtilities.scala @@ -7,11 +7,13 @@ import java.nio.file.Files import java.text.SimpleDateFormat import java.util.Calendar +import logger.LazyLogging + import firrtl.FileUtils import scala.sys.process.{ProcessBuilder, ProcessLogger, _} -trait BackendCompilationUtilities { +trait BackendCompilationUtilities extends LazyLogging { /** Parent directory for tests */ lazy val TestDirectory = new File("test_run_dir") @@ -21,6 +23,9 @@ trait BackendCompilationUtilities { format.format(now) } + def loggingProcessLogger: ProcessLogger = + ProcessLogger(logger.info(_), logger.warn(_)) + /** * Copy the contents of a resource to a destination file. * @param name the name of the resource @@ -151,7 +156,7 @@ trait BackendCompilationUtilities { s"""-Wno-undefined-bool-conversion -O1 -DTOP_TYPE=V$dutFile -DVL_USER_FINISH -include V$dutFile.h""", "-Mdir", dir.getAbsolutePath, "--exe", cppHarness.getAbsolutePath) - System.out.println(s"${command.mkString(" ")}") // scalastyle:ignore regex + logger.info(s"${command.mkString(" ")}") // scalastyle:ignore regex command } @@ -167,8 +172,9 @@ trait BackendCompilationUtilities { val e = Process(s"./V$prefix", dir) ! ProcessLogger(line => { triggered = triggered || (assertionMessageSupplied && line.contains(assertionMsg)) - System.out.println(line) // scalastyle:ignore regex - }) + logger.info(line) // scalastyle:ignore regex + }, + logger.warn(_)) // Fail if a line contained an assertion or if we get a non-zero exit code // or, we get a SIGABRT (assertion failure) and we didn't provide a specific assertion message triggered || (e != 0 && (e != 134 || !assertionMessageSupplied)) -- cgit v1.2.3 From 0a5b90fff540f3d82cc5b16db0bf2ff83e9dd760 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Fri, 29 Nov 2019 16:59:53 -0800 Subject: Change printing of FIRRTL runtime from error to warn --- src/main/scala/firrtl/Compiler.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/scala/firrtl/Compiler.scala b/src/main/scala/firrtl/Compiler.scala index 9014d213..81d219ea 100644 --- a/src/main/scala/firrtl/Compiler.scala +++ b/src/main/scala/firrtl/Compiler.scala @@ -485,7 +485,7 @@ trait Compiler extends LazyLogging { } } - logger.error(f"Total FIRRTL Compile Time: $timeMillis%.1f ms") + logger.warn(f"Total FIRRTL Compile Time: $timeMillis%.1f ms") finalState } -- cgit v1.2.3