diff --git a/scripts/spack/packages/serac/package.py b/scripts/spack/packages/serac/package.py index ca80e7e73..643122840 100644 --- a/scripts/spack/packages/serac/package.py +++ b/scripts/spack/packages/serac/package.py @@ -96,15 +96,16 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on('enzyme@0.0.180', when="+enzyme") # Devtool dependencies these need to match serac_devtools/package.py - depends_on("cppcheck", when="+devtools") - depends_on("doxygen", when="+devtools") - depends_on("llvm@19+clang", when="+devtools") - depends_on("python", when="+devtools") - depends_on("py-sphinx", when="+devtools") + with when("+devtools"): + depends_on("cppcheck") + depends_on("doxygen") + depends_on("llvm@19+clang") + depends_on("python") + depends_on("py-sphinx") with when("+sundials"): # Going to sundials@7: causes 80%+ test failures - depends_on("sundials@:6.999", when="+sundials") + depends_on("sundials@:6.999") # MFEM is deprecating the monitoring support with sundials v6.0 and later # NOTE: Sundials must be built static to prevent the following runtime error: # "error while loading shared libraries: libsundials_nvecserial.so.6: @@ -126,20 +127,22 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("hypre@2.26.0:~superlu-dist+mpi") - depends_on("petsc", when="+petsc") - depends_on("petsc+strumpack", when="+petsc+strumpack") - depends_on("petsc~strumpack", when="+petsc~strumpack") - depends_on("petsc+openmp", when="+petsc+openmp") - depends_on("petsc~openmp", when="+petsc~openmp") - depends_on("slepc+arpack", when="+slepc") - - depends_on("tribol", when="+tribol") - depends_on("tribol+raja", when="+raja") - depends_on("tribol~raja", when="~raja") - depends_on("tribol+umpire", when="+umpire") - depends_on("tribol~umpire", when="~umpire") - depends_on("tribol+enzyme", when="+enzyme") - depends_on("tribol~enzyme", when="~enzyme") + with when("+petsc"): + depends_on("petsc") + depends_on("petsc+strumpack", when="+strumpack") + depends_on("petsc~strumpack", when="~strumpack") + depends_on("petsc+openmp", when="+openmp") + depends_on("petsc~openmp", when="~openmp") + depends_on("slepc+arpack", when="+slepc") + + with when("+tribol"): + depends_on("tribol") + depends_on("tribol+raja", when="+raja") + depends_on("tribol~raja", when="~raja") + depends_on("tribol+umpire", when="+umpire") + depends_on("tribol~umpire", when="~umpire") + depends_on("tribol+enzyme", when="+enzyme") + depends_on("tribol~enzyme", when="~enzyme") # Needs to be first due to a bug with the Spack concretizer # Note: Certain combinations of CMake and Conduit do not like +mpi @@ -149,15 +152,17 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("camp@2024.02.0:") - depends_on("raja@2024.02.0:~examples~exercises", when="+raja") - depends_on("raja~openmp", when="+raja~openmp") - depends_on("raja+openmp", when="+raja+openmp") + with when("+raja"): + depends_on("raja@2024.02.0:~examples~exercises") + depends_on("raja+openmp", when="+openmp") + depends_on("raja~openmp", when="~openmp") - depends_on("umpire@2024.02.0:~examples~device_alloc", when="+umpire") - depends_on("umpire~openmp", when="+umpire~openmp") - depends_on("umpire+openmp", when="+umpire+openmp") + with when("+umpire"): + depends_on("umpire@2024.02.0:~examples~device_alloc") + depends_on("umpire+openmp", when="+openmp") + depends_on("umpire~openmp", when="~openmp") - depends_on("axom@0.9:~fortran~tools~examples+mfem+lua") + depends_on("axom@0.10:~fortran~tools~examples+mfem+lua") depends_on("axom+raja", when="+raja") depends_on("axom~raja", when="~raja") depends_on("axom+umpire", when="+umpire") @@ -170,15 +175,17 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("conduit~python~test") - depends_on("adiak+mpi", when="+profiling") - depends_on("caliper+mpi+adiak~papi", when="+profiling") + with when("+profiling"): + depends_on("adiak+mpi") + depends_on("caliper+mpi+adiak~papi") depends_on("superlu-dist@8.1.2") # The optional slate dependency is not handled in the MFEM spack package - depends_on("strumpack~slate~butterflypack~zfp", when="+strumpack") - depends_on("strumpack+openmp", when="+strumpack+openmp") - depends_on("strumpack~openmp", when="+strumpack~openmp") + with when("+strumpack"): + depends_on("strumpack~slate~butterflypack~zfp") + depends_on("strumpack+openmp", when="+openmp") + depends_on("strumpack~openmp", when="~openmp") # # Forward variants @@ -242,8 +249,8 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("{0}~shared".format(dep), when="~shared") # MFEM has a static variant - depends_on("{0}+static".format("mfem"), when="~shared") - depends_on("{0}~static".format("mfem"), when="+shared") + depends_on("mfem+static", when="~shared") + depends_on("mfem~static", when="+shared") # # Conflicts @@ -261,9 +268,6 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): conflicts("~petsc", when="+slepc", msg="PETSc must be built when building with SLEPc!") - conflicts("sundials@:6.0.0", when="+sundials", - msg="Sundials needs to be greater than 6.0.0") - conflicts("sundials+shared", when="+sundials", msg="Sundials causes runtime errors if shared!") diff --git a/src/serac/infrastructure/tests/CMakeLists.txt b/src/serac/infrastructure/tests/CMakeLists.txt index 4942c51cf..3784f14da 100644 --- a/src/serac/infrastructure/tests/CMakeLists.txt +++ b/src/serac/infrastructure/tests/CMakeLists.txt @@ -4,13 +4,21 @@ # # SPDX-License-Identifier: (BSD-3-Clause) -set(infrastructure_test_depends serac_physics gtest) +set(infrastructure_test_depends serac_infrastructure gtest) set(infrastructure_test_sources + application_manager.cpp debug_print.cpp - error_handling.cpp - input.cpp - profiling.cpp) + input.cpp) serac_add_tests( SOURCES ${infrastructure_test_sources} DEPENDS_ON ${infrastructure_test_depends}) + + +# Infrastructure tests that require more than just infrastructure + +serac_add_tests( SOURCES error_handling.cpp + DEPENDS_ON serac_physics ${infrastructure_test_depends}) + +serac_add_tests( SOURCES profiling.cpp + DEPENDS_ON serac_mesh_utils ${infrastructure_test_depends}) diff --git a/src/serac/infrastructure/tests/application_manager.cpp b/src/serac/infrastructure/tests/application_manager.cpp new file mode 100644 index 000000000..37b5f6708 --- /dev/null +++ b/src/serac/infrastructure/tests/application_manager.cpp @@ -0,0 +1,30 @@ +// Copyright (c) Lawrence Livermore National Security, LLC and +// other Serac Project Developers. See the top-level LICENSE file for +// details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#include "gtest/gtest.h" + +#include "serac/serac_config.hpp" +#include "serac/infrastructure/application_manager.hpp" + +namespace { +// Stash copies that tests can read (after gtest strips its flags) +int g_argc = 0; +char** g_argv = nullptr; +} // namespace + +namespace serac { + +TEST(ApplicationManager, Lifetime) { serac::ApplicationManager applicationManager(g_argc, g_argv); } + +} // namespace serac + +int main(int argc, char* argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); // removes --gtest_* flags + g_argc = argc; // store leftovers for tests + g_argv = argv; + return RUN_ALL_TESTS(); +}