summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/dll/test/shared_library_search_symbol_test.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/dll/test/shared_library_search_symbol_test.cpp
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/dll/test/shared_library_search_symbol_test.cpp')
-rw-r--r--src/boost/libs/dll/test/shared_library_search_symbol_test.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/boost/libs/dll/test/shared_library_search_symbol_test.cpp b/src/boost/libs/dll/test/shared_library_search_symbol_test.cpp
new file mode 100644
index 000000000..cf1dc66fc
--- /dev/null
+++ b/src/boost/libs/dll/test/shared_library_search_symbol_test.cpp
@@ -0,0 +1,49 @@
+// Copyright 2011-2012 Renato Tegon Forti
+// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
+// Copyright 2015-2019 Antony Polukhin.
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// For more information, see http://www.boost.org
+
+#include "../example/b2_workarounds.hpp"
+#include <boost/dll.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+// Unit Tests
+
+extern "C" void BOOST_SYMBOL_EXPORT exef() {
+}
+
+int main(int argc, char* argv[])
+{
+ using namespace boost::dll;
+
+ boost::dll::fs::path shared_library_path = b2_workarounds::first_lib_from_argv(argc, argv);
+ BOOST_TEST(shared_library_path.string().find("test_library") != std::string::npos);
+ BOOST_TEST(b2_workarounds::is_shared_library(shared_library_path));
+ std::cout << "Library: " << shared_library_path;
+
+ {
+ shared_library sl(shared_library_path);
+ BOOST_TEST(sl.has("say_hello"));
+ BOOST_TEST(sl.has("lib_version"));
+ BOOST_TEST(sl.has("integer_g"));
+ BOOST_TEST(sl.has(std::string("integer_g")));
+ BOOST_TEST(!sl.has("i_do_not_exist"));
+ BOOST_TEST(!sl.has(std::string("i_do_not_exist")));
+ }
+
+ {
+ shared_library sl(program_location());
+ BOOST_TEST(sl.has("exef"));
+ BOOST_TEST(!sl.has("i_do_not_exist"));
+ }
+
+
+ exef(); // Make sure that this function still callable in traditional way
+ return boost::report_errors();
+}
+