File tree Expand file tree Collapse file tree 8 files changed +113
-7
lines changed Expand file tree Collapse file tree 8 files changed +113
-7
lines changed Original file line number Diff line number Diff line change @@ -287,3 +287,11 @@ if(OGS_BUILD_WHEEL)
287287 message (FATAL_ERROR "Binary list comparison failed. Please update binaries_list in provide_ogs_cli_tools_via_wheel.py!" )
288288 endif ()
289289endif ()
290+
291+ if (TARGET ogs_test_dlopen)
292+ # Has to come last in this top-level CMakeLists.txt to add tests for all shared libraries.
293+ # We pass ${Python_LIBRARIES} as additional lib(s) to load, because many OGS libs
294+ # (e.g. each process, because of a cyclic dependency between the generic process lib and (Python) BCs)
295+ # depend on them and they are not explicitly linked against.
296+ for_each_subdir("${PROJECT_SOURCE_DIR} " add_dlopen_tests ${Python_LIBRARIES} )
297+ endif ()
Original file line number Diff line number Diff line change @@ -213,11 +213,6 @@ ProcessVariable::ProcessVariable(
213213
214214ProcessVariable::ProcessVariable (ProcessVariable&&) = default;
215215
216- std::string const & ProcessVariable::getName () const
217- {
218- return _name;
219- }
220-
221216MeshLib::Mesh const & ProcessVariable::getMesh () const
222217{
223218 return _mesh;
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ class ProcessVariable
7272
7373 ProcessVariable (ProcessVariable&&);
7474
75- std::string const & getName () const ;
75+ std::string const & getName () const { return _name; }
7676
7777 // / Returns a mesh on which the process variable is defined.
7878 MeshLib::Mesh const & getMesh () const ;
Original file line number Diff line number Diff line change @@ -198,3 +198,5 @@ endif()
198198# cmake-format: on
199199
200200unset (CMAKE_FOLDER)
201+
202+ add_subdirectory (Dlopen)
Original file line number Diff line number Diff line change 1+ if (LINUX)
2+ add_executable (ogs_test_dlopen dlopen.cpp)
3+
4+ # Adds ogs_test_dlopen tests for each shared library in the passed dir.
5+ # Any surplus arguments (${ARGN}) are added as commandline arguments to the test command.
6+ function (add_dlopen_tests dir)
7+ get_directory_property (_targets DIRECTORY "${dir} " BUILDSYSTEM_TARGETS)
8+
9+ foreach (target IN LISTS _targets)
10+ get_target_property (_type ${target} TYPE )
11+ if (_type STREQUAL "SHARED_LIBRARY" )
12+ add_test (
13+ NAME "dlopen_${target} "
14+ COMMAND $<TARGET_FILE:ogs_test_dlopen> ${ARGN} $<TARGET_FILE:${target} >)
15+ set_tests_properties ("dlopen_${target} " PROPERTIES DEPENDS ogs_test_dlopen)
16+ endif ()
17+ endforeach ()
18+ endfunction ()
19+
20+ # Invokes the passed callback for each subdirectory of the passed directory (and for dir itself).
21+ # Only subdirectories of the ${PROJECT_SOURCE_DIR} are considered.
22+ # Any surplus arguments (${ARGN}) are passed on to the callback.
23+ function (for_each_subdir dir callback)
24+ if (COMMAND ${callback} )
25+ cmake_language(CALL "${callback} " "${dir} " ${ARGN} )
26+ else ()
27+ message (FATAL_ERROR "Callback ${callback} is not a valid function" )
28+ endif ()
29+
30+ get_directory_property (_subdirs DIRECTORY "${dir} " SUBDIRECTORIES)
31+
32+ foreach (subdir IN LISTS _subdirs)
33+ string (FIND "${subdir} " "${PROJECT_SOURCE_DIR} " _index)
34+ if (NOT _index EQUAL 0)
35+ continue ()
36+ endif ()
37+
38+ for_each_subdir("${subdir} " "${callback} " ${ARGN} )
39+ endforeach ()
40+ endfunction ()
41+ endif ()
Original file line number Diff line number Diff line change 1+ /* *
2+ * \file
3+ * \copyright
4+ * Copyright (c) 2012-2025, OpenGeoSys Community (http://www.opengeosys.org)
5+ * Distributed under a Modified BSD License.
6+ * See accompanying file LICENSE.txt or
7+ * http://www.opengeosys.org/project/license
8+ *
9+ */
10+
11+ #include < dlfcn.h>
12+
13+ #include < cassert>
14+ #include < iostream>
15+
16+ void * load (char const * lib)
17+ {
18+ void * handle = dlopen (lib, RTLD_NOW | RTLD_GLOBAL);
19+
20+ if (!handle)
21+ {
22+ std::cerr << dlerror () << ' \n ' ;
23+ std::exit (EXIT_FAILURE);
24+ }
25+
26+ dlerror (); /* Clear any existing error */
27+
28+ return handle;
29+ }
30+
31+ int main (int argc, char ** argv)
32+ {
33+ if (argc < 2 )
34+ {
35+ std::cerr << " you invoked this command without arguments\n " ;
36+ std::exit (EXIT_FAILURE);
37+ }
38+
39+ for (int i = 1 ; i < argc; ++i)
40+ {
41+ void * handle = load (argv[i]);
42+ std::cout << " lib address of " << argv[i] << " is: " << handle
43+ << std::endl;
44+ }
45+ }
Original file line number Diff line number Diff line change 33 when : always
44 paths :
55 - build/*/logs
6+ - build/*/Testing/Temporary/LastTestsFailed*.log
67 - build/*/Tests/ctest-junit.xml
78 - build/*/Tests/testrunner.xml
89 - build/*/make.txt
Original file line number Diff line number Diff line change @@ -70,12 +70,26 @@ aggregate ctest logs:
7070 tags : [envinf, shell]
7171 script :
7272 - |
73+ out_root=build/log_summary
7374 python -m venv .venv_custom_job
7475 . .venv_custom_job/bin/activate
7576 pip install pandas
7677 mkdir -p build/log_summary
7778 set -x
78- Applications/Python/ogs/dev/ogs_log_summary.py --snippet-out --out build/log_summary/ -v build/*/logs &>build/log_summary/ogs_log_summary.txt
79+ Applications/Python/ogs/dev/ogs_log_summary.py --snippet-out --out "$out_root" -v build/*/logs &>"$out_root/ogs_log_summary.txt"
80+ #
81+ # summarize failed ctests
82+ #
83+ function exists() {
84+ [ -e "$1" ]
85+ }
86+ if exists build/*/Testing/Temporary/LastTestsFailed*.log
87+ then
88+ out_dir="$out_root/Testing/Temporary"
89+ mkdir -p "$out_dir"
90+ echo "### Failed ctests from all jobs (and number of jobs where they failed):"
91+ cut -d':' -f2- build/*/Testing/Temporary/LastTestsFailed*.log | sort | uniq -c | tee "$out_dir/LastTestsFailed.log"
92+ fi
7993 rules :
8094 - when : always
8195 artifacts :
You can’t perform that action at this time.
0 commit comments