From f991b6b6e30ce0c629087c1d734db08f143ab628 Mon Sep 17 00:00:00 2001 From: Shreyas Atre Date: Fri, 16 Feb 2024 16:34:53 -0600 Subject: [PATCH] Add a function to find path of libtestsharedlib using std::filesystem Signed-off-by: Shreyas Atre --- unittests/CppInterOp/DynamicLibraryManagerTest.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/unittests/CppInterOp/DynamicLibraryManagerTest.cpp b/unittests/CppInterOp/DynamicLibraryManagerTest.cpp index ee735eb96..45021f00d 100644 --- a/unittests/CppInterOp/DynamicLibraryManagerTest.cpp +++ b/unittests/CppInterOp/DynamicLibraryManagerTest.cpp @@ -7,6 +7,8 @@ #include "../../lib/Interpreter/Paths.h" +#include + // 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 @@ -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<