diff options
Diffstat (limited to '')
-rw-r--r-- | test cases/frameworks/25 hdf5/main.c | 30 | ||||
-rw-r--r-- | test cases/frameworks/25 hdf5/main.cpp | 29 | ||||
-rw-r--r-- | test cases/frameworks/25 hdf5/main.f90 | 17 | ||||
-rw-r--r-- | test cases/frameworks/25 hdf5/meson.build | 47 | ||||
-rw-r--r-- | test cases/frameworks/25 hdf5/meson_options.txt | 6 | ||||
-rw-r--r-- | test cases/frameworks/25 hdf5/test.json | 11 |
6 files changed, 140 insertions, 0 deletions
diff --git a/test cases/frameworks/25 hdf5/main.c b/test cases/frameworks/25 hdf5/main.c new file mode 100644 index 0000000..4c46310 --- /dev/null +++ b/test cases/frameworks/25 hdf5/main.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "hdf5.h" + +int main(void) +{ +herr_t ier; +unsigned maj, min, rel; + +ier = H5open(); +if (ier) { + fprintf(stderr,"Unable to initialize HDF5: %d\n", ier); + return EXIT_FAILURE; +} + +ier = H5get_libversion(&maj, &min, &rel); +if (ier) { + fprintf(stderr,"HDF5 did not initialize!\n"); + return EXIT_FAILURE; +} +printf("C HDF5 version %d.%d.%d\n", maj, min, rel); + +ier = H5close(); +if (ier) { + fprintf(stderr,"Unable to close HDF5: %d\n", ier); + return EXIT_FAILURE; +} +return EXIT_SUCCESS; +} diff --git a/test cases/frameworks/25 hdf5/main.cpp b/test cases/frameworks/25 hdf5/main.cpp new file mode 100644 index 0000000..477e76b --- /dev/null +++ b/test cases/frameworks/25 hdf5/main.cpp @@ -0,0 +1,29 @@ +#include <iostream> +#include "hdf5.h" + + +int main(void) +{ +herr_t ier; +unsigned maj, min, rel; + +ier = H5open(); +if (ier) { + std::cerr << "Unable to initialize HDF5: " << ier << std::endl; + return EXIT_FAILURE; +} + +ier = H5get_libversion(&maj, &min, &rel); +if (ier) { + std::cerr << "HDF5 did not initialize!" << std::endl; + return EXIT_FAILURE; +} +std::cout << "C++ HDF5 version " << maj << "." << min << "." << rel << std::endl; + +ier = H5close(); +if (ier) { + std::cerr << "Unable to close HDF5: " << ier << std::endl; + return EXIT_FAILURE; +} +return EXIT_SUCCESS; +} diff --git a/test cases/frameworks/25 hdf5/main.f90 b/test cases/frameworks/25 hdf5/main.f90 new file mode 100644 index 0000000..45be146 --- /dev/null +++ b/test cases/frameworks/25 hdf5/main.f90 @@ -0,0 +1,17 @@ +use hdf5 + +implicit none + +integer :: ier, major, minor, rel + +call h5open_f(ier) +if (ier /= 0) error stop 'Unable to initialize HDF5' + +call h5get_libversion_f(major, minor, rel, ier) +if (ier /= 0) error stop 'Unable to check HDF5 version' +print '(A,I1,A1,I0.2,A1,I1)','Fortran HDF5 version ',major,'.',minor,'.',rel + +call h5close_f(ier) +if (ier /= 0) error stop 'Unable to close HDF5 library' + +end program diff --git a/test cases/frameworks/25 hdf5/meson.build b/test cases/frameworks/25 hdf5/meson.build new file mode 100644 index 0000000..0df2ffd --- /dev/null +++ b/test cases/frameworks/25 hdf5/meson.build @@ -0,0 +1,47 @@ +project('hdf5_framework', 'c') + +# NOTE: all HDF5 languages must have HDF5 C library working. + +method = get_option('method') + +# --- C tests +h5c = dependency('hdf5', language : 'c', required : false, method : method) +if not h5c.found() + error('MESON_SKIP_TEST: HDF5 C library not found.') +endif +exec = executable('exec', 'main.c', dependencies : h5c) +test('HDF5 C', exec, timeout: 30) + +# --- C++ tests +if add_languages('cpp', required: false) + h5cpp = dependency('hdf5', language : 'cpp', required : false, disabler: true, method : method) + execpp = executable('execpp', 'main.cpp', dependencies : h5cpp) + test('HDF5 C++', execpp, timeout: 30) +endif + +test_fortran = add_languages('fortran', required: false) + +if test_fortran + cpp = meson.get_compiler('cpp') + fc = meson.get_compiler('fortran') + + if host_machine.system() == 'darwin' and cpp.get_id() == 'clang' and fc.get_id() == 'gcc' + # Search paths don't work correctly here and -lgfortran doesn't work + test_fortran = false + elif host_machine.system() == 'windows' and cpp.get_id() != 'gcc' and fc.get_id() == 'gcc' + # mixing gfotran with non-gcc doesn't work on windows + test_fortran = false + endif + + # --- Fortran tests + if test_fortran + h5f = dependency('hdf5', language : 'fortran', required : false, disabler: true, method : method) + exef = executable('exef', 'main.f90', dependencies : h5f) + test('HDF5 Fortran', exef, timeout: 30) + endif +endif + +# Check we can apply a version constraint +if h5c.version() != 'unknown' + dependency('hdf5', version: '>=@0@'.format(h5c.version())) +endif diff --git a/test cases/frameworks/25 hdf5/meson_options.txt b/test cases/frameworks/25 hdf5/meson_options.txt new file mode 100644 index 0000000..741f58e --- /dev/null +++ b/test cases/frameworks/25 hdf5/meson_options.txt @@ -0,0 +1,6 @@ +option( + 'method', + type : 'combo', + choices : ['pkg-config', 'config-tool'], + value : 'pkg-config' +) diff --git a/test cases/frameworks/25 hdf5/test.json b/test cases/frameworks/25 hdf5/test.json new file mode 100644 index 0000000..dd073ec --- /dev/null +++ b/test cases/frameworks/25 hdf5/test.json @@ -0,0 +1,11 @@ +{ + "matrix": { + "options": { + "method": [ + { "val": "pkg-config", "skip_on_jobname": ["macos"] }, + { "val": "config-tool" } + ] + } + }, + "skip_on_jobname": ["azure", "cygwin", "fedora", "msys2", "opensuse"] +} |