Skip to content

Commit e2bd1f6

Browse files
committed
cmake/meson: skip tests when used as external/subproject
1 parent b5e993b commit e2bd1f6

File tree

3 files changed

+41
-25
lines changed

3 files changed

+41
-25
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if(NOT CMAKE_BUILD_TYPE)
44
endif()
55
project(hdf5iface
66
LANGUAGES Fortran
7-
VERSION 2.1.0
7+
VERSION 2.2.0
88
HOMEPAGE_URL https://github.com/scivision/h5fortran)
99
enable_testing()
1010

@@ -14,4 +14,9 @@ include(cmake/hdf5.cmake)
1414

1515
add_subdirectory(src)
1616

17+
# skip tests if used as ExternalProject
18+
if(NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
19+
return()
20+
endif()
21+
1722
add_subdirectory(tests)

meson.build

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project('h5fortran', 'fortran',
22
meson_version : '>=0.52.0',
3-
version : '2.1.0',
3+
version : '2.2.0',
44
default_options : ['default_library=static', 'buildtype=release', 'warning_level=3'])
55

66
subdir('meson')
@@ -15,24 +15,6 @@ ooh5 = library('h5fortran',
1515
hdf5_interface = declare_dependency(link_with: ooh5, dependencies: hdf5)
1616

1717
# --- testing
18-
subdir('tests')
19-
20-
shapes = executable('shapes_hdf5', 'tests/GetShape.f90',
21-
dependencies: hdf5_interface,
22-
fortran_args: quiet)
23-
24-
test('Shapes', shapes,
25-
args: [meson.build_root()/'p5.h5','/group69/flux_node'],
26-
is_parallel: false,
27-
suite: 'h5fortran',
28-
priority: -100,
29-
timeout: 15)
30-
31-
python = find_program('python')
32-
33-
test('CheckShapes', python,
34-
args: [files('tests/GetShapes.py'), meson.build_root()/'p5.h5', '/group69/flux_node'],
35-
is_parallel: false,
36-
suite: 'h5fortran',
37-
priority: -100,
38-
timeout: 30)
18+
if not meson.is_subproject()
19+
subdir('tests')
20+
endif

tests/meson.build

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
1+
test_error = executable('test_error', 'test_error.f90',
2+
dependencies: hdf5_interface)
3+
test('errors', test_error,
4+
args: meson.current_build_dir(),
5+
suite: 'h5basic',
6+
timeout: 10)
7+
8+
19
testh5 = executable('test_hdf5', 'test_hdf5_ifc.f90',
210
dependencies: hdf5_interface,
311
fortran_args: quiet)
412
test('h5interface', testh5,
513
is_parallel: false,
6-
suite: 'h5fortran',
7-
priority: 100,
14+
suite: 'h5basic',
815
timeout: 15)
16+
17+
shapes = executable('shapes_hdf5', 'GetShape.f90',
18+
dependencies: hdf5_interface,
19+
fortran_args: quiet)
20+
21+
testfn = meson.build_root()/'p5.h5'
22+
23+
test('Shapes', shapes,
24+
args: [testfn,'/group69/flux_node'],
25+
is_parallel: false,
26+
suite: 'h5shaky',
27+
priority: -100,
28+
timeout: 15)
29+
30+
python = find_program('python')
31+
32+
test('CheckShapes', python,
33+
args: [files('GetShapes.py'), testfn, '/group69/flux_node'],
34+
is_parallel: false,
35+
suite: 'h5shaky',
36+
priority: -100,
37+
timeout: 30)

0 commit comments

Comments
 (0)