diff --git a/CMakeLists.txt b/CMakeLists.txt index 88df53cf3..b3bde946e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,6 @@ SET(LIB ${CMAKE_SOURCE_DIR}/lib) SET(BIN ${CMAKE_SOURCE_DIR}/bin) SET(MOD ${CMAKE_SOURCE_DIR}/include) SET(PY ${CMAKE_SOURCE_DIR}/swiftest) -#SET(TEST ${CMAKE_SOURCE_DIR}/tests) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB}) @@ -73,9 +72,6 @@ SET(CMAKE_Fortran_MODULE_DIRECTORY ${MOD}) ADD_SUBDIRECTORY(${SRC} ${BIN}) ADD_SUBDIRECTORY(${PY}) -# # Set up test directory -# ENABLE_TESTING() -# ADD_SUBDIRECTORY(${TEST}) # Add a distclean target to the Makefile ADD_CUSTOM_TARGET(distclean diff --git a/pyproject.toml b/pyproject.toml index b15841821..036396069 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,9 @@ requires = [ ] build-backend = "setuptools.build_meta" +[tool.cibuildwheel] +dependency-versions = "latest" + [tool.cibuildwheel.linux] environment = {SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF", FFLAGS="${FFLAGS} -fPIC", CFLAGS="${CFLAGS} -fPIC", LDFLAGS="${LDFLAGS} -fPIE", LIBS="-lgomp"} before-all = [ diff --git a/src/base/base_module.f90 b/src/base/base_module.f90 index 8dde5d36f..a056a94b2 100644 --- a/src/base/base_module.f90 +++ b/src/base/base_module.f90 @@ -623,7 +623,7 @@ subroutine base_util_exit(code,unit) case default write(iu, FAIL_MSG) VERSION write(iu, BAR) - error stop + stop end select stop diff --git a/src/misc/lambda_function_module.f90 b/src/misc/lambda_function_module.f90 index 9f7a0ef70..cea7dea29 100644 --- a/src/misc/lambda_function_module.f90 +++ b/src/misc/lambda_function_module.f90 @@ -79,7 +79,7 @@ module lambda_function !! if (allocated(self%lastarg)) deallocate(self%lastarg) !! allocate(self%lastarg, source=x) !! else - !! error stop "Lambda function was not initialized" + !! stop "Lambda function was not initialized" !! end if !! end function lambda_ri_args_eval !! @@ -238,7 +238,7 @@ function lambda_eval_0(self, x) result(y) if (allocated(self%lastarg)) deallocate(self%lastarg) allocate(self%lastarg, source=x) else - error stop "Lambda function was not initialized" + stop "Lambda function was not initialized" end if end function lambda_eval_0 @@ -255,7 +255,7 @@ function lambda_eval_0_err(self, x) result(y) if (allocated(self%lastarg)) deallocate(self%lastarg) allocate(self%lastarg, source=x) else - error stop "Lambda function was not initialized" + stop "Lambda function was not initialized" end if end function lambda_eval_0_err @@ -270,7 +270,7 @@ function lambda_eval_tvar(self, x, t) result(y) if (associated(self%lambdaptr_tvar)) then y = self%lambdaptr_tvar(x,t) else - error stop "Lambda function was not initialized" + stop "Lambda function was not initialized" end if end function lambda_eval_tvar diff --git a/src/tides/tides_spin_step.f90 b/src/tides/tides_spin_step.f90 index 40a8f1659..697485ae6 100644 --- a/src/tides/tides_spin_step.f90 +++ b/src/tides/tides_spin_step.f90 @@ -82,7 +82,7 @@ module function tides_derivs_eval(self, x, t) result(y) if (associated(self%lambdaptr_tides_deriv)) then y = self%lambdaptr_tides_deriv(x, t, self%dt, self%rbeg, self%rend) else - error stop "Lambda function was not initialized" + stop "Lambda function was not initialized" end if return diff --git a/swiftest/_bindings.pyx b/swiftest/_bindings.pyx index 8f8265c04..fbc8dab69 100644 --- a/swiftest/_bindings.pyx +++ b/swiftest/_bindings.pyx @@ -13,6 +13,10 @@ def driver(integrator, param_file_name, display_style): char* c_param_file_name = b_param_file_name char* c_display_style = b_display_style - with nogil: - bindings_c_driver(c_integrator, c_param_file_name, c_display_style) + try: + with nogil: + bindings_c_driver(c_integrator, c_param_file_name, c_display_style) + except: + raise Warning("The Swiftest driver did not terminate normally") + return \ No newline at end of file diff --git a/swiftest/tests/CMakeLists.txt b/swiftest/tests/CMakeLists.txt deleted file mode 100644 index 4a7f951f0..000000000 --- a/swiftest/tests/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -ENABLE_TESTING() -FIND_PACKAGE(Python COMPONENTS Interpreter REQUIRED) - -SET(UNIT_TEST swiftest_test_suite) -ADD_CUSTOM_TARGET(${UNIT_TEST} ALL) -ADD_DEPENDENCIES(${UNIT_TEST} ${SWIFTEST_DRIVER}) - -ADD_TEST(NAME ${UNIT_TEST} COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/test_input_output.py) - -ADD_CUSTOM_COMMAND( - TARGET ${UNIT_TEST} - COMMENT "Run tests" - POST_BUILD - WORKING_DIRECTORY ${TEST} - COMMAND ${CMAKE_CTEST_COMMAND} "${UNIT_TEST}" --output-on-failures -) - diff --git a/swiftest/tests/test_input_output.py b/swiftest/tests/test_input_output.py index d4ddc7c50..745abc582 100755 --- a/swiftest/tests/test_input_output.py +++ b/swiftest/tests/test_input_output.py @@ -60,10 +60,6 @@ def test01_gen_ic(self): for f in file_list: self.assertTrue(os.path.exists(f)) - def test02_read_ic(self): - """ - Tests that Swiftest is able to read a set of pre-existing initial conditions files and that they contain the correct data - """ print("\ntest_read_ic: Test whether we can read back initial conditions files created by test_gen_ic") sim = swiftest.Simulation(read_param=True) # Check if all names in Dataset read in from file match the expected list of names @@ -72,12 +68,21 @@ def test02_read_ic(self): # Check to see if all parameter values read in from file match the expected parameters saved when generating the file self.assertTrue(all([v == param[k] for k,v in sim.param.items() if k in param])) - def test03_integrators(self): + def test02_integrators(self): """ Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators """ print("\ntest_integrators: Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators") - sim = swiftest.Simulation(read_param=True) + sim = swiftest.Simulation() + sim.clean() + + # Add the modern planets and the Sun using the JPL Horizons Database. + # Add the modern planets and the Sun using the JPL Horizons Database. + sim.add_solar_system_body(major_bodies) + + # Display the run configuration parameters. + param = sim.get_parameter(verbose=False) + sim.save() # Add 10 user-defined test particles. ntp = 10 @@ -90,18 +95,14 @@ def test03_integrators(self): omega_tp = rng.uniform(0.0, 360.0, ntp) capm_tp = rng.uniform(0.0, 360.0, ntp) - integrators= ["whm","helio","rmvs","symba"] + integrators= ["helio","whm","rmvs","symba"] sim.add_body(name=name_tp, a=a_tp, e=e_tp, inc=inc_tp, capom=capom_tp, omega=omega_tp, capm=capm_tp) - sim.set_parameter(tstart=0.0, tstop=0.02, dt=0.01, istep_out=1, dump_cadence=0) - integrators= ["whm","helio","rmvs","symba"] + sim.set_parameter(tstart=0.0, tstop=0.10, dt=0.01, istep_out=1, dump_cadence=0) for i in integrators: - try: - sim.run(integrator=i) - except: - self.fail(f"Failed with integrator {i}") + sim.run(integrator=i) - def test04_conservation(self): + def test03_conservation(self): """ Tests that Swiftest conserves mass, energy, and momentum to within acceptable tolerances. """