[llvm-commits] [PATCH] unittests/ExecutionEngine: use EngineBuilder::setErrorStr()
nobled
nobled at dreamwidth.org
Mon May 9 18:49:25 PDT 2011
Oops, I meant to paste this in the last message:
When I tried this patch, it causes the test to fail all by itself,
even though the "Engine.get() != NULL" assert doesn't trigger. It
gives this output:
Error building ExecutionEngine: Unable to find target for this triple
(no targets are registered)
Does that indicate a bug in the test?
> 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;
> };
>
More information about the llvm-commits
mailing list