Skip to content

Commit

Permalink
Merge pull request #328 from lanl/jmm/spack2-v3
Browse files Browse the repository at this point in the history
update catch2 v2 to catch2 v3
  • Loading branch information
Yurlungur authored Nov 30, 2023
2 parents 34f2208 + 503724c commit 6fe168d
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 29 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,8 @@ if(SINGULARITY_BUILD_TESTS)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
# MAUNEYC: On my side, this version works. The ones pinned onto upstream
# codes do not like to play with clang and/or newer compilers.
GIT_TAG v2.13.7)
# or later is fine too
GIT_TAG v3.0.1)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/contrib)
endif()
Expand Down
3 changes: 2 additions & 1 deletion spack-repo/packages/singularity-eos/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class SingularityEos(CMakePackage, CudaPackage):

# building/testing/docs
depends_on("cmake@3.19:")
depends_on("catch2@2.13.7", when="+tests")
depends_on("catch2@3.0.1:", when="@main +tests")
depends_on("catch2@2.13.7", when="@:1.8.0 +tests")
depends_on("python@3:", when="+python")
depends_on("py-numpy", when="+python+tests")
depends_on("py-pybind11@2.9.1:", when="+python")
Expand Down
5 changes: 4 additions & 1 deletion spack-repo/packages/spiner/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ class Spiner(CMakePackage, CudaPackage):

variant("python", default=False, description="Python, Numpy & Matplotlib Support")

variant("test", default=False, description="Build tests")

depends_on("cmake@3.12:", when="@:1.5.1")
depends_on("cmake@3.19:", when="@1.6.0:")
depends_on("catch2@2.13.4:2.13.9")
depends_on("catch2@3.0.1:", when="@main +test")
depends_on("catch2@2.13.4:2.13.9", when="@:1.6.2 +test")
depends_on("ports-of-call@1.2.0:", when="@:1.5.1")
depends_on("ports-of-call@1.5.1:", when="@1.6.0:")
depends_on("ports-of-call@main", when="@main")
Expand Down
7 changes: 1 addition & 6 deletions test/catch2_define.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@
// publicly and display publicly, and to permit others to do so.
//------------------------------------------------------------------------------

#include <catch2/catch_session.hpp>
#include <ports-of-call/portability.hpp>

#ifndef CATCH_CONFIG_RUNNER
#define CATCH_CONFIG_RUNNER
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#endif

int main(int argc, char *argv[]) {

#ifdef PORTABILITY_STRATEGY_KOKKOS
Expand Down
2 changes: 1 addition & 1 deletion test/eos_unit_test_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif
#include <cmath>
#include <cstdio>
Expand Down
6 changes: 2 additions & 4 deletions test/test_eos_gruneisen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <limits>
#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <singularity-eos/base/constants.hpp>
Expand Down Expand Up @@ -56,9 +56,7 @@ SCENARIO("Gruneisen EOS entropy is disabled", "[GruneisenEOS][Entropy]") {
EOS host_eos = Gruneisen(C0, S1, S2, S3, Gamma0, b, rho0, T0, P0, Cv);
EOS eos = host_eos.GetOnDevice();
THEN("A call to the entropy should throw an exception") {
using Catch::Matchers::Contains;
auto msg_matcher = Contains("Entropy is not enabled");
REQUIRE_THROWS_WITH(eos.EntropyFromDensityTemperature(1.0, 1.0), msg_matcher);
REQUIRE_THROWS(eos.EntropyFromDensityTemperature(1.0, 1.0));
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions test/test_eos_helmholtz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <ports-of-call/portability.hpp>
Expand All @@ -34,7 +34,6 @@
#include <singularity-eos/eos/eos.hpp>
#include <test/eos_unit_test_helpers.hpp>

using Catch::Matchers::WithinRel;
using singularity::Helmholtz;
const std::string filename = "../data/helmholtz/helm_table.dat";
SCENARIO("Helmholtz equation of state - Table interpolation (tgiven)", "[HelmholtzEOS]") {
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_ideal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <test/eos_unit_test_helpers.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_modifiers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <test/eos_unit_test_helpers.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_noble_abel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <limits>
#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <singularity-eos/base/constants.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_sap_polynomial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <limits>
#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <singularity-eos/base/constants.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_stellar_collapse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <test/eos_unit_test_helpers.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_stiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cstdlib>
#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <singularity-eos/base/constants.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_tabulated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <test/eos_unit_test_helpers.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <test/eos_unit_test_helpers.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_vinet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <cstdlib>
#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <ports-of-call/portability.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_math_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

#include <test/eos_unit_test_helpers.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/test_variadic_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#ifndef CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_FAST_COMPILE
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#endif

using singularity::Gruneisen;
Expand Down

0 comments on commit 6fe168d

Please sign in to comment.