summaryrefslogtreecommitdiffstats
path: root/java/test/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-05-15 23:12:19 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-05-15 23:12:19 (GMT)
commit427ac6041a5f7a705e3811c5da4ad83bb39b535d (patch)
tree0a363ca36e203b3849383097903b9ec8109788d0 /java/test/CMakeLists.txt
parent37c27afde06c02416b6cc8bf518fea534aef0af6 (diff)
downloadhdf5-427ac6041a5f7a705e3811c5da4ad83bb39b535d.zip
hdf5-427ac6041a5f7a705e3811c5da4ad83bb39b535d.tar.gz
hdf5-427ac6041a5f7a705e3811c5da4ad83bb39b535d.tar.bz2
HDFFV-9739 factor out tests into separate JUnit
Diffstat (limited to 'java/test/CMakeLists.txt')
-rw-r--r--java/test/CMakeLists.txt192
1 files changed, 76 insertions, 116 deletions
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index 5cded3b..ac6c005 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -6,93 +6,71 @@ set (CMAKE_VERBOSE_MAKEFILE 1)
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_JAVA_JNI_BINARY_DIR};${HDF5_JAVA_HDF5_LIB_DIR}")
set (HDF5_JAVA_TEST_SOURCES
- TestH5.java
- TestH5Eparams.java
- TestH5Eregister.java
- TestH5Fparams.java
- TestH5Fbasic.java
- TestH5F.java
- TestH5Fswmr.java
- TestH5Gbasic.java
- TestH5G.java
- TestH5Sbasic.java
- TestH5S.java
- TestH5Tparams.java
- TestH5Tbasic.java
- TestH5T.java
- TestH5Dparams.java
- TestH5D.java
- TestH5Dplist.java
- TestH5Lparams.java
- TestH5Lbasic.java
- TestH5Lcreate.java
- TestH5R.java
- TestH5P.java
- TestH5PData.java
- TestH5Pfapl.java
- TestH5Pvirtual.java
- TestH5Plist.java
- TestH5A.java
- TestH5Oparams.java
- TestH5Obasic.java
- TestH5Ocreate.java
- TestH5Ocopy.java
- TestH5PL.java
- TestH5Z.java
+ TestH5
+ TestH5Eparams
+ TestH5Eregister
+ TestH5Fparams
+ TestH5Fbasic
+ TestH5F
+ TestH5Fswmr
+ TestH5Gbasic
+ TestH5G
+ TestH5Sbasic
+ TestH5S
+ TestH5Tparams
+ TestH5Tbasic
+ TestH5T
+ TestH5Dparams
+ TestH5D
+ TestH5Dplist
+ TestH5Lparams
+ TestH5Lbasic
+ TestH5Lcreate
+ TestH5R
+ TestH5P
+ TestH5PData
+ TestH5Pfapl
+ TestH5Pvirtual
+ TestH5Plist
+ TestH5A
+ TestH5Oparams
+ TestH5Obasic
+ TestH5Ocreate
+ TestH5Ocopy
+ TestH5PL
+ TestH5Z
)
-if (HDF5_ENABLE_DEBUG_APIS)
+if (NOT HDF5_ENABLE_DEBUG_APIS)
set (HDF5_JAVA_TEST_SOURCES
${HDF5_JAVA_TEST_SOURCES}
- TestUnit.java
- )
-
- file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt
- "Main-Class: test.TestUnit
-"
- )
-else ()
- set (HDF5_JAVA_TEST_SOURCES
- ${HDF5_JAVA_TEST_SOURCES}
- TestH5E.java
- TestH5Edefault.java
- TestH5Giterate.java
- TestAll.java
- )
-
- file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt
- "Main-Class: test.TestAll
-"
+ TestH5E
+ TestH5Edefault
+ TestH5Giterate
)
endif ()
set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_LIB_DIR}/junit.jar;${HDF5_JAVA_LIB_DIR}/hamcrest-core.jar;${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_SIMPLE_JAR}")
-add_jar (${HDF5_JAVA_TEST_LIB_TARGET} MANIFEST ${PROJECT_BINARY_DIR}/Manifest.txt ${HDF5_JAVA_TEST_SOURCES})
+foreach (test_file ${HDF5_JAVA_TEST_SOURCES})
-get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE ${HDF5_JAVA_TEST_LIB_TARGET} JAR_FILE)
-#install_jar (${HDF5_JAVA_TEST_LIB_TARGET} ${HJAVA_INSTALL_DATA_DIR}/tests tests)
-#get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_CLASSPATH ${HDF5_JAVA_TEST_LIB_TARGET} CLASSDIR)
+ file (WRITE ${PROJECT_BINARY_DIR}/${test_file}Manifest.txt
+ "Main-Class: test.${test_file}
+"
+ )
-add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET} ${HDF5_JAVA_HDF5_LIB_TARGET})
-set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET} PROPERTIES FOLDER test/java)
+ add_jar (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} MANIFEST ${PROJECT_BINARY_DIR}/${test_file}Manifest.txt ${test_file}.java)
-if (HDF5_ENABLE_DEBUG_APIS)
- set (HDF_JAVA_TEST_FILES
- JUnit-unit.txt
- JUnit-interface.ert
- )
- set (testfilter "OK (608 tests)")
-else ()
- set (HDF_JAVA_TEST_FILES
- JUnit-interface.txt
- JUnit-interface.ert
- )
- set (testfilter "OK (645 tests)")
-endif ()
+ get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE ${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} JAR_FILE)
+ #install_jar (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} ${HJAVA_INSTALL_DATA_DIR}/tests tests)
+ #get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_CLASSPATH ${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} CLASSDIR)
+
+ add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} ${HDF5_JAVA_HDF5_LIB_TARGET})
+ set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} PROPERTIES FOLDER test/java)
+endforeach ()
-foreach (h5_file ${HDF_JAVA_TEST_FILES})
- HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+foreach (h5_file ${HDF5_JAVA_TEST_SOURCES})
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/JUnit-${h5_file}.txt" "${PROJECT_BINARY_DIR}/${h5_file}.txt" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
endforeach ()
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterate.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
@@ -104,62 +82,44 @@ else ()
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
endif ()
-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}_JAR_FILE}")
-
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<TARGET_PROPERTY:${HDF5_JAVA_JNI_LIB_TARGET},OUTPUT_NAME$<$<CONFIG:Debug>:_DEBUG>>;")
-add_test (
- NAME JUnit-interface-clearall-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- JUnit-interface.out
- JUnit-interface.out.err
-)
+set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<TARGET_PROPERTY:${HDF5_JAVA_JNI_LIB_TARGET},OUTPUT_NAME$<$<CONFIG:Debug>:_DEBUG>>;")
+
+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}")
-if (HDF5_ENABLE_DEBUG_APIS)
add_test (
- NAME JUnit-interface
- 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.TestUnit"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test"
- -D "TEST_OUTPUT=JUnit-interface.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-unit.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ NAME JUnit-${test_file}-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ JUnit-${test_file}.out
+ JUnit-${test_file}.out.err
)
-else ()
add_test (
- NAME JUnit-interface
+ 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.TestAll"
+ -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-interface.out"
+ -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-interface.txt"
+# -D "TEST_FILTER:STRING=${testfilter}"
+ -D "TEST_REFERENCE=JUnit-${test_file}.txt"
-P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
)
-endif ()
-set_tests_properties (JUnit-interface PROPERTIES
- ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2"
- DEPENDS "JUnit-interface-clearall-objects"
-)
+ set_tests_properties (JUnit-${test_file} PROPERTIES
+ ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2"
+ DEPENDS "JUnit-${test_file}-clearall-objects"
+ )
+endforeach ()