aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-10-23 23:01:39 +0000
committerLang Hames <lhames@gmail.com>2018-10-23 23:01:39 +0000
commit8b9cbda1b3249b6ec40f8495a13876159ebfef7d (patch)
treed1677394f303972b552947c37339f2d9d27b092f /unittests
parent2a04af10be8a35388d6d80cce7539f1c76931328 (diff)
[ORC] Re-apply r345077 with fixes to remove ambiguity in lookup calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp72
-rw-r--r--unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp10
2 files changed, 48 insertions, 34 deletions
diff --git a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index 1ccc4755957..22be76a2eb6 100644
--- a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -48,7 +48,8 @@ TEST_F(CoreAPIsStandardTest, BasicSuccessfulLookup) {
FooMR = std::make_shared<MaterializationResponsibility>(std::move(R));
})));
- ES.lookup({&JD}, {Foo}, OnResolution, OnReady, NoDependenciesToRegister);
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo}, OnResolution, OnReady,
+ NoDependenciesToRegister);
EXPECT_FALSE(OnResolutionRun) << "Should not have been resolved yet";
EXPECT_FALSE(OnReadyRun) << "Should not have been marked ready yet";
@@ -101,7 +102,8 @@ TEST_F(CoreAPIsStandardTest, EmptyLookup) {
OnReadyRun = true;
};
- ES.lookup({&JD}, {}, OnResolution, OnReady, NoDependenciesToRegister);
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {}, OnResolution, OnReady,
+ NoDependenciesToRegister);
EXPECT_TRUE(OnResolvedRun) << "OnResolved was not run for empty query";
EXPECT_TRUE(OnReadyRun) << "OnReady was not run for empty query";
@@ -148,7 +150,7 @@ TEST_F(CoreAPIsStandardTest, RemoveSymbolsTest) {
bool OnResolvedRun = false;
bool OnReadyRun = false;
- ES.lookup({&JD}, {Foo, Baz},
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo, Baz},
[&](Expected<SymbolMap> Result) {
EXPECT_TRUE(!!Result) << "OnResolved failed unexpectedly";
consumeError(Result.takeError());
@@ -229,7 +231,9 @@ TEST_F(CoreAPIsStandardTest, LookupWithHiddenSymbols) {
auto &JD2 = ES.createJITDylib("JD2");
cantFail(JD2.define(absoluteSymbols({{Bar, QuxSym}})));
- auto Result = cantFail(ES.lookup({&JD, &JD2}, {Foo, Bar}));
+ /// Try a blocking lookup.
+ auto Result = cantFail(
+ ES.lookup(JITDylibSearchList({{&JD, false}, {&JD2, false}}), {Foo, Bar}));
EXPECT_EQ(Result.size(), 2U) << "Unexpected number of results";
EXPECT_EQ(Result.count(Foo), 1U) << "Missing result for \"Foo\"";
@@ -275,7 +279,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicAliases) {
{Qux, {Bar, JITSymbolFlags::Weak}}})));
cantFail(JD.define(absoluteSymbols({{Qux, QuxSym}})));
- auto Result = ES.lookup({&JD}, {Baz, Qux});
+ auto Result = ES.lookup(JITDylibSearchList({{&JD, false}}), {Baz, Qux});
EXPECT_TRUE(!!Result) << "Unexpected lookup failure";
EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\"";
EXPECT_EQ(Result->count(Qux), 1U) << "No result for \"qux\"";
@@ -290,7 +294,7 @@ TEST_F(CoreAPIsStandardTest, TestChainedAliases) {
cantFail(JD.define(symbolAliases(
{{Baz, {Bar, BazSym.getFlags()}}, {Bar, {Foo, BarSym.getFlags()}}})));
- auto Result = ES.lookup({&JD}, {Bar, Baz});
+ auto Result = ES.lookup(JITDylibSearchList({{&JD, false}}), {Bar, Baz});
EXPECT_TRUE(!!Result) << "Unexpected lookup failure";
EXPECT_EQ(Result->count(Bar), 1U) << "No result for \"bar\"";
EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\"";
@@ -309,7 +313,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicReExports) {
cantFail(JD2.define(reexports(JD, {{Bar, {Foo, BarSym.getFlags()}}})));
- auto Result = cantFail(ES.lookup({&JD2}, Bar));
+ auto Result = cantFail(ES.lookup(JITDylibSearchList({{&JD2, false}}), Bar));
EXPECT_EQ(Result.getAddress(), FooSym.getAddress())
<< "Re-export Bar for symbol Foo should match FooSym's address";
}
@@ -335,7 +339,7 @@ TEST_F(CoreAPIsStandardTest, TestThatReExportsDontUnnecessarilyMaterialize) {
cantFail(JD2.define(reexports(
JD, {{Baz, {Foo, BazSym.getFlags()}}, {Qux, {Bar, QuxSym.getFlags()}}})));
- auto Result = cantFail(ES.lookup({&JD2}, Baz));
+ auto Result = cantFail(ES.lookup(JITDylibSearchList({{&JD2, false}}), Baz));
EXPECT_EQ(Result.getAddress(), FooSym.getAddress())
<< "Re-export Baz for symbol Foo should match FooSym's address";
@@ -350,13 +354,13 @@ TEST_F(CoreAPIsStandardTest, TestReexportsGenerator) {
auto Filter = [this](SymbolStringPtr Name) { return Name != Bar; };
- JD.setGenerator(ReexportsGenerator(JD2, Filter));
+ JD.setGenerator(ReexportsGenerator(JD2, false, Filter));
auto Flags = JD.lookupFlags({Foo, Bar, Baz});
EXPECT_EQ(Flags.size(), 1U) << "Unexpected number of results";
EXPECT_EQ(Flags[Foo], FooSym.getFlags()) << "Unexpected flags for Foo";
- auto Result = cantFail(ES.lookup({&JD}, Foo));
+ auto Result = cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), Foo));
EXPECT_EQ(Result.getAddress(), FooSym.getAddress())
<< "Incorrect reexported symbol address";
@@ -377,8 +381,8 @@ TEST_F(CoreAPIsStandardTest, TestTrivialCircularDependency) {
FooReady = true;
};
- ES.lookup({&JD}, {Foo}, std::move(OnResolution), std::move(OnReady),
- NoDependenciesToRegister);
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo}, std::move(OnResolution),
+ std::move(OnReady), NoDependenciesToRegister);
FooR->resolve({{Foo, FooSym}});
FooR->emit();
@@ -434,7 +438,8 @@ TEST_F(CoreAPIsStandardTest, TestCircularDependenceInOneJITDylib) {
// Issue a lookup for Foo. Use NoDependenciesToRegister: We're going to add
// the dependencies manually below.
- ES.lookup({&JD}, {Foo}, std::move(OnFooResolution), std::move(OnFooReady),
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo},
+ std::move(OnFooResolution), std::move(OnFooReady),
NoDependenciesToRegister);
bool BarResolved = false;
@@ -449,7 +454,8 @@ TEST_F(CoreAPIsStandardTest, TestCircularDependenceInOneJITDylib) {
BarReady = true;
};
- ES.lookup({&JD}, {Bar}, std::move(OnBarResolution), std::move(OnBarReady),
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Bar},
+ std::move(OnBarResolution), std::move(OnBarReady),
NoDependenciesToRegister);
bool BazResolved = false;
@@ -465,7 +471,8 @@ TEST_F(CoreAPIsStandardTest, TestCircularDependenceInOneJITDylib) {
BazReady = true;
};
- ES.lookup({&JD}, {Baz}, std::move(OnBazResolution), std::move(OnBazReady),
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Baz},
+ std::move(OnBazResolution), std::move(OnBazReady),
NoDependenciesToRegister);
// Add a circular dependency: Foo -> Bar, Bar -> Baz, Baz -> Foo.
@@ -588,8 +595,8 @@ TEST_F(CoreAPIsStandardTest, AddAndMaterializeLazySymbol) {
OnReadyRun = true;
};
- ES.lookup({&JD}, Names, std::move(OnResolution), std::move(OnReady),
- NoDependenciesToRegister);
+ ES.lookup(JITDylibSearchList({{&JD, false}}), Names, std::move(OnResolution),
+ std::move(OnReady), NoDependenciesToRegister);
EXPECT_TRUE(FooMaterialized) << "Foo was not materialized";
EXPECT_TRUE(BarDiscarded) << "Bar was not discarded";
@@ -637,8 +644,8 @@ TEST_F(CoreAPIsStandardTest, TestBasicWeakSymbolMaterialization) {
OnReadyRun = true;
};
- ES.lookup({&JD}, {Bar}, std::move(OnResolution), std::move(OnReady),
- NoDependenciesToRegister);
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Bar}, std::move(OnResolution),
+ std::move(OnReady), NoDependenciesToRegister);
EXPECT_TRUE(OnResolvedRun) << "OnResolved not run";
EXPECT_TRUE(OnReadyRun) << "OnReady not run";
@@ -666,13 +673,13 @@ TEST_F(CoreAPIsStandardTest, DefineMaterializingSymbol) {
});
cantFail(JD.define(MU));
- cantFail(ES.lookup({&JD}, Foo));
+ cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), Foo));
// Assert that materialization is complete by now.
ExpectNoMoreMaterialization = true;
// Look up bar to verify that no further materialization happens.
- auto BarResult = cantFail(ES.lookup({&JD}, Bar));
+ auto BarResult = cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), Bar));
EXPECT_EQ(BarResult.getAddress(), BarSym.getAddress())
<< "Expected Bar == BarSym";
}
@@ -685,7 +692,8 @@ TEST_F(CoreAPIsStandardTest, GeneratorTest) {
return SymbolNameSet({Bar});
});
- auto Result = cantFail(ES.lookup({&JD}, {Foo, Bar}));
+ auto Result =
+ cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo, Bar}));
EXPECT_EQ(Result.count(Bar), 1U) << "Expected to find fallback def for 'bar'";
EXPECT_EQ(Result[Bar].getAddress(), BarSym.getAddress())
@@ -701,7 +709,7 @@ TEST_F(CoreAPIsStandardTest, FailResolution) {
cantFail(JD.define(MU));
SymbolNameSet Names({Foo, Bar});
- auto Result = ES.lookup({&JD}, Names);
+ auto Result = ES.lookup(JITDylibSearchList({{&JD, false}}), Names);
EXPECT_FALSE(!!Result) << "Expected failure";
if (!Result) {
@@ -733,7 +741,8 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithUnthreadedMaterialization) {
cantFail(JD.define(MU));
- auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo));
+ auto FooLookupResult =
+ cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), Foo));
EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress())
<< "lookup returned an incorrect address";
@@ -754,7 +763,8 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithThreadedMaterialization) {
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
- auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo));
+ auto FooLookupResult =
+ cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), Foo));
EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress())
<< "lookup returned an incorrect address";
@@ -802,14 +812,16 @@ TEST_F(CoreAPIsStandardTest, TestGetRequestedSymbolsAndReplace) {
EXPECT_FALSE(FooMaterialized) << "Foo should not be materialized yet";
EXPECT_FALSE(BarMaterialized) << "Bar should not be materialized yet";
- auto FooSymResult = cantFail(ES.lookup({&JD}, Foo));
+ auto FooSymResult =
+ cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), Foo));
EXPECT_EQ(FooSymResult.getAddress(), FooSym.getAddress())
<< "Address mismatch for Foo";
EXPECT_TRUE(FooMaterialized) << "Foo should be materialized now";
EXPECT_FALSE(BarMaterialized) << "Bar still should not be materialized";
- auto BarSymResult = cantFail(ES.lookup({&JD}, Bar));
+ auto BarSymResult =
+ cantFail(ES.lookup(JITDylibSearchList({{&JD, false}}), Bar));
EXPECT_EQ(BarSymResult.getAddress(), BarSym.getAddress())
<< "Address mismatch for Bar";
EXPECT_TRUE(BarMaterialized) << "Bar should be materialized now";
@@ -829,7 +841,7 @@ TEST_F(CoreAPIsStandardTest, TestMaterializationResponsibilityDelegation) {
cantFail(JD.define(MU));
- auto Result = ES.lookup({&JD}, {Foo, Bar});
+ auto Result = ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo, Bar});
EXPECT_TRUE(!!Result) << "Result should be a success value";
EXPECT_EQ(Result->count(Foo), 1U) << "\"Foo\" entry missing";
@@ -861,8 +873,8 @@ TEST_F(CoreAPIsStandardTest, TestMaterializeWeakSymbol) {
auto OnReady = [](Error Err) { cantFail(std::move(Err)); };
- ES.lookup({&JD}, {Foo}, std::move(OnResolution), std::move(OnReady),
- NoDependenciesToRegister);
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo}, std::move(OnResolution),
+ std::move(OnReady), NoDependenciesToRegister);
auto MU2 = llvm::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap({{Foo, JITSymbolFlags::Exported}}),
diff --git a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
index 1660670ae63..6b1dbe93d5e 100644
--- a/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
+++ b/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
@@ -66,8 +66,8 @@ static bool testSetProcessAllSections(std::unique_ptr<MemoryBuffer> Obj,
ObjLayer.setProcessAllSections(ProcessAllSections);
cantFail(ObjLayer.add(JD, std::move(Obj), ES.allocateVModule()));
- ES.lookup({&JD}, {Foo}, OnResolveDoNothing, OnReadyDoNothing,
- NoDependenciesToRegister);
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo}, OnResolveDoNothing,
+ OnReadyDoNothing, NoDependenciesToRegister);
return DebugSectionSeen;
}
@@ -157,7 +157,8 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true);
cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule()));
- ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo},
+ [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
[](Error Err) { cantFail(std::move(Err)); },
NoDependenciesToRegister);
}
@@ -219,7 +220,8 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true);
cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule()));
- ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
+ ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo},
+ [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
[](Error Err) { cantFail(std::move(Err)); },
NoDependenciesToRegister);
}