[llvm] 3e753ce - [ORC] Add unit test for HasMaterializationSideEffectsOnly failure behavior.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 12:34:45 PDT 2020


Author: Lang Hames
Date: 2020-09-01T12:34:34-07:00
New Revision: 3e753ce1ab5288f1fa5fb03711474ac2800e2f14

URL: https://github.com/llvm/llvm-project/commit/3e753ce1ab5288f1fa5fb03711474ac2800e2f14
DIFF: https://github.com/llvm/llvm-project/commit/3e753ce1ab5288f1fa5fb03711474ac2800e2f14.diff

LOG: [ORC] Add unit test for HasMaterializationSideEffectsOnly failure behavior.

Added: 
    

Modified: 
    llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index 5a83e6a2b04b..2c008dfdbd33 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -110,7 +110,7 @@ TEST_F(CoreAPIsStandardTest, ResolveUnrequestedSymbol) {
   EXPECT_TRUE(Result.count(Foo)) << "Expected result for \"Foo\"";
 }
 
-TEST_F(CoreAPIsStandardTest, MaterializationSideEffctsOnlyTest) {
+TEST_F(CoreAPIsStandardTest, MaterializationSideEffctsOnlyBasic) {
   // Test that basic materialization-side-effects-only symbols work as expected:
   // that they can be emitted without being resolved, that queries for them
   // don't return until they're emitted, and that they don't appear in query
@@ -147,6 +147,24 @@ TEST_F(CoreAPIsStandardTest, MaterializationSideEffctsOnlyTest) {
   EXPECT_TRUE(Result->empty()) << "Lookup result contained unexpected value";
 }
 
+TEST_F(CoreAPIsStandardTest, MaterializationSideEffectsOnlyFailuresPersist) {
+  // Test that when a MaterializationSideEffectsOnly symbol is failed it
+  // remains in the failure state rather than vanishing.
+
+  cantFail(JD.define(std::make_unique<SimpleMaterializationUnit>(
+      SymbolFlagsMap(
+          {{Foo, JITSymbolFlags::Exported |
+                     JITSymbolFlags::MaterializationSideEffectsOnly}}),
+      [&](MaterializationResponsibility R) { R.failMaterialization(); })));
+
+  EXPECT_THAT_EXPECTED(
+      ES.lookup(makeJITDylibSearchOrder(&JD), SymbolLookupSet({Foo})),
+      Failed());
+  EXPECT_THAT_EXPECTED(
+      ES.lookup(makeJITDylibSearchOrder(&JD), SymbolLookupSet({Foo})),
+      Failed());
+}
+
 TEST_F(CoreAPIsStandardTest, RemoveSymbolsTest) {
   // Test that:
   // (1) Missing symbols generate a SymbolsNotFound error.


        


More information about the llvm-commits mailing list