Skip to content

Commit 56703e8

Browse files
authored
Support running tests against HDF5 2.0.0 with CMake builds (#130)
* Support HDF5 2.0.0 with CMake builds
1 parent 04c3b5f commit 56703e8

File tree

5 files changed

+80
-3
lines changed

5 files changed

+80
-3
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
matrix:
3434
os: [ubuntu-latest]
3535
python-version: ["3.10"]
36-
hdf5-branch: ["hdf5_1_14", "develop"]
36+
hdf5-branch: ["hdf5_1_14"]
3737

3838
runs-on: ${{matrix.os}}
3939
steps:

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent)
311311
endif ()
312312
endmacro ()
313313

314-
315314
#-----------------------------------------------------------------------------
316315
# Setup output Directories
317316
#-----------------------------------------------------------------------------
@@ -582,7 +581,6 @@ if (BUILD_STATIC_LIBS)
582581
${HDF5_C_HL_LIBRARIES})
583582
endif()
584583

585-
586584
#-----------------------------------------------------------------------------
587585
# Build the REST VOL
588586
#-----------------------------------------------------------------------------

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,9 @@ else
11611161
enable_static=no
11621162
fi
11631163

1164+
# Autotools build isn't supported by HDF5 >= 2.0.0, so assume HDF5 version is < 2.0.0
1165+
AC_DEFINE([HDF5_2], [0], [Whether HDF5 version is at least 2.0.0])
1166+
11641167
## Expose things for *.in markup
11651168
AC_SUBST([STATIC_SHARED])
11661169
AC_SUBST([enable_shared])

test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ MACRO (ADD_HDF5_VOL_REST_EXE file)
4343
target_link_libraries (${file} PUBLIC ${HDF5_VOL_REST_LIB_TARGET})
4444
set_target_properties (${file} PROPERTIES FOLDER test)
4545
add_dependencies(${file} ${HDF5_VOL_REST_LIB_TARGET})
46+
target_compile_definitions(${file} PRIVATE HDF5_2=$<IF:$<VERSION_GREATER_EQUAL:${HDF5_VERSION},2.0.0>,1,0>)
4647
endif ()
4748
if (BUILD_SHARED_LIBS)
4849
add_executable (${file}-shared ${HDF5_VOL_REST_TEST_SOURCE_DIR}/${file}.c)
4950
RV_TARGET_C_PROPERTIES (${file}-shared SHARED " " " ")
5051
target_link_libraries (${file}-shared PUBLIC ${HDF5_VOL_REST_LIBSH_TARGET})
5152
set_target_properties (${file}-shared PROPERTIES FOLDER test)
5253
add_dependencies(${file}-shared ${HDF5_VOL_REST_LIBSH_TARGET})
54+
target_compile_definitions(${file}-shared PRIVATE HDF5_2=$<IF:$<VERSION_GREATER_EQUAL:${HDF5_VERSION},2.0.0>,1,0>)
5355
endif (BUILD_SHARED_LIBS)
5456
ENDMACRO (ADD_HDF5_VOL_REST_EXE file)
5557

test/test_rest_vol.c

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18281,6 +18281,10 @@ generate_random_datatype(H5T_class_t parent_class)
1828118281
goto case_vlen;
1828218282
case H5T_ARRAY:
1828318283
goto case_array;
18284+
#if HDF5_2
18285+
case H5T_COMPLEX:
18286+
goto case_complex;
18287+
#endif
1828418288
default:
1828518289
H5_FAILED();
1828618290
printf(" invalid value for goto\n");
@@ -18365,6 +18369,10 @@ generate_random_datatype(H5T_class_t parent_class)
1836518369
goto case_vlen;
1836618370
case H5T_ARRAY:
1836718371
goto case_array;
18372+
#if HDF5_2
18373+
case H5T_COMPLEX:
18374+
goto case_complex;
18375+
#endif
1836818376
default:
1836918377
H5_FAILED();
1837018378
printf(" invalid value for goto\n");
@@ -18400,6 +18408,10 @@ generate_random_datatype(H5T_class_t parent_class)
1840018408
goto case_vlen;
1840118409
case H5T_ARRAY:
1840218410
goto case_array;
18411+
#if HDF5_2
18412+
case H5T_COMPLEX:
18413+
goto case_complex;
18414+
#endif
1840318415
default:
1840418416
H5_FAILED();
1840518417
printf(" invalid value for goto\n");
@@ -18443,6 +18455,10 @@ generate_random_datatype(H5T_class_t parent_class)
1844318455
goto case_vlen;
1844418456
case H5T_ARRAY:
1844518457
goto case_array;
18458+
#if HDF5_2
18459+
case H5T_COMPLEX:
18460+
goto case_complex;
18461+
#endif
1844618462
default:
1844718463
H5_FAILED();
1844818464
printf(" invalid value for goto\n");
@@ -18527,6 +18543,10 @@ generate_random_datatype(H5T_class_t parent_class)
1852718543
goto case_vlen;
1852818544
case H5T_ARRAY:
1852918545
goto case_array;
18546+
#if HDF5_2
18547+
case H5T_COMPLEX:
18548+
goto case_complex;
18549+
#endif
1853018550
default:
1853118551
H5_FAILED();
1853218552
printf(" invalid value for goto\n");
@@ -18566,6 +18586,10 @@ generate_random_datatype(H5T_class_t parent_class)
1856618586
goto case_vlen;
1856718587
case H5T_ARRAY:
1856818588
goto case_array;
18589+
#if HDF5_2
18590+
case H5T_COMPLEX:
18591+
goto case_complex;
18592+
#endif
1856918593
default:
1857018594
H5_FAILED();
1857118595
printf(" invalid value for goto\n");
@@ -18614,6 +18638,10 @@ generate_random_datatype(H5T_class_t parent_class)
1861418638
goto case_vlen;
1861518639
case H5T_ARRAY:
1861618640
goto case_array;
18641+
#if HDF5_2
18642+
case H5T_COMPLEX:
18643+
goto case_complex;
18644+
#endif
1861718645
default:
1861818646
H5_FAILED();
1861918647
printf(" invalid value for goto\n");
@@ -18669,6 +18697,10 @@ generate_random_datatype(H5T_class_t parent_class)
1866918697
goto case_vlen;
1867018698
case H5T_ARRAY:
1867118699
goto case_array;
18700+
#if HDF5_2
18701+
case H5T_COMPLEX:
18702+
goto case_complex;
18703+
#endif
1867218704
default:
1867318705
H5_FAILED();
1867418706
printf(" invalid value for goto\n");
@@ -18710,6 +18742,10 @@ generate_random_datatype(H5T_class_t parent_class)
1871018742
goto case_vlen;
1871118743
case H5T_ARRAY:
1871218744
goto case_array;
18745+
#if HDF5_2
18746+
case H5T_COMPLEX:
18747+
goto case_complex;
18748+
#endif
1871318749
default:
1871418750
H5_FAILED();
1871518751
printf(" invalid value for goto\n");
@@ -18739,6 +18775,44 @@ generate_random_datatype(H5T_class_t parent_class)
1873918775

1874018776
break;
1874118777
}
18778+
#if HDF5_2
18779+
case_complex:
18780+
case H5T_COMPLEX: {
18781+
/* Complex datatypes are unsupported, try again */
18782+
switch (rand() % H5T_NCLASSES) {
18783+
case H5T_INTEGER:
18784+
goto case_integer;
18785+
case H5T_FLOAT:
18786+
goto case_float;
18787+
case H5T_TIME:
18788+
goto case_time;
18789+
case H5T_STRING:
18790+
goto case_string;
18791+
case H5T_BITFIELD:
18792+
goto case_bitfield;
18793+
case H5T_OPAQUE:
18794+
goto case_opaque;
18795+
case H5T_COMPOUND:
18796+
goto case_compound;
18797+
case H5T_REFERENCE:
18798+
goto case_reference;
18799+
case H5T_ENUM:
18800+
goto case_enum;
18801+
case H5T_VLEN:
18802+
goto case_vlen;
18803+
case H5T_ARRAY:
18804+
goto case_array;
18805+
case H5T_COMPLEX:
18806+
goto case_complex;
18807+
default:
18808+
H5_FAILED();
18809+
printf(" invalid value for goto\n");
18810+
break;
18811+
}
18812+
18813+
break;
18814+
}
18815+
#endif
1874218816

1874318817
default:
1874418818
H5_FAILED();

0 commit comments

Comments
 (0)