diff options
Diffstat (limited to 'java')
30 files changed, 483 insertions, 279 deletions
diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in index cb16d45..f5c63cd 100644 --- a/java/examples/datasets/JavaDatasetExample.sh.in +++ b/java/examples/datasets/JavaDatasetExample.sh.in @@ -52,12 +52,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Checksum.txt @@ -83,6 +85,7 @@ $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Soint.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -110,6 +113,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -117,11 +144,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -215,14 +245,9 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH - ;; + ;; esac export LD_LIBRARY_PATH diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in index 033442a..447512a 100644 --- a/java/examples/datatypes/JavaDatatypeExample.sh.in +++ b/java/examples/datatypes/JavaDatatypeExample.sh.in @@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt @@ -80,6 +82,7 @@ $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_VLString.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -107,6 +110,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -114,11 +141,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -211,11 +241,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 36df02e..9d4673f 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -34,13 +34,13 @@ nerrors=0 # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" BLDLIBDIR="$top_builddir/hdf5/lib" -BLDREFDIR="./groups" +BLDITERDIR="./groups" BLDDIR="." HDFTEST_HOME="$top_srcdir/java/examples/groups" JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar TESTJARFILE=jar@PACKAGE_TARNAME@groups.jar test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR -test -d $BLDREFDIR || mkdir -p $BLDREFDIR +test -d $BLDITERDIR || mkdir -p $BLDITERDIR ###################################################################### # library files @@ -51,13 +51,15 @@ test -d $BLDREFDIR || mkdir -p $BLDREFDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " -LIST_REF_FILES=" +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" +LIST_ITER_FILES=" $HDFTEST_HOME/h5ex_g_iterate.h5 $HDFTEST_HOME/h5ex_g_visit.h5 " @@ -75,6 +77,7 @@ $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Visit.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -102,6 +105,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -109,11 +136,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -152,6 +182,7 @@ CLEAN_DATAFILES_AND_BLDDIR() $RM $BLDDIR/examples.groups.H5Ex_G_*.txt $RM $BLDDIR/H5Ex_G_*.out $RM $BLDDIR/H5Ex_G_*.h5 + $RM $BLDDIR/h5ex_g_*.h5 SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` @@ -161,12 +192,12 @@ CLEAN_DATAFILES_AND_BLDDIR() fi } -COPY_REFFILES="$LIST_REF_FILES" +COPY_ITERFILES="$LIST_ITER_FILES" -COPY_REFFILES_TO_BLDREFDIR() +COPY_ITERFILES_TO_BLDITERDIR() { # copy test files. Used -f to make sure get a new copy - for tstfile in $COPY_REFFILES + for tstfile in $COPY_ITERFILES do # ignore '#' comment echo $tstfile | tr -d ' ' | grep '^#' > /dev/null @@ -177,9 +208,9 @@ COPY_REFFILES_TO_BLDREFDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $BLDREFDIR + $CP -f $tstfile $BLDITERDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." @@ -191,16 +222,16 @@ COPY_REFFILES_TO_BLDREFDIR() done } -CLEAN_REFFILES_AND_BLDREFDIR() +CLEAN_ITERFILES_AND_BLDITERDIR() { # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.h5` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDREFDIR + $RM $BLDITERDIR fi } @@ -223,7 +254,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@ # prepare for test COPY_LIBFILES_TO_BLDLIBDIR COPY_DATAFILES_TO_BLDDIR -COPY_REFFILES_TO_BLDREFDIR +COPY_ITERFILES_TO_BLDITERDIR CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE"" @@ -257,11 +288,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; @@ -340,9 +366,9 @@ else fi # Clean up temporary files/directories +CLEAN_ITERFILES_AND_BLDITERDIR CLEAN_LIBFILES_AND_BLDLIBDIR CLEAN_DATAFILES_AND_BLDDIR -CLEAN_REFFILES_AND_BLDREFDIR # Report test results and exit if test $nerrors -eq 0 ; then diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in index 077146d..1886485 100644 --- a/java/examples/intro/JavaIntroExample.sh.in +++ b/java/examples/intro/JavaIntroExample.sh.in @@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$HDFLIB_HOME/slf4j-api-1.7.25.jar -$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " +LIST_JAR_TESTFILES=" +$HDFLIB_HOME/slf4j-api-1.7.25.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" LIST_DATA_FILES=" $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateAttribute.txt @@ -69,6 +71,7 @@ $HDFTEST_HOME/../testfiles/examples.intro.H5_ReadWrite.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_LIBFILES_TO_BLDLIBDIR() { @@ -96,6 +99,30 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi fi done + # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done } CLEAN_LIBFILES_AND_BLDLIBDIR() @@ -103,11 +130,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.25.jar` + SDIR=$HDFLIB_HOME INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -200,11 +230,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index f58623e..f9f9b65 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. * <hr> * - * @version HDF5 1.11.2 <BR> + * @version HDF5 1.11.4 <BR> * <b>See also: <a href ="./hdf.hdf5lib.HDFArray.html"> hdf.hdf5lib.HDFArray</a> </b><BR> * <a href ="./hdf.hdf5lib.HDF5Constants.html"> hdf.hdf5lib.HDF5Constants</a><BR> * <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR> @@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 11, 2 }; + public final static int LIB_VERSION[] = { 1, 11, 4 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 7eddac0..b530f4b 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -190,6 +190,7 @@ public class HDF5Constants { public static final long H5E_UNSUPPORTED = H5E_UNSUPPORTED(); public static final long H5E_VERSION = H5E_VERSION(); public static final long H5E_VFL = H5E_VFL(); + public static final long H5E_VOL = H5E_VOL(); public static final long H5E_WALK_DOWNWARD = H5E_WALK_DOWNWARD(); public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD(); public static final long H5E_WRITEERROR = H5E_WRITEERROR(); @@ -317,6 +318,7 @@ public class HDF5Constants { public static final int H5I_REFERENCE = H5I_REFERENCE(); public static final int H5I_UNINIT = H5I_UNINIT(); public static final int H5I_VFL = H5I_VFL(); + public static final int H5I_VOL = H5I_VOL(); public static final int H5L_TYPE_ERROR = H5L_TYPE_ERROR(); public static final int H5L_TYPE_HARD = H5L_TYPE_HARD(); @@ -980,6 +982,8 @@ public class HDF5Constants { private static native final long H5E_VFL(); + private static native final long H5E_VOL(); + private static native final long H5E_WALK_DOWNWARD(); private static native final long H5E_WALK_UPWARD(); @@ -1224,6 +1228,8 @@ public class HDF5Constants { private static native final int H5I_VFL(); + private static native final int H5I_VOL(); + private static native final int H5L_TYPE_ERROR(); private static native final int H5L_TYPE_HARD(); diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html index 9c19442..edb1b76 100644 --- a/java/src/hdf/overview.html +++ b/java/src/hdf/overview.html @@ -6,18 +6,19 @@ The <b>Java HD5 Interface (JHI5)</b> is a Java package (<a href="../../hdf-java-html/javadocs/hdf/hdf5lib/package-summary.html">hdf.hdf5lib</a>) that ``wraps around'' the HDF5 library. -<p />There are a large number of functions in the HDF5 +<p>There are a large number of functions in the HDF5 library (version 1.10). Some of the functions are not supported in JHI5. Most of the unsupported functions have C function pointers, which is not currently -implemented in JHI5. +implemented in JHI5.</p> -<center><table BORDER=1 COLS=1 WIDTH="71%" BGCOLOR="#dbeaf5" > +<table style="width:71%;text-align:center;background-color:#dbeaf5" border="1"> +<caption>Java HDF5 Interface (JHI5)</caption> <tr> -<td> -<center>Note: The JHI5 does not support HDF4 or earlier.</center> +<td style="text-align:center;"> +Note: The JHI5 does not support HDF4 or earlier. </td> </tr> -</table></center> +</table> <p>The JHI5 may be used by any Java application that needs to access HDF5 files. It is extremely important to emphasize that <i>this package is not @@ -91,6 +92,6 @@ and the HDF5 library. <h3> <a NAME="DOWNLOAD"></a>To Obtain</h3> -The JHI5 is included with the <a href="http://www.hdfgroup.org/HDF5/index.html">HDF5</a> library. +The JHI5 is included with the <a href="https://portal.hdfgroup.org/display/support/Downloads">HDF5</a> library. </body> diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index a0228e1..7b95e0b 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -50,22 +50,10 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR}) TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) -target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) +target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA") -if (WIN32) - get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) - set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}$<$<CONFIG:Debug>:_D>") - # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") - if (BUILD_TESTING) - add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET}) - endif () -endif () #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index c99745d..fdec61a 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -344,6 +344,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5 JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5E_1VOL(JNIEnv *env, jclass cls) { return H5E_VOL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; } @@ -605,6 +607,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5I_1VOL(JNIEnv *env, jclass cls) { return H5I_VOL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; } diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c index 2eeb075..1ad6b17 100644 --- a/java/src/jni/h5Imp.c +++ b/java/src/jni/h5Imp.c @@ -36,7 +36,6 @@ extern "C" { #include "h5Imp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index c0dc182..aba2240 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -29,7 +29,11 @@ extern "C" { #include "h5aImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #define CBENVPTR (cbenv) @@ -53,7 +57,8 @@ static herr_t H5AwriteVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjec static herr_t H5AwriteVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); static herr_t H5AreadVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); static herr_t H5AreadVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf); -static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data); + +static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data); /* @@ -1138,7 +1143,7 @@ Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist static herr_t H5A_iterate_cb - (hid_t g_id, const char *name, const H5A_info_t *info, void *op_data) { + (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; @@ -1147,6 +1152,9 @@ H5A_iterate_cb jmethodID constructor; jvalue args[4]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -1195,14 +1203,14 @@ Java_hdf_hdf5lib_H5_H5Aiterate hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data); + status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -1224,9 +1232,9 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name const char *lName; hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); @@ -1234,7 +1242,7 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index cea6bb4..652c873 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -30,7 +30,11 @@ extern "C" { #include "h5dImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #ifdef _WINDOWS @@ -1105,7 +1109,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); if (utf8) { - strncpy(&c_buf[i * str_len], utf8, str_len); + HDstrncpy(&c_buf[i * str_len], utf8, str_len); } /* end if */ ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); @@ -1888,7 +1892,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent static herr_t H5D_iterate_cb - (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *op_data) { + (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) { JNIEnv *cbenv; jint status; jclass cls; @@ -1896,6 +1900,9 @@ H5D_iterate_cb jbyteArray elemArray; jlongArray pointArray; jsize size; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { JVMPTR->DetachCurrentThread(JVMPAR); @@ -1958,9 +1965,9 @@ Java_hdf_hdf5lib_H5_H5Diterate herr_t status = -1; jboolean isCopy; jbyte *buffP; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Diterate: op_data is NULL"); @@ -1977,7 +1984,7 @@ Java_hdf_hdf5lib_H5_H5Diterate h5JNIFatalError(env, "H5Diterate: buf not pinned"); } /* end if */ else { - status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data); + status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)&wrapper); if (status < 0) { ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 10a02b0..9c80461 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -40,7 +40,11 @@ extern "C" { #include "h5eImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; #ifdef __cplusplus #define CBENVPTR (cbenv) @@ -60,7 +64,7 @@ extern jobject visit_callback; /* Local Prototypes */ /********************/ -static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data); +static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -475,7 +479,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1num static herr_t H5E_walk_cb - (int nindx, const H5E_error2_t *info, void *op_data) + (int nindx, const H5E_error2_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; @@ -485,6 +489,9 @@ H5E_walk_cb jmethodID constructor; jvalue args[7]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -532,13 +539,14 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) { + cb_wrapper wrapper = {callback_op, op_data}; + ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL"); } /* end if */ - else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0) + else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)&wrapper) < 0) h5libraryError(env); } /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */ diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 8cf5252..9d68290 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -29,7 +29,6 @@ extern "C" { #include "h5util.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 @@ -541,7 +540,7 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass cls, jlong file_id) { if (H5Fstart_swmr_write((hid_t)file_id) < 0) h5libraryError(env); @@ -554,7 +553,7 @@ Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass cls, jlong file_id) { if (H5Fstart_mdc_logging((hid_t)file_id) < 0) h5libraryError(env); @@ -580,7 +579,7 @@ Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status - (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) + (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) { hbool_t is_enabled; hbool_t is_currently_logging; diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c index 41ec382..42c042a 100644 --- a/java/src/jni/h5gImp.c +++ b/java/src/jni/h5gImp.c @@ -30,7 +30,6 @@ extern "C" { #include "h5gImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c index 47574ca..b8bd1cd 100644 --- a/java/src/jni/h5iImp.c +++ b/java/src/jni/h5iImp.c @@ -28,7 +28,6 @@ extern "C" { #include "h5iImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index f1734fd..e1ec3bd 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -28,13 +28,17 @@ extern "C" { #include "h5lImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; /********************/ /* Local Prototypes */ /********************/ -static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data); +static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -541,7 +545,7 @@ Java_hdf_hdf5lib_H5_H5Lmove static herr_t H5L_iterate_cb - (hid_t g_id, const char *name, const H5L_info_t *info, void *op_data) + (hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status; @@ -551,6 +555,9 @@ H5L_iterate_cb jmethodID constructor; jvalue args[5]; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); @@ -600,15 +607,15 @@ Java_hdf_hdf5lib_H5_H5Lvisit jobject callback_op, jobject op_data) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); } /* end else */ @@ -628,9 +635,9 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name { herr_t status = -1; const char *lName; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL"); @@ -638,7 +645,7 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); @@ -662,15 +669,15 @@ Java_hdf_hdf5lib_H5_H5Literate { hsize_t start_idx = (hsize_t)idx; herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate: op_data or callback_op is NULL"); } /* end if */ else { - status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -694,7 +701,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name const char *lName; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; + cb_wrapper wrapper = {callback_op, op_data}; if ((op_data == NULL) || (callback_op == NULL)) { h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); @@ -702,7 +709,7 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index 6093e46..1de505a 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -27,13 +27,17 @@ extern "C" { #include "h5oImp.h" extern JavaVM *jvm; -extern jobject visit_callback; + +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; /********************/ /* Local Prototypes */ /********************/ -static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data); +static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -330,7 +334,7 @@ Java_hdf_hdf5lib_H5_H5Olink static herr_t H5O_iterate_cb - (hid_t g_id, const char *name, const H5O_info_t *info, void *op_data) + (hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data) { JNIEnv *cbenv; jint status = -1; @@ -343,6 +347,9 @@ H5O_iterate_cb jobject ihinfobuf1; jobject ihinfobuf2; jobject cb_info_t = NULL; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { /* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */ @@ -448,9 +455,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit jobject callback_op, jobject op_data, jint fields) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit: op_data is NULL"); @@ -459,7 +466,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit h5nullArgument(env, "H5Ovisit: callback_op is NULL"); } /* end if */ else { - status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields); + status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields); if (status < 0) h5libraryError(env); @@ -480,9 +487,9 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name { herr_t status = -1; const char *lName; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL"); @@ -495,7 +502,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id); + status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 3ff7436..52008ce 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5pImp.h" extern JavaVM *jvm; -extern jobject visit_callback; extern jobject copy_callback; extern jobject close_callback; extern jobject create_callback; @@ -36,6 +35,11 @@ extern jobject get_callback; extern jobject set_callback; extern jobject delete_callback; +typedef struct _cb_wrapper { + jobject visit_callback; + jobject op_data; +} cb_wrapper; + /********************/ /* Local Prototypes */ /********************/ @@ -52,7 +56,7 @@ static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size, static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data); +static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data); /* * Class: hdf_hdf5lib_H5 @@ -3877,7 +3881,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); if (utf8) { - member_name[i] = (char*)HDmalloc(strlen(utf8) + 1); + member_name[i] = (char*)HDmalloc(HDstrlen(utf8) + 1); if (member_name[i]) { strcpy(member_name[i], utf8); } /* end if */ @@ -4185,7 +4189,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name"); return; } /* end if */ - strncpy(cacheinfo.trace_file_name, str, 1025); + HDstrncpy(cacheinfo.trace_file_name, str, 1025); ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str); if(ENVPTR->ExceptionOccurred(ENVONLY)) { h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed"); @@ -5042,7 +5046,7 @@ H5P_cls_copy_cb } /* end if */ JVMPTR->DetachCurrentThread(JVMPAR); return (herr_t)status; -} /* end H5P_cls_ccopy_cb */ +} /* end H5P_cls_copy_cb */ static herr_t H5P_cls_close_cb @@ -5158,13 +5162,16 @@ Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options static herr_t H5D_append_cb - (hid_t dataset_id, hsize_t *cur_dims, void *op_data) + (hid_t dataset_id, hsize_t *cur_dims, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; jmethodID mid; jlongArray cur_dimsArray; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { JVMPTR->DetachCurrentThread(JVMPAR); @@ -5199,9 +5206,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data) { herr_t status = -1; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Pset_append_flush: op_data is NULL"); @@ -5210,7 +5217,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush h5nullArgument(env, "H5Pset_append_flush: callback_op is NULL"); } /* end if */ else { - status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)op_data); + status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)&wrapper); if (status < 0) h5libraryError(env); @@ -5603,13 +5610,16 @@ Java_hdf_hdf5lib_H5_H5Pinsert2 static herr_t H5P_iterate_cb - (hid_t prop_id, const char *name, void *op_data) + (hid_t prop_id, const char *name, void *cb_data) { JNIEnv *cbenv; jint status = -1; jclass cls; jmethodID mid; jstring str; + cb_wrapper *wrapper = (cb_wrapper *)cb_data; + void *op_data = (void *)wrapper->op_data; + jobject visit_callback = wrapper->visit_callback; /* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */ if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { @@ -5656,9 +5666,9 @@ Java_hdf_hdf5lib_H5_H5Piterate herr_t status = -1; jint *theArray = NULL; jboolean isCopy; + cb_wrapper wrapper = {callback_op, op_data}; ENVPTR->GetJavaVM(ENVPAR &jvm); - visit_callback = callback_op; if (op_data == NULL) { h5nullArgument(env, "H5Piterate: op_data is NULL"); @@ -5668,7 +5678,7 @@ Java_hdf_hdf5lib_H5_H5Piterate } /* end else if */ else { if (idx == NULL) { - status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper); } /* end if */ else { theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy); @@ -5676,7 +5686,7 @@ Java_hdf_hdf5lib_H5_H5Piterate h5JNIFatalError(env, "H5Piterate: idx not pinned"); } /* end if */ else - status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper); } /* end else */ if (status < 0) { diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c index ffd5b7a..d551120 100644 --- a/java/src/jni/h5plImp.c +++ b/java/src/jni/h5plImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5plImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c index b250550..5f2b86d 100644 --- a/java/src/jni/h5rImp.c +++ b/java/src/jni/h5rImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5rImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index 10f69eb..65cdd7b 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -27,7 +27,6 @@ extern "C" { #include "h5sImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 @@ -572,7 +571,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned"); return -1; } /* end if */ - sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t)); + sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)); if (sa == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t"); @@ -1018,7 +1017,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned"); } /* end if */ else { - ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); + ba = (hsize_t *) HDmalloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); if (ba == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t"); @@ -1136,7 +1135,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds return -1; } /* end if */ rank = (int) ENVPTR->GetArrayLength(ENVPAR start); - strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)); + strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); if (strt == NULL) { ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t"); diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 7b4af56..307f1a5 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -30,7 +30,6 @@ extern "C" { #include "h5tImp.h" extern JavaVM *jvm; -extern jobject visit_callback; /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 33dca7f..fd34ba1 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -33,7 +33,6 @@ hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ JavaVM *jvm; -jobject visit_callback; jobject copy_callback; jobject close_callback; jobject create_callback; @@ -1769,7 +1768,7 @@ h5str_render_bin_output if (H5Tis_variable_str(tid)) { s = *(char**) mem; if (s != NULL) - size = strlen(s); + size = HDstrlen(s); } else { s = (char *) mem; @@ -2130,11 +2129,11 @@ render_bin_output_region_data_points ret_value = -1; HDfree(dims1); - } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */ + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ else ret_value = -1; HDfree(region_buf); - } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */ + } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */ else ret_value = -1; @@ -2437,7 +2436,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex H5Tclose(p_type); n = ENVPTR->GetArrayLength(ENVPAR buf); - rdata = (char *)malloc((size_t)n * size); + rdata = (char *)HDmalloc((size_t)n * size); if (rdata == NULL) { h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read"); } /* end if */ @@ -2953,7 +2952,7 @@ obj_info_all if (retVal < 0) { *(datainfo->otype+datainfo->count) = -1; *(datainfo->ltype+datainfo->count) = -1; - *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1); + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1); HDstrcpy(*(datainfo->objname+datainfo->count), name); *(datainfo->objno+datainfo->count) = (unsigned long)-1; } /* end if */ diff --git a/java/test/TestH5.java b/java/test/TestH5.java index b922583..54603ca 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 11, 2 }; + int libversion[] = { 1, 11, 4 }; try { H5.H5get_libversion(libversion); @@ -184,7 +184,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 11, relnum = 2; + int majnum = 1, minnum = 11, relnum = 4; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 656069a..fd015c0 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -37,6 +37,7 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); + long hdf_java_classid = -1; long current_stackid = -1; @@ -75,7 +76,7 @@ public class TestH5E { public void testH5Eget_msg_major() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { long errnum = hdferr.getMajorErrorNumber(); @@ -89,7 +90,7 @@ public class TestH5E { fail("H5.H5Eget_msg(Throwable): " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Object atom", msg); + assertEquals("H5.H5Eget_msg: ", "File accessibility", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]); } catch (Throwable err) { @@ -101,7 +102,7 @@ public class TestH5E { @Test public void testH5Eget_msg_minor() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { long errnum = hdferr.getMinorErrorNumber(); @@ -115,7 +116,7 @@ public class TestH5E { fail("H5.H5Eget_msg: " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Unable to find atom information (already closed?)", msg); + assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]); } catch (Throwable err) { @@ -126,6 +127,10 @@ public class TestH5E { @Test public void testH5Epop() { + + long num_msg = -1; + long saved_num_msg = -1; + try { H5.H5Eset_current_stack(current_stackid); } @@ -135,12 +140,12 @@ public class TestH5E { } try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -149,7 +154,6 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - long num_msg = -1; try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -168,8 +172,9 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(current_stackid, 1); } @@ -186,7 +191,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == 3); + assertTrue("H5.H5Epop", num_msg == saved_num_msg - 1); } @Test @@ -293,12 +298,12 @@ public class TestH5E { fail("testH5Ewalk:H5Eset_current_stack " + err); } try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -314,7 +319,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == 4); + assertTrue("testH5Ewalk #:" + num_msg, num_msg > 0); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); @@ -324,7 +329,8 @@ public class TestH5E { fail("testH5Ewalk:H5Ewalk2 " + err); } assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); - assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==4); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0); } } + diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 5324d3a..591793f 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -29,6 +29,8 @@ import org.junit.rules.TestName; public class TestH5Edefault { @Rule public TestName testname = new TestName(); + public static final int ERRSTACK_CNT = 6; + @Before public void H5Eset_default_stack() { assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); @@ -56,7 +58,7 @@ public class TestH5Edefault { @Test public void testH5Eprint() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -73,17 +75,18 @@ public class TestH5Edefault { public void testH5Eget_current_stack() { long num_msg = -1; long num_msg_default = -1; + long saved_num_msg = -1; long stack_id = -1; long stack_id_default = HDF5Constants.H5E_DEFAULT; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //default stack id will be different after exception stack_id_default = HDF5Constants.H5E_DEFAULT; //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have messages on the error stack try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -91,9 +94,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -104,7 +108,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == stack_id_default); - // Verify we have the correct number of messages + // Verify the default stack is empty try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -114,7 +118,7 @@ public class TestH5Edefault { } assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original try { num_msg = H5.H5Eget_num(stack_id); } @@ -122,7 +126,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); try { H5.H5Eclose_stack(stack_id); @@ -137,15 +141,16 @@ public class TestH5Edefault { public void testH5Eget_current_stack_pop() { long num_msg = -1; long num_msg_default = -1; + long saved_num_msg = -1; long stack_id = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify there are error messages on the stack and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -153,9 +158,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -166,7 +172,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); - // Verify we have the correct number of messages + // Verify the stack is empty try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -176,7 +182,7 @@ public class TestH5Edefault { } assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -184,17 +190,17 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -202,9 +208,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg; - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -213,9 +220,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == 3); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the old number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -223,7 +230,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -278,14 +285,17 @@ public class TestH5Edefault { public void testH5Eset_current_stack() { long num_msg = -1; long stack_id = -1; + long saved_num_msg = -1; + + // Generate errors on the default stack try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -293,9 +303,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; - //Save a copy of the current stack + // Save a copy of the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -306,7 +317,7 @@ public class TestH5Edefault { assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id < 0); assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original stack try { num_msg = H5.H5Eget_num(stack_id); } @@ -314,17 +325,17 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack (again, in the same way) try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have the same number of messages as before try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -332,9 +343,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -343,9 +354,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -353,8 +364,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); + // Se the current stack to be the default and try that again try { H5.H5Eset_current_stack(stack_id); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -363,7 +375,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == 4); + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -374,8 +386,9 @@ public class TestH5Edefault { @Test public void testH5Epop() throws Throwable { long num_msg = -1; + long saved_num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -386,7 +399,8 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Epop before #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -395,7 +409,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 3); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == saved_num_msg - 1); } @Test(expected = IllegalArgumentException.class) @@ -416,7 +430,7 @@ public class TestH5Edefault { @Test public void testH5EprintInt() { try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -460,7 +474,7 @@ public class TestH5Edefault { public void testH5Eclear2_with_msg() { long num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -471,7 +485,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == 4); + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg > 0); try { H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -523,7 +537,7 @@ public class TestH5Edefault { public void testH5Eget_num_with_msg() { long num_msg = -1; try { - H5.H5Fopen("test", 0, 1); + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { } @@ -538,3 +552,4 @@ public class TestH5Edefault { } } + diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java index 31adf22..f3049ed 100644 --- a/java/test/TestH5Z.java +++ b/java/test/TestH5Z.java @@ -41,8 +41,8 @@ public class TestH5Z { @Test public void testH5Zfilter_avail() { try { - int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zfilter_avail_DEFLATE", filter_found > 0); + int filter_found; + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zfilter_avail_FLETCHER32", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); @@ -51,8 +51,12 @@ public class TestH5Z { assertTrue("H5.H5Zfilter_avail_SCALEOFFSET", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zfilter_avail_SHUFFLE", filter_found > 0); -// filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zfilter_avail_SZIP", filter_found > 0); + + // Just make sure H5Zfilter_avail() doesn't fail with szip/zlib + // since there is no way for us to determine if they should be present + // or not. + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); } catch (Throwable err) { err.printStackTrace(); @@ -63,9 +67,8 @@ public class TestH5Z { @Test public void testH5Zget_filter_info() { try { - int filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + int filter_flag; + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); @@ -78,9 +81,19 @@ public class TestH5Z { filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); -// filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); -// assertTrue("H5.H5Zget_filter_info_ENCODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + } + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); + // Decode should always be available, but we have no way of determining + // if encode is so don't assert on that. + assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + } } catch (Throwable err) { err.printStackTrace(); @@ -96,3 +109,4 @@ public class TestH5Z { H5.H5Zunregister(HDF5Constants.H5Z_FILTER_SHUFFLE); } } + diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 5d69bee..350fb7b 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -59,11 +59,13 @@ LIST_LIBRARY_FILES=" $top_builddir/src/.libs/libhdf5.* $top_builddir/java/src/jni/.libs/libhdf5_java.* " -LIST_JAR_FILES=" +LIST_JAR_TESTFILES=" $HDFLIB_HOME/hamcrest-core.jar $HDFLIB_HOME/junit.jar $HDFLIB_HOME/slf4j-api-1.7.25.jar $HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar +" +LIST_JAR_FILES=" $top_builddir/java/src/$JARFILE " LIST_DATA_FILES=" @@ -109,6 +111,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Giterate.txt # copy files from source dirs to test dir # COPY_LIBFILES="$LIST_LIBRARY_FILES" +COPY_JARTESTFILES="$LIST_JAR_TESTFILES" COPY_JARFILES="$LIST_JAR_FILES" COPY_LIBFILES_TO_BLDLIBDIR() @@ -138,6 +141,29 @@ COPY_LIBFILES_TO_BLDLIBDIR() fi done # copy jar files. Used -f to make sure get a new copy + for tstfile in $COPY_JARTESTFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done for tstfile in $COPY_JARFILES do # ignore '#' comment @@ -172,7 +198,10 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDLIBDIR + for tstfile in $COPY_JARTESTFILES + do + $RM $BLDLIBDIR/tstfile + done fi } @@ -281,11 +310,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then fi case $os_name in - Darwin) - DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH - export DYLD_LIBRARY_PATH - LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH - ;; *) LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH ;; @@ -986,53 +1010,48 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Z.txt JUnit-TestH5Z.out |sed 's/^/ /' fi -if test "X-$BUILD_MODE" = "X-production" ; then - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" - TESTING JUnit-TestH5E - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5E.ext > JUnit-TestH5E.out - - if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then - echo " PASSED JUnit-TestH5E" - else - echo "**FAILED** JUnit-TestH5E" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' - fi - fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" +TESTING JUnit-TestH5E +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" - TESTING JUnit-TestH5Edefault - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out - - if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then - echo " PASSED JUnit-TestH5Edefault" - else - echo "**FAILED** JUnit-TestH5Edefault" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' - fi - fi +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5E.ext > JUnit-TestH5E.out + +if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then + echo " PASSED JUnit-TestH5E" +else + echo "**FAILED** JUnit-TestH5E" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" +TESTING JUnit-TestH5Edefault +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out + +if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then + echo " PASSED JUnit-TestH5Edefault" +else + echo "**FAILED** JUnit-TestH5Edefault" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' +fi + if test $USE_FILTER_SZIP = "yes"; then echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" TESTING JUnit-TestH5Giterate diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 62497f9..71d1431 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -34,27 +34,39 @@ OK (28 tests) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibilty + major: File accessibility minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty + #001: (file name) line (number) in H5VL_file_open(): open failed + major: Virtual Object Layer + minor: Unable to initialize object + #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + major: File accessibility + minor: Unable to open file + #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + major: File accessibility + minor: Unable to open file + #004: (file name) line (number) in H5FD_open(): open failed + major: Virtual File Layer + minor: Unable to initialize object + #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + major: File accessibility minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class - major: File accessibilty - minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID - major: Object atom - minor: Unable to find atom information (already closed?) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibilty + major: File accessibility + minor: Unable to open file + #001: (file name) line (number) in H5VL_file_open(): open failed + major: Virtual Object Layer + minor: Unable to initialize object + #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + major: File accessibility + minor: Unable to open file + #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + major: File accessibility minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty + #004: (file name) line (number) in H5FD_open(): open failed + major: Virtual File Layer + minor: Unable to initialize object + #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + major: File accessibility minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class - major: File accessibilty - minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID - major: Object atom - minor: Unable to find atom information (already closed?) |