unittests: add ErrorStr to ExecutionEngine test
authorDylan Noblesmith <nobled@dreamwidth.org>
Fri, 2 Dec 2011 20:53:53 +0000 (20:53 +0000)
committerDylan Noblesmith <nobled@dreamwidth.org>
Fri, 2 Dec 2011 20:53:53 +0000 (20:53 +0000)
Makes failures more self-explanatory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145704 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/ExecutionEngine/ExecutionEngineTest.cpp

index 4dcef20c6e77f5e5e88a8927935039da1b9e36f6..74a2ccdd0663011ed242d1e98ab1750ed0e2ec8c 100644 (file)
@@ -22,12 +22,13 @@ 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() {
-    ASSERT_TRUE(Engine.get() != NULL);
+    ASSERT_TRUE(Engine.get() != NULL) << "EngineBuilder returned error: '"
+      << Error << "'";
   }
 
   GlobalVariable *NewExtGlobal(Type *T, const Twine &Name) {
@@ -36,6 +37,7 @@ protected:
   }
 
   Module *const M;
+  std::string Error;
   const OwningPtr<ExecutionEngine> Engine;
 };