Skip to content

Commit

Permalink
Add a function to find path of libtestsharedlib using std::filesystem
Browse files Browse the repository at this point in the history
Signed-off-by: Shreyas Atre <[email protected]>
  • Loading branch information
SAtacker committed Feb 16, 2024
1 parent 01182ab commit f991b6b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions unittests/CppInterOp/DynamicLibraryManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "../../lib/Interpreter/Paths.h"

#include <filesystem>

// This function isn't referenced outside its translation unit, but it
// can't use the "static" keyword because its address is used for
// GetMainExecutable (since some platforms don't support taking the
Expand Down Expand Up @@ -59,6 +61,17 @@ TEST(DynamicLibraryManagerTest, Sanity) {

TEST(UtilsPlatform, DLTest) {
std::string err = "";
std::string path = "";
for (auto const& dir_entry : std::filesystem::recursive_directory_iterator(
std::filesystem::current_path())) {
if (std::string(dir_entry.path()).find("libTestSharedLib.") !=
std::string::npos) {
path = dir_entry.path();
break;
}
}
EXPECT_FALSE(path.empty());
std::cout<<path<<"\n";
#if defined(__APPLE__)
auto dlopen_handle =
Cpp::utils::platform::DLOpen("./libTestSharedLib.dylib", err);
Expand Down

0 comments on commit f991b6b

Please sign in to comment.