-
Notifications
You must be signed in to change notification settings - Fork 74
Add post-installation sanity test #2389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # This file is part of t8code. | ||
| # t8code is a C library to manage a collection (a forest) of multiple | ||
| # connected adaptive space-trees of general element types in parallel. | ||
| # | ||
| # Copyright (C) 2026 the developers | ||
| # | ||
| # t8code is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # t8code is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with t8code; if not, write to the Free Software Foundation, Inc., | ||
| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
|
||
| cmake_minimum_required( VERSION 3.19 ) | ||
|
|
||
| project( T8CODE_POST_INSTALL_SANITY LANGUAGES C CXX ) | ||
|
|
||
| find_package( T8CODE CONFIG REQUIRED ) | ||
|
|
||
| add_executable( t8code_post_install_sanity t8code_post_install_sanity.cxx ) | ||
| target_link_libraries( t8code_post_install_sanity PRIVATE T8CODE::T8 ) | ||
|
|
||
| enable_testing() | ||
| add_test( NAME t8code_post_install_sanity COMMAND t8code_post_install_sanity ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # t8code post-installation sanity test | ||
|
|
||
| This directory contains a minimal external CMake project that checks whether an installed t8code package can be found, | ||
| linked, and run. | ||
|
|
||
| Configure it with the t8code installation prefix in `CMAKE_PREFIX_PATH`: | ||
|
|
||
| ```sh | ||
| cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/t8code/install | ||
| cmake --build build | ||
| ctest --test-dir build --output-on-failure | ||
| ``` |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||||||||||
| /* | ||||||||||||
| This file is part of t8code. | ||||||||||||
| t8code is a C library to manage a collection (a forest) of multiple | ||||||||||||
| connected adaptive space-trees of general element types in parallel. | ||||||||||||
|
|
||||||||||||
| Copyright (C) 2026 the developers | ||||||||||||
|
|
||||||||||||
| t8code is free software; you can redistribute it and/or modify | ||||||||||||
| it under the terms of the GNU General Public License as published by | ||||||||||||
| the Free Software Foundation; either version 2 of the License, or | ||||||||||||
| (at your option) any later version. | ||||||||||||
|
|
||||||||||||
| t8code is distributed in the hope that it will be useful, | ||||||||||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||
| GNU General Public License for more details. | ||||||||||||
|
|
||||||||||||
| You should have received a copy of the GNU General Public License | ||||||||||||
| along with t8code; if not, write to the Free Software Foundation, Inc., | ||||||||||||
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||||||||||
| */ | ||||||||||||
|
|
||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| #include <t8.h> | ||||||||||||
|
|
||||||||||||
| int | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| main (int argc, char **argv) | ||||||||||||
| { | ||||||||||||
| int mpiret = sc_MPI_Init (&argc, &argv); | ||||||||||||
| SC_CHECK_MPI (mpiret); | ||||||||||||
|
|
||||||||||||
| sc_init (sc_MPI_COMM_WORLD, 1, 1, NULL, SC_LP_ESSENTIAL); | ||||||||||||
| t8_init (SC_LP_PRODUCTION); | ||||||||||||
|
|
||||||||||||
| t8_global_productionf ("t8code post-installation sanity test succeeded.\n"); | ||||||||||||
|
|
||||||||||||
| sc_finalize (); | ||||||||||||
|
|
||||||||||||
| mpiret = sc_MPI_Finalize (); | ||||||||||||
| SC_CHECK_MPI (mpiret); | ||||||||||||
|
|
||||||||||||
| return 0; | ||||||||||||
| } | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,12 @@ | |
|
|
||
| include( CMakeFindDependencyMacro ) | ||
|
|
||
| set( T8CODE_ENABLE_MPI @T8CODE_ENABLE_MPI@ ) | ||
|
|
||
| if( T8CODE_ENABLE_MPI ) | ||
| find_dependency( MPI 3.0 COMPONENTS C ) | ||
| endif() | ||
|
Comment on lines
3
to
+9
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain why this change is necessary or how it is related to the psost-install tests? |
||
|
|
||
| find_dependency( P4EST CONFIG ) | ||
| find_dependency( SC CONFIG ) | ||
|
|
||
|
|
@@ -11,7 +17,6 @@ set( T8CODE_BUILD_TUTORIALS @T8CODE_BUILD_TUTORIALS@ ) | |
| set( T8CODE_BUILD_EXAMPLES @T8CODE_BUILD_EXAMPLES@ ) | ||
| set( T8CODE_BUILD_MESH_HANDLE @T8CODE_BUILD_MESH_HANDLE@ ) | ||
|
|
||
| set( T8CODE_ENABLE_MPI @T8CODE_ENABLE_MPI@ ) | ||
| set( T8CODE_ENABLE_VTK @T8CODE_ENABLE_VTK@ ) | ||
|
|
||
| set( T8CODE_USE_SYSTEM_SC @T8CODE_USE_SYSTEM_SC@ ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to move everything related to the post-install tests to an own cmake file to keep the main t8code file clean.
Then we could simply say something like
include(cmake/PostInstallTests.cmake)here.