Skip to content

Commit

Permalink
Support running tests against HDF5 2.0.0 with CMake builds (#130)
Browse files Browse the repository at this point in the history
* Support HDF5 2.0.0 with CMake builds
  • Loading branch information
mattjala authored Nov 25, 2024
1 parent 04c3b5f commit 56703e8
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
hdf5-branch: ["hdf5_1_14", "develop"]
hdf5-branch: ["hdf5_1_14"]

runs-on: ${{matrix.os}}
steps:
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent)
endif ()
endmacro ()


#-----------------------------------------------------------------------------
# Setup output Directories
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -582,7 +581,6 @@ if (BUILD_STATIC_LIBS)
${HDF5_C_HL_LIBRARIES})
endif()


#-----------------------------------------------------------------------------
# Build the REST VOL
#-----------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,9 @@ else
enable_static=no
fi

# Autotools build isn't supported by HDF5 >= 2.0.0, so assume HDF5 version is < 2.0.0
AC_DEFINE([HDF5_2], [0], [Whether HDF5 version is at least 2.0.0])

## Expose things for *.in markup
AC_SUBST([STATIC_SHARED])
AC_SUBST([enable_shared])
Expand Down
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ MACRO (ADD_HDF5_VOL_REST_EXE file)
target_link_libraries (${file} PUBLIC ${HDF5_VOL_REST_LIB_TARGET})
set_target_properties (${file} PROPERTIES FOLDER test)
add_dependencies(${file} ${HDF5_VOL_REST_LIB_TARGET})
target_compile_definitions(${file} PRIVATE HDF5_2=$<IF:$<VERSION_GREATER_EQUAL:${HDF5_VERSION},2.0.0>,1,0>)
endif ()
if (BUILD_SHARED_LIBS)
add_executable (${file}-shared ${HDF5_VOL_REST_TEST_SOURCE_DIR}/${file}.c)
RV_TARGET_C_PROPERTIES (${file}-shared SHARED " " " ")
target_link_libraries (${file}-shared PUBLIC ${HDF5_VOL_REST_LIBSH_TARGET})
set_target_properties (${file}-shared PROPERTIES FOLDER test)
add_dependencies(${file}-shared ${HDF5_VOL_REST_LIBSH_TARGET})
target_compile_definitions(${file}-shared PRIVATE HDF5_2=$<IF:$<VERSION_GREATER_EQUAL:${HDF5_VERSION},2.0.0>,1,0>)
endif (BUILD_SHARED_LIBS)
ENDMACRO (ADD_HDF5_VOL_REST_EXE file)

Expand Down
74 changes: 74 additions & 0 deletions test/test_rest_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -18281,6 +18281,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18365,6 +18369,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18400,6 +18408,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18443,6 +18455,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18527,6 +18543,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18566,6 +18586,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18614,6 +18638,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18669,6 +18697,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18710,6 +18742,10 @@ generate_random_datatype(H5T_class_t parent_class)
goto case_vlen;
case H5T_ARRAY:
goto case_array;
#if HDF5_2
case H5T_COMPLEX:
goto case_complex;
#endif
default:
H5_FAILED();
printf(" invalid value for goto\n");
Expand Down Expand Up @@ -18739,6 +18775,44 @@ generate_random_datatype(H5T_class_t parent_class)

break;
}
#if HDF5_2
case_complex:
case H5T_COMPLEX: {
/* Complex datatypes are unsupported, try again */
switch (rand() % H5T_NCLASSES) {
case H5T_INTEGER:
goto case_integer;
case H5T_FLOAT:
goto case_float;
case H5T_TIME:
goto case_time;
case H5T_STRING:
goto case_string;
case H5T_BITFIELD:
goto case_bitfield;
case H5T_OPAQUE:
goto case_opaque;
case H5T_COMPOUND:
goto case_compound;
case H5T_REFERENCE:
goto case_reference;
case H5T_ENUM:
goto case_enum;
case H5T_VLEN:
goto case_vlen;
case H5T_ARRAY:
goto case_array;
case H5T_COMPLEX:
goto case_complex;
default:
H5_FAILED();
printf(" invalid value for goto\n");
break;
}

break;
}
#endif

default:
H5_FAILED();
Expand Down

0 comments on commit 56703e8

Please sign in to comment.