diff options
Diffstat (limited to 'java/test')
-rw-r--r-- | java/test/CMakeLists.txt | 79 | ||||
-rw-r--r-- | java/test/Makefile.am | 5 | ||||
-rw-r--r-- | java/test/TestH5VL.java | 26 | ||||
-rw-r--r-- | java/test/testfiles/JUnit-TestH5VL.txt | 3 |
4 files changed, 107 insertions, 6 deletions
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index de7dc62..6275227 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -142,4 +142,83 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL) 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/TestH5VL.java b/java/test/TestH5VL.java index d774dbb..bd660d3 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -55,15 +55,18 @@ 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); } } @@ -113,6 +116,19 @@ public class TestH5VL { } @Test + public void testH5VLget_connector_id_by_value() { + try { + 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_by_value " + err); + } + } + + @Test public void testH5VLget_connector_name() { String H5_FILE = "testFvl.h5"; diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt index f646009..ff94969 100644 --- a/java/test/testfiles/JUnit-TestH5VL.txt +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -1,5 +1,6 @@ JUnit version 4.11 .testH5VLget_connector_id_by_name +.testH5VLget_connector_id_by_value .testH5VLget_connector_id .testH5VLnative_init .testH5VLget_connector_name @@ -8,5 +9,5 @@ JUnit version 4.11 Time: XXXX -OK (6 tests) +OK (7 tests) |