diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 5 | ||||
-rw-r--r-- | config/cmake_ext_mod/runTest.cmake | 9 | ||||
-rw-r--r-- | config/toolchain/build32.cmake | 36 | ||||
-rw-r--r-- | java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java | 6 | ||||
-rw-r--r-- | java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java | 20 | ||||
-rw-r--r-- | java/src/jni/h5pFAPLImp.c | 334 | ||||
-rw-r--r-- | java/src/jni/h5pFAPLImp.h | 36 | ||||
-rw-r--r-- | java/test/TestH5Pfaplhdfs.java | 69 | ||||
-rw-r--r-- | java/test/TestH5Pfapls3.java | 67 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 31 | ||||
-rw-r--r-- | src/H5FDros3.h | 20 | ||||
-rw-r--r-- | src/H5FDs3comms.c | 49 | ||||
-rw-r--r-- | src/H5FDs3comms.h | 2 | ||||
-rw-r--r-- | tools/libtest/CMakeLists.txt | 19 | ||||
-rw-r--r-- | tools/libtest/CMakeTests.cmake | 2 | ||||
-rw-r--r-- | tools/libtest/h5tools_test_utils.c | 37 |
17 files changed, 545 insertions, 201 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a9a759f..38ec775 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required (VERSION 3.10) project (HDF5 C) +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + #----------------------------------------------------------------------------- # Instructions for use : Normal Build # diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index cb1eb48..7d0f429 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -159,11 +159,16 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if (HDF5_ENABLE_ROS3_VFD) + # CMake version 3.13 fixed FindCURL module + if(CMAKE_VERSION VERSION_LESS "3.13.0" AND WIN32) + MESSAGE(FATAL_ERROR "Windows builds for this option requires a minimum of CMake 3.13") + endif () find_package(CURL REQUIRED) find_package(OpenSSL REQUIRED) if (${CURL_FOUND} AND ${OPENSSL_FOUND}) set (${HDF_PREFIX}_HAVE_ROS3_VFD 1) list (APPEND LINK_LIBS ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) + INCLUDE_DIRECTORIES (${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) else () message (STATUS "The Read-Only S3 VFD was requested but cannot be built.\nPlease check that openssl and cURL are available on your\nsystem, and/or re-configure without option HDF5_ENABLE_ROS3_VFD.") endif () diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index e601653..6f633f3 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -343,6 +343,15 @@ if (TEST_GREP_COMPARE) endif () endif () +# dump the output unless nodisplay option is set +if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + execute_process ( + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_STREAM} + RESULT_VARIABLE TEST_RESULT + ) +endif () + # everything went fine... message (STATUS "${TEST_PROGRAM} Passed") diff --git a/config/toolchain/build32.cmake b/config/toolchain/build32.cmake index d078956..deb5899 100644 --- a/config/toolchain/build32.cmake +++ b/config/toolchain/build32.cmake @@ -3,6 +3,42 @@ if (WIN32) set (CMAKE_GENERATOR_PLATFORM "x86") elseif(APPLE) set (CMAKE_OSX_ARCHITECTURES "i386") +elseif(MINGW) + set (CMAKE_SYSTEM_NAME Windows) + set (CMAKE_C_COMPILER i686-w64-mingw32-gcc) + set (CMAKE_CXX_COMPILER i686-w64-mingw32-g++) + set (CMAKE_RC_COMPILER i686-w64-mingw32-windres) + set (CMAKE_Fortran_COMPILER i686-w64-mingw32-gfortran) + + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags") + + set (LIB32 /usr/lib) # Fedora + + if (EXISTS "/usr/lib32") + set (LIB32 /usr/lib32) # Arch, Solus + endif () + + set (CMAKE_SYSTEM_LIBRARY_PATH ${LIB32} CACHE STRING "system library search path" FORCE) + set (CMAKE_LIBRARY_PATH ${LIB32} CACHE STRING "library search path" FORCE) + + # this is probably unlikely to be needed, but just in case + set (CMAKE_EXE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "executable linker flags" FORCE) + set (CMAKE_SHARED_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "shared library linker flags" FORCE) + set (CMAKE_MODULE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "module linker flags" FORCE) + + # on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have + # to include the regular system .pc files as well (at the end), because some + # are not always present in the 32 bit directory + if (EXISTS "${LIB32}/pkgconfig") + set (ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig) + endif () + + set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + set (CMAKE_CROSSCOMPILING_EMULATOR wine32) else () set (CMAKE_SYSTEM_NAME Linux) diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java index c13473c..9fcff2e 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java @@ -23,14 +23,14 @@ import java.io.Serializable; * Used for the access of files hosted on the Hadoop Distributed File System. */ -@SuppressWarnings("serial") // mute default serialUID warnings until someone knowledgeable comes along or something breaks horribly public class H5FD_hdfs_fapl_t implements Serializable { + private static final long serialVersionUID = 2072473407027648309L; - private long version; + private int version; private String namenode_name; + private int namenode_port; private String user_name; private String kerberos_ticket_cache; - private int namenode_port; private int stream_buffer_size; /* diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java index 881aad3..a899e10 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java @@ -17,13 +17,14 @@ package hdf.hdf5lib.structs; import java.io.Serializable; /* - * Java representation of the ROS3 VFD file access property list (fapl) + * Java representation of the ROS3 VFD file access property list (fapl) * structure. * * Used for the access of files hosted remotely on S3 by Amazon. - * + * * For simplicity, implemented assuming that all ROS3 fapls have components: * - version + * - authenticate * - aws_region * - secret_id * - secret_key @@ -38,14 +39,15 @@ import java.io.Serializable; * H5FD_ros3_fapl_v2_t (extends super with Version 2 components) * and so on, for each version * - * "super" is passed around, and is version-checked and re-cast as + * "super" is passed around, and is version-checked and re-cast as * appropriate */ -@SuppressWarnings("serial") // mute default serialUID warnings until someone knowledgeable comes along or something breaks horribly public class H5FD_ros3_fapl_t implements Serializable { + private static final long serialVersionUID = 8985533001471224030L; - private long version; + private int version; + private boolean authenticate; private String aws_region; private String secret_id; private String secret_key; @@ -111,10 +113,10 @@ public class H5FD_ros3_fapl_t implements Serializable { @Override public String toString() { return "H5FD_ros3_fapl_t (Version:" + this.version + ") {" + - "\n aws_region : " + this.aws_region + - "\n secret_id : " + this.secret_id + - "\n secret_key : " + this.secret_key + - "\n}\n"; + "\n aws_region : " + this.aws_region + + "\n secret_id : " + this.secret_id + + "\n secret_key : " + this.secret_key + + "\n}\n"; } } diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index acfc853..006707a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -370,6 +370,179 @@ done: return (jlong)offset; } /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */ +/* Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_hdfs + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs + (JNIEnv *env, jclass clss, jlong fapl_id) +{ +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_fapl_t fa; + jvalue args[5]; + jint j_namenode_port = 0; + jstring j_namenode_name = NULL; + jstring j_user_name = NULL; + jstring j_kerb_cache_path = NULL; + jint j_stream_buffer_size = 0; +#endif /* H5_HAVE_LIBHDFS */ + jobject ret_obj = NULL; + + UNUSED(clss); + +#ifdef H5_HAVE_LIBHDFS + if (H5Pget_fapl_hdfs((hid_t)fapl_id, &fa) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL != fa.namenode_name) { + if (NULL == (j_namenode_name = ENVPTR->NewStringUTF(ENVONLY, fa.namenode_name))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create namenode_name string"); + } + } + args[0].l = j_namenode_name; + + args[1].i = (jint)fa.namenode_port; + + if (NULL != fa.user_name) { + if (NULL == (j_user_name = ENVPTR->NewStringUTF(ENVONLY, fa.user_name))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create user_name string"); + } + } + args[2].l = j_user_name; + + if (NULL != fa.kerberos_ticket_cache) { + if (NULL == (j_kerb_cache_path = ENVPTR->NewStringUTF(ENVONLY, fa.kerberos_ticket_cache))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create kerberos_ticket_cache string"); + } + } + args[3].l = j_kerb_cache_path; + + args[4].i = (jint)fa.stream_buffer_size; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_hdfs: not implemented"); +#endif /* H5_HAVE_LIBHDFS */ + +done: + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_hdfs + * Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs + (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) +{ +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_fapl_t instance; + const char *str = NULL; + jfieldID fid; + jstring j_str; + jclass cls; +#endif /* H5_HAVE_LIBHDFS */ + + UNUSED(clss); + +#ifdef H5_HAVE_LIBHDFS + HDmemset(&instance, 0, sizeof(H5FD_hdfs_fapl_t)); + + if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.version = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "namenode_name", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config namenode_name not pinned"); + + HDstrncpy(instance.namenode_name, str, H5FD__HDFS_NODE_NAME_SPACE + 1); + instance.namenode_name[H5FD__HDFS_NODE_NAME_SPACE] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.namenode_name, 0, H5FD__HDFS_NODE_NAME_SPACE + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "namenode_port", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.namenode_port = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "user_name", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config user_name not pinned"); + + HDstrncpy(instance.user_name, str, H5FD__HDFS_USER_NAME_SPACE + 1); + instance.user_name[H5FD__HDFS_USER_NAME_SPACE] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.user_name, 0, H5FD__HDFS_USER_NAME_SPACE + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "kerberos_ticket_cache", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned"); + + HDstrncpy(instance.kerberos_ticket_cache, str, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); + instance.kerberos_ticket_cache[H5FD__HDFS_KERB_CACHE_PATH_SPACE] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.kerberos_ticket_cache, 0, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "stream_buffer_size", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.stream_buffer_size = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (H5Pset_fapl_hdfs((hid_t)fapl_id, &instance) < 0) + H5_LIBRARY_ERROR(ENVONLY); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented"); +#endif /* H5_HAVE_LIBHDFS */ + +done: + /* NOP */; +#ifdef H5_HAVE_LIBHDFS + if (str) + UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#endif /* H5_HAVE_LIBHDFS */ +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs */ + /* * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_log @@ -617,6 +790,167 @@ done: */ /* + * Class: hdf5_hdf5lib_H5 + * Method: H5Pget_fapl_ros3 + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 + (JNIEnv *env, jclass clss, jlong fapl_id) +{ +#ifdef H5_HAVE_ROS3_VFD + H5FD_ros3_fapl_t fa; + jvalue args[3]; + jstring j_aws = NULL; + jstring j_id = NULL; + jstring j_key = NULL; +#endif /* H5_HAVE_ROS3_VFD */ + jobject ret_obj = NULL; + + UNUSED(clss); + +#ifdef H5_HAVE_ROS3_VFD + /* pass fapl and fapl_t instance into library get_fapl */ + /* store fapl details in ros3_fapl_t instance `fa` */ + if (H5Pget_fapl_ros3((hid_t)fapl_id, &fa) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL != fa.aws_region) { + if (NULL == (j_aws = ENVPTR->NewStringUTF(ENVONLY, fa.aws_region))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create aws_region string"); + } + } + args[0].l = j_aws; + + if (NULL != fa.secret_id) { + if (NULL == (j_id = ENVPTR->NewStringUTF(ENVONLY, fa.secret_id))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_id string"); + } + } + args[1].l = j_id; + + if (NULL != fa.secret_key) { + if (NULL == (j_key = ENVPTR->NewStringUTF(ENVONLY, fa.secret_key))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_key string"); + } + } + args[2].l = j_key; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_ros3: not implemented"); +#endif /* H5_HAVE_ROS3_VFD */ + +done: + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_ros3 + * Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 + (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) +{ +#ifdef H5_HAVE_ROS3_VFD + H5FD_ros3_fapl_t instance; + const char *str = NULL; + jfieldID fid; + jstring j_str; + jclass cls; +#endif /* H5_HAVE_ROS3_VFD */ + + UNUSED(clss); + +#ifdef H5_HAVE_ROS3_VFD + HDmemset(&instance, 0, sizeof(H5FD_ros3_fapl_t)); + + if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.version = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "aws_region", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config aws_region not pinned"); + + HDstrncpy(instance.aws_region, str, H5FD_ROS3_MAX_REGION_LEN + 1); + instance.aws_region[H5FD_ROS3_MAX_REGION_LEN] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.aws_region, 0, H5FD_ROS3_MAX_REGION_LEN + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_id", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_id not pinned"); + + HDstrncpy(instance.secret_id, str, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); + instance.secret_id[H5FD_ROS3_MAX_SECRET_ID_LEN] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.secret_id, 0, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_key", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_key not pinned"); + + HDstrncpy(instance.secret_key, str, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); + instance.secret_key[H5FD_ROS3_MAX_SECRET_KEY_LEN] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.secret_key, 0, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); + + if (instance.aws_region[0] != '\0' && instance.secret_id[0] !='\0' && instance.secret_key[0] !='\0') + instance.authenticate = TRUE; + + if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0) + H5_LIBRARY_ERROR(ENVONLY); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented"); +#endif /* H5_HAVE_ROS3_VFD */ + +done: + /* NOP */; +#ifdef H5_HAVE_ROS3_VFD + if (str) + UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#endif /* H5_HAVE_LIBHDFS */ +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 */ + +/* * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_split * Signature: (JLjava/lang/String;JLjava/lang/String;J)V diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h index 28b1d95..9b353e6 100644 --- a/java/src/jni/h5pFAPLImp.h +++ b/java/src/jni/h5pFAPLImp.h @@ -137,6 +137,24 @@ Java_hdf_hdf5lib_H5_H5Pget_1family_1offset /* * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_hdfs + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_hdfs + * Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs +(JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_log * Signature: (JLjava/lang/String;JJ)V */ @@ -188,6 +206,24 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi /* * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_ros3 + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_ros3 + * Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 +(JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_split * Signature: (JLjava/lang/String;JLjava/lang/String;J)V */ diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java index 30d326e..b0d42d8 100644 --- a/java/test/TestH5Pfaplhdfs.java +++ b/java/test/TestH5Pfaplhdfs.java @@ -19,18 +19,11 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.File; -import java.text.DecimalFormat; -import java.text.NumberFormat; - import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; -import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; -import hdf.hdf5lib.structs.H5AC_cache_config_t; import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; -import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; import org.junit.Before; @@ -41,11 +34,6 @@ import org.junit.rules.TestName; public class TestH5Pfaplhdfs { @Rule public TestName testname = new TestName(); - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; @@ -53,9 +41,9 @@ public class TestH5Pfaplhdfs { long btplist_id = -1; @Before - public void createFileAccess() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createFileAccess() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -89,7 +77,8 @@ public class TestH5Pfaplhdfs { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (fapl_id > 0) try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} if (plapl_id > 0) @@ -100,23 +89,11 @@ public class TestH5Pfaplhdfs { try {H5.H5Pclose(plist_id);} catch (Exception ex) {} if (btplist_id > 0) try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} - - if (H5Fdsid > 0) - try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} - if (H5Fdid > 0) - try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} - if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} - if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} - if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} System.out.println(); } @Test - public void testHDFS_fapl() - throws Exception + public void testHDFS_fapl() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -127,34 +104,17 @@ public class TestH5Pfaplhdfs { String kerbcache = "/dev/null"; int streamsize = 1024; - final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t( - nodename, - nodeport, - username, - kerbcache, - streamsize - ); - assertTrue("setting fapl should succeed", - -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); + final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize); + assertTrue("setting fapl should succeed", -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); - assertEquals("driver types should match", - HDF5Constants.H5FD_HDFS, - H5.H5Pget_driver(fapl_id)); + assertEquals("driver types should match", HDF5Constants.H5FD_HDFS, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t copy = H5.H5Pget_fapl_hdfs(fapl_id); - assertEquals("fapl contents should match", - new H5FD_hdfs_fapl_t( - nodename, - nodeport, - username, - kerbcache, - streamsize), - copy); + assertEquals("fapl contents should match", new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy); } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_hdfs_invalid_fapl_id() - throws Exception + public void testH5Pget_fapl_hdfs_invalid_fapl_id() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -162,8 +122,7 @@ public class TestH5Pfaplhdfs { } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() - throws Exception + public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -172,9 +131,7 @@ public class TestH5Pfaplhdfs { /* TODO: for now, test against a sec2 fapl only */ H5.H5Pset_fapl_sec2(fapl_id); - assertEquals("fapl_id was not set properly", - HDF5Constants.H5FD_SEC2, - H5.H5Pget_driver(fapl_id)); + assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(fapl_id); } diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java index 00a2a73..ba10524 100644 --- a/java/test/TestH5Pfapls3.java +++ b/java/test/TestH5Pfapls3.java @@ -19,17 +19,10 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.File; -import java.text.DecimalFormat; -import java.text.NumberFormat; - import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; -import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; -import hdf.hdf5lib.structs.H5AC_cache_config_t; -import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; @@ -41,11 +34,6 @@ import org.junit.rules.TestName; public class TestH5Pfapls3 { @Rule public TestName testname = new TestName(); - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; @@ -53,9 +41,9 @@ public class TestH5Pfapls3 { long btplist_id = -1; @Before - public void createFileAccess() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createFileAccess() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -89,7 +77,8 @@ public class TestH5Pfapls3 { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (fapl_id > 0) try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} if (plapl_id > 0) @@ -100,48 +89,32 @@ public class TestH5Pfapls3 { try {H5.H5Pclose(plist_id);} catch (Exception ex) {} if (btplist_id > 0) try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} - - if (H5Fdsid > 0) - try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} - if (H5Fdid > 0) - try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} - if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} - if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} - if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} System.out.println(); } @Test - public void testH5Pset_fapl_ros3() - throws Exception + public void testH5Pset_fapl_ros3() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) return; final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(); assertEquals("Default fapl has unexpected contents", - new H5FD_ros3_fapl_t("", "", ""), - config); + new H5FD_ros3_fapl_t("", "", ""), config); H5.H5Pset_fapl_ros3(fapl_id, config); assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); /* get_fapl_ros3 can throw exception in error cases */ H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t("", "", ""), - copy); + new H5FD_ros3_fapl_t("", "", ""), copy); } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_ros3_invalid_fapl_id() - throws Exception + public void testH5Pget_fapl_ros3_invalid_fapl_id() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) throw new HDF5LibraryException("skip"); @@ -149,8 +122,7 @@ public class TestH5Pfapls3 { } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() - throws Exception + public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) throw new HDF5LibraryException("skip"); @@ -160,14 +132,12 @@ public class TestH5Pfapls3 { H5.H5Pset_fapl_sec2(fapl_id); assertEquals("fapl_id was not set properly", - HDF5Constants.H5FD_SEC2, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(fapl_id); } @Test - public void testH5Pset_fapl_ros3_specified() - throws Exception + public void testH5Pset_fapl_ros3_specified() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) return; @@ -176,19 +146,14 @@ public class TestH5Pfapls3 { String acc_id = "my_access_id"; String acc_key = "my_access_key"; - final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t( - region, - acc_id, - acc_key); + final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(region, acc_id, acc_key); H5.H5Pset_fapl_ros3(fapl_id, config); assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t(region, acc_id, acc_key), - copy); + new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy); } } diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 37dec3e..f26d969 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -191,6 +191,31 @@ New Features Library: -------- + - Add S3 and HDFS VFDs to HDF5 maintenance + + Fix windows requirements and java tests. Windows requires CMake 3.13. + Install openssl library (with dev files); + from "Shining Light Productions". msi package preferred. + + PATH should have been updated with the installation dir. + set ENV variable OPENSSL_ROOT_DIR to the installation dir. + set ENV variable OPENSSL_CONF to the cfg file, likely %OPENSSL_ROOT_DIR%\bin\openssl.cfg + Install libcurl library (with dev files); + download the latest released version using git: https://github.com/curl/curl.git + + Open a Visual Studio Command prompt + change to the libcurl root folder + run the "buildconf.bat" batch file + change to the winbuild directory + nmake /f Makefile.vc mode=dll MACHINE=x64 + copy libcurl-vc-x64-release-dll-ipv6-sspi-winssl dir to C:\curl (installation dir) + set ENV variable CURL_ROOT to C:\curl (installation dir) + update PATH ENV variable to %CURL_ROOT%\bin (installation bin dir). + the aws credentials file should be in %USERPROFILE%\.aws folder + set the ENV variable "HDF5_ROS3_TEST_BUCKET_URL=https://s3.us-east-2.amazonaws.com/hdf5ros3" + + (ADB - 2019/09/12, HDFFV-10854) + - Added new chunk query functions The following public functions were added to discover information about @@ -343,10 +368,10 @@ Bug Fixes since HDF5-1.10.3 release There was an assertion failure when moving meessages from running a user test program with library release hdf5.1.10.4. It was because the tag value (object header's address) was not set up when entering - the library routine H5O__chunk_update_idx(), which will eventually + the library routine H5O__chunk_update_idx(), which will eventually verifies the metadata tag value when protecting the object header. - The problem was fixed by replacing FUNC_ENTER_PACKAGE in H5O__chunk_update_idx() + The problem was fixed by replacing FUNC_ENTER_PACKAGE in H5O__chunk_update_idx() with FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) to set up the metadata tag. (VC - 2019/08/23, HDFFV-10873) @@ -363,7 +388,7 @@ Bug Fixes since HDF5-1.10.3 release to unsigned later on, the decimal part is chopped off causing the test failure. - This was fixed by obtaining the rounded integer value (HDceil) for the + This was fixed by obtaining the rounded integer value (HDceil) for the log10 value of read attempts first before casting the result to unsigned. (VC - 2019/8/14, HDFFV-10813) diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 250c7cc..457326e 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -11,12 +11,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * Programmer: John Mainzer * 2017-10-10 * - * Purpose: The public header file for the ros3 driver. + * Purpose: The public header file for the ros3 driver. */ #ifndef H5FDros3_H #define H5FDros3_H @@ -35,16 +35,16 @@ * * Purpose: * - * H5FD_ros3_fapl_t is a public structure that is used to pass S3 - * authentication data to the appropriate S3 VFD via the FAPL. A pointer - * to an instance of this structure is a parameter to H5Pset_fapl_ros3() + * H5FD_ros3_fapl_t is a public structure that is used to pass S3 + * authentication data to the appropriate S3 VFD via the FAPL. A pointer + * to an instance of this structure is a parameter to H5Pset_fapl_ros3() * and H5Pget_fapl_ros3(). * * * * `version` (int32_t) * - * Version number of the H5FD_ros3_fapl_t structure. Any instance passed + * Version number of the H5FD_ros3_fapl_t structure. Any instance passed * to the above calls must have a recognized version number, or an error * will be flagged. * @@ -53,8 +53,8 @@ * `authenticate` (hbool_t) * * Flag TRUE or FALSE whether or not requests are to be authenticated - * with the AWS4 algorithm. - * If TRUE, `aws_region`, `secret_id`, and `secret_key` must be populated. + * with the AWS4 algorithm. + * If TRUE, `aws_region`, `secret_id`, and `secret_key` must be populated. * If FALSE, those three components are unused. * * `aws_region` (char[]) @@ -91,8 +91,8 @@ extern "C" { #endif H5_DLL hid_t H5FD_ros3_init(void); -H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa_out); -H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa); +H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out); +H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa); #ifdef __cplusplus } diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index f8b4417..f08e9d5 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -114,7 +114,7 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle); /* Functions */ /*************/ - + /*---------------------------------------------------------------------------- * * Function: curlwritecallback() @@ -162,7 +162,7 @@ curlwritecallback(char *ptr, } /* end curlwritecallback() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_hrb_node_set() @@ -589,7 +589,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_hrb_node_set() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_hrb_destroy() @@ -803,7 +803,7 @@ done: * S3R FUNCTIONS ****************************************************************************/ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_close() @@ -865,7 +865,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_close */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_get_filesize() @@ -900,7 +900,7 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_get_filesize */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_getsize() @@ -1109,7 +1109,7 @@ done: } /* H5FD_s3comms_s3r_getsize */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_open() @@ -1362,7 +1362,7 @@ done: } /* H5FD_s3comms_s3r_open */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_read() @@ -1924,7 +1924,7 @@ done: * MISCELLANEOUS FUNCTIONS ****************************************************************************/ - + /*---------------------------------------------------------------------------- * * Function: gmnow() @@ -2136,7 +2136,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_aws_canonical_request() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_bytes_to_hex() @@ -2210,7 +2210,7 @@ done: } /* end H5FD_s3comms_bytes_to_hex() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_free_purl() @@ -2253,7 +2253,7 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_s3comms_free_purl() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_HMAC_SHA256() @@ -2330,7 +2330,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5FD_s3comms_HMAC_SHA256 */ - + /*----------------------------------------------------------------------------- * * Function: H5FD__s3comms_load_aws_creds_from_file() @@ -2505,7 +2505,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD__s3comms_load_aws_creds_from_file() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_load_aws_profile() @@ -2556,9 +2556,12 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, HDfprintf(stdout, "called H5FD_s3comms_load_aws_profile.\n"); #endif - /* TODO: Windows and other path gotchas */ +#ifdef H5_HAVE_WIN32_API + ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("USERPROFILE")) ; +#else ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")) ; - if (ret < 0 || (size_t)ret >= 117) { +#endif + if (ret < 0 || (size_t)ret >= 117) { HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") } @@ -2631,7 +2634,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_load_aws_profile() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_nlowercase() @@ -2689,7 +2692,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_nlowercase() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_parse_url() @@ -2953,7 +2956,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_parse_url() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_percent_encode_char() @@ -3127,7 +3130,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5FD_s3comms_percent_encode_char */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_signing_key() @@ -3258,7 +3261,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_signing_key() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_tostringtosign() @@ -3385,7 +3388,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5ros3_tostringtosign() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_trim() @@ -3470,7 +3473,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_trim() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_uriencode() diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 94fae7e..90c6650 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * This is the header for the S3 Communications module * diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 105607d..f3d28da 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -5,17 +5,14 @@ project (HDF5_TOOLS_LIBTEST C) # Add the h5tools_utils test executables #----------------------------------------------------------------------------- add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test_utils.c) -target_include_directories(h5tools_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5tools_utils STATIC) -target_link_libraries (h5tools_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5tools_utils PROPERTIES FOLDER tools) - -if (BUILD_SHARED_LIBS) - add_executable (h5tools_utils-shared ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_utils.c) - target_include_directories(h5tools_utils-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5tools_utils-shared SHARED) - target_link_libraries (h5tools_utils-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5tools_utils-shared PROPERTIES FOLDER tools) +target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5tools_test_utils STATIC) + target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5tools_test_utils SHARED) + target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/libtest/CMakeTests.cmake b/tools/libtest/CMakeTests.cmake index 403969d..4feee9b 100644 --- a/tools/libtest/CMakeTests.cmake +++ b/tools/libtest/CMakeTests.cmake @@ -34,7 +34,7 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LIBTEST-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () - add_test (NAME H5LIBTEST-${resultfile} COMMAND $<TARGET_FILE:h5tools_utils> ${ARGN}) + add_test (NAME H5LIBTEST-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5tools_test_utils> ${ARGN}) if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5LIBTEST-${resultfile} PROPERTIES WILL_FAIL "true") endif () diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index b4d66e0..7908519 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -16,40 +16,11 @@ * Jacob Smith 2017-11-10 */ -#include "hdf5.h" -#include "H5private.h" #include "h5tools_utils.h" -/* #include "h5test.h" */ /* linking failure */ +#include "h5test.h" #define UTIL_TEST_DEBUG 0 -#ifndef _H5TEST_ - -#define UTIL_AT() HDfprintf(stdout, " at %s:%d in %s()...\n", \ - __FILE__, __LINE__, FUNC); - -#define UTIL_FAILED(msg) { \ - HDfprintf(stdout, "*FAILED*"); AT() \ - if (msg == NULL) { \ - HDfprintf(stdout,"(NULL)\n"); \ - } else { \ - HDfprintf(stdout, "%s\n", msg); \ - } \ - HDfflush(stdout); \ -} - -#define UTIL_TESTING(msg) { \ - HDfprintf(stdout, "TESTING %-62s", (msg)); \ - HDfflush(stdout); \ -} - -#define UTIL_PASSED() { \ - HDfprintf(stdout, " PASSED\n"); \ - HDfflush(stdout); \ -} - -#endif /* ifndef _H5TEST_ */ - #ifndef __js_test__ #define __js_test__ 1L @@ -548,7 +519,7 @@ test_parse_tuple(void) - UTIL_TESTING("arbitrary-count tuple parsing"); + TESTING("arbitrary-count tuple parsing"); #if H5TOOLS_UTILS_TEST_DEBUG > 0 show_progress = TRUE; @@ -641,7 +612,7 @@ test_populate_ros3_fa(void) int bad_version = 0xf87a; /* arbitrarily wrong version number */ #endif /* H5_HAVE_ROS3_VFD */ - UTIL_TESTING("programmatic ros3 fapl population"); + TESTING("programmatic ros3 fapl population"); #ifndef H5_HAVE_ROS3_VFD HDputs(" -SKIP-"); @@ -1172,7 +1143,7 @@ test_set_configured_fapl(void) n_cases += 5; #endif /* H5_HAVE_LIBHDFS */ - UTIL_TESTING("programmatic fapl set"); + TESTING("programmatic fapl set"); for (unsigned i = 0; i < n_cases; i++) { int result; |