[llvm-commits] [PATCH] unittests/ExecutionEngine: use EngineBuilder::setErrorStr()

nobled nobled at dreamwidth.org
Mon May 9 17:37:38 PDT 2011


If EngineBuilder::create() returns NULL, this prints the reason why
before exiting.

---
diff --git a/unittests/ExecutionEngine/ExecutionEngineTest.cpp
b/unittests/ExecutionEngine/ExecutionEngineTest.cpp
index 904ee2b..e5daf19 100644
--- a/unittests/ExecutionEngine/ExecutionEngineTest.cpp
+++ b/unittests/ExecutionEngine/ExecutionEngineTest.cpp
@@ -22,11 +22,14 @@ namespace {
 class ExecutionEngineTest : public testing::Test {
 protected:
   ExecutionEngineTest()
-    : M(new Module("<main>", getGlobalContext())),
-      Engine(EngineBuilder(M).create()) {
+    : M(new Module("<main>", getGlobalContext())), Error(""),
+    Engine(EngineBuilder(M).setErrorStr(&Error).create()) {
   }

   virtual void SetUp() {
+    EXPECT_EQ(Error.empty(), true)
+      << "Error building ExecutionEngine: " << Error;
+
     ASSERT_TRUE(Engine.get() != NULL);
   }

@@ -36,6 +39,7 @@ protected:
   }

   Module *const M;
+  std::string Error;
   const OwningPtr<ExecutionEngine> Engine;
 };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-unittests-ExecutionEngine-use-EngineBuilder-setError.patch
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110509/d6223961/attachment.bin>


More information about the llvm-commits mailing list