From f651cb4747bafc6025b2a51cf96c065f353ab058 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 09:35:54 -0500 Subject: Fix build for tools library test --- tools/libtest/CMakeLists.txt | 19 ++++++++----------- tools/libtest/CMakeTests.cmake | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 105607d..dc72676 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};$<$:${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};$<$:${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};$<$:${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}) +else () + TARGET_C_PROPERTIES (h5tools_test_utils SHARED) + target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5tools_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 $ ${ARGN}) + add_test (NAME H5LIBTEST-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5LIBTEST-${resultfile} PROPERTIES WILL_FAIL "true") endif () -- cgit v0.12 From 1ca73845326ab5ab4f63f684babe3549e1c90e63 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 09:45:25 -0500 Subject: Correct name and add mingw to 32bit toolchain --- config/toolchain/build32.cmake | 36 ++++++++++++++++++++++++++++++++++++ tools/libtest/CMakeLists.txt | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) 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/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index dc72676..8b63fd1 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -13,6 +13,6 @@ else () TARGET_C_PROPERTIES (h5tools_test_utils SHARED) target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () -set_target_properties (h5tools_utils PROPERTIES FOLDER tools) +set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools) include (CMakeTests.cmake) -- cgit v0.12 From a88f98ae8250972d230c43ba64d49efde8ae9561 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 09:50:42 -0500 Subject: special windows override --- config/cmake/ConfigureChecks.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index cb1eb48..24947f2 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -159,6 +159,9 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if (HDF5_ENABLE_ROS3_VFD) + if (WIN32) + set(CURL_LIBRARY "-lcurl") + endif () find_package(CURL REQUIRED) find_package(OpenSSL REQUIRED) if (${CURL_FOUND} AND ${OPENSSL_FOUND}) -- cgit v0.12 From d5de03225f9e7d653fbc0b4d1c72eb0d3f126818 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 11:43:00 -0500 Subject: add test library --- tools/libtest/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 8b63fd1..f3d28da 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -8,10 +8,10 @@ add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${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}) + 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}) + 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) -- cgit v0.12 From e3e9cf04b07310873c0916448229a0d45eb83c11 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 11:44:32 -0500 Subject: use h5test.h --- tools/libtest/h5tools_test_utils.c | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) 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; -- cgit v0.12 From dcab85c83b72bd41fcefd8d989b3d17db8b44981 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 14:35:33 -0500 Subject: Add back missing java implementation --- java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java | 6 +- java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java | 20 +- java/src/jni/h5pFAPLImp.c | 328 +++++++++++++++++++++ java/src/jni/h5pFAPLImp.h | 36 +++ java/test/TestH5Pfaplhdfs.java | 69 +---- java/test/TestH5Pfapls3.java | 67 +---- src/H5FDros3.h | 20 +- 7 files changed, 417 insertions(+), 129 deletions(-) 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..4241758 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -370,6 +370,176 @@ 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); + +done: +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_hdfs: not implemented"); +#endif /* H5_HAVE_LIBHDFS */ + 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); + +done: + if (str) + UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented"); +#endif /* H5_HAVE_LIBHDFS */ +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs */ + /* * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_log @@ -617,6 +787,164 @@ 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)loc_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); + +done: +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_ros3: not implemented"); +#endif /* H5_HAVE_ROS3_VFD */ + 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); + +done: + if (str) + UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented"); +#endif /* H5_HAVE_ROS3_VFD */ +} /* 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/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 } -- cgit v0.12 From 3467de59f8e7a6bb3ec5164a99b3123d82e3a301 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 14:57:35 -0500 Subject: Correct label and var names --- java/src/jni/h5pFAPLImp.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 4241758..69cdfdb 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -424,11 +424,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs 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); - -done: #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 */ @@ -441,9 +441,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { + const char *str = NULL; #ifdef H5_HAVE_LIBHDFS H5FD_hdfs_fapl_t instance; - const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -529,15 +529,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs 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) + 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: if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); -#else - H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented"); -#endif /* H5_HAVE_LIBHDFS */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs */ /* @@ -809,7 +809,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 #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)loc_id, &fa) < 0) + if (H5Pget_fapl_ros3((hid_t)fapl_id, &fa) < 0) H5_LIBRARY_ERROR(ENVONLY); if (NULL != fa.aws_region) { @@ -837,11 +837,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 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); - -done: #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 */ @@ -854,9 +854,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { + const char *str = NULL; #ifdef H5_HAVE_ROS3_VFD H5FD_ros3_fapl_t instance; - const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -935,13 +935,13 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 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: if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); -#else - H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented"); -#endif /* H5_HAVE_ROS3_VFD */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 */ /* -- cgit v0.12 From ff4cb06d425d04c87f4a8389e93b8ea5ef39e110 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 14:58:07 -0500 Subject: Add updated find module for earlier CMake versions --- MANIFEST | 1 + config/cmake_ext_mod/FindCURL.cmake | 193 ++++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 config/cmake_ext_mod/FindCURL.cmake diff --git a/MANIFEST b/MANIFEST index 2e0022e..93661fa 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3304,6 +3304,7 @@ ./config/cmake_ext_mod/ConfigureChecks.cmake ./config/cmake_ext_mod/CTestCustom.cmake +./config/cmake_ext_mod/FindCURL.cmake ./config/cmake_ext_mod/FindSZIP.cmake ./config/cmake_ext_mod/GetTimeOfDayTest.cpp ./config/cmake_ext_mod/grepTest.cmake diff --git a/config/cmake_ext_mod/FindCURL.cmake b/config/cmake_ext_mod/FindCURL.cmake new file mode 100644 index 0000000..84299ec --- /dev/null +++ b/config/cmake_ext_mod/FindCURL.cmake @@ -0,0 +1,193 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindCURL +-------- + +Find the native CURL headers and libraries. + +This module accept optional COMPONENTS to check supported features and +protocols:: + + PROTOCOLS: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 + POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP + FEATURES: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO + Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy + +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if +curl has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``CURL_FOUND`` + "True" if ``curl`` found. + +``CURL_INCLUDE_DIRS`` + where to find ``curl``/``curl.h``, etc. + +``CURL_LIBRARIES`` + List of libraries when using ``curl``. + +``CURL_VERSION_STRING`` + The version of ``curl`` found. +#]=======================================================================] + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_CURL QUIET libcurl) + if(PC_CURL_FOUND) + set(CURL_VERSION_STRING ${PC_CURL_VERSION}) + pkg_get_variable(CURL_SUPPORTED_PROTOCOLS libcurl supported_protocols) + pkg_get_variable(CURL_SUPPORTED_FEATURES libcurl supported_features) + endif() +endif() + +# Look for the header file. +find_path(CURL_INCLUDE_DIR + NAMES curl/curl.h + HINTS ${PC_CURL_INCLUDE_DIRS}) +mark_as_advanced(CURL_INCLUDE_DIR) + +if(NOT CURL_LIBRARY) + # Look for the library (sorted from most current/relevant entry to least). + find_library(CURL_LIBRARY_RELEASE NAMES + curl + # Windows MSVC prebuilts: + curllib + libcurl_imp + curllib_static + # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): + libcurl + HINTS ${PC_CURL_LIBRARY_DIRS} + ) + mark_as_advanced(CURL_LIBRARY_RELEASE) + + find_library(CURL_LIBRARY_DEBUG NAMES + # Windows MSVC CMake builds in debug configuration on vcpkg: + libcurl-d_imp + libcurl-d + HINTS ${PC_CURL_LIBRARY_DIRS} + ) + mark_as_advanced(CURL_LIBRARY_DEBUG) + + include(SelectLibraryConfigurations.cmake) + select_library_configurations(CURL) +endif() + +if(CURL_INCLUDE_DIR AND NOT CURL_VERSION_STRING) + foreach(_curl_version_header curlver.h curl.h) + if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") + file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") + + string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") + unset(curl_version_str) + break() + endif() + endforeach() +endif() + +if(CURL_FIND_COMPONENTS) + set(CURL_KNOWN_PROTOCOLS ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP) + set(CURL_KNOWN_FEATURES SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy) + foreach(component IN LISTS CURL_KNOWN_PROTOCOLS CURL_KNOWN_FEATURES) + set(CURL_${component}_FOUND FALSE) + endforeach() + if(NOT PC_CURL_FOUND) + find_program(CURL_CONFIG_EXECUTABLE NAMES curl-config) + if(CURL_CONFIG_EXECUTABLE) + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE CURL_CONFIG_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --feature + OUTPUT_VARIABLE CURL_CONFIG_FEATURES_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "\n" ";" CURL_SUPPORTED_FEATURES "${CURL_CONFIG_FEATURES_STRING}") + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --protocols + OUTPUT_VARIABLE CURL_CONFIG_PROTOCOLS_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "\n" ";" CURL_SUPPORTED_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}") + endif() + + endif() + foreach(component IN LISTS CURL_FIND_COMPONENTS) + list(FIND CURL_KNOWN_PROTOCOLS ${component} _found) + if(_found) + list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found) + if(_found) + set(CURL_${component}_FOUND TRUE) + elseif(CURL_FIND_REQUIRED) + message(FATAL_ERROR "CURL: Required protocol ${component} is not found") + endif() + else() + list(FIND CURL_SUPPORTED_FEATURES ${component} _found) + if(_found) + set(CURL_${component}_FOUND TRUE) + elseif(CURL_FIND_REQUIRED) + message(FATAL_ERROR "CURL: Required feature ${component} is not found") + endif() + endif() + endforeach() +endif() + +include(FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(CURL + REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR + VERSION_VAR CURL_VERSION_STRING + HANDLE_COMPONENTS) + +if(CURL_FOUND) + set(CURL_LIBRARIES ${CURL_LIBRARY}) + set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) + + if(NOT TARGET CURL::libcurl) + add_library(CURL::libcurl UNKNOWN IMPORTED) + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + + if(EXISTS "${CURL_LIBRARY}") + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${CURL_LIBRARY}") + endif() + if(CURL_LIBRARY_RELEASE) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}") + endif() + if(CURL_LIBRARY_DEBUG) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") + endif() + endif() +endif() + +mark_as_advanced(CURL_LIBRARY CURL_INCLUDE_DIR) + +# Report the results. +if (NOT CURL_FOUND) + set (CURL_DIR_MESSAGE + "CURL was not found. Make sure CURL_LIBRARY and CURL_INCLUDE_DIR are set or set the CURL_INSTALL environment variable." + ) + if (NOT CURL_FIND_QUIETLY) + message (STATUS "${CURL_DIR_MESSAGE}") + else () + if (CURL_FIND_REQUIRED) + message (FATAL_ERROR "CURL was NOT found and is Required by this project") + endif () + endif () +endif () -- cgit v0.12 From 60cc470a359f13eba31945c396a58fd96a490f35 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 15:21:02 -0500 Subject: Fix unused var --- java/src/jni/h5pFAPLImp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 69cdfdb..f737319 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -441,9 +441,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { - const char *str = NULL; #ifdef H5_HAVE_LIBHDFS H5FD_hdfs_fapl_t instance; + const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -536,8 +536,10 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs #endif /* H5_HAVE_LIBHDFS */ done: +#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 */ /* @@ -854,9 +856,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { - const char *str = NULL; #ifdef H5_HAVE_ROS3_VFD H5FD_ros3_fapl_t instance; + const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -940,8 +942,10 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 #endif /* H5_HAVE_ROS3_VFD */ done: +#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 */ /* -- cgit v0.12 From 9857dc553f49084f9039ae2e8d5f80420bf53b56 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 15:41:07 -0500 Subject: Update Windows require for CURL to CMake 3.13 --- MANIFEST | 1 - config/cmake/ConfigureChecks.cmake | 5 +- config/cmake_ext_mod/FindCURL.cmake | 193 ------------------------------------ 3 files changed, 3 insertions(+), 196 deletions(-) delete mode 100644 config/cmake_ext_mod/FindCURL.cmake diff --git a/MANIFEST b/MANIFEST index 93661fa..2e0022e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3304,7 +3304,6 @@ ./config/cmake_ext_mod/ConfigureChecks.cmake ./config/cmake_ext_mod/CTestCustom.cmake -./config/cmake_ext_mod/FindCURL.cmake ./config/cmake_ext_mod/FindSZIP.cmake ./config/cmake_ext_mod/GetTimeOfDayTest.cpp ./config/cmake_ext_mod/grepTest.cmake diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 24947f2..8230df8 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -159,8 +159,9 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if (HDF5_ENABLE_ROS3_VFD) - if (WIN32) - set(CURL_LIBRARY "-lcurl") + # 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) diff --git a/config/cmake_ext_mod/FindCURL.cmake b/config/cmake_ext_mod/FindCURL.cmake deleted file mode 100644 index 84299ec..0000000 --- a/config/cmake_ext_mod/FindCURL.cmake +++ /dev/null @@ -1,193 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindCURL --------- - -Find the native CURL headers and libraries. - -This module accept optional COMPONENTS to check supported features and -protocols:: - - PROTOCOLS: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 - POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP - FEATURES: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO - Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy - -IMPORTED Targets -^^^^^^^^^^^^^^^^ - -This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if -curl has been found. - -Result Variables -^^^^^^^^^^^^^^^^ - -This module defines the following variables: - -``CURL_FOUND`` - "True" if ``curl`` found. - -``CURL_INCLUDE_DIRS`` - where to find ``curl``/``curl.h``, etc. - -``CURL_LIBRARIES`` - List of libraries when using ``curl``. - -``CURL_VERSION_STRING`` - The version of ``curl`` found. -#]=======================================================================] - -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_CURL QUIET libcurl) - if(PC_CURL_FOUND) - set(CURL_VERSION_STRING ${PC_CURL_VERSION}) - pkg_get_variable(CURL_SUPPORTED_PROTOCOLS libcurl supported_protocols) - pkg_get_variable(CURL_SUPPORTED_FEATURES libcurl supported_features) - endif() -endif() - -# Look for the header file. -find_path(CURL_INCLUDE_DIR - NAMES curl/curl.h - HINTS ${PC_CURL_INCLUDE_DIRS}) -mark_as_advanced(CURL_INCLUDE_DIR) - -if(NOT CURL_LIBRARY) - # Look for the library (sorted from most current/relevant entry to least). - find_library(CURL_LIBRARY_RELEASE NAMES - curl - # Windows MSVC prebuilts: - curllib - libcurl_imp - curllib_static - # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): - libcurl - HINTS ${PC_CURL_LIBRARY_DIRS} - ) - mark_as_advanced(CURL_LIBRARY_RELEASE) - - find_library(CURL_LIBRARY_DEBUG NAMES - # Windows MSVC CMake builds in debug configuration on vcpkg: - libcurl-d_imp - libcurl-d - HINTS ${PC_CURL_LIBRARY_DIRS} - ) - mark_as_advanced(CURL_LIBRARY_DEBUG) - - include(SelectLibraryConfigurations.cmake) - select_library_configurations(CURL) -endif() - -if(CURL_INCLUDE_DIR AND NOT CURL_VERSION_STRING) - foreach(_curl_version_header curlver.h curl.h) - if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") - file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") - - string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") - unset(curl_version_str) - break() - endif() - endforeach() -endif() - -if(CURL_FIND_COMPONENTS) - set(CURL_KNOWN_PROTOCOLS ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP) - set(CURL_KNOWN_FEATURES SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy) - foreach(component IN LISTS CURL_KNOWN_PROTOCOLS CURL_KNOWN_FEATURES) - set(CURL_${component}_FOUND FALSE) - endforeach() - if(NOT PC_CURL_FOUND) - find_program(CURL_CONFIG_EXECUTABLE NAMES curl-config) - if(CURL_CONFIG_EXECUTABLE) - execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --version - OUTPUT_VARIABLE CURL_CONFIG_VERSION_STRING - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --feature - OUTPUT_VARIABLE CURL_CONFIG_FEATURES_STRING - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" CURL_SUPPORTED_FEATURES "${CURL_CONFIG_FEATURES_STRING}") - execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --protocols - OUTPUT_VARIABLE CURL_CONFIG_PROTOCOLS_STRING - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" CURL_SUPPORTED_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}") - endif() - - endif() - foreach(component IN LISTS CURL_FIND_COMPONENTS) - list(FIND CURL_KNOWN_PROTOCOLS ${component} _found) - if(_found) - list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found) - if(_found) - set(CURL_${component}_FOUND TRUE) - elseif(CURL_FIND_REQUIRED) - message(FATAL_ERROR "CURL: Required protocol ${component} is not found") - endif() - else() - list(FIND CURL_SUPPORTED_FEATURES ${component} _found) - if(_found) - set(CURL_${component}_FOUND TRUE) - elseif(CURL_FIND_REQUIRED) - message(FATAL_ERROR "CURL: Required feature ${component} is not found") - endif() - endif() - endforeach() -endif() - -include(FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(CURL - REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR - VERSION_VAR CURL_VERSION_STRING - HANDLE_COMPONENTS) - -if(CURL_FOUND) - set(CURL_LIBRARIES ${CURL_LIBRARY}) - set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) - - if(NOT TARGET CURL::libcurl) - add_library(CURL::libcurl UNKNOWN IMPORTED) - set_target_properties(CURL::libcurl PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") - - if(EXISTS "${CURL_LIBRARY}") - set_target_properties(CURL::libcurl PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${CURL_LIBRARY}") - endif() - if(CURL_LIBRARY_RELEASE) - set_property(TARGET CURL::libcurl APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(CURL::libcurl PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}") - endif() - if(CURL_LIBRARY_DEBUG) - set_property(TARGET CURL::libcurl APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(CURL::libcurl PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") - endif() - endif() -endif() - -mark_as_advanced(CURL_LIBRARY CURL_INCLUDE_DIR) - -# Report the results. -if (NOT CURL_FOUND) - set (CURL_DIR_MESSAGE - "CURL was not found. Make sure CURL_LIBRARY and CURL_INCLUDE_DIR are set or set the CURL_INSTALL environment variable." - ) - if (NOT CURL_FIND_QUIETLY) - message (STATUS "${CURL_DIR_MESSAGE}") - else () - if (CURL_FIND_REQUIRED) - message (FATAL_ERROR "CURL was NOT found and is Required by this project") - endif () - endif () -endif () -- cgit v0.12 From 3e816bd089f1eabc6e6cc68ec5b48f965d9a1129 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 15:49:57 -0500 Subject: Add statement for label if code unimplemented --- java/src/jni/h5pFAPLImp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index f737319..006707a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -536,6 +536,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs #endif /* H5_HAVE_LIBHDFS */ done: + /* NOP */; #ifdef H5_HAVE_LIBHDFS if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); @@ -942,6 +943,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 #endif /* H5_HAVE_ROS3_VFD */ done: + /* NOP */; #ifdef H5_HAVE_ROS3_VFD if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); -- cgit v0.12 From bad125a071d6bb2b4ed958ebcdbd04d14f23bd1e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 16:54:24 -0500 Subject: Add policy to use _ROOT --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) 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 # -- cgit v0.12 From 677f8e6f31d756efb5f5259c6aea79d766d60639 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 17:25:27 -0500 Subject: Add include dirs and default lib for windows --- config/cmake/ConfigureChecks.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8230df8..ae76d1e 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -163,11 +163,15 @@ option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) 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 () + if (WIN32) + set (CURL_LIBRARY "-lcurl") + 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_DIRS}) 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 () -- cgit v0.12 From acdeee8c6ac287618807cd22702d3cba1a1cd1ee Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2019 10:17:28 -0500 Subject: Windows ssl headers are not in system loacation --- src/H5FDs3comms.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 94fae7e..51d9b55 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 * @@ -57,10 +57,10 @@ #ifdef H5_HAVE_ROS3_VFD /* Necessary S3 headers */ -#include -#include -#include -#include +#include "curl/curl.h" +#include "openssl/evp.h" +#include "openssl/hmac.h" +#include "openssl/sha.h" /***************** * PUBLIC MACROS * -- cgit v0.12 From 0d964c2f88047ae56b61d72485f3f01b45071294 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2019 11:01:25 -0500 Subject: revert windows change --- src/H5FDs3comms.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 51d9b55..90c6650 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -57,10 +57,10 @@ #ifdef H5_HAVE_ROS3_VFD /* Necessary S3 headers */ -#include "curl/curl.h" -#include "openssl/evp.h" -#include "openssl/hmac.h" -#include "openssl/sha.h" +#include +#include +#include +#include /***************** * PUBLIC MACROS * -- cgit v0.12 From 6eb6e0db8da2684ac702bebbe9d75c6c4900628a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2019 15:24:52 -0500 Subject: Correct Windows check --- config/cmake/ConfigureChecks.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index ae76d1e..7d0f429 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -163,15 +163,12 @@ option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) 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 () - if (WIN32) - set (CURL_LIBRARY "-lcurl") - 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_DIRS}) + 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 () -- cgit v0.12 From afb07f9b3932633686a262f0b91a00993acb112f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 10 Sep 2019 13:47:24 -0500 Subject: Clear exception for getting JNI string to clear the exception --- java/src/jni/h5pFAPLImp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 006707a..b7e351a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -467,7 +467,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config namenode_name not pinned"); @@ -491,7 +491,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config user_name not pinned"); @@ -509,7 +509,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned"); @@ -883,7 +883,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config aws_region not pinned"); @@ -901,7 +901,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_id not pinned"); @@ -919,7 +919,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_key not pinned"); -- cgit v0.12 From e20331651e34a043bd54826169b21e776bb09816 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 10 Sep 2019 14:19:29 -0500 Subject: revert as CHECK will first check for exception --- java/src/jni/h5pFAPLImp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index b7e351a..006707a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -467,7 +467,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + 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"); @@ -491,7 +491,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + 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"); @@ -509,7 +509,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + 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"); @@ -883,7 +883,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + 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"); @@ -901,7 +901,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + 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"); @@ -919,7 +919,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + 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"); -- cgit v0.12 From 24f863dfba86fa0ace926847f0dacce18635a73c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 11 Sep 2019 12:51:31 -0500 Subject: Allow tests to dump output if not comparing --- config/cmake_ext_mod/runTest.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index e601653..7a10df2 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -343,6 +343,14 @@ if (TEST_GREP_COMPARE) endif () endif () +# dump the output unless nodisplay option is set +if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) + execute_process ( + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_FOLDER}/${TEST_OUTPUT} + RESULT_VARIABLE TEST_RESULT + ) +endif () + # everything went fine... message (STATUS "${TEST_PROGRAM} Passed") -- cgit v0.12 From e37b474374592d28352f354450efdbc1ff1836ba Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 11 Sep 2019 14:09:25 -0500 Subject: Use variable for test output --- config/cmake_ext_mod/runTest.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 7a10df2..6f633f3 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -345,8 +345,9 @@ 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_FOLDER}/${TEST_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_STREAM} RESULT_VARIABLE TEST_RESULT ) endif () -- cgit v0.12 From 50287cb9d245698a281102c79f76fa3fa9c38ed0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 12 Sep 2019 14:22:43 -0500 Subject: Fix get home dir for windows --- src/H5FDs3comms.c | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) 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() -- cgit v0.12 From 05f49d5ffdbd4cf9e967d60a3a0efd0ca7f2c820 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 12 Sep 2019 15:13:42 -0500 Subject: HDFFV-10854 add release note for windows --- release_docs/RELEASE.txt | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) 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) -- cgit v0.12