From 9c2b2173ceecf178734da863751d213ffe5e494c Mon Sep 17 00:00:00 2001 From: ducky Date: Tue, 15 Dec 2015 14:01:53 -0800 Subject: Meaningful error when resource copy fails --- src/main/scala/Chisel/testers/TesterDriver.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/scala/Chisel/testers/TesterDriver.scala b/src/main/scala/Chisel/testers/TesterDriver.scala index 4da5d059..b25b160b 100644 --- a/src/main/scala/Chisel/testers/TesterDriver.scala +++ b/src/main/scala/Chisel/testers/TesterDriver.scala @@ -11,13 +11,16 @@ object TesterDriver extends BackendCompilationUtilities { */ def copyResourceToFile(name: String, file: File) { val in = getClass().getResourceAsStream(name) + if (in == null) { + throw new FileNotFoundException(s"Resource '$name'") + } val out = new FileOutputStream(file) Iterator.continually(in.read).takeWhile(-1 !=).foreach(out.write) out.close() } /** For use with modules that should successfully be elaborated by the - * frontend, and which can be turned into executeables with assertions. */ + * frontend, and which can be turned into executables with assertions. */ def execute(t: () => BasicTester, additionalVResources: Seq[String] = Seq()): Boolean = { // Invoke the chisel compiler to get the circuit's IR val circuit = Driver.elaborate(t) -- cgit v1.2.3