Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-penev committed Sep 19, 2024
1 parent 7b15669 commit a04706e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 75 deletions.
5 changes: 2 additions & 3 deletions unittests/CppInterOp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ set_output_directory(DynamicLibraryManagerTests BINARY_DIR ${CMAKE_BINARY_DIR}/u
add_dependencies(DynamicLibraryManagerTests TestSharedLib)
#export_executable_symbols_for_plugins(TestSharedLib)
add_subdirectory(TestSharedLib)

add_dependencies(DynamicLibraryManagerTests TestSharedLib1)
#export_executable_symbols_for_plugins(TestSharedLib1)
add_subdirectory(TestSharedLib1)

add_dependencies(DynamicLibraryManagerTests TestSharedLib2)
#export_executable_symbols_for_plugins(TestSharedLib2)
add_subdirectory(TestSharedLib2)
add_dependencies(DynamicLibraryManagerTests TestSharedLib3)
#export_executable_symbols_for_plugins(TestSharedLib3)
add_subdirectory(TestSharedLib3)
53 changes: 6 additions & 47 deletions unittests/CppInterOp/DynamicLibraryManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,51 +167,10 @@ TEST(DynamicLibraryManagerTest, LibrariesAutoloadExtraCoverage) {
rss << MU;
EXPECT_STRNE("", rss.str().c_str()) << "MU problem!";

// Cover: LoadLibrary error
// if (DLM->loadLibrary(lib, false) != DynamicLibraryManager::LoadLibResult::kLoadLibSuccess) {
// LLVM_DEBUG(dbgs() << "MU: Failed to load library " << lib);
// string err = "MU: Failed to load library! " + lib;
// perror(err.c_str());
// } else {
// Find library with "ret_value" symbol defined and exported
std::string PathToTestSharedLib3 =
Cpp::SearchLibrariesForSymbol(MangleNameForDlsym("ret_val").c_str(), /*search_system=*/false);
// If result is "" then we cannot find this library.
EXPECT_STRNE("", PathToTestSharedLib3.c_str())
<< "Cannot find: '" << PathToTestSharedLib3 << "' in '" << Dir.str() << "'";
// Remove library for simulate load error
llvm::sys::fs::remove(PathToTestSharedLib3, true);
EXPECT_TRUE(Cpp::GetLibrariesAutoload());
// FIXME: Conda returns false to run this code on osx.
EXPECT_FALSE(Cpp::GetFunctionAddress(MangleNameForDlsym("ret_val").c_str()));

// Cover
// } else {
// // Collect all failing symbols, delegate their responsibility and then
// // fail their materialization. R->defineNonExistent() sounds like it
// // should do that, but it's not implemented?!
// failedSymbols.insert(symbol);
// TODO: implement test this case

// Cover
// if (!failedSymbols.empty()) {
// auto failingMR = R->delegate(failedSymbols);
// if (failingMR) {
// (*failingMR)->failMaterialization();
// TODO: implement test this case

// Cover
// void discard(const llvm::orc::JITDylib &JD, const llvm::orc::SymbolStringPtr &Name) override {}
// TODO: implement test this case

// Cover
// if (Path.empty()) {
// LLVM_DEBUG(dbgs() << "DynamicLibraryManager::lookupLibMaybeAddExt(): "
// TODO: implement test this case

// Cover
// platform::DLClose(dyLibHandle, &errMsg);
// if (!errMsg.empty()) {
// LLVM_DEBUG(dbgs() << "DynamicLibraryManager::unloadLibrary(): "
// TODO: implement test this case
//TODO: Test and cover also if it is possible:
// 1. Error when LoadLibrary
// 2. if (!failedSymbols.empty()) { ...
// 3. void discard(const llvm::orc::JITDylib &JD, const llvm::orc::SymbolStringPtr &Name) override {}
// 4. if (Path.empty()) { ...
// 5. platform::DLClose(dyLibHandle, &errMsg);
}
11 changes: 0 additions & 11 deletions unittests/CppInterOp/TestSharedLib3/CMakeLists.txt

This file was deleted.

3 changes: 0 additions & 3 deletions unittests/CppInterOp/TestSharedLib3/TestSharedLib3.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions unittests/CppInterOp/TestSharedLib3/TestSharedLib3.h

This file was deleted.

0 comments on commit a04706e

Please sign in to comment.