diff options
| author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-07-31 15:38:26 -0400 |
|---|---|---|
| committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-08-04 20:07:08 -0400 |
| commit | edb260b4f4e79433f38bdda11bc84fa5ee56b080 (patch) | |
| tree | d27b0f958319e46f5487b328019b34b704c1e809 /test cases/frameworks | |
| parent | 4cbfb9a08dd8b89aaec7fffd4efbe3a542a67a3d (diff) | |
| download | meson-edb260b4f4e79433f38bdda11bc84fa5ee56b080.tar.gz | |
Move MPI tests into frameworks.
This prevents them being cross-compiled (which wouldn't work without MPI
cross-compilers) and disables Windows builds (will need to be fixed
later.)
Diffstat (limited to 'test cases/frameworks')
| -rw-r--r-- | test cases/frameworks/17 mpi/main.c | 27 | ||||
| -rw-r--r-- | test cases/frameworks/17 mpi/main.cpp | 11 | ||||
| -rw-r--r-- | test cases/frameworks/17 mpi/main.f90 | 21 | ||||
| -rw-r--r-- | test cases/frameworks/17 mpi/meson.build | 33 |
4 files changed, 92 insertions, 0 deletions
diff --git a/test cases/frameworks/17 mpi/main.c b/test cases/frameworks/17 mpi/main.c new file mode 100644 index 000000000..e44357a97 --- /dev/null +++ b/test cases/frameworks/17 mpi/main.c @@ -0,0 +1,27 @@ +#include <stdio.h> +#include <mpi.h> + +int main(int argc, char **argv) +{ + int ier, flag; + ier = MPI_Init(&argc, &argv); + if (ier) { + printf("Unable to initialize MPI: %d\n", ier); + return 1; + } + ier = MPI_Initialized(&flag); + if (ier) { + printf("Unable to check MPI initialization state: %d\n", ier); + return 1; + } + if (!flag) { + printf("MPI did not initialize!\n"); + return 1; + } + ier = MPI_Finalize(); + if (ier) { + printf("Unable to finalize MPI: %d\n", ier); + return 1; + } + return 0; +} diff --git a/test cases/frameworks/17 mpi/main.cpp b/test cases/frameworks/17 mpi/main.cpp new file mode 100644 index 000000000..0e0b62173 --- /dev/null +++ b/test cases/frameworks/17 mpi/main.cpp @@ -0,0 +1,11 @@ +#include <mpi.h> + +int main(int argc, char **argv) +{ + MPI::Init(argc, argv); + if (!MPI::Is_initialized()) { + printf("MPI did not initialize!\n"); + return 1; + } + MPI::Finalize(); +} diff --git a/test cases/frameworks/17 mpi/main.f90 b/test cases/frameworks/17 mpi/main.f90 new file mode 100644 index 000000000..d379e96f8 --- /dev/null +++ b/test cases/frameworks/17 mpi/main.f90 @@ -0,0 +1,21 @@ +program mpitest + implicit none + include 'mpif.h' + logical :: flag + integer :: ier + call MPI_Init(ier) + if (ier /= 0) then + print *, 'Unable to initialize MPI: ', ier + stop 1 + endif + call MPI_Initialized(flag, ier) + if (ier /= 0) then + print *, 'Unable to check MPI initialization state: ', ier + stop 1 + endif + call MPI_Finalize(ier) + if (ier /= 0) then + print *, 'Unable to finalize MPI: ', ier + stop 1 + endif +end program mpitest diff --git a/test cases/frameworks/17 mpi/meson.build b/test cases/frameworks/17 mpi/meson.build new file mode 100644 index 000000000..5e9bc563d --- /dev/null +++ b/test cases/frameworks/17 mpi/meson.build @@ -0,0 +1,33 @@ +project('mpi', 'c', 'cpp') + +cc = meson.get_compiler('c') + +if build_machine.system() == 'windows' and cc.get_id() != 'msvc' + error('MESON_SKIP_TEST: MPI not available on Windows without MSVC.') +endif + +mpic = dependency('mpi', language : 'c') +exec = executable('exec', + 'main.c', + dependencies : [mpic]) + +test('MPI C', exec) + +if build_machine.system() != 'windows' + # C++ MPI not supported by MS-MPI used on AppVeyor. + mpicpp = dependency('mpi', language : 'cpp') + execpp = executable('execpp', + 'main.cpp', + dependencies : [mpicpp]) + + test('MPI C++', execpp) +endif + +if add_languages('fortran', required : false) + mpifort = dependency('mpi', language : 'fortran') + exef = executable('exef', + 'main.f90', + dependencies : [mpifort]) + + test('MPI Fortran', exef) +endif |
