summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-09-05 22:24:40 +0000
committerLang Hames <lhames@gmail.com>2017-09-05 22:24:40 +0000
commit4c744026014b48998c09df37917f41fccbc7e612 (patch)
tree7aafb95d01b56179d1febd995178f473d52ebe87 /llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
parent37c747498d98c809574cd99631f8ca3e69564b3e (diff)
downloadbcm5719-llvm-4c744026014b48998c09df37917f41fccbc7e612.tar.gz
bcm5719-llvm-4c744026014b48998c09df37917f41fccbc7e612.zip
[ORC] Convert null remote symbols to null JITSymbols.
The existing code created a JITSymbol with an invalid materializer instead, guaranteeing a 'missing symbol' error when someone tried to materialize the symbol. llvm-svn: 312584
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
index da76890d73d..819c5f8eb34 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
@@ -334,7 +334,7 @@ TEST(RemoteObjectLayer, FindSymbol) {
auto ReportError =
[](Error Err) {
auto ErrMsg = toString(std::move(Err));
- EXPECT_EQ(ErrMsg, "Could not find symbol 'barbaz'")
+ EXPECT_EQ(ErrMsg, "Could not find symbol 'badsymbol'")
<< "Expected error string to be \"Object handle 42 not found\"";
};
@@ -352,7 +352,9 @@ TEST(RemoteObjectLayer, FindSymbol) {
[](StringRef Name, bool ExportedSymbolsOnly) -> JITSymbol {
if (Name == "foobar")
return JITSymbol(0x12348765, JITSymbolFlags::Exported);
- return make_error<JITSymbolNotFound>(Name);
+ if (Name == "badsymbol")
+ return make_error<JITSymbolNotFound>(Name);
+ return nullptr;
};
return 42;
});
@@ -374,19 +376,30 @@ TEST(RemoteObjectLayer, FindSymbol) {
cantFail(Client.addObject(std::move(TestObject),
std::make_shared<NullResolver>()));
+ // Check that we can find and materialize a valid symbol.
auto Sym1 = Client.findSymbol("foobar", true);
-
EXPECT_TRUE(!!Sym1) << "Symbol 'foobar' should be findable";
EXPECT_EQ(cantFail(Sym1.getAddress()), 0x12348765ULL)
<< "Symbol 'foobar' does not return the correct address";
- auto Sym2 = Client.findSymbol("barbaz", true);
- EXPECT_FALSE(!!Sym2) << "Symbol 'barbaz' should not be findable";
- auto Err = Sym2.takeError();
- EXPECT_TRUE(!!Err) << "Sym2 should contain an error value";
- auto ErrMsg = toString(std::move(Err));
- EXPECT_EQ(ErrMsg, "Could not find symbol 'barbaz'")
- << "Expected symbol-not-found error for Sym2";
+ {
+ // Check that we can return a symbol containing an error.
+ auto Sym2 = Client.findSymbol("badsymbol", true);
+ EXPECT_FALSE(!!Sym2) << "Symbol 'badsymbol' should not be findable";
+ auto Err = Sym2.takeError();
+ EXPECT_TRUE(!!Err) << "Sym2 should contain an error value";
+ auto ErrMsg = toString(std::move(Err));
+ EXPECT_EQ(ErrMsg, "Could not find symbol 'badsymbol'")
+ << "Expected symbol-not-found error for Sym2";
+ }
+
+ {
+ // Check that we can return a 'null' symbol.
+ auto Sym3 = Client.findSymbol("baz", true);
+ EXPECT_FALSE(!!Sym3) << "Symbol 'baz' should convert to false";
+ auto Err = Sym3.takeError();
+ EXPECT_FALSE(!!Err) << "Symbol 'baz' should not contain an error";
+ }
cantFail(ClientEP.callB<remote::utils::TerminateSession>());
ServerThread.join();
OpenPOWER on IntegriCloud