feat(initial): added portable mfem build system
This commit is contained in:
86
tests/meson.build
Normal file
86
tests/meson.build
Normal file
@@ -0,0 +1,86 @@
|
||||
if get_option('build_tests') and get_option('build_examples')
|
||||
runtime_environment = environment()
|
||||
if (
|
||||
mfem_runtime_prefix != '' and dependency_prefix != '' and
|
||||
not wheel_carries_native_bundle
|
||||
)
|
||||
runtime_environment.prepend('PATH', dependency_prefix / 'bin')
|
||||
if host_machine.system() == 'darwin'
|
||||
runtime_environment.prepend('DYLD_LIBRARY_PATH', dependency_prefix / 'lib64')
|
||||
runtime_environment.prepend('DYLD_LIBRARY_PATH', dependency_prefix / 'lib')
|
||||
elif host_machine.system() != 'windows' and not is_wasm
|
||||
runtime_environment.prepend('LD_LIBRARY_PATH', dependency_prefix / 'lib64')
|
||||
runtime_environment.prepend('LD_LIBRARY_PATH', dependency_prefix / 'lib')
|
||||
endif
|
||||
endif
|
||||
if mfem_runtime_prefix != ''
|
||||
runtime_environment.prepend('PATH', mfem_runtime_prefix / 'bin')
|
||||
if host_machine.system() == 'darwin'
|
||||
runtime_environment.prepend('DYLD_LIBRARY_PATH', mfem_runtime_prefix / 'lib64')
|
||||
runtime_environment.prepend('DYLD_LIBRARY_PATH', mfem_runtime_prefix / 'lib')
|
||||
elif host_machine.system() != 'windows' and not is_wasm
|
||||
runtime_environment.prepend('LD_LIBRARY_PATH', mfem_runtime_prefix / 'lib64')
|
||||
runtime_environment.prepend('LD_LIBRARY_PATH', mfem_runtime_prefix / 'lib')
|
||||
endif
|
||||
endif
|
||||
|
||||
test(
|
||||
'serial-poisson',
|
||||
serial_example,
|
||||
env: runtime_environment,
|
||||
timeout: 120,
|
||||
)
|
||||
|
||||
if mfem_has_mpi
|
||||
if mpi_launcher_from_dependency and not wheel_carries_native_bundle
|
||||
mpi_launcher_program = find_program(
|
||||
dependency_prefix / 'bin' / 'mpiexec',
|
||||
dependency_prefix / 'bin' / 'mpirun',
|
||||
required: true,
|
||||
)
|
||||
mpi_launcher = mpi_launcher_program.full_path()
|
||||
elif mfem_runtime_prefix != ''
|
||||
mpi_launcher = mfem_runtime_prefix / 'bin' / 'mpiexec'
|
||||
else
|
||||
mpi_launcher_program = find_program('mpiexec', 'mpirun', required: true)
|
||||
mpi_launcher = mpi_launcher_program.full_path()
|
||||
endif
|
||||
test(
|
||||
'parallel-hypre-boomeramg',
|
||||
python_build,
|
||||
args: [
|
||||
files('../tools/run_mpi_test.py'),
|
||||
'--launcher', mpi_launcher,
|
||||
'--processes', '2',
|
||||
parallel_example,
|
||||
],
|
||||
env: runtime_environment,
|
||||
timeout: 180,
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('build_tests') and get_option('build_python')
|
||||
python_test_environment = environment()
|
||||
python_test_environment.prepend('PYTHONPATH', python_extension_dir)
|
||||
if mfem_runtime_prefix != ''
|
||||
if host_machine.system() == 'darwin'
|
||||
python_test_environment.prepend('DYLD_LIBRARY_PATH', mfem_runtime_prefix / 'lib64')
|
||||
python_test_environment.prepend('DYLD_LIBRARY_PATH', mfem_runtime_prefix / 'lib')
|
||||
elif host_machine.system() != 'windows'
|
||||
python_test_environment.prepend('LD_LIBRARY_PATH', mfem_runtime_prefix / 'lib64')
|
||||
python_test_environment.prepend('LD_LIBRARY_PATH', mfem_runtime_prefix / 'lib')
|
||||
endif
|
||||
endif
|
||||
test(
|
||||
'python-nanobind',
|
||||
python_build,
|
||||
args: [
|
||||
'-c',
|
||||
'import _core; assert _core.serial_poisson_dofs(3, 1) > 0; assert _core.capabilities()["hypre"] == _core.capabilities()["mpi"]',
|
||||
],
|
||||
depends: python_extension,
|
||||
env: python_test_environment,
|
||||
timeout: 120,
|
||||
)
|
||||
endif
|
||||
Reference in New Issue
Block a user