diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-02-21 20:30:34 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-02-21 20:30:34 (GMT) |
commit | 51b8c63864c72de9a7b40c00673fe07510fec27e (patch) | |
tree | 298e9a2584860a24f55d2bce1fc60faed2bef2dd /java/test | |
parent | c4f785bc93c5f4e8677b325c321e0f9ed41c3baa (diff) | |
parent | c5ab2285639a801f87a77987db1a0b609a020314 (diff) | |
download | hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.zip hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.gz hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.bz2 |
Merge develop
Diffstat (limited to 'java/test')
25 files changed, 1259 insertions, 417 deletions
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index dfb6e72..6275227 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -105,39 +105,120 @@ endif () get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;") -foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) - set (CMAKE_JAVA_CLASSPATH ".") - foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) - set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) + foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) + set (CMAKE_JAVA_CLASSPATH ".") + foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") + endforeach () + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE}") + + add_test ( + NAME JUnit-${test_file}-clearall-objects + COMMAND ${CMAKE_COMMAND} -E remove + JUnit-${test_file}.out + JUnit-${test_file}.out.err + ) + add_test ( + NAME JUnit-${test_file} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}" + -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" + -D "TEST_PROGRAM=test.${test_file}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" + -D "TEST_OUTPUT=JUnit-${test_file}.out" +# -D "TEST_LOG_LEVEL=trace" + -D "TEST_EXPECT=0" + -D "SKIP_APPEND=1" + -D "TEST_MASK_ERROR=TRUE" +# -D "TEST_FILTER:STRING=${testfilter}" + -D "TEST_REFERENCE=JUnit-${test_file}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JUnit-${test_file} PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" + DEPENDS "JUnit-${test_file}-clearall-objects" + ) endforeach () - set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE}") - add_test ( - NAME JUnit-${test_file}-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - JUnit-${test_file}.out - JUnit-${test_file}.out.err - ) - add_test ( - NAME JUnit-${test_file} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}" - -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" - -D "TEST_PROGRAM=test.${test_file}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" - -D "TEST_OUTPUT=JUnit-${test_file}.out" -# -D "TEST_LOG_LEVEL=trace" - -D "TEST_EXPECT=0" - -D "SKIP_APPEND=1" - -D "TEST_MASK_ERROR=TRUE" -# -D "TEST_FILTER:STRING=${testfilter}" - -D "TEST_REFERENCE=JUnit-${test_file}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - set_tests_properties (JUnit-${test_file} PROPERTIES - ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" - DEPENDS "JUnit-${test_file}-clearall-objects" - ) -endforeach () + + ############################################################################## + ############################################################################## + ### V O L T E S T S ### + ############################################################################## + ############################################################################## + + macro (DO_VOL_TEST voltest volname volinfo volclasspath) + #message(STATUS "${voltest}-${volname} with ${volinfo}") + add_test ( + NAME JUnit-VOL-${volname}-${voltest}-clearall-objects + COMMAND ${CMAKE_COMMAND} -E remove + JUnit-VOL-${volname}-${voltest}.out + JUnit-VOL-${volname}-${voltest}.out.err + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname} + ) + add_test (NAME JUnit-VOL-${volname}-${voltest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${volclasspath}" + -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" + -D "TEST_PROGRAM=test.${voltest}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test/${volname}" + -D "TEST_VOL:STRING=${volinfo}" + -D "TEST_OUTPUT=JUnit-VOL-${volname}-${voltest}.out" +# -D "TEST_LOG_LEVEL=trace" + -D "TEST_EXPECT=0" + -D "SKIP_APPEND=1" + -D "TEST_MASK_ERROR=TRUE" +# -D "TEST_FILTER:STRING=${testfilter}" + -D "TEST_REFERENCE=JUnit-${volname}-${voltest}.txt" + -P "${HDF_RESOURCES_DIR}/jvolTest.cmake" + ) + set_tests_properties (JUnit-VOL-${volname}-${voltest} PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" + DEPENDS "JUnit-VOL-${volname}-${voltest}-clearall-objects" + WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname} + ) + endmacro () + + if (HDF5_TEST_PASSTHROUGH_VOL) + set (VOL_LIST + vol_native + vol_pass_through1 + vol_pass_through2 + ) + + set (vol_native native) + set (vol_pass_through1 "pass_through under_vol=0\;under_info={}") + set (vol_pass_through2 "pass_through under_vol=505\;under_info={under_vol=0\;under_info={}}") + + foreach (voltest ${VOL_LIST}) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}") + foreach (h5_file ${HDF5_JAVA_TEST_SOURCES}) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/JUnit-${h5_file}.txt" "${PROJECT_BINARY_DIR}/${voltest}/JUnit-${h5_file}.txt" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + endforeach () + + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterate.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files") + + add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list}) + + foreach (volinfo IN LISTS ${voltest}) + foreach (h5_file ${HDF5_JAVA_TEST_SOURCES}) + set (CMAKE_JAVA_CLASSPATH ".") + foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") + endforeach () + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${h5_file}_JAR_FILE}") + DO_VOL_TEST (${h5_file} ${voltest} "${volinfo}" ${CMAKE_JAVA_CLASSPATH}) + endforeach () + endforeach () + endforeach () + endif () +endif () diff --git a/java/test/Makefile.am b/java/test/Makefile.am index c375938..3f11933 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -84,6 +84,11 @@ noinst_DATA = $(jarfile) .PHONY: classes +# Test with just the native connector, with a single pass-through connector +# and with a doubly-stacked pass-through. +VOL_LIST = native "pass_through under_vol=0;under_info={}" \ + "pass_through under_vol=505;under_info={under_vol=0;under_info={}}" + check_SCRIPTS = junit.sh TEST_SCRIPT = $(check_SCRIPTS) diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 2bee075..9b2a1d3 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -22,12 +22,17 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.io.Reader; +import java.io.StreamTokenizer; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; @@ -50,6 +55,81 @@ public class TestH5 { public void nextTestName() { System.out.println(); } + private static final String H5_FILE = "testData.h5"; + private static final String EXPORT_FILE = "testExport.txt"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int RANK = 2; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + private final void _deleteFile(String filename) { + File file = null; + try { + file = new File(filename); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5._createDataset: ", did > 0); + + return did; + } + + private final void _createH5File() { + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + public final void _closeH5File() throws HDF5LibraryException { + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + H5dsid = -1; + H5did = -1; + } + + public final void _deleteH5file() { + _deleteFile(H5_FILE); + } /** * Test method for {@link hdf.hdf5lib.H5#J2C(int)}. @@ -268,4 +348,67 @@ public class TestH5 { fail("Exception thrown during test: " + ex.toString()); } } + + @Test + public void testH5export_dataset() { + int[][] dset_data = new int[DIM_X][DIM_Y]; + int[][] dset_indata = new int[DIM_X][DIM_Y]; + int FILLVAL = 99; + + _createH5File(); + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = FILLVAL; + + try { + if (H5did >= 0) + H5.H5Dwrite(H5did, HDF5Constants.H5T_STD_I32LE, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + _closeH5File(); + + try { + H5.H5export_dataset(EXPORT_FILE, H5_FILE, "/dset", 99); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5export_dataset failed: " + err); + } + + File file = new File(EXPORT_FILE); + + try { + Reader reader = new FileReader(EXPORT_FILE); + StreamTokenizer streamTokenizer = new StreamTokenizer(reader); + int indx = 0; + int jndx = 0; + while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ + if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + dset_indata[indx][jndx] = (int)streamTokenizer.nval; + jndx++; + if (jndx >= DIM_Y) { + jndx = 0; + indx++; + } + } + } + reader.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("read file failed: " + err); + } + for(int row = 0; row < DIM_X; row++) + for(int col = 0; col < DIM_Y; col++) { + assertTrue("H5export_dataset: <"+row+","+col+">"+dset_indata[row][col]+"=99", dset_indata[row][col]==99); + } + _deleteH5file(); + } } diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java index a3618f2..621c000 100644 --- a/java/test/TestH5Dparams.java +++ b/java/test/TestH5Dparams.java @@ -113,17 +113,6 @@ public class TestH5Dparams { H5.H5Dvlen_get_buf_size(-1, -1, -1); } - @Test(expected = HDF5LibraryException.class) - public void testH5Dvlen_reclaim_invalid() throws Throwable { - byte[] buf = new byte[2]; - H5.H5Dvlen_reclaim(-1, -1, -1, buf); - } - - @Test(expected = NullPointerException.class) - public void testH5Dvlen_reclaim_null() throws Throwable { - H5.H5Dvlen_reclaim(-1, -1, -1, null); - } - @Test(expected = IllegalArgumentException.class) public void testH5Dget_storage_size_invalid() throws Throwable { H5.H5Dget_storage_size(-1); diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index fd015c0..6f4f473 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -74,7 +74,6 @@ public class TestH5E { @Test public void testH5Eget_msg_major() { - try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -90,8 +89,17 @@ public class TestH5E { fail("H5.H5Eget_msg(Throwable): " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "File accessibility", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error string might be different. + * Only check for the specific error message if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertEquals("H5.H5Eget_msg: ", "File accessibility", msg); } catch (Throwable err) { err.printStackTrace(); @@ -116,8 +124,17 @@ public class TestH5E { fail("H5.H5Eget_msg: " + err); } assertNotNull("H5.H5Eget_msg: " + msg, msg); - assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg); assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error string might be different. + * Only check for the specific error message if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index ee2850b..0e55bcc 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -24,6 +24,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.Ignore; import org.junit.rules.TestName; public class TestH5Edefault { @@ -55,20 +56,29 @@ public class TestH5Edefault { H5.H5Eprint2(-1, null); } - @Test + @Ignore public void testH5Eprint() { - try { - H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - } - try { - H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Eprint: " + err); - } + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) { + try { + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eprint: " + err); + } + } } @Test @@ -366,7 +376,7 @@ public class TestH5Edefault { } 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 + // Set 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); @@ -427,20 +437,29 @@ public class TestH5Edefault { H5.H5Eprint2(-1, null); } - @Test + @Ignore public void testH5EprintInt() { - try { - H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - } - try { - H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5EprintInt: " + err); - } + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) { + try { + H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EprintInt: " + err); + } + } } @Test diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java index 6c30187..4b6d470 100644 --- a/java/test/TestH5G.java +++ b/java/test/TestH5G.java @@ -24,6 +24,7 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5G_info_t; +import hdf.hdf5lib.structs.H5O_token_t; import org.junit.After; import org.junit.Before; @@ -286,12 +287,12 @@ public class TestH5G { String objNames[] = new String[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -317,14 +318,14 @@ public class TestH5G { assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0); String objNames[] = new String[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objRefs, HDF5Constants.H5_INDEX_NAME); + objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -358,14 +359,14 @@ public class TestH5G { assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0); String objNames[] = new String[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objRefs, HDF5Constants.H5_INDEX_NAME); + objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); @@ -395,12 +396,12 @@ public class TestH5G { String objNames[] = new String[(int)groups_max_size]; int objTypes[] = new int[(int)groups_max_size]; int lnkTypes[] = new int[(int)groups_max_size]; - long objRefs[] = new long[(int)groups_max_size]; + H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objRefs, groups_max_size); + objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); @@ -426,12 +427,12 @@ public class TestH5G { String objNames[] = new String[(int)groups_max_size]; int objTypes[] = new int[(int)groups_max_size]; int lnkTypes[] = new int[(int)groups_max_size]; - long objRefs[] = new long[(int)groups_max_size]; + H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objRefs, groups_max_size); + objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); @@ -471,11 +472,11 @@ public class TestH5G { String objNames[] = new String[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; try { H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_CRT_ORDER); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_CRT_ORDER); } catch (Throwable err) { err.printStackTrace(); @@ -488,7 +489,7 @@ public class TestH5G { try { H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java index 06c59e7..9514837 100644 --- a/java/test/TestH5Giterate.java +++ b/java/test/TestH5Giterate.java @@ -20,6 +20,7 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5G_info_t; +import hdf.hdf5lib.structs.H5O_token_t; import org.junit.After; import org.junit.Before; @@ -93,12 +94,12 @@ public class TestH5Giterate { String objNames[] = new String[(int) info.nlinks]; int objTypes[] = new int[(int) info.nlinks]; int lnkTypes[] = new int[(int) info.nlinks]; - long objRefs[] = new long[(int) info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; int names_found = 0; try { names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, - objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java index 0a836c1..3bea1ee 100644 --- a/java/test/TestH5Lbasic.java +++ b/java/test/TestH5Lbasic.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_cb; import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5L_info_t; @@ -119,9 +119,8 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ",link_info==null); + assertFalse("H5Lget_info",link_info==null); assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); - assertTrue("Link Address ",link_info.address_val_size>0); } @Test(expected = HDF5LibraryException.class) @@ -155,7 +154,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx ",link_info==null); + assertFalse("H5Lget_info_by_idx",link_info==null); assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); try { link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -164,7 +163,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + assertTrue("Link Value Size", link_info.val_size == link_info2.val_size); } @Test @@ -178,7 +177,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx ",link_info==null); + assertFalse("H5Lget_info_by_idx",link_info==null); assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); try { link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -187,7 +186,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + assertTrue("Link Value Size", link_info.val_size == link_info2.val_size); } @Test(expected = HDF5LibraryException.class) @@ -233,18 +232,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } @@ -271,18 +270,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } @@ -305,18 +304,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); } @@ -342,18 +341,18 @@ public class TestH5Lbasic { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java index 06c4ac1..c8f2348 100644 --- a/java/test/TestH5Lcreate.java +++ b/java/test/TestH5Lcreate.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_cb; import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5L_info_t; @@ -320,9 +320,9 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ", link_info==null); + assertFalse("H5Lget_info", link_info==null); assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); - assertTrue("Link Address ", link_info.address_val_size>0); + assertTrue("Link Value Size", link_info.val_size > 0); } @Test @@ -383,9 +383,9 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ", link_info==null); + assertFalse("H5Lget_info", link_info==null); assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); - assertTrue("Link Address ", link_info.address_val_size>0); + assertTrue("Link Value Size", link_info.val_size > 0); } @Test @@ -431,9 +431,9 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ", link_info==null); + assertFalse("H5Lget_info", link_info==null); assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); - assertTrue("Link Address ", link_info.address_val_size>0); + assertTrue("Link Value Size", link_info.val_size > 0); } @Test @@ -740,18 +740,18 @@ public class TestH5Lcreate { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } @@ -792,18 +792,18 @@ public class TestH5Lcreate { this.link_type = type; } } - class H5L_iter_data implements H5L_iterate_t { + class H5L_iter_data implements H5L_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5L_iterate_t iter_data = new H5L_iter_data(); - class H5L_iter_callback implements H5L_iterate_cb { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + H5L_iterate_opdata_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_t { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; } } - H5L_iterate_cb iter_cb = new H5L_iter_callback(); + H5L_iterate_t iter_cb = new H5L_iter_callback(); try { H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data); } diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java index 8c6689f..20ffc41 100644 --- a/java/test/TestH5Obasic.java +++ b/java/test/TestH5Obasic.java @@ -21,10 +21,14 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_cb; import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5O_info_t; +import hdf.hdf5lib.structs.H5O_native_info_t; +import hdf.hdf5lib.structs.H5O_token_t; +import hdf.hdf5lib.structs.H5O_hdr_info_t; +import hdf.hdf5lib.structs.H5_ih_info_t; import org.junit.After; import org.junit.Before; @@ -35,10 +39,8 @@ import org.junit.rules.TestName; public class TestH5Obasic { @Rule public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterateO1.hdf"; - private static long H5la_ds1 = -1; - private static long H5la_l1 = -1; - private static long H5la_dt1 = -1; - private static long H5la_g1 = -1; + private static H5O_token_t H5la_ds1 = null; + private static H5O_token_t H5la_l1 = null; long H5fid = -1; @Before @@ -242,7 +244,7 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err); } - H5la_ds1 = obj_info.addr; + H5la_ds1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); @@ -253,7 +255,7 @@ public class TestH5Obasic { } assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oget_info_by_idx_n0:Link Address ",obj_info.addr==H5la_ds1); + assertTrue("testH5Oget_info_by_idx_n0:Link Object token", obj_info.token.equals(H5la_ds1)); } @Test @@ -268,7 +270,7 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err); } - H5la_l1 = obj_info.addr; + H5la_l1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); @@ -279,7 +281,263 @@ public class TestH5Obasic { } assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oget_info_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + assertTrue("testH5Oget_info_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1)); + } + + @Test + public void testH5Oget_native_info_dataset() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_native_info_hardlink() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_native_info_group() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_native_info_datatype() { + long oid = -1; + H5O_native_info_t native_info = null; + + try { + oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info: " + err); + } + assertFalse("H5Oget_native_info ", native_info == null); + assertFalse("H5Oget_native_info ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info ", native_info.obj_info == null); + assertFalse("H5Oget_native_info ", native_info.attr_info == null); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable { + H5.H5Oget_native_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_name_not_exists() throws Throwable { + H5.H5Oget_native_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_native_info_by_name_dataset() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test + public void testH5Oget_native_info_by_name_hardlink() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test + public void testH5Oget_native_info_by_name_group() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test + public void testH5Oget_native_info_by_name_datatype() { + H5O_native_info_t native_info = null; + + try { + native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_native_info_by_name: " + err); + } + assertFalse("H5Oget_native_info_by_name ", native_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable { + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_native_info_by_idx_n0() { + long oid = -1; + H5O_native_info_t native_info = null; + H5O_hdr_info_t ohdr; + H5_ih_info_t oinfo; + H5_ih_info_t ainfo; + + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info: " + err); + } + + ohdr = native_info.hdr_info; + oinfo = native_info.obj_info; + ainfo = native_info.attr_info; + + try {H5.H5Oclose(oid);} catch (Exception ex) {} + + try { + native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info_by_idx: " + err); + } + assertFalse("H5Oget_native_info_by_idx ", native_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null); + assertTrue("testH5Oget_native_info_by_idx_n0:Object Header Info", native_info.hdr_info.equals(ohdr)); + assertTrue("testH5Oget_native_info_by_idx_n0:Object Info", native_info.obj_info.equals(oinfo)); + assertTrue("testH5Oget_native_info_by_idx_n0:Attribute Info", native_info.attr_info.equals(ainfo)); + } + + @Test + public void testH5Oget_native_info_by_idx_n3() { + long oid = -1; + H5O_native_info_t native_info = null; + H5O_hdr_info_t ohdr; + H5_ih_info_t oinfo; + H5_ih_info_t ainfo; + + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + native_info = H5.H5Oget_native_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info: " + err); + } + + ohdr = native_info.hdr_info; + oinfo = native_info.obj_info; + ainfo = native_info.attr_info; + + try {H5.H5Oclose(oid);} catch (Exception ex) {} + + try { + native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info_by_idx: " + err); + } + assertFalse("H5Oget_native_info_by_idx ", native_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null); + assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null); + assertTrue("testH5Oget_native_info_by_idx_n3:Object Header Info", native_info.hdr_info.equals(ohdr)); + assertTrue("testH5Oget_native_info_by_idx_n3:Object Info", native_info.obj_info.equals(oinfo)); + assertTrue("testH5Oget_native_info_by_idx_n3:Attribute Info", native_info.attr_info.equals(ainfo)); } @Test @@ -292,18 +550,18 @@ public class TestH5Obasic { this.link_type = type; } } - class H5O_iter_data implements H5O_iterate_t { + class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5O_iterate_t iter_data = new H5O_iter_data(); - class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; } } - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); try { H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } @@ -331,18 +589,18 @@ public class TestH5Obasic { this.link_type = type; } } - class H5O_iter_data implements H5O_iterate_t { + class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5O_iterate_t iter_data = new H5O_iter_data(); - class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; } } - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); try { H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } @@ -371,7 +629,7 @@ public class TestH5Obasic { } @Test - public void testH5Oopen_by_addr() { + public void testH5Oopen_by_token() { long oid = -1; H5O_info_t obj_info = null; try { @@ -381,32 +639,32 @@ public class TestH5Obasic { } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + fail("testH5Oopen_by_token: H5.H5Oget_info: " + err); } - H5la_ds1 = obj_info.addr; + H5la_ds1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - oid = H5.H5Oopen_by_addr(H5fid, H5la_ds1); + oid = H5.H5Oopen_by_token(H5fid, H5la_ds1); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + fail("testH5Oopen_by_token: H5.H5Oopen_by_token: " + err); } try { obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + fail("testH5Oopen_by_token: H5.H5Oget_info: " + err); } - assertFalse("testH5Oopen_by_addr: H5Oget_info ",obj_info==null); - assertTrue("testH5Oopen_by_addr: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oopen_by_addr: Link Address ",obj_info.addr==H5la_ds1); + assertFalse("testH5Oopen_by_token: H5Oget_info ",obj_info==null); + assertTrue("testH5Oopen_by_token: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_token: Link Object Token", obj_info.token.equals(H5la_ds1)); } finally { try{H5.H5Oclose(oid);} catch (Exception ex) {} } - } + } @Test public void testH5Oopen_by_idx_n0() { @@ -421,14 +679,14 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err); } - H5la_ds1 = obj_info.addr; + H5la_ds1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + fail("testH5Oopen_by_idx_n0: H5.H5Oopen_by_idx: " + err); } try { obj_info = H5.H5Oget_info(oid); @@ -439,7 +697,7 @@ public class TestH5Obasic { } assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oopen_by_idx_n0: Link Address ",obj_info.addr==H5la_ds1); + assertTrue("testH5Oopen_by_idx_n0: Link Object Token", obj_info.token.equals(H5la_ds1)); } finally { try{H5.H5Oclose(oid);} catch (Exception ex) {} @@ -459,14 +717,14 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err); } - H5la_l1 = obj_info.addr; + H5la_l1 = obj_info.token; try {H5.H5Oclose(oid);} catch (Exception ex) {} try { oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + fail("testH5Oopen_by_idx_n3: H5.H5Oopen_by_idx: " + err); } try { obj_info = H5.H5Oget_info(oid); @@ -477,7 +735,7 @@ public class TestH5Obasic { } assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("testH5Oopen_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + assertTrue("testH5Oopen_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1)); } finally { try{H5.H5Oclose(oid);} catch (Exception ex) {} diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index de17d8b..5e9fdf2 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_cb; import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5O_info_t; @@ -264,9 +264,9 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ", obj_info==null); + assertFalse("H5Oget_info", obj_info==null); assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - assertTrue("Link Address ", obj_info.addr>0); + assertTrue("Link Object Token", obj_info.token != null); } @Test(expected = HDF5LibraryException.class) @@ -286,9 +286,9 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ", obj_info==null); + assertFalse("H5Oget_info", obj_info==null); assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); - assertTrue("Link Address ", obj_info.addr>0); + assertTrue("Link Object Token", obj_info.token != null); } @Test @@ -351,18 +351,18 @@ public class TestH5Ocreate { this.link_type = type; } } - class H5O_iter_data implements H5O_iterate_t { + class H5O_iter_data implements H5O_iterate_opdata_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } - H5O_iterate_t iter_data = new H5O_iter_data(); - class H5O_iter_callback implements H5O_iterate_cb { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + H5O_iterate_opdata_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_t { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; } } - H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); try { H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); } diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index cac3dcd..1f379d3 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -95,6 +95,31 @@ public class TestH5Oparams { } @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_invalid() throws Throwable { + H5.H5Oget_native_info(-1, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_native_info_by_name_null() throws Throwable { + H5.H5Oget_native_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_name_invalid() throws Throwable { + H5.H5Oget_native_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_native_info_by_idx_invalid() throws Throwable { + H5.H5Oget_native_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_native_info_by_idx_null() throws Throwable { + H5.H5Oget_native_info_by_idx(-1, null, 0, 0, 0L, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) public void testH5Olink_invalid() throws Throwable { H5.H5Olink(-1, -1, "Bogus", -1, -1); } diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java index 5349855..7b9f538 100644 --- a/java/test/TestH5R.java +++ b/java/test/TestH5R.java @@ -14,6 +14,7 @@ package test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -24,9 +25,11 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -42,6 +45,8 @@ public class TestH5R { long H5gid = -1; long H5did2 = -1; long[] H5dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + int FILLVAL = 99; private final void _deleteFile(String filename) { File file = null; @@ -51,8 +56,9 @@ public class TestH5R { catch (Throwable err) {} if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try {file.delete();} catch (SecurityException e) {e.printStackTrace();} } + assertFalse("TestH5R._deleteFile file still exists ", file.exists()); } private final long _createDataset(long fid, long dsid, String name, long dapl) { @@ -66,7 +72,7 @@ public class TestH5R { err.printStackTrace(); fail("H5.H5Dcreate: " + err); } - assertTrue("TestH5R._createDataset: ",did > 0); + assertTrue("TestH5R._createDataset: ", did > 0); return did; } @@ -100,6 +106,21 @@ public class TestH5R { H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT); H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = FILLVAL; + + try { + if (H5did >= 0) + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + } catch (Throwable err) { err.printStackTrace(); @@ -129,205 +150,438 @@ public class TestH5R { System.out.println(); } + // Test v1.8 APIs params + /* + * @Ignore public void testH5Rget_name() { long loc_id = H5fid; int ref_type = + * HDF5Constants.H5R_OBJECT; long ret_val = -1; byte[] ref = null; String[] name = {""}; String + * objName = "/dset"; + * + * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rget_name:H5Rcreate " + err); } + * + * try { ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rget_name: " + err); } + * + * assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); assertTrue("The name of the object: ", + * objName.equals(name[0])); } + * + * @Ignore public void testH5Rget_obj_type2() { int ref_type=HDF5Constants.H5R_OBJECT; byte[] + * ref=null; + * + * String objName = "/dset"; int obj_type = -1; + * + * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch(Throwable err) { + * err.printStackTrace(); } + * + * try { obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); } catch (Throwable + * err) { err.printStackTrace(); fail("H5.H5Rget_obj_type2: " + err); } assertEquals(obj_type, + * HDF5Constants.H5O_TYPE_DATASET); } + * + * @Ignore public void testH5Rcreate_refobj() { byte[] ref = null; + * + * try { ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } + * + * @Ignore public void testH5Rcreate_regionrefobj() { byte[] ref = null; try { ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } + * + * @Ignore public void testH5Rdereference() { byte[] ref1 = null; byte[] ref2 = null; long + * dataset_id = -1; long group_id = -1; try { //Create reference on dataset ref1 = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dataset_id= + * H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); + * + * //Create reference on group ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); + * group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); + * assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0); assertTrue(group_id >= 0); + * } catch (Throwable err) { err.printStackTrace(); fail("TestH5Rdereference " + err); } finally { + * try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} try {H5.H5Gclose(group_id);} catch + * (Exception ex) {} } } + * + * @Ignore public void testH5Rget_region() { byte[] ref = null; long dsid = -1; try { ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dsid = + * H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); assertNotNull(ref); + * assertTrue(dsid >= 0); } catch (Throwable err) { err.printStackTrace(); + * fail("TestH5Rget_region: " + err); } finally { try {H5.H5Sclose(dsid);} catch (Exception ex) {} } + * } + * + * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rget_name_Invalidreftype() + * throws Throwable { byte[] ref = null; String[] name = {""}; ref = H5.H5Rcreate(H5fid, "/dset", + * HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, + * 16); } + * + * @Ignore//(expected = NullPointerException.class) public void testH5Rget_name_NULLreference() + * throws Throwable { byte[] ref = null; String[] name = {""}; H5.H5Rget_name(H5fid, + * HDF5Constants.H5R_OBJECT, ref, name, 16); } + * + * @Ignore//(expected = HDF5LibraryException.class) public void + * testH5Rget_obj_type2_Invalidreftype() throws Throwable { byte[] ref = null; ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_obj_type(H5fid, + * HDF5Constants.H5R_DATASET_REGION, ref); } + * + * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_InvalidObjectName() + * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); } + * + * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_Invalidspace_id() + * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); + * } + * + * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rcreate_Invalidreftype() + * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); } + * + * @Ignore//(expected = IllegalArgumentException.class) public void + * testH5Rgetregion_Invalidreftype() throws Throwable { byte[] ref = null; ref = H5.H5Rcreate(H5fid, + * "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, + * HDF5Constants.H5R_DATASET_REGION, ref); } + * + * @Ignore//(expected = IllegalArgumentException.class) public void + * testH5Rgetregion_Badreferencetype() throws Throwable { byte[] ref = null; ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, + * HDF5Constants.H5R_OBJECT, ref); } + * + * @Ignore//(expected = NullPointerException.class) public void testH5Rgetregion_Nullreference() + * throws Throwable { byte[] ref = null; H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, + * ref); } + * + * @Ignore//(expected = NullPointerException.class) public void testH5Rdereference_Nullreference() + * throws Throwable { byte[] ref = null; H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, + * HDF5Constants.H5R_OBJECT, ref); } + * + * @Ignore//(expected = IllegalArgumentException.class) public void + * testH5Rdereference_Invalidreference() throws Throwable { byte[] ref1 = null; byte[] ref2 = null; + * ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); ref2 = + * H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); H5.H5Rdereference(H5gid, + * HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); } + */ + // Test v1.12 APIs params + @Test - public void testH5Rget_name() { - long loc_id=H5fid; - int ref_type=HDF5Constants.H5R_OBJECT; - long ret_val=-1; - byte[] ref=null; - String[] name= {""}; + public void testH5Rget_object() { + int ref_type = HDF5Constants.H5R_OBJECT2; + long ret_val = -1; + byte[] ref = null; + String name = ""; String objName = "/dset"; try { - ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); + ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5Rget_name:H5Rcreate " + err); + fail("testH5Rget_object: H5Rcreate_object " + err); } try { - ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); + ret_val = H5.H5Rget_type(ref); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5Rget_name: " + err); + fail("testH5Rget_object: H5Rget_type: " + err); } - - assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); - assertTrue("The name of the object: ", objName.equals(name[0])); - } - - @Test - public void testH5Rget_obj_type2() { - int ref_type=HDF5Constants.H5R_OBJECT; - byte[] ref=null; - - String objName = "/dset"; - int obj_type = -1;; + assertTrue("testH5Rget_object: H5Rget_type", ret_val == ref_type); try { - ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); + name = H5.H5Rget_file_name(ref); } - catch(Throwable err) { + catch (Throwable err) { err.printStackTrace(); + fail("testH5Rget_object: H5Rget_file_name: " + err); } + assertTrue("testH5Rget_object: H5Rget_file_name", H5_FILE.equals(name)); try { - obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); + name = H5.H5Rget_obj_name(ref, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5Rget_obj_type2: " + err); + fail("testH5Rget_object: H5Rget_obj_name: " + err); } - assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + assertTrue("The name of the object: ", objName.equals(name)); + H5.H5Rdestroy(ref); } @Test - public void testH5Rcreate_refobj() { + public void testH5Rget_obj_type3() { + int obj_type = -1; byte[] ref = null; + String objName = "/dset"; try { - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); + ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5Rcreate: " + err); + fail("testH5Rget_obj_type3: H5Rcreate_object " + err); } - assertNotNull(ref); - } - @Test - public void testH5Rcreate_regionrefobj() { - byte[] ref = null; try { - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + obj_type = H5.H5Rget_obj_type3(ref, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5Rcreate: " + err); + fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err); } - assertNotNull(ref); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + H5.H5Rdestroy(ref); } @Test - public void testH5Rdereference() { - byte[] ref1 = null; - byte[] ref2 = null; - long dataset_id = -1; - long group_id = -1; + public void testH5Rcreate_regionref_object() { + byte[] ref = null; + String objName = "/dset"; + long start[] = {2,2}; // Starting location of hyperslab + long stride[] = {1,1}; // Stride of hyperslab + long count[] = {1,1}; // Element count of hyperslab + long block[] = {3,3}; // Block size of hyperslab + + // Select 3x3 hyperslab for reference try { - //Create reference on dataset - ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); - dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); - - //Create reference on group - ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); - group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); - assertNotNull(ref1); - assertNotNull(ref2); - assertTrue(dataset_id>=0); - assertTrue(group_id>=0); + H5.H5Sselect_hyperslab(H5dsid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); } catch (Throwable err) { err.printStackTrace(); - fail("TestH5Rdereference " + err); - } - finally { - try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} - try {H5.H5Gclose(group_id);} catch (Exception ex) {} + fail("testH5Rget_object: H5Sselect_hyperslab " + err); } - } - - @Test - public void testH5Rget_region() { - byte[] ref = null; - long dsid = -1; try { - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); - dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); - assertNotNull(ref); - assertTrue(dsid>=0); + ref = H5.H5Rcreate_region(H5fid, objName, H5dsid, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); - fail("TestH5Rget_region: " + err); - } - finally { - try {H5.H5Sclose(dsid);} catch (Exception ex) {} + fail("testH5Rget_object: H5Rcreate_region " + err); } + assertNotNull(ref); + H5.H5Rdestroy(ref); } - @Test(expected = IllegalArgumentException.class) - public void testH5Rget_name_Invalidreftype() throws Throwable { - byte[] ref = null; - String[] name= {""}; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); - H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, 16); +// These tests need to be updated with new APIs +// @Test// +// public void testH5Rget_group() { +// long loc_id = H5fid; +// int ref_type = HDF5Constants.H5R_OBJECT2; +// long ret_val = -1; +// byte[] ref = null; +// String name = ""; +// String objName = "/dset"; +// +// try { +// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("testH5Rget_object: H5Rcreate_object " + err); +// } +// try { +// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); +// +// //Create reference on group +// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); +// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); +// assertNotNull(ref1); +// assertNotNull(ref2); +// assertTrue(dataset_id >= 0); +// assertTrue(group_id >= 0); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("TestH5Rdereference " + err); +// } +// finally { +// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} +// try {H5.H5Gclose(group_id);} catch (Exception ex) {} +// } +// } + +// @Test// +// public void testH5Rget_region_dataset() { +// long loc_id = H5fid; +// int ref_type = HDF5Constants.H5R_OBJECT2; +// long ret_val = -1; +// byte[] ref = null; +// String name = ""; +// String objName = "/dset"; +// +// try { +// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("testH5Rget_object: H5Rcreate_object " + err); +// } +// try { +// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); +// assertNotNull(ref); +// assertTrue(dsid >= 0); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("TestH5Rget_region: " + err); +// } +// finally { +// try {H5.H5Sclose(dsid);} catch (Exception ex) {} +// } +// } + +// @Test// +// public void testH5Rget_attr() { +// long loc_id = H5fid; +// int ref_type = HDF5Constants.H5R_OBJECT2; +// long ret_val = -1; +// byte[] ref = null; +// String name = ""; +// String objName = "/dset"; +// +// try { +// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("testH5Rget_object: H5Rcreate_object " + err); +// } +// try { +// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); +// assertNotNull(ref); +// assertTrue(dsid >= 0); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("TestH5Rget_region: " + err); +// } +// finally { +// try {H5.H5Sclose(dsid);} catch (Exception ex) {} +// } +// } + + // Test parameters to H5Rcreate_object + @Test(expected = NullPointerException.class) + public void testH5Rcreate_object_Nullname() throws Throwable { + String name = null; + H5.H5Rcreate_object(H5fid, name, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5FunctionArgumentException.class) + public void testH5Rget_name_Invalidloc() throws Throwable { + String name= ""; + H5.H5Rcreate_object(-1, name, HDF5Constants.H5P_DEFAULT); } + // Test parameters to H5Rcreate_region @Test(expected = NullPointerException.class) - public void testH5Rget_name_NULLreference() throws Throwable { + public void testH5Rcreate_region_Nullname() throws Throwable { + String name = null; + H5.H5Rcreate_region(H5fid, name, -1, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5FunctionArgumentException.class) + public void testH5Rcreate_region_Invalidloc() throws Throwable { + String name= ""; + H5.H5Rcreate_region(-1, name, -1, HDF5Constants.H5P_DEFAULT); + } + + // Test parameters to H5Rcreate_attr + @Test(expected = NullPointerException.class) + public void testH5Rcreate_attr_Nullname() throws Throwable { + String name = null; + String attrname = ""; + H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Rcreate_attr_Nullattrname() throws Throwable { + String name = ""; + String attrname = null; + H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5FunctionArgumentException.class) + public void testH5Rcreate_attr_Invalidloc() throws Throwable { + String name= ""; + String attrname= ""; + H5.H5Rcreate_attr(-1, name, attrname, HDF5Constants.H5P_DEFAULT); + } + + // Test parameters to H5Rdestroy + @Test(expected = NullPointerException.class) + public void testH5Rdestroy_Nullref() throws Throwable { byte[] ref = null; - String[] name= {""}; - H5.H5Rget_name(H5fid, HDF5Constants.H5R_OBJECT, ref, name, 16); + H5.H5Rdestroy(ref); } - @Test(expected = HDF5LibraryException.class) - public void testH5Rget_obj_type2_Invalidreftype() throws Throwable { + // Test parameters to H5Rget_type + @Test(expected = NullPointerException.class) + public void testH5Rget_type_Nullref() throws Throwable { byte[] ref = null; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); - H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + H5.H5Rget_type(ref); + } + + // Test parameters to H5Requal + @Test(expected = NullPointerException.class) + public void testH5Requal_Nullref1() throws Throwable { + byte[] ref1 = null; + byte[] ref2 = {0,0,0,0}; + H5.H5Requal(ref1, ref2); } - @Test(expected = HDF5LibraryException.class) - public void testH5Rcreate_InvalidObjectName() throws Throwable { - H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); + @Test(expected = NullPointerException.class) + public void testH5Requal_Nullref2() throws Throwable { + byte[] ref1 = {0,0,0,0}; + byte[] ref2 = null; + H5.H5Requal(ref1, ref2); } - @Test(expected = HDF5LibraryException.class) - public void testH5Rcreate_Invalidspace_id() throws Throwable { - H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); + // Test parameters to H5Rcopy + @Test(expected = NullPointerException.class) + public void testH5Rcopy_Nullref1() throws Throwable { + byte[] ref1 = null; + byte[] ref2 = H5.H5Rcopy(ref1); } - @Test(expected = IllegalArgumentException.class) - public void testH5Rcreate_Invalidreftype() throws Throwable { - H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); + // Test parameters to H5Ropen_object + @Test(expected = NullPointerException.class) + public void testH5Ropen_object_Nullref() throws Throwable { + byte[] ref = null; + H5.H5Ropen_object(ref, -1, -1); } - @Test(expected = IllegalArgumentException.class) - public void testH5Rgetregion_Invalidreftype() throws Throwable { + // Test parameters to H5Ropen_region + @Test(expected = NullPointerException.class) + public void testH5Ropen_region_Nullref() throws Throwable { byte[] ref = null; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); - H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + H5.H5Ropen_region(ref, -1, -1); } - @Test(expected = IllegalArgumentException.class) - public void testH5Rgetregion_Badreferencetype() throws Throwable { + // Test parameters to H5Ropen_attr + @Test(expected = NullPointerException.class) + public void testH5Ropen_attr_Nullref() throws Throwable { byte[] ref = null; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); - H5.H5Rget_region(H5fid, HDF5Constants.H5R_OBJECT, ref); + H5.H5Ropen_attr(ref, -1, -1); } + // Test parameters to H5Rget_obj_type3 @Test(expected = NullPointerException.class) - public void testH5Rgetregion_Nullreference() throws Throwable { + public void testH5Rget_obj_type3_Nullref() throws Throwable { byte[] ref = null; - H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + H5.H5Rget_obj_type3(ref, -1); } + // Test parameters to H5Rget_file_name @Test(expected = NullPointerException.class) - public void testH5Rdereference_Nullreference() throws Throwable { + public void testH5Rget_file_name_Nullref() throws Throwable { byte[] ref = null; - H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref); + H5.H5Rget_file_name(ref); } - @Test(expected = IllegalArgumentException.class) - public void testH5Rdereference_Invalidreference() throws Throwable { - byte[] ref1 = null; - byte[] ref2 = null; - ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); - ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); - H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); + // Test parameters to H5Rget_obj_name + @Test(expected = NullPointerException.class) + public void testH5Rget_obj_name_Nullref() throws Throwable { + byte[] ref = null; + H5.H5Rget_obj_name(ref, -1); + } + + // Test parameters to H5Rget_attr_name + @Test(expected = NullPointerException.class) + public void testH5Rget_attr_name_Nullref() throws Throwable { + byte[] ref = null; + H5.H5Rget_attr_name(ref); } } diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java index 53d3a37..8baccd1 100644 --- a/java/test/TestH5Tparams.java +++ b/java/test/TestH5Tparams.java @@ -274,6 +274,17 @@ public class TestH5Tparams { public void testH5Tpack_invalid() throws Throwable { H5.H5Tpack(-1); } + + @Test(expected = HDF5LibraryException.class) + public void testH5Treclaim_invalid() throws Throwable { + byte[] buf = new byte[2]; + H5.H5Treclaim(-1, -1, -1, buf); + } + + @Test(expected = NullPointerException.class) + public void testH5Treclaim_null() throws Throwable { + H5.H5Treclaim(-1, -1, -1, null); + } @Test(expected = HDF5LibraryException.class) public void testH5Tvlen_create_invalid() throws Throwable { diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index 0397be1..bd660d3 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -55,28 +55,76 @@ public class TestH5VL { try { boolean is_registered; - is_registered = H5.H5VLis_connector_registered(HDF5Constants.H5VL_NATIVE_NAME); - assertTrue("H5.H5VLis_connector_registered H5VL_NATIVE_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name(HDF5Constants.H5VL_NATIVE_NAME); + assertTrue("H5.H5VLis_connector_registered_by_name H5VL_NATIVE_NAME", is_registered); - is_registered = H5.H5VLis_connector_registered("FAKE_VOL_NAME"); - assertFalse("H5.H5VLis_connector_registered FAKE_VOL_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name("FAKE_VOL_NAME"); + assertFalse("H5.H5VLis_connector_registered_by_name FAKE_VOL_NAME", is_registered); + + is_registered = H5.H5VLis_connector_registered_by_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLis_connector_registered_by_value H5VL_NATIVE_VALUE", is_registered); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5VLis_connector_registered " + err); + fail("testH5VLnative_init(): " + err); } } @Test public void testH5VLget_connector_id() { + String H5_FILE = "testFvl.h5"; + + long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + try { + long native_id = H5.H5VLget_connector_id(H5fid); + assertTrue("H5.H5VLget_connector_id", native_id >= 0); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector. Only check for the native connector + * if this isn't set. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertEquals(HDF5Constants.H5VL_NATIVE, native_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_id " + err); + } + finally { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + } + } + + @Test + public void testH5VLget_connector_id_by_name() { + try { + long native_id = H5.H5VLget_connector_id_by_name(HDF5Constants.H5VL_NATIVE_NAME); + assertTrue("H5.H5VLget_connector_id_by_name H5VL_NATIVE_NAME", native_id >= 0); + assertEquals(HDF5Constants.H5VL_NATIVE, native_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_id_by_name " + err); + } + } + + @Test + public void testH5VLget_connector_id_by_value() { try { - long native_id = H5.H5VLget_connector_id(HDF5Constants.H5VL_NATIVE_NAME); - assertTrue("H5.H5VLget_connector_id H5VL_NATIVE_NAME", native_id >= 0); + long native_id = H5.H5VLget_connector_id_by_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", native_id >= 0); assertEquals(HDF5Constants.H5VL_NATIVE, native_id); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5VLget_connector_id " + err); + fail("H5.H5VLget_connector_id_by_value " + err); } } @@ -90,7 +138,15 @@ public class TestH5VL { try { String native_name = H5.H5VLget_connector_name(H5fid); - assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); + + /* + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector. Only check for the native connector + * if this isn't set. + */ + String connector = System.getenv("HDF5_VOL_CONNECTOR"); + if (connector == null) + assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index ac09db7..598b3d2 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -330,7 +330,7 @@ TESTING JUnit-TestH5 # 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/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-TestH5.ext > JUnit-TestH5.out @@ -351,7 +351,7 @@ TESTING JUnit-TestH5Eparams # 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/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-TestH5Eparams.ext > JUnit-TestH5Eparams.out @@ -372,7 +372,7 @@ TESTING JUnit-TestH5Eregister # 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/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-TestH5Eregister.ext > JUnit-TestH5Eregister.out @@ -393,7 +393,7 @@ TESTING JUnit-TestH5Fparams # 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/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-TestH5Fparams.ext > JUnit-TestH5Fparams.out @@ -414,7 +414,7 @@ TESTING JUnit-TestH5Fbasic # 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/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-TestH5Fbasic.ext > JUnit-TestH5Fbasic.out @@ -435,7 +435,7 @@ TESTING JUnit-TestH5F # 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/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-TestH5F.ext > JUnit-TestH5F.out @@ -456,7 +456,7 @@ TESTING JUnit-TestH5Fswmr # 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/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-TestH5Fswmr.ext > JUnit-TestH5Fswmr.out @@ -477,7 +477,7 @@ TESTING JUnit-TestH5Gbasic # 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/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-TestH5Gbasic.ext > JUnit-TestH5Gbasic.out @@ -498,7 +498,7 @@ TESTING JUnit-TestH5G # 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/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-TestH5G.ext > JUnit-TestH5G.out @@ -519,7 +519,7 @@ TESTING JUnit-TestH5Sbasic # 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/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-TestH5Sbasic.ext > JUnit-TestH5Sbasic.out @@ -540,7 +540,7 @@ TESTING JUnit-TestH5S # 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/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-TestH5S.ext > JUnit-TestH5S.out @@ -561,7 +561,7 @@ TESTING JUnit-TestH5Tparams # 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/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-TestH5Tparams.ext > JUnit-TestH5Tparams.out @@ -582,7 +582,7 @@ TESTING JUnit-TestH5Tbasic # 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/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-TestH5Tbasic.ext > JUnit-TestH5Tbasic.out @@ -603,7 +603,7 @@ TESTING JUnit-TestH5T # 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/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-TestH5T.ext > JUnit-TestH5T.out @@ -624,7 +624,7 @@ TESTING JUnit-TestH5Dparams # 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/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-TestH5Dparams.ext > JUnit-TestH5Dparams.out @@ -645,7 +645,7 @@ TESTING JUnit-TestH5D # 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/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-TestH5D.ext > JUnit-TestH5D.out @@ -666,7 +666,7 @@ TESTING JUnit-TestH5Dplist # 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/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-TestH5Dplist.ext > JUnit-TestH5Dplist.out @@ -687,7 +687,7 @@ TESTING JUnit-TestH5Lparams # 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/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-TestH5Lparams.ext > JUnit-TestH5Lparams.out @@ -708,7 +708,7 @@ TESTING JUnit-TestH5Lbasic # 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/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-TestH5Lbasic.ext > JUnit-TestH5Lbasic.out @@ -729,7 +729,7 @@ TESTING JUnit-TestH5Lcreate # 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/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-TestH5Lcreate.ext > JUnit-TestH5Lcreate.out @@ -750,7 +750,7 @@ TESTING JUnit-TestH5R # 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/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-TestH5R.ext > JUnit-TestH5R.out @@ -771,7 +771,7 @@ TESTING JUnit-TestH5P # 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/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-TestH5P.ext > JUnit-TestH5P.out @@ -792,7 +792,7 @@ TESTING JUnit-TestH5PData # 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/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-TestH5PData.ext > JUnit-TestH5PData.out @@ -813,7 +813,7 @@ TESTING JUnit-TestH5Pfapl # 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/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-TestH5Pfapl.ext > JUnit-TestH5Pfapl.out @@ -834,7 +834,7 @@ TESTING JUnit-TestH5Pvirtual # 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/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-TestH5Pvirtual.ext > JUnit-TestH5Pvirtual.out @@ -855,7 +855,7 @@ TESTING JUnit-TestH5Plist # 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/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-TestH5Plist.ext > JUnit-TestH5Plist.out @@ -876,7 +876,7 @@ TESTING JUnit-TestH5A # 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/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-TestH5A.ext > JUnit-TestH5A.out @@ -897,7 +897,7 @@ TESTING JUnit-TestH5Oparams # 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/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-TestH5Oparams.ext > JUnit-TestH5Oparams.out @@ -918,7 +918,7 @@ TESTING JUnit-TestH5Obasic # 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/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-TestH5Obasic.ext > JUnit-TestH5Obasic.out @@ -939,7 +939,7 @@ TESTING JUnit-TestH5Ocreate # 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/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-TestH5Ocreate.ext > JUnit-TestH5Ocreate.out @@ -960,7 +960,7 @@ TESTING JUnit-TestH5Ocopy # 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/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-TestH5Ocopy.ext > JUnit-TestH5Ocopy.out @@ -981,7 +981,7 @@ TESTING JUnit-TestH5PL # 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/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-TestH5PL.ext > JUnit-TestH5PL.out @@ -1002,7 +1002,7 @@ TESTING JUnit-TestH5VL # 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/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-TestH5VL.ext > JUnit-TestH5VL.out @@ -1023,7 +1023,7 @@ TESTING JUnit-TestH5Z # 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/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-TestH5Z.ext > JUnit-TestH5Z.out @@ -1044,7 +1044,7 @@ TESTING JUnit-TestH5E # 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/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 @@ -1065,7 +1065,7 @@ TESTING JUnit-TestH5Edefault # 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/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 @@ -1087,7 +1087,7 @@ if test $USE_FILTER_SZIP = "yes"; then # 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/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-TestH5Giterate.ext > JUnit-TestH5Giterate.out @@ -1109,7 +1109,7 @@ if test "X$ROS3_VFD" = "Xyes"; then # 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/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-TestH5Pfapls3.ext > JUnit-TestH5Pfapls3.out @@ -1131,7 +1131,7 @@ if test "X$HAVE_LIBHDFS" = "Xyes"; then # 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/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-TestH5Pfaplhdfs.ext > JUnit-TestH5Pfaplhdfs.out diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt index b282a91..4bab633 100644 --- a/java/test/testfiles/JUnit-TestH5.txt +++ b/java/test/testfiles/JUnit-TestH5.txt @@ -1,6 +1,7 @@ JUnit version 4.11 .testH5get_libversion_null_param .testJ2C +.testH5export_dataset .testIsSerializable .testH5garbage_collect .testH5error_off @@ -12,5 +13,5 @@ JUnit version 4.11 Time: XXXX -OK (10 tests) +OK (11 tests) diff --git a/java/test/testfiles/JUnit-TestH5Dparams.txt b/java/test/testfiles/JUnit-TestH5Dparams.txt index 9751be4..9acedd7 100644 --- a/java/test/testfiles/JUnit-TestH5Dparams.txt +++ b/java/test/testfiles/JUnit-TestH5Dparams.txt @@ -7,11 +7,9 @@ JUnit version 4.11 .testH5Dvlen_get_buf_size_invalid .testH5Dcreate_null .testH5Dset_extent_status_null -.testH5Dvlen_reclaim_null .testH5Dcreate_invalid .testH5Dcreate_anon_invalid .testH5Dset_extent_status_invalid -.testH5Dvlen_reclaim_invalid .testH5Dopen_invalid .testH5Dclose_invalid .testH5Dflush_invalid @@ -22,5 +20,5 @@ JUnit version 4.11 Time: XXXX -OK (20 tests) +OK (18 tests) diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 48c6254..bb43c64 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -1,10 +1,8 @@ JUnit version 4.11 -.testH5EprintInt .testH5Eset_current_stack_invalid_stkid .testH5Eset_current_stack .testH5Eget_num .testH5Eclear -.testH5Eprint .testH5Epush_null_name .testH5Eget_num_with_msg .testH5Eclear2_with_msg @@ -30,49 +28,5 @@ JUnit version 4.11 Time: XXXX -OK (28 tests) +OK (26 tests) -HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibility - minor: Unable to open file - #001: (file name) line (number) in H5VL_file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #002: (file name) line (number) in H5VL__file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #003: (file name) line (number) in H5VL__native_file_open(): unable to open file - major: File accessibility - minor: Unable to open file - #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 - major: File accessibility - minor: Unable to open file - #005: (file name) line (number) in H5FD_open(): open failed - major: Virtual File Layer - minor: Unable to initialize object - #006: (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 -HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Fopen(): unable to open file - major: File accessibility - minor: Unable to open file - #001: (file name) line (number) in H5VL_file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #002: (file name) line (number) in H5VL__file_open(): open failed - major: Virtual Object Layer - minor: Can't open object - #003: (file name) line (number) in H5VL__native_file_open(): unable to open file - major: File accessibility - minor: Unable to open file - #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 - major: File accessibility - minor: Unable to open file - #005: (file name) line (number) in H5FD_open(): open failed - major: Virtual File Layer - minor: Unable to initialize object - #006: (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 diff --git a/java/test/testfiles/JUnit-TestH5Obasic.txt b/java/test/testfiles/JUnit-TestH5Obasic.txt index d015bdd..c39c01d 100644 --- a/java/test/testfiles/JUnit-TestH5Obasic.txt +++ b/java/test/testfiles/JUnit-TestH5Obasic.txt @@ -1,29 +1,45 @@ JUnit version 4.11 .testH5Oexists_by_name +.testH5Oget_native_info_dataset +.testH5Oopen_by_token .testH5Oget_info_by_idx_n0 .testH5Oget_info_by_idx_n3 +.testH5Oget_native_info_datatype .testH5Oget_info_by_name_not_exist_name .testH5Ovisit_by_name +.testH5Oget_native_info_by_name_datatype .testH5Oget_info_by_idx_name_not_exist_name .testH5Oget_info_datatype .testH5Oget_info_by_idx_not_exist_name .testH5Oopen_by_idx_n0 .testH5Oopen_by_idx_n3 +.testH5Oget_native_info_by_name_not_exist_name .testH5Oopen_not_exists .testH5Ovisit .testH5Oget_info_by_idx_not_exist_create +.testH5Oget_native_info_by_idx_not_exist_name .testH5Oget_info_by_name_hardlink .testH5Oget_info_by_name_group -.testH5Oopen_by_addr .testH5Oget_info_by_name_not_exists +.testH5Oget_native_info_by_idx_not_exist_create .testH5Oget_info_by_name_dataset .testH5Oget_info_group +.testH5Oget_native_info_hardlink +.testH5Oget_native_info_by_name_hardlink +.testH5Oget_native_info_by_idx_name_not_exist_name .testH5Oget_info_by_name_datatype .testH5Oget_info_hardlink +.testH5Oget_native_info_group +.testH5Oget_native_info_by_name_not_exists +.testH5Oget_native_info_by_name_dataset .testH5Oget_info_by_idx_name_not_exist_create +.testH5Oget_native_info_by_idx_n0 +.testH5Oget_native_info_by_idx_n3 .testH5Oget_info_dataset +.testH5Oget_native_info_by_name_group +.testH5Oget_native_info_by_idx_name_not_exist_create Time: XXXX -OK (23 tests) +OK (39 tests) diff --git a/java/test/testfiles/JUnit-TestH5Oparams.txt b/java/test/testfiles/JUnit-TestH5Oparams.txt index bc23695..b756bcf 100644 --- a/java/test/testfiles/JUnit-TestH5Oparams.txt +++ b/java/test/testfiles/JUnit-TestH5Oparams.txt @@ -1,22 +1,27 @@ JUnit version 4.11 .testH5Oget_comment_by_name_null +.testH5Oget_native_info_by_name_invalid .testH5Ovisit_by_name_nullname .testH5Oget_info_invalid .testH5Ovisit_by_name_null .testH5Odisable_mdc_flushes .testH5Oget_comment_invalid +.testH5Oget_native_info_invalid .testH5Oset_comment_by_name_invalid .testH5Oare_mdc_flushes_disabled .testH5Oopen_null .testH5Oclose_invalid .testH5Oflush_invalid +.testH5Oget_native_info_by_name_null .testH5Oget_comment_by_name_invalid .testH5Orefresh_invalid .testH5Ocopy_null_dest +.testH5Oget_native_info_by_idx_null .testH5Olink_invalid .testH5Oget_info_by_idx_invalid .testH5Oget_info_by_idx_null .testH5Olink_null_dest +.testH5Oget_native_info_by_idx_invalid .testH5Oget_info_by_name_invalid .testH5Oget_info_by_name_null .testH5Ocopy_invalid @@ -29,5 +34,5 @@ JUnit version 4.11 Time: XXXX -OK (27 tests) +OK (32 tests) diff --git a/java/test/testfiles/JUnit-TestH5R.txt b/java/test/testfiles/JUnit-TestH5R.txt index 150df54..a96fbb4 100644 --- a/java/test/testfiles/JUnit-TestH5R.txt +++ b/java/test/testfiles/JUnit-TestH5R.txt @@ -1,23 +1,28 @@ JUnit version 4.11 -.testH5Rgetregion_Nullreference -.testH5Rget_obj_type2_Invalidreftype -.testH5Rdereference -.testH5Rget_name -.testH5Rcreate_Invalidreftype -.testH5Rget_name_NULLreference -.testH5Rget_region -.testH5Rdereference_Nullreference -.testH5Rcreate_refobj -.testH5Rcreate_Invalidspace_id -.testH5Rdereference_Invalidreference -.testH5Rgetregion_Badreferencetype -.testH5Rcreate_regionrefobj -.testH5Rget_name_Invalidreftype -.testH5Rgetregion_Invalidreftype -.testH5Rget_obj_type2 -.testH5Rcreate_InvalidObjectName +.testH5Ropen_attr_Nullref +.testH5Rget_attr_name_Nullref +.testH5Ropen_region_Nullref +.testH5Requal_Nullref1 +.testH5Requal_Nullref2 +.testH5Rget_object +.testH5Rget_obj_type3_Nullref +.testH5Ropen_object_Nullref +.testH5Rdestroy_Nullref +.testH5Rcreate_object_Nullname +.testH5Rget_obj_type3 +.testH5Rget_name_Invalidloc +.testH5Rcopy_Nullref1 +.testH5Rcreate_attr_Invalidloc +.testH5Rget_file_name_Nullref +.testH5Rget_obj_name_Nullref +.testH5Rcreate_region_Nullname +.testH5Rcreate_regionref_object +.testH5Rcreate_attr_Nullattrname +.testH5Rcreate_region_Invalidloc +.testH5Rget_type_Nullref +.testH5Rcreate_attr_Nullname Time: XXXX -OK (17 tests) +OK (22 tests) diff --git a/java/test/testfiles/JUnit-TestH5Tparams.txt b/java/test/testfiles/JUnit-TestH5Tparams.txt index e61f1e4..9f725ac 100644 --- a/java/test/testfiles/JUnit-TestH5Tparams.txt +++ b/java/test/testfiles/JUnit-TestH5Tparams.txt @@ -1,5 +1,6 @@ JUnit version 4.11 .testH5Tget_member_type_invalid +.testH5Treclaim_invalid .testH5Tenum_insert_null .testH5Tget_offset_invalid .testH5Tset_precision_invalid @@ -68,9 +69,10 @@ JUnit version 4.11 .testH5Tget_member_index_null .testH5Trefresh_invalid .testH5Tset_sign_invalid +.testH5Treclaim_null .testH5Tenum_insert_name_null Time: XXXX -OK (70 tests) +OK (72 tests) diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt index caadf26..ff94969 100644 --- a/java/test/testfiles/JUnit-TestH5VL.txt +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -1,4 +1,6 @@ JUnit version 4.11 +.testH5VLget_connector_id_by_name +.testH5VLget_connector_id_by_value .testH5VLget_connector_id .testH5VLnative_init .testH5VLget_connector_name @@ -7,5 +9,5 @@ JUnit version 4.11 Time: XXXX -OK (5 tests) +OK (7 tests) |