From e3e24a298967e40adc79a4ed37c8d9f5695bfbba Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 3 Dec 2018 09:35:59 -0600 Subject: HDFFV-10632 - split stderr and stdout in cmake --- MANIFEST | 50 ++++--- config/cmake/jrunTest.cmake | 93 ++++++------- config/cmake/vfdTest.cmake | 6 +- config/cmake_ext_mod/runTest.cmake | 144 ++++++++++++--------- hl/tools/h5watch/CMakeTests.cmake | 59 ++++++--- hl/tools/testfiles/w-err-cmpd1.ddl | 2 - hl/tools/testfiles/w-err-cmpd1.err | 1 + hl/tools/testfiles/w-err-cmpd2.ddl | 2 - hl/tools/testfiles/w-err-cmpd2.err | 1 + hl/tools/testfiles/w-err-cmpd3.ddl | 2 - hl/tools/testfiles/w-err-cmpd3.err | 1 + hl/tools/testfiles/w-err-cmpd4.ddl | 2 - hl/tools/testfiles/w-err-cmpd4.err | 1 + hl/tools/testfiles/w-err-cmpd5.ddl | 2 - hl/tools/testfiles/w-err-cmpd5.err | 1 + hl/tools/testfiles/w-err-dset-nomax.ddl | 2 - hl/tools/testfiles/w-err-dset-nomax.err | 1 + hl/tools/testfiles/w-err-dset-none.ddl | 2 - hl/tools/testfiles/w-err-dset-none.err | 1 + hl/tools/testfiles/w-err-dset1.ddl | 2 - hl/tools/testfiles/w-err-dset1.err | 1 + hl/tools/testfiles/w-err-dset2.ddl | 2 - hl/tools/testfiles/w-err-dset2.err | 1 + hl/tools/testfiles/w-err-file.ddl | 1 - hl/tools/testfiles/w-err-file.err | 1 + hl/tools/testfiles/w-err-std.ddl | 2 + test/CMakeTests.cmake | 4 + tools/test/h5copy/CMakeTests.cmake | 2 + tools/test/h5copy/testfiles/h5copy_misc1.err | 1 + tools/test/h5copy/testfiles/h5copy_misc1.out | 1 - tools/test/h5diff/CMakeTests.cmake | 1 + tools/test/h5diff/testfiles/h5diff_454_ERR.txt | 4 - tools/test/h5diff/testfiles/h5diff_455_ERR.txt | 4 - tools/test/h5diff/testfiles/h5diff_457_ERR.txt | 4 - tools/test/h5diff/testfiles/h5diff_458_ERR.txt | 4 - tools/test/h5diff/testfiles/h5diff_459_ERR.txt | 4 - tools/test/h5diff/testfiles/h5diff_600.txt | 1 - tools/test/h5diff/testfiles/h5diff_601_ERR.txt | 4 - tools/test/h5diff/testfiles/h5diff_udfail.err | 12 ++ tools/test/h5diff/testfiles/h5diff_udfail.txt | 1 - tools/test/h5format_convert/CMakeTests.cmake | 60 +++++++-- .../h5format_convert/testfiles/h5fc_d_file-d.ddl | 25 ++++ .../h5format_convert/testfiles/h5fc_d_file.ddl | 1 - .../h5format_convert/testfiles/h5fc_d_file.ddl.err | 1 + .../test/h5format_convert/testfiles/h5fc_dname.ddl | 1 - .../test/h5format_convert/testfiles/h5fc_dname.err | 1 + .../testfiles/h5fc_nonexistdset_file.ddl | 1 - .../testfiles/h5fc_nonexistdset_file.ddl.err | 1 + .../testfiles/h5fc_nonexistfile.ddl | 1 - .../testfiles/h5fc_nonexistfile.ddl.err | 1 + .../testfiles/h5fc_nonexistfile.err | 1 + tools/test/h5jam/CMakeTests.cmake | 2 + tools/test/h5ls/CMakeTests.cmake | 52 +++++++- tools/test/h5ls/errfiles/nosuchfile.err | 1 + .../test/h5ls/errfiles/textlinksrc-nodangle-1.err | 2 + tools/test/h5ls/errfiles/tgroup-1.err | 2 + tools/test/h5repack/CMakeTests.cmake | 2 +- tools/test/h5stat/CMakeTests.cmake | 63 +++++++-- tools/test/h5stat/testfiles/h5stat_err1_dims.ddl | 1 - tools/test/h5stat/testfiles/h5stat_err1_dims.err | 1 + tools/test/h5stat/testfiles/h5stat_err1_links.ddl | 1 - tools/test/h5stat/testfiles/h5stat_err1_links.err | 1 + .../test/h5stat/testfiles/h5stat_err1_numattrs.ddl | 1 - .../test/h5stat/testfiles/h5stat_err1_numattrs.err | 1 + .../test/h5stat/testfiles/h5stat_err2_numattrs.ddl | 1 - .../test/h5stat/testfiles/h5stat_err2_numattrs.err | 1 + .../test/h5stat/testfiles/h5stat_err_old_fill.ddl | 1 - .../test/h5stat/testfiles/h5stat_err_old_fill.err | 1 + .../h5stat/testfiles/h5stat_err_old_layout.ddl | 1 - .../h5stat/testfiles/h5stat_err_old_layout.err | 1 + .../test/h5stat/testfiles/h5stat_err_refcount.ddl | 1 - .../test/h5stat/testfiles/h5stat_err_refcount.err | 1 + tools/test/h5stat/testfiles/h5stat_nofile.ddl | 1 - tools/test/h5stat/testfiles/h5stat_nofile.err | 1 + tools/test/h5stat/testfiles/h5stat_notexist.ddl | 1 - tools/test/h5stat/testfiles/h5stat_notexist.err | 1 + tools/test/misc/CMakeTestsClear.cmake | 87 +++++++++++-- tools/test/misc/testfiles/h5clear_missing_file.ddl | 1 - tools/test/misc/testfiles/h5clear_missing_file.err | 23 ++++ tools/test/misc/testfiles/h5clear_no_mdc_image.ddl | 1 - tools/test/misc/testfiles/h5clear_no_mdc_image.err | 1 + tools/test/misc/testfiles/h5clear_open_fail.ddl | 1 - tools/test/misc/testfiles/h5clear_open_fail.err | 1 + tools/testfiles/err_attr_dspace.ddl | 1 - tools/testfiles/non_existing.ddl | 1 - tools/testfiles/nosuchfile.ls | 1 - .../pbits/tnofilename-with-packed-bits.ddl | 1 - tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsIncomplete.ddl | 1 - tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsLengthPositive.ddl | 1 - tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 1 - tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 1 - tools/testfiles/texceedsubblock.ddl | 1 - tools/testfiles/texceedsubcount.ddl | 1 - tools/testfiles/texceedsubstart.ddl | 1 - tools/testfiles/texceedsubstride.ddl | 1 - tools/testfiles/textlinksrc-nodangle-1.ls | 2 - tools/testfiles/tgroup-1.ls | 2 - tools/testfiles/tstarfile.ddl | 1 - 106 files changed, 539 insertions(+), 267 deletions(-) delete mode 100644 hl/tools/testfiles/w-err-cmpd1.ddl create mode 100644 hl/tools/testfiles/w-err-cmpd1.err delete mode 100644 hl/tools/testfiles/w-err-cmpd2.ddl create mode 100644 hl/tools/testfiles/w-err-cmpd2.err delete mode 100644 hl/tools/testfiles/w-err-cmpd3.ddl create mode 100644 hl/tools/testfiles/w-err-cmpd3.err delete mode 100644 hl/tools/testfiles/w-err-cmpd4.ddl create mode 100644 hl/tools/testfiles/w-err-cmpd4.err delete mode 100644 hl/tools/testfiles/w-err-cmpd5.ddl create mode 100644 hl/tools/testfiles/w-err-cmpd5.err delete mode 100644 hl/tools/testfiles/w-err-dset-nomax.ddl create mode 100644 hl/tools/testfiles/w-err-dset-nomax.err delete mode 100644 hl/tools/testfiles/w-err-dset-none.ddl create mode 100644 hl/tools/testfiles/w-err-dset-none.err delete mode 100644 hl/tools/testfiles/w-err-dset1.ddl create mode 100644 hl/tools/testfiles/w-err-dset1.err delete mode 100644 hl/tools/testfiles/w-err-dset2.ddl create mode 100644 hl/tools/testfiles/w-err-dset2.err delete mode 100644 hl/tools/testfiles/w-err-file.ddl create mode 100644 hl/tools/testfiles/w-err-file.err create mode 100644 hl/tools/testfiles/w-err-std.ddl create mode 100644 tools/test/h5copy/testfiles/h5copy_misc1.err create mode 100644 tools/test/h5diff/testfiles/h5diff_udfail.err create mode 100644 tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl create mode 100644 tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err create mode 100644 tools/test/h5format_convert/testfiles/h5fc_dname.err delete mode 100644 tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl create mode 100644 tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err delete mode 100644 tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl create mode 100644 tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err create mode 100644 tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err create mode 100644 tools/test/h5ls/errfiles/nosuchfile.err create mode 100644 tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err create mode 100644 tools/test/h5ls/errfiles/tgroup-1.err delete mode 100644 tools/test/h5stat/testfiles/h5stat_err1_dims.ddl create mode 100644 tools/test/h5stat/testfiles/h5stat_err1_dims.err delete mode 100644 tools/test/h5stat/testfiles/h5stat_err1_links.ddl create mode 100644 tools/test/h5stat/testfiles/h5stat_err1_links.err delete mode 100644 tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl create mode 100644 tools/test/h5stat/testfiles/h5stat_err1_numattrs.err delete mode 100644 tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl create mode 100644 tools/test/h5stat/testfiles/h5stat_err2_numattrs.err create mode 100644 tools/test/h5stat/testfiles/h5stat_err_old_fill.err create mode 100644 tools/test/h5stat/testfiles/h5stat_err_old_layout.err create mode 100644 tools/test/h5stat/testfiles/h5stat_err_refcount.err create mode 100644 tools/test/h5stat/testfiles/h5stat_nofile.err create mode 100644 tools/test/h5stat/testfiles/h5stat_notexist.err create mode 100644 tools/test/misc/testfiles/h5clear_missing_file.err delete mode 100644 tools/test/misc/testfiles/h5clear_no_mdc_image.ddl create mode 100644 tools/test/misc/testfiles/h5clear_no_mdc_image.err delete mode 100644 tools/test/misc/testfiles/h5clear_open_fail.ddl create mode 100644 tools/test/misc/testfiles/h5clear_open_fail.err diff --git a/MANIFEST b/MANIFEST index 95d8b39..889dd2e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1388,14 +1388,15 @@ ./tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err ./tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl ./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl +./tools/test/h5format_convert/testfiles/h5fc_d_file.err ./tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl ./tools/test/h5format_convert/testfiles/h5fc_dname.ddl -./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl +./tools/test/h5format_convert/testfiles/h5fc_dname.err +./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err ./tools/test/h5format_convert/testfiles/h5fc_help.ddl ./tools/test/h5format_convert/testfiles/h5fc_v_all.ddl ./tools/test/h5format_convert/testfiles/h5fc_nooption.ddl ./tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl -./tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl ./tools/test/h5format_convert/testfiles/h5fc_non_v3.h5 ./tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5 ./tools/test/h5format_convert/testfiles/h5fc_err_level.h5 @@ -1465,6 +1466,11 @@ ./tools/test/h5ls/vds_prefix/tvds-4.ls ./tools/test/h5ls/vds_prefix/tvds-5.ls +# h5ls test error files +./tools/test/h5ls/errfiles/nosuchfile.err +./tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err +./tools/test/h5ls/errfiles/tgroup-1.err + # h5copy sources ./tools/src/h5copy/Makefile.am ./tools/src/h5copy/h5copy.c @@ -1522,8 +1528,8 @@ ./tools/test/misc/testfiles/h5clear_missing_file.ddl ./tools/test/misc/testfiles/h5clear_noclose_after_size.ddl ./tools/test/misc/testfiles/h5clear_noclose_before_size.ddl -./tools/test/misc/testfiles/h5clear_no_mdc_image.ddl -./tools/test/misc/testfiles/h5clear_open_fail.ddl +./tools/test/misc/testfiles/h5clear_no_mdc_image.err +./tools/test/misc/testfiles/h5clear_open_fail.err ./tools/test/misc/testfiles/h5clear_status_noclose_after_size.ddl ./tools/test/misc/testfiles/h5clear_usage.ddl ./tools/test/misc/testfiles/h5clear_user_equal_after_size.ddl @@ -1577,10 +1583,6 @@ ./tools/test/h5stat/testh5stat.sh.in ./tools/test/h5stat/testfiles/h5stat_dims1.ddl ./tools/test/h5stat/testfiles/h5stat_dims2.ddl -./tools/test/h5stat/testfiles/h5stat_err1_dims.ddl -./tools/test/h5stat/testfiles/h5stat_err1_links.ddl -./tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl -./tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl ./tools/test/h5stat/testfiles/h5stat_err_old_fill.h5 ./tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl ./tools/test/h5stat/testfiles/h5stat_err_old_layout.h5 @@ -1618,6 +1620,15 @@ ./tools/test/h5stat/testfiles/h5stat_threshold.h5 ./tools/test/h5stat/testfiles/h5stat_tsohm.ddl ./tools/test/h5stat/testfiles/h5stat_tsohm.h5 +./tools/test/h5stat/testfiles/h5stat_err_refcount.err +./tools/test/h5stat/testfiles/h5stat_err_old_layout.err +./tools/test/h5stat/testfiles/h5stat_err_old_fill.err +./tools/test/h5stat/testfiles/h5stat_err1_dims.err +./tools/test/h5stat/testfiles/h5stat_err1_links.err +./tools/test/h5stat/testfiles/h5stat_err1_numattrs.err +./tools/test/h5stat/testfiles/h5stat_err2_numattrs.err +./tools/test/h5stat/testfiles/h5stat_notexist.err +./tools/test/h5stat/testfiles/h5stat_nofile.err # h5dump test files ./tools/testfiles/charsets.h5 @@ -2490,6 +2501,7 @@ ./tools/test/h5diff/testfiles/tudfilter.h5 ./tools/test/h5diff/testfiles/tudfilter2.h5 ./tools/test/h5diff/testfiles/h5diff_ud.txt +./tools/test/h5diff/testfiles/h5diff_udfail.err ./tools/test/h5diff/testfiles/h5diff_udfail.txt ./tools/test/h5diff/testfiles/diff_strings1.h5 ./tools/test/h5diff/testfiles/diff_strings2.h5 @@ -2590,6 +2602,7 @@ ./tools/test/h5copy/testfiles/h5copy_extlinks_src.h5 ./tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5 ./tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls +./tools/test/h5copy/testfiles/h5copy_misc1.err ./tools/test/h5copy/testfiles/h5copy_misc1.out ./tools/test/h5copy/testfiles/h5copytst_new.h5 ./tools/test/h5copy/testfiles/h5copytst_new.out.ls @@ -2758,16 +2771,17 @@ # expected test output from testing h5watch # -./hl/tools/testfiles/w-err-cmpd1.ddl -./hl/tools/testfiles/w-err-cmpd2.ddl -./hl/tools/testfiles/w-err-cmpd3.ddl -./hl/tools/testfiles/w-err-cmpd4.ddl -./hl/tools/testfiles/w-err-cmpd5.ddl -./hl/tools/testfiles/w-err-dset1.ddl -./hl/tools/testfiles/w-err-dset2.ddl -./hl/tools/testfiles/w-err-dset-nomax.ddl -./hl/tools/testfiles/w-err-dset-none.ddl -./hl/tools/testfiles/w-err-file.ddl +./hl/tools/testfiles/w-err-std.ddl +./hl/tools/testfiles/w-err-cmpd1.err +./hl/tools/testfiles/w-err-cmpd2.err +./hl/tools/testfiles/w-err-cmpd3.err +./hl/tools/testfiles/w-err-cmpd4.err +./hl/tools/testfiles/w-err-cmpd5.err +./hl/tools/testfiles/w-err-dset1.err +./hl/tools/testfiles/w-err-dset2.err +./hl/tools/testfiles/w-err-dset-nomax.err +./hl/tools/testfiles/w-err-dset-none.err +./hl/tools/testfiles/w-err-file.err ./hl/tools/testfiles/w-err-poll0.ddl ./hl/tools/testfiles/w-err-poll.ddl ./hl/tools/testfiles/w-err-width.ddl diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index b66f3a8..43aef22 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -32,9 +32,6 @@ endif () if (NOT TEST_CLASSPATH) message (STATUS "Require TEST_CLASSPATH to be defined") endif () -if (NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif () if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) @@ -44,14 +41,6 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () -# if there is not an error reference file add the error output to the stdout file -if (NOT TEST_ERRREF) - if (NOT SKIP_APPEND) - # append error file since skip was not defined - set (ERROR_APPEND 1) - endif () -endif () - if (NOT TEST_LOG_LEVEL) set (LOG_LEVEL "info") else () @@ -131,52 +120,54 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () + if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) + if (WIN32 AND NOT MINGW) + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - if (NOT "${TEST_RESULT}" STREQUAL "0") - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + if (NOT "${TEST_RESULT}" STREQUAL "0") + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () endif () + endforeach () + else () + if ("${len_act}" STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if ("${len_ref}" STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () - endforeach () - else () - if ("${len_act}" STREQUAL "0") - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if ("${len_ref}" STREQUAL "0") - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + if (NOT "${len_act}" STREQUAL "${len_ref}") + set (TEST_RESULT 1) endif () endif () - if (NOT "${len_act}" STREQUAL "${len_ref}") - set (TEST_RESULT 1) - endif () - endif () - message (STATUS "COMPARE Result: ${TEST_RESULT}") + message (STATUS "COMPARE Result: ${TEST_RESULT}") - # again, if return value is !=0 scream and shout - if (NOT "${TEST_RESULT}" STREQUAL "0") - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + # again, if return value is !=0 scream and shout + if (NOT "${TEST_RESULT}" STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + endif () endif () # now compare the .err file with the error reference, if supplied @@ -217,7 +208,7 @@ if (NOT TEST_SKIP_COMPARE) if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () - endif() + endif () if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () @@ -226,7 +217,7 @@ if (NOT TEST_SKIP_COMPARE) message (STATUS "COMPARE Result: ${TEST_RESULT}") # again, if return value is !=0 scream and shout - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") endif () endif () diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 66a97c0..95a4c40 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -32,9 +32,9 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () # if there is not an error reference file add the error output to the stdout file -if (NOT TEST_ERRREF) - set (ERROR_APPEND 1) -endif () +#if (NOT TEST_ERRREF) +# set (ERROR_APPEND 1) +#endif () message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 5569a73..75d0f3b 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -26,9 +26,6 @@ endif () if (NOT TEST_EXPECT) message (STATUS "Require TEST_EXPECT to be defined") endif () -if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif () if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) @@ -38,11 +35,6 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () -# if there is not an error reference file add the error output to the stdout file -if (NOT TEST_ERRREF) - set (ERROR_APPEND 1) -endif () - message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) @@ -96,9 +88,19 @@ endif () message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled -if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + if (TEST_MASK_FILE) + STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") + endif () + + if (NOT ERROR_APPEND) + # append error output to the stdout output file + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + else () + # write back to original .err file + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () endif () # append the test result status with a predefined text @@ -173,63 +175,65 @@ endif () # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () + if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) + if (WIN32 AND NOT MINGW) + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () - if (NOT TEST_SORT_COMPARE) - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) - else () - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) - list (SORT v1) - list (SORT v2) - if (NOT v1 STREQUAL v2) - set(TEST_RESULT 1) + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_RESULT 1) + endif () endif () - endif () - if (NOT "${TEST_RESULT}" STREQUAL "0") - set (TEST_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT "${str_act}" STREQUAL "${str_ref}") - if (NOT "${str_act}" STREQUAL "") - set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + if (NOT "${TEST_RESULT}" STREQUAL "0") + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0") + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () endif () + endforeach () + else () + if ("${len_act}" STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if ("${len_ref}" STREQUAL "0") + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () - endforeach () - else () - if ("${len_act}" STREQUAL "0") - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if ("${len_ref}" STREQUAL "0") - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + if (NOT "${len_act}" STREQUAL "${len_ref}") + set (TEST_RESULT 1) endif () endif () - if (NOT "${len_act}" STREQUAL "${len_ref}") - set (TEST_RESULT 1) - endif () - endif () - message (STATUS "COMPARE Result: ${TEST_RESULT}") + message (STATUS "COMPARE Result: ${TEST_RESULT}") - # again, if return value is !=0 scream and shout - if (NOT "${TEST_RESULT}" STREQUAL "0") - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + # again, if return value is !=0 scream and shout + if (NOT "${TEST_RESULT}" STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + endif () endif () # now compare the .err file with the error reference, if supplied @@ -260,7 +264,7 @@ if (NOT TEST_SKIP_COMPARE) if (NOT "${str_act}" STREQUAL "") set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif () + endif () endif () endforeach () else () @@ -285,5 +289,27 @@ if (NOT TEST_SKIP_COMPARE) endif () endif () +if (TEST_GREP_COMPARE) + # now grep the output with the reference + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) + if ("${TEST_RESULT}" STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif () + + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if ("${TEST_EXPECT}" STREQUAL "1") + # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match + string (LENGTH "${TEST_MATCH}" TEST_RESULT) + if (NOT "${TEST_RESULT}" STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif () + endif () +endif () + # everything went fine... -message ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}") +message ("${TEST_PROGRAM} Passed") + diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index 0b7b4d4..9c18798 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -18,16 +18,16 @@ set (H5WATCH_TEST_FILES w-help1.ddl - w-err-cmpd1.ddl - w-err-cmpd2.ddl - w-err-cmpd3.ddl - w-err-cmpd4.ddl - w-err-cmpd5.ddl - w-err-dset1.ddl - w-err-dset2.ddl - w-err-dset-nomax.ddl - w-err-dset-none.ddl - w-err-file.ddl + w-err-cmpd1.err + w-err-cmpd2.err + w-err-cmpd3.err + w-err-cmpd4.err + w-err-cmpd5.err + w-err-dset1.err + w-err-dset2.err + w-err-dset-nomax.err + w-err-dset-none.err + w-err-file.err w-err-poll.ddl w-err-poll0.ddl w-err-width.ddl @@ -86,6 +86,25 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes endif () endmacro () + macro (ADD_H5_ERR_TEST resultfile resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5WATCH_ARGS-h5watch-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test}) + set (last_test "H5WATCH_ARGS-h5watch-${resultfile}") + endif () + endmacro () + macro (ADD_H5_WATCH resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -162,20 +181,20 @@ if (NOT SWMR_INCOMPAT) ADD_H5_TEST (w-help1 0 --help) # # Tests on expected failures - ADD_H5_TEST (w-err-dset1 1 WATCH.h5) - ADD_H5_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD) - ADD_H5_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE) - ADD_H5_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX) - ADD_H5_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD) + ADD_H5_ERR_TEST (w-err-dset1 1 WATCH.h5) + ADD_H5_ERR_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD) + ADD_H5_ERR_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE) + ADD_H5_ERR_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX) + ADD_H5_ERR_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD) ADD_H5_TEST (w-err-width 1 --width=-8 WATCH.h5/DSET_ONE) ADD_H5_TEST (w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE) ADD_H5_TEST (w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE) # # Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD - ADD_H5_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD) - ADD_H5_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD) - ADD_H5_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD) - ADD_H5_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD) - ADD_H5_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD) + ADD_H5_ERR_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD) + ADD_H5_ERR_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD) + ADD_H5_ERR_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD) + ADD_H5_ERR_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD) + ADD_H5_ERR_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD) # endif () diff --git a/hl/tools/testfiles/w-err-cmpd1.ddl b/hl/tools/testfiles/w-err-cmpd1.ddl deleted file mode 100644 index 775d6a0..0000000 --- a/hl/tools/testfiles/w-err-cmpd1.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd1.err b/hl/tools/testfiles/w-err-cmpd1.err new file mode 100644 index 0000000..9c165fb --- /dev/null +++ b/hl/tools/testfiles/w-err-cmpd1.err @@ -0,0 +1 @@ +h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd2.ddl b/hl/tools/testfiles/w-err-cmpd2.ddl deleted file mode 100644 index 775d6a0..0000000 --- a/hl/tools/testfiles/w-err-cmpd2.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd2.err b/hl/tools/testfiles/w-err-cmpd2.err new file mode 100644 index 0000000..9c165fb --- /dev/null +++ b/hl/tools/testfiles/w-err-cmpd2.err @@ -0,0 +1 @@ +h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd3.ddl b/hl/tools/testfiles/w-err-cmpd3.ddl deleted file mode 100644 index 775d6a0..0000000 --- a/hl/tools/testfiles/w-err-cmpd3.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd3.err b/hl/tools/testfiles/w-err-cmpd3.err new file mode 100644 index 0000000..9c165fb --- /dev/null +++ b/hl/tools/testfiles/w-err-cmpd3.err @@ -0,0 +1 @@ +h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd4.ddl b/hl/tools/testfiles/w-err-cmpd4.ddl deleted file mode 100644 index 775d6a0..0000000 --- a/hl/tools/testfiles/w-err-cmpd4.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd4.err b/hl/tools/testfiles/w-err-cmpd4.err new file mode 100644 index 0000000..9c165fb --- /dev/null +++ b/hl/tools/testfiles/w-err-cmpd4.err @@ -0,0 +1 @@ +h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd5.ddl b/hl/tools/testfiles/w-err-cmpd5.ddl deleted file mode 100644 index 775d6a0..0000000 --- a/hl/tools/testfiles/w-err-cmpd5.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-cmpd5.err b/hl/tools/testfiles/w-err-cmpd5.err new file mode 100644 index 0000000..9c165fb --- /dev/null +++ b/hl/tools/testfiles/w-err-cmpd5.err @@ -0,0 +1 @@ +h5watch error: error in processing diff --git a/hl/tools/testfiles/w-err-dset-nomax.ddl b/hl/tools/testfiles/w-err-dset-nomax.ddl deleted file mode 100644 index b99cf84..0000000 --- a/hl/tools/testfiles/w-err-dset-nomax.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: "/DSET_NOMAX" should have unlimited or max. dimension setting diff --git a/hl/tools/testfiles/w-err-dset-nomax.err b/hl/tools/testfiles/w-err-dset-nomax.err new file mode 100644 index 0000000..fd5ca7e --- /dev/null +++ b/hl/tools/testfiles/w-err-dset-nomax.err @@ -0,0 +1 @@ +h5watch error: "/DSET_NOMAX" should have unlimited or max. dimension setting diff --git a/hl/tools/testfiles/w-err-dset-none.ddl b/hl/tools/testfiles/w-err-dset-none.ddl deleted file mode 100644 index cbf6770..0000000 --- a/hl/tools/testfiles/w-err-dset-none.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: "/DSET_NONE" should be a chunked or virtual dataset diff --git a/hl/tools/testfiles/w-err-dset-none.err b/hl/tools/testfiles/w-err-dset-none.err new file mode 100644 index 0000000..db781c3 --- /dev/null +++ b/hl/tools/testfiles/w-err-dset-none.err @@ -0,0 +1 @@ +h5watch error: "/DSET_NONE" should be a chunked or virtual dataset diff --git a/hl/tools/testfiles/w-err-dset1.ddl b/hl/tools/testfiles/w-err-dset1.ddl deleted file mode 100644 index 433c4d6..0000000 --- a/hl/tools/testfiles/w-err-dset1.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: no dataset specified diff --git a/hl/tools/testfiles/w-err-dset1.err b/hl/tools/testfiles/w-err-dset1.err new file mode 100644 index 0000000..d6b2a6e --- /dev/null +++ b/hl/tools/testfiles/w-err-dset1.err @@ -0,0 +1 @@ +h5watch error: no dataset specified diff --git a/hl/tools/testfiles/w-err-dset2.ddl b/hl/tools/testfiles/w-err-dset2.ddl deleted file mode 100644 index 81b52de..0000000 --- a/hl/tools/testfiles/w-err-dset2.ddl +++ /dev/null @@ -1,2 +0,0 @@ -Opened "WATCH.h5" with sec2 driver. -h5watch error: unable to open dataset "/group/DSET_CMPD" diff --git a/hl/tools/testfiles/w-err-dset2.err b/hl/tools/testfiles/w-err-dset2.err new file mode 100644 index 0000000..3f77ec8 --- /dev/null +++ b/hl/tools/testfiles/w-err-dset2.err @@ -0,0 +1 @@ +h5watch error: unable to open dataset "/group/DSET_CMPD" diff --git a/hl/tools/testfiles/w-err-file.ddl b/hl/tools/testfiles/w-err-file.ddl deleted file mode 100644 index 015661f..0000000 --- a/hl/tools/testfiles/w-err-file.ddl +++ /dev/null @@ -1 +0,0 @@ -h5watch error: unable to open file "../WATCH.h5/DSET_CMPD" diff --git a/hl/tools/testfiles/w-err-file.err b/hl/tools/testfiles/w-err-file.err new file mode 100644 index 0000000..015661f --- /dev/null +++ b/hl/tools/testfiles/w-err-file.err @@ -0,0 +1 @@ +h5watch error: unable to open file "../WATCH.h5/DSET_CMPD" diff --git a/hl/tools/testfiles/w-err-std.ddl b/hl/tools/testfiles/w-err-std.ddl new file mode 100644 index 0000000..775d6a0 --- /dev/null +++ b/hl/tools/testfiles/w-err-std.ddl @@ -0,0 +1,2 @@ +Opened "WATCH.h5" with sec2 driver. +h5watch error: error in processing diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 3ad9de7..1c26def 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -843,6 +843,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" @@ -877,6 +878,7 @@ else () -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" @@ -943,6 +945,7 @@ if (BUILD_SHARED_LIBS) -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" @@ -977,6 +980,7 @@ if (BUILD_SHARED_LIBS) -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 924ade1..f31068b 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -30,6 +30,7 @@ set (LIST_OTHER_TEST_FILES ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.out + ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.err ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5.txt ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5_ERR.txt ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_plugin_fail_ERR.out.h5.txt @@ -250,6 +251,7 @@ -D "TEST_OUTPUT=./testfiles/${testname}.out.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=./testfiles/${testname}.out" + -D "TEST_ERRREF=./testfiles/${testname}.err" -D "TEST_MASK=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.err b/tools/test/h5copy/testfiles/h5copy_misc1.err new file mode 100644 index 0000000..2c2c867 --- /dev/null +++ b/tools/test/h5copy/testfiles/h5copy_misc1.err @@ -0,0 +1 @@ +h5copy error: group doesn't exist. Use -p to create parent groups. diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.out b/tools/test/h5copy/testfiles/h5copy_misc1.out index 1624f2b..1c7181b 100644 --- a/tools/test/h5copy/testfiles/h5copy_misc1.out +++ b/tools/test/h5copy/testfiles/h5copy_misc1.out @@ -1,3 +1,2 @@ Copying file <./testfiles/h5copytst.h5> and object to file <./testfiles/h5copy_misc1.out.h5> and object Error in copy...Exiting -h5copy error: group doesn't exist. Use -p to create parent groups. diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index e06f069..596128f 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -293,6 +293,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v1.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt b/tools/test/h5diff/testfiles/h5diff_454_ERR.txt index 4501071..dcc2e9c 100644 --- a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt +++ b/tools/test/h5diff/testfiles/h5diff_454_ERR.txt @@ -1,6 +1,2 @@ Warning: is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt b/tools/test/h5diff/testfiles/h5diff_455_ERR.txt index 4501071..dcc2e9c 100644 --- a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt +++ b/tools/test/h5diff/testfiles/h5diff_455_ERR.txt @@ -1,6 +1,2 @@ Warning: is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt b/tools/test/h5diff/testfiles/h5diff_457_ERR.txt index 9d73750..762ccdc 100644 --- a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt +++ b/tools/test/h5diff/testfiles/h5diff_457_ERR.txt @@ -1,6 +1,2 @@ Warning: is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt b/tools/test/h5diff/testfiles/h5diff_458_ERR.txt index b084914..067d665 100644 --- a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt +++ b/tools/test/h5diff/testfiles/h5diff_458_ERR.txt @@ -1,6 +1,2 @@ Warning: is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt b/tools/test/h5diff/testfiles/h5diff_459_ERR.txt index 9d73750..762ccdc 100644 --- a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt +++ b/tools/test/h5diff/testfiles/h5diff_459_ERR.txt @@ -1,6 +1,2 @@ Warning: is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt index f3b346a..13d627c 100644 --- a/tools/test/h5diff/testfiles/h5diff_600.txt +++ b/tools/test/h5diff/testfiles/h5diff_600.txt @@ -142,5 +142,4 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare '/g1/dset1' and '/g1/dset2' in the same file -h5diff error: missing file names EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt b/tools/test/h5diff/testfiles/h5diff_601_ERR.txt index b58124a..eb12f38 100644 --- a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt +++ b/tools/test/h5diff/testfiles/h5diff_601_ERR.txt @@ -1,6 +1,2 @@ Object could not be found in -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): Error: Object could not be found - major: Failure in tools library - minor: error in function EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.err b/tools/test/h5diff/testfiles/h5diff_udfail.err new file mode 100644 index 0000000..d51de38 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_udfail.err @@ -0,0 +1,12 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dynlibud + +group : and +0 differences found +dataset: and +0 differences found +Warning: dataset cannot be read, user defined filter is not available +EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.txt b/tools/test/h5diff/testfiles/h5diff_udfail.txt index d51de38..e6000fc 100644 --- a/tools/test/h5diff/testfiles/h5diff_udfail.txt +++ b/tools/test/h5diff/testfiles/h5diff_udfail.txt @@ -8,5 +8,4 @@ group : and 0 differences found dataset: and 0 differences found -Warning: dataset cannot be read, user defined filter is not available EXIT CODE: 2 diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 2240813..f790a75 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -22,10 +22,8 @@ set (HDF5_REFERENCE_FILES h5fc_help.ddl h5fc_nooption.ddl - h5fc_nonexistfile.ddl h5fc_d_file.ddl h5fc_dname.ddl - h5fc_nonexistdset_file.ddl h5fc_v_non_chunked.ddl h5fc_v_bt1.ddl h5fc_v_ndata_bt1.ddl @@ -49,6 +47,11 @@ h5fc_v_err.ddl h5fc_v_err.ddl.err ) + set (HDF5_REFERENCE_ERR_FILES + h5fc_d_file.ddl.err + h5fc_dname.err + h5fc_nonexistdset_file.ddl.err + ) set (HDF5_REFERENCE_TEST_FILES h5fc_non_v3.h5 h5fc_edge_v3.h5 @@ -78,6 +81,10 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}" "h5fc_files") endforeach () + foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files") + endforeach () + foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files") endforeach () @@ -119,6 +126,7 @@ -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" + -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") @@ -141,6 +149,42 @@ endif () endmacro () + macro (ADD_H5_NOERR_OUTPUT testname resultfile resultcode testfile) + # If using memchecker add tests without using scripts + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5FC-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ./testfiles/outtmp.h5 + ./testfiles/${testname}.out + ./testfiles/${testname}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5FC-${testname}-${testfile}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname}-${testfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") + set (last_test "H5FC-${testname}-${testfile}") + endif () + endmacro () + macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -433,17 +477,17 @@ # h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset) # h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset) # h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets) - ADD_H5_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v) - ADD_H5_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose) - ADD_H5_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n) - ADD_H5_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v) + ADD_H5_NOERR_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v) + ADD_H5_NOERR_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose) + ADD_H5_NOERR_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n) + ADD_H5_NOERR_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v) # # # # h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset) # h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets) - ADD_H5_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n) - ADD_H5_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n) + ADD_H5_NOERR_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n) + ADD_H5_NOERR_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n) # # # diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl b/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl new file mode 100644 index 0000000..bc0229c --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl @@ -0,0 +1,25 @@ +usage: h5format_convert [OPTIONS] file_name + OPTIONS + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -v, --verbose Turn on verbose mode + -d dname, --dname=dataset_name Pathname for the dataset + -n, --noop Perform all the steps except the actual conversion + +Examples of use: + +h5format_convert -d /group/dataset file_name + Convert the dataset in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action + +h5format_convert file_name + Convert all datasets in the HDF5 file : + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action + +h5format_convert -n -d /group/dataset file_name + Go through all the steps except the actual conversion when + converting the dataset in the HDF5 file . diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl index 38fc432..bc0229c 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl @@ -23,4 +23,3 @@ h5format_convert file_name h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when converting the dataset in the HDF5 file . -h5format_convert error: missing file name diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err new file mode 100644 index 0000000..ceb0fe4 --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err @@ -0,0 +1 @@ +h5format_convert error: missing file name diff --git a/tools/test/h5format_convert/testfiles/h5fc_dname.ddl b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl index 48564b7..bc0229c 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_dname.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl @@ -23,4 +23,3 @@ h5format_convert file_name h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when converting the dataset in the HDF5 file . -h5format_convert error: No dataset name diff --git a/tools/test/h5format_convert/testfiles/h5fc_dname.err b/tools/test/h5format_convert/testfiles/h5fc_dname.err new file mode 100644 index 0000000..361d8a9 --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_dname.err @@ -0,0 +1 @@ +h5format_convert error: No dataset name diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl deleted file mode 100644 index 39450c0..0000000 --- a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl +++ /dev/null @@ -1 +0,0 @@ -h5format_convert error: unable to open dataset "nonexist" diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err new file mode 100644 index 0000000..39450c0 --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err @@ -0,0 +1 @@ +h5format_convert error: unable to open dataset "nonexist" diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl deleted file mode 100644 index 706ea9d..0000000 --- a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl +++ /dev/null @@ -1 +0,0 @@ -h5format_convert error: unable to open file "nonexist.h5" diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err new file mode 100644 index 0000000..706ea9d --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err @@ -0,0 +1 @@ +h5format_convert error: unable to open file "nonexist.h5" diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err new file mode 100644 index 0000000..706ea9d --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err @@ -0,0 +1 @@ +h5format_convert error: unable to open file "nonexist.h5" diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 66ff715..2d00b86 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -74,6 +74,8 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" -D "TEST_EXPECT=${resultcode}" + -D "TEST_ERRREF=testfiles/${expectfile}.txt" + -D "TEST_SKIP_COMPARE=1" -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 488b271..116d097 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -47,6 +47,12 @@ ${HDF5_TOOLS_DIR}/testfiles/tdset_idx.h5 ) + set (LIST_ERR_TEST_FILES + ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/nosuchfile.err + ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/textlinksrc-nodangle-1.err + ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/tgroup-1.err + ) + set (LIST_OTHER_TEST_FILES ${HDF5_TOOLS_DIR}/testfiles/help-1.ls ${HDF5_TOOLS_DIR}/testfiles/help-2.ls @@ -116,6 +122,10 @@ get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files") endforeach () + foreach (listfiles ${LIST_ERR_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files") + endforeach () add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list}) ############################################################################## @@ -159,6 +169,42 @@ endif () endmacro () + macro (ADD_H5_ERR_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if ("${resultcode}" STREQUAL "1") + set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else () + # Remove any output file left over from previous test run + add_test ( + NAME H5LS-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${resultfile}.out + testfiles/${resultfile}.out.err + ) + add_test ( + NAME H5LS-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ls" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) + endif () + endmacro () + macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run @@ -341,7 +387,7 @@ # test for displaying groups # The following combination of arguments is expected to return an error message # and return value 1 - ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) + ADD_H5_ERR_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1) # test for files with groups that have long comments @@ -382,7 +428,7 @@ # tests for no-dangling-links # if this option is given on dangling link, h5ls should return exit code 1 # when used alone , expect to print out help and return exit code 1 - ADD_H5_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5) + ADD_H5_ERR_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5) # external dangling link - expected exit code 1 ADD_H5_TEST (textlinksrc-nodangle-2 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5) # soft dangling link - expected exit code 1 @@ -444,7 +490,7 @@ endif () # test for non-existing file - ADD_H5_TEST (nosuchfile 1 nosuchfile.h5) + ADD_H5_ERR_TEST (nosuchfile 1 nosuchfile.h5) # test for variable length data types in verbose mode if (H5_WORDS_BIGENDIAN) diff --git a/tools/test/h5ls/errfiles/nosuchfile.err b/tools/test/h5ls/errfiles/nosuchfile.err new file mode 100644 index 0000000..8c4ee42 --- /dev/null +++ b/tools/test/h5ls/errfiles/nosuchfile.err @@ -0,0 +1 @@ +nosuchfile.h5: unable to open file diff --git a/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err b/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err new file mode 100644 index 0000000..8991fc1 --- /dev/null +++ b/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err @@ -0,0 +1,2 @@ +Error: --no-dangling-links must be used along with --follow-symlinks option! + diff --git a/tools/test/h5ls/errfiles/tgroup-1.err b/tools/test/h5ls/errfiles/tgroup-1.err new file mode 100644 index 0000000..ba4cf07 --- /dev/null +++ b/tools/test/h5ls/errfiles/tgroup-1.err @@ -0,0 +1,2 @@ +Error: 'recursive' option not compatible with 'group info' option! + diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 3ee5e27..b9eb8a1 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -377,7 +377,7 @@ -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_MASK_ERROR=true" - -D "TEST_REFERENCE=${resultfile}-${testname}.tst" + -D "TEST_ERRREF=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index bd55ac1..9c26a92 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -39,23 +39,30 @@ h5stat_newgrat h5stat_newgrat-UG h5stat_newgrat-UA - h5stat_err1_links h5stat_idx h5stat_links1 h5stat_links2 h5stat_links3 h5stat_links4 h5stat_links5 - h5stat_err1_dims h5stat_dims1 h5stat_dims2 - h5stat_err1_numattrs - h5stat_err2_numattrs h5stat_numattrs1 h5stat_numattrs2 h5stat_numattrs3 h5stat_numattrs4 ) + set (HDF5_REFERENCE_ERR_FILES + h5stat_err_refcount + h5stat_err_old_layout + h5stat_err_old_fill + h5stat_err1_dims + h5stat_err1_links + h5stat_err1_numattrs + h5stat_err2_numattrs + h5stat_notexist + h5stat_nofile + ) set (HDF5_REFERENCE_TEST_FILES h5stat_err_refcount.h5 h5stat_err_old_layout.h5 @@ -71,6 +78,10 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}.ddl" "${PROJECT_BINARY_DIR}/${ddl_file}.ddl" "h5stat_files") endforeach () + foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}.err" "${PROJECT_BINARY_DIR}/${h5_file}.err" "h5stat_files") + endforeach () + foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files") endforeach () @@ -118,6 +129,42 @@ endif () endmacro () + macro (ADD_H5_ERR_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + if (NOT "${resultcode}" STREQUAL "0") + set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else (HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5STAT-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5STAT-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects) + endif () + endmacro () + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -173,7 +220,7 @@ # -g -l 8 # --links=8 # --links=20 -g - ADD_H5_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links1 0 -g -l 8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links2 0 --links=8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links3 0 --links=20 -g h5stat_threshold.h5) @@ -188,7 +235,7 @@ # -d --dims=-1 (incorrect threshold value) # -gd -m 5 # -d --di=15 - ADD_H5_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims2 0 -d --di=15 h5stat_threshold.h5) # @@ -198,8 +245,8 @@ # -AS -a 10 # -a 1 # -A --numattrs=25 - ADD_H5_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5) - ADD_H5_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs1 0 -AS -a 10 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs2 0 -a 1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs3 0 -A --numattrs=25 h5stat_threshold.h5) diff --git a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl b/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl deleted file mode 100644 index 86d375b..0000000 --- a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl +++ /dev/null @@ -1 +0,0 @@ -h5stat error: Invalid threshold for small datasets diff --git a/tools/test/h5stat/testfiles/h5stat_err1_dims.err b/tools/test/h5stat/testfiles/h5stat_err1_dims.err new file mode 100644 index 0000000..86d375b --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err1_dims.err @@ -0,0 +1 @@ +h5stat error: Invalid threshold for small datasets diff --git a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl b/tools/test/h5stat/testfiles/h5stat_err1_links.ddl deleted file mode 100644 index d43207c..0000000 --- a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl +++ /dev/null @@ -1 +0,0 @@ -h5stat error: Invalid threshold for small groups diff --git a/tools/test/h5stat/testfiles/h5stat_err1_links.err b/tools/test/h5stat/testfiles/h5stat_err1_links.err new file mode 100644 index 0000000..d43207c --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err1_links.err @@ -0,0 +1 @@ +h5stat error: Invalid threshold for small groups diff --git a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl deleted file mode 100644 index 01b6c18..0000000 --- a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl +++ /dev/null @@ -1 +0,0 @@ -h5stat error: Invalid threshold for small # of attributes diff --git a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err new file mode 100644 index 0000000..01b6c18 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err @@ -0,0 +1 @@ +h5stat error: Invalid threshold for small # of attributes diff --git a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl deleted file mode 100644 index 01b6c18..0000000 --- a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl +++ /dev/null @@ -1 +0,0 @@ -h5stat error: Invalid threshold for small # of attributes diff --git a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err new file mode 100644 index 0000000..01b6c18 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err @@ -0,0 +1 @@ +h5stat error: Invalid threshold for small # of attributes diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl index e751b7f..5cc1e32 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl @@ -1,2 +1 @@ Filename: h5stat_err_old_fill.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.err b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err new file mode 100644 index 0000000..8b886d2 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl index a3e27e2..112190c 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl @@ -1,2 +1 @@ Filename: h5stat_err_old_layout.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.err b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err new file mode 100644 index 0000000..7aa2fa7 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl index 1f1b491..41e533e 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl @@ -1,2 +1 @@ Filename: h5stat_err_refcount.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.err b/tools/test/h5stat/testfiles/h5stat_err_refcount.err new file mode 100644 index 0000000..d176996 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.ddl b/tools/test/h5stat/testfiles/h5stat_nofile.ddl index 7171320..01e39af 100644 --- a/tools/test/h5stat/testfiles/h5stat_nofile.ddl +++ b/tools/test/h5stat/testfiles/h5stat_nofile.ddl @@ -23,4 +23,3 @@ Usage: h5stat [OPTIONS] file -s, --freespace Print free space information -S, --summary Print summary of file space information --enable-error-stack Prints messages from the HDF5 error stack as they occur -h5stat error: missing file name diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.err b/tools/test/h5stat/testfiles/h5stat_nofile.err new file mode 100644 index 0000000..3b7e979 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_nofile.err @@ -0,0 +1 @@ +h5stat error: missing file name diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.ddl b/tools/test/h5stat/testfiles/h5stat_notexist.ddl index cc25e43..7f71941 100644 --- a/tools/test/h5stat/testfiles/h5stat_notexist.ddl +++ b/tools/test/h5stat/testfiles/h5stat_notexist.ddl @@ -1,2 +1 @@ Filename: notexist.h5 -h5stat error: unable to open file "notexist.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.err b/tools/test/h5stat/testfiles/h5stat_notexist.err new file mode 100644 index 0000000..c1d9e54 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_notexist.err @@ -0,0 +1 @@ +h5stat error: unable to open file "notexist.h5" diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index a51d0e9..7c3bc71 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -49,8 +49,6 @@ h5clear_missing_file.ddl h5clear_noclose_after_size.ddl h5clear_noclose_before_size.ddl - h5clear_no_mdc_image.ddl - h5clear_open_fail.ddl h5clear_status_noclose_after_size.ddl h5clear_usage.ddl h5clear_user_equal_after_size.ddl @@ -60,10 +58,17 @@ h5clear_user_less_after_size.ddl h5clear_user_less_before_size.ddl ) + set (HDF5_REFERENCE_ERR_FILES + h5clear_no_mdc_image.err + h5clear_open_fail.err + ) foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES} ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") endforeach () + foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") + endforeach () # make second copy of h5clear_sec2.h5 foreach (h5_file ${HDF5_SEC2_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" "h5clear_files") @@ -108,6 +113,34 @@ endif () endmacro () + macro (ADD_H5_ERR_CMP testname resultfile resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${testname}.out + testfiles/${testname}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5CLEAR_CMP-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + set (last_test "H5CLEAR_CMP-${testname}") + endif () + endmacro () + macro (ADD_H5_CMP_WITH_COPY testname resultcode resultfile testfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -144,6 +177,42 @@ endif () endmacro () + macro (ADD_H5_ERR_CMP_WITH_COPY testname resultcode resultfile testfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${testname}.out + testfiles/${testname}.out.err + testfiles/${testfile} + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5CLEAR_CMP-copy_${testname} + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}" + ) + set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + add_test ( + NAME H5CLEAR_CMP-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN};${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname}) + set (last_test "H5CLEAR_CMP-${testname}") + endif () + endmacro () + macro (ADD_H5_RETTEST testname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -347,11 +416,11 @@ endif() ADD_H5_CMP (h5clr_usage_junk h5clear_usage 1 "" junk.h5) ADD_H5_CMP (h5clr_usage_none h5clear_usage 1 "" orig_h5clear_sec2_v3.h5) ADD_H5_CMP (h5clr_missing_file_m h5clear_missing_file 1 "-m") - ADD_H5_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5) ADD_H5_CMP (h5clr_missing_file_ms h5clear_missing_file 1 "-m" "-s") - ADD_H5_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5) - ADD_H5_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5) - ADD_H5_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5) # # # @@ -382,8 +451,8 @@ endif() # # # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: - ADD_H5_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5) - ADD_H5_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5) # # # @@ -404,7 +473,7 @@ endif() # "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) # (no output, check exit code) # "h5clear --filesize h5clear_status_noclose.h5" (print EOA/EOF after the last action) - ADD_H5_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize") + ADD_H5_ERR_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize") ADD_H5_RETTEST (h5clr_mdc_image_nc "false" "-s" "--increment=0" h5clear_status_noclose.h5) ADD_H5_CMP (h5clr_no_mdc_image_nc_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5) # diff --git a/tools/test/misc/testfiles/h5clear_missing_file.ddl b/tools/test/misc/testfiles/h5clear_missing_file.ddl index 13eb2c9..32dd549 100644 --- a/tools/test/misc/testfiles/h5clear_missing_file.ddl +++ b/tools/test/misc/testfiles/h5clear_missing_file.ddl @@ -20,4 +20,3 @@ h5clear --increment file_name h5clear --increment=512 file_name Set the EOA to the maximum of (EOA, EOF) + 512 for the file . -h5clear error: missing file name diff --git a/tools/test/misc/testfiles/h5clear_missing_file.err b/tools/test/misc/testfiles/h5clear_missing_file.err new file mode 100644 index 0000000..13eb2c9 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_missing_file.err @@ -0,0 +1,23 @@ +usage: h5clear [OPTIONS] file_name + OPTIONS + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -s, --status Clear the status_flags field in the file's superblock + -m, --image Remove the metadata cache image from the file + --filesize Print the file's EOA and EOF + --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for the file + C is >= 0; C is optional and will default to 1M when not set +Examples of use: + +h5clear -s file_name + Clear the status_flags field in the superblock of the HDF5 file . + +h5clear -m file_name + Remove the metadata cache image from the HDF5 file . + +h5clear --increment file_name + Set the EOA to the maximum of (EOA, EOF) + 1M for the file . + +h5clear --increment=512 file_name + Set the EOA to the maximum of (EOA, EOF) + 512 for the file . +h5clear error: missing file name diff --git a/tools/test/misc/testfiles/h5clear_no_mdc_image.ddl b/tools/test/misc/testfiles/h5clear_no_mdc_image.ddl deleted file mode 100644 index f5acd71..0000000 --- a/tools/test/misc/testfiles/h5clear_no_mdc_image.ddl +++ /dev/null @@ -1 +0,0 @@ -h5clear warning: No cache image in the file diff --git a/tools/test/misc/testfiles/h5clear_no_mdc_image.err b/tools/test/misc/testfiles/h5clear_no_mdc_image.err new file mode 100644 index 0000000..f5acd71 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_no_mdc_image.err @@ -0,0 +1 @@ +h5clear warning: No cache image in the file diff --git a/tools/test/misc/testfiles/h5clear_open_fail.ddl b/tools/test/misc/testfiles/h5clear_open_fail.ddl deleted file mode 100644 index 895ecd4..0000000 --- a/tools/test/misc/testfiles/h5clear_open_fail.ddl +++ /dev/null @@ -1 +0,0 @@ -h5clear error: h5tools_fopen diff --git a/tools/test/misc/testfiles/h5clear_open_fail.err b/tools/test/misc/testfiles/h5clear_open_fail.err new file mode 100644 index 0000000..895ecd4 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_open_fail.err @@ -0,0 +1 @@ +h5clear error: h5tools_fopen diff --git a/tools/testfiles/err_attr_dspace.ddl b/tools/testfiles/err_attr_dspace.ddl index 6c45322..48ef659 100644 --- a/tools/testfiles/err_attr_dspace.ddl +++ b/tools/testfiles/err_attr_dspace.ddl @@ -2,4 +2,3 @@ HDF5 "err_attr_dspace.h5" { GROUP "/" { } } -h5dump error: error getting attribute information diff --git a/tools/testfiles/non_existing.ddl b/tools/testfiles/non_existing.ddl index 4377f8d..4407eae 100644 --- a/tools/testfiles/non_existing.ddl +++ b/tools/testfiles/non_existing.ddl @@ -28,4 +28,3 @@ GROUP "/" { } } } -h5dump error: unable to open file "non_existing.h5" diff --git a/tools/testfiles/nosuchfile.ls b/tools/testfiles/nosuchfile.ls index 8c4ee42..e69de29 100644 --- a/tools/testfiles/nosuchfile.ls +++ b/tools/testfiles/nosuchfile.ls @@ -1 +0,0 @@ -nosuchfile.h5: unable to open file diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 0a3beb0..19de76f 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files h5dump -d /foo -f family fam%05d.h5 -h5dump error: missing file name diff --git a/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl index b0683a7..b281827 100644 --- a/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl @@ -15,4 +15,3 @@ DATASET "/DS08BITS" { } } } -h5dump error: Packed Bit offset+length value(9) too large. Max is 8 diff --git a/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl index 530fa05..ee56a5c 100644 --- a/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl @@ -15,4 +15,3 @@ DATASET "/DS08BITS" { } } } -h5dump error: Packed Bit offset+length value(9) too large. Max is 8 diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index b353065..19de76f 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files h5dump -d /foo -f family fam%05d.h5 -h5dump error: Bad mask list(0,2,2,1,0,2,2,) diff --git a/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl index 1c919cd..1cba6d5 100644 --- a/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl @@ -15,4 +15,3 @@ DATASET "/DS16BITS" { } } } -h5dump error: Packed Bit offset+length value(17) too large. Max is 16 diff --git a/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl index f3b2a8c..330d61f 100644 --- a/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl @@ -15,4 +15,3 @@ DATASET "/DS16BITS" { } } } -h5dump error: Packed Bit offset+length value(17) too large. Max is 16 diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index ffe0da9..19de76f 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files h5dump -d /foo -f family fam%05d.h5 -h5dump error: Packed Bit offset+length value(65) too large. Max is 64 diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index 4502143..19de76f 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files h5dump -d /foo -f family fam%05d.h5 -h5dump error: Packed Bit length value(0) must be positive. diff --git a/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl index 812c300..44ec077 100644 --- a/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl @@ -23,4 +23,3 @@ DATASET "/DS32BITS" { } } } -h5dump error: Packed Bit offset+length value(33) too large. Max is 32 diff --git a/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl index cbea722..c775557 100644 --- a/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl @@ -23,4 +23,3 @@ DATASET "/DS32BITS" { } } } -h5dump error: Packed Bit offset+length value(33) too large. Max is 32 diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 011f6c9..19de76f 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files h5dump -d /foo -f family fam%05d.h5 -h5dump error: Too many masks requested (max. 8). Mask list(0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1) diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index 857fe62..19de76f 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files h5dump -d /foo -f family fam%05d.h5 -h5dump error: Packed Bit offset value(64) must be between 0 and 63 diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index 9ac1160..19de76f 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files h5dump -d /foo -f family fam%05d.h5 -h5dump error: Bad mask list(-1,1) diff --git a/tools/testfiles/texceedsubblock.ddl b/tools/testfiles/texceedsubblock.ddl index 499e0d2..69ec706 100644 --- a/tools/testfiles/texceedsubblock.ddl +++ b/tools/testfiles/texceedsubblock.ddl @@ -1,3 +1,2 @@ HDF5 "taindices.h5" { } -h5dump error: number of block dims (2) exceed dataset dims (1) diff --git a/tools/testfiles/texceedsubcount.ddl b/tools/testfiles/texceedsubcount.ddl index 81e8c4a..69ec706 100644 --- a/tools/testfiles/texceedsubcount.ddl +++ b/tools/testfiles/texceedsubcount.ddl @@ -1,3 +1,2 @@ HDF5 "taindices.h5" { } -h5dump error: number of count dims (2) exceed dataset dims (1) diff --git a/tools/testfiles/texceedsubstart.ddl b/tools/testfiles/texceedsubstart.ddl index cb535a0..69ec706 100644 --- a/tools/testfiles/texceedsubstart.ddl +++ b/tools/testfiles/texceedsubstart.ddl @@ -1,3 +1,2 @@ HDF5 "taindices.h5" { } -h5dump error: number of start dims (2) exceed dataset dims (1) diff --git a/tools/testfiles/texceedsubstride.ddl b/tools/testfiles/texceedsubstride.ddl index bf85997..69ec706 100644 --- a/tools/testfiles/texceedsubstride.ddl +++ b/tools/testfiles/texceedsubstride.ddl @@ -1,3 +1,2 @@ HDF5 "taindices.h5" { } -h5dump error: number of stride dims (2) exceed dataset dims (1) diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls index 6d1da9e..491f696 100644 --- a/tools/testfiles/textlinksrc-nodangle-1.ls +++ b/tools/testfiles/textlinksrc-nodangle-1.ls @@ -56,5 +56,3 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] Replaced by --follow-symlinks. -e, --errors Show all HDF5 error reporting Replaced by --enable-error-stack. -Error: --no-dangling-links must be used along with --follow-symlinks option! - diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls index 069d43e..491f696 100644 --- a/tools/testfiles/tgroup-1.ls +++ b/tools/testfiles/tgroup-1.ls @@ -56,5 +56,3 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] Replaced by --follow-symlinks. -e, --errors Show all HDF5 error reporting Replaced by --enable-error-stack. -Error: 'recursive' option not compatible with 'group info' option! - diff --git a/tools/testfiles/tstarfile.ddl b/tools/testfiles/tstarfile.ddl index 87c3f87..1cd87f7 100644 --- a/tools/testfiles/tstarfile.ddl +++ b/tools/testfiles/tstarfile.ddl @@ -86,4 +86,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist major: Symbol table minor: Object not found -h5dump error: unable to get link info from "Dataset1" -- cgit v0.12 From d6de299f01273cd7fa7180f3336fc45e9a5c7f0c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 4 Dec 2018 23:16:03 -0600 Subject: Need nonexistent file to skip stdout compare --- hl/tools/h5watch/CMakeTests.cmake | 2 +- tools/test/h5repack/CMakeTests.cmake | 1 + tools/test/h5stat/CMakeTests.cmake | 1 + tools/test/misc/CMakeTestsClear.cmake | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index 9c18798..13d5e47 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -96,7 +96,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index b9eb8a1..ad468f0 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -377,6 +377,7 @@ -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_MASK_ERROR=true" + -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 9c26a92..ec8c9b1 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -158,6 +158,7 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 7c3bc71..63abe58 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -133,6 +133,7 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) -- cgit v0.12 From a68fd292081be9415d9f9c9de41312a9d60bb5ad Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 5 Dec 2018 09:44:13 -0600 Subject: Fix special macro stdout as empty --- tools/test/misc/CMakeTestsClear.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 63abe58..c46ac59 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -206,6 +206,7 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) -- cgit v0.12 From eb1b3f42c46fd7317c904105515c4d47d8f035fe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 6 Dec 2018 07:53:31 -0600 Subject: HDFFV=10632 test cleanup --- MANIFEST | 15 +-- config/cmake/scripts/HDF5options.cmake | 5 +- config/cmake_ext_mod/runTest.cmake | 1 + tools/test/h5diff/CMakeTests.cmake | 118 +-------------------- tools/test/h5diff/testfiles/dangling_link.err | 4 + tools/test/h5diff/testfiles/h5diff_454_ERR.err | 4 - tools/test/h5diff/testfiles/h5diff_454_ERR.txt | 2 - tools/test/h5diff/testfiles/h5diff_455_ERR.err | 4 - tools/test/h5diff/testfiles/h5diff_455_ERR.txt | 2 - tools/test/h5diff/testfiles/h5diff_457_ERR.err | 4 - tools/test/h5diff/testfiles/h5diff_457_ERR.txt | 2 - tools/test/h5diff/testfiles/h5diff_458_ERR.err | 4 - tools/test/h5diff/testfiles/h5diff_458_ERR.txt | 2 - tools/test/h5diff/testfiles/h5diff_459_ERR.err | 4 - tools/test/h5diff/testfiles/h5diff_459_ERR.txt | 2 - tools/test/h5diff/testfiles/h5diff_601_ERR.txt | 2 - tools/test/h5format_convert/CMakeTests.cmake | 1 + .../testfiles/h5fc_nonexistfile.err | 1 - tools/test/misc/testfiles/h5clear_missing_file.err | 22 ---- 19 files changed, 13 insertions(+), 186 deletions(-) create mode 100644 tools/test/h5diff/testfiles/dangling_link.err delete mode 100644 tools/test/h5diff/testfiles/h5diff_454_ERR.err delete mode 100644 tools/test/h5diff/testfiles/h5diff_454_ERR.txt delete mode 100644 tools/test/h5diff/testfiles/h5diff_455_ERR.err delete mode 100644 tools/test/h5diff/testfiles/h5diff_455_ERR.txt delete mode 100644 tools/test/h5diff/testfiles/h5diff_457_ERR.err delete mode 100644 tools/test/h5diff/testfiles/h5diff_457_ERR.txt delete mode 100644 tools/test/h5diff/testfiles/h5diff_458_ERR.err delete mode 100644 tools/test/h5diff/testfiles/h5diff_458_ERR.txt delete mode 100644 tools/test/h5diff/testfiles/h5diff_459_ERR.err delete mode 100644 tools/test/h5diff/testfiles/h5diff_459_ERR.txt delete mode 100644 tools/test/h5diff/testfiles/h5diff_601_ERR.txt delete mode 100644 tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err diff --git a/MANIFEST b/MANIFEST index 8c921cd..6a1f53d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1388,10 +1388,11 @@ ./tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err ./tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl ./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl -./tools/test/h5format_convert/testfiles/h5fc_d_file.err +./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err ./tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl ./tools/test/h5format_convert/testfiles/h5fc_dname.ddl ./tools/test/h5format_convert/testfiles/h5fc_dname.err +./tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err ./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err ./tools/test/h5format_convert/testfiles/h5fc_help.ddl ./tools/test/h5format_convert/testfiles/h5fc_v_all.ddl @@ -2290,7 +2291,6 @@ ./tools/test/h5diff/testfiles/h5diff_600.txt ./tools/test/h5diff/testfiles/h5diff_601.txt ./tools/test/h5diff/testfiles/h5diff_601_ERR.err -./tools/test/h5diff/testfiles/h5diff_601_ERR.txt ./tools/test/h5diff/testfiles/h5diff_603.txt ./tools/test/h5diff/testfiles/h5diff_604.txt ./tools/test/h5diff/testfiles/h5diff_605.txt @@ -2397,21 +2397,12 @@ ./tools/test/h5diff/testfiles/h5diff_452.txt ./tools/test/h5diff/testfiles/h5diff_453.txt ./tools/test/h5diff/testfiles/h5diff_454.txt -./tools/test/h5diff/testfiles/h5diff_454_ERR.err -./tools/test/h5diff/testfiles/h5diff_454_ERR.txt +./tools/test/h5diff/testfiles/dangling_link.err ./tools/test/h5diff/testfiles/h5diff_455.txt -./tools/test/h5diff/testfiles/h5diff_455_ERR.err -./tools/test/h5diff/testfiles/h5diff_455_ERR.txt ./tools/test/h5diff/testfiles/h5diff_456.txt ./tools/test/h5diff/testfiles/h5diff_457.txt -./tools/test/h5diff/testfiles/h5diff_457_ERR.err -./tools/test/h5diff/testfiles/h5diff_457_ERR.txt ./tools/test/h5diff/testfiles/h5diff_458.txt -./tools/test/h5diff/testfiles/h5diff_458_ERR.err -./tools/test/h5diff/testfiles/h5diff_458_ERR.txt ./tools/test/h5diff/testfiles/h5diff_459.txt -./tools/test/h5diff/testfiles/h5diff_459_ERR.err -./tools/test/h5diff/testfiles/h5diff_459_ERR.txt ./tools/test/h5diff/testfiles/h5diff_465.txt ./tools/test/h5diff/testfiles/h5diff_466.txt ./tools/test/h5diff/testfiles/h5diff_467.txt diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 6d1a57a..d4cc996 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -58,12 +58,13 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN ### ext libs from git #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT") ### ext libs on system +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=NO") #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include") #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include") -### disable ext zlib building +### disable using ext zlib #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF") -### disable ext szip building +### disable using ext szip #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF") #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF") diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 75d0f3b..e8033c5 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -144,6 +144,7 @@ if (TEST_MASK_ERROR) # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () + string (REGEX REPLACE "[.]*_pmi_alps[.]*\n" "" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 596128f..24646b0 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -168,21 +168,12 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_452.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_453.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454_ERR.err + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/dangling_link.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_456.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_465.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_466.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_467.txt @@ -238,7 +229,6 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_63.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_600.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601_ERR.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_603.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_604.txt @@ -401,47 +391,6 @@ endif () endmacro () - macro (ADD_H5_ERR_TEST resultfile resultcode) - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF_ERR-${resultfile} COMMAND $ --enable-error-stack ${ARGN}) - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${resultcode}" STREQUAL "0") - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WILL_FAIL "true") - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF_ERR-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}_ERR.out - testfiles/${resultfile}_ERR.out.err - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF_ERR-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5DIFF_ERR-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}_ERR.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}_ERR.txt" - -D "TEST_MASK_ERROR=true" - -D "TEST_APPEND=EXIT CODE:" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES DEPENDS H5DIFF_ERR-${resultfile}-clear-objects) - endif () - set (last_test "H5DIFF_ERR-${resultfile}") - endmacro () - macro (ADD_PH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) @@ -530,53 +479,6 @@ endif () endmacro () - macro (ADD_H5_UD_ERR_TEST testname resultcode resultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF_UD_ERR-${testname}-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}_ERR.out - testfiles/${resultfile}_ERR.out.err - ) - if ("${resultcode}" STREQUAL "2") - add_test ( - NAME H5DIFF_UD_ERR-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}_ERR.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}_ERR.txt" - -D "TEST_MASK_ERROR=true" - -D "TEST_APPEND=EXIT CODE:" - -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" - -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - else () - add_test ( - NAME H5DIFF_UD_ERR-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}_ERR.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}_ERR.txt" - -D "TEST_MASK_ERROR=true" - -D "TEST_APPEND=EXIT CODE:" - -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" - -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (H5DIFF_UD_ERR-${testname} PROPERTIES DEPENDS H5DIFF_UD_ERR-${testname}-clearall-objects) - endif () - endmacro () - ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -799,26 +701,16 @@ h5diff_453.out.err h5diff_454.out h5diff_454.out.err - h5diff_454_ERR.out - h5diff_454_ERR.out.err h5diff_455.out h5diff_455.out.err - h5diff_455_ERR.out - h5diff_455_ERR.out.err h5diff_456.out h5diff_456.out.err h5diff_457.out h5diff_457.out.err - h5diff_457_ERR.out - h5diff_457_ERR.out.err h5diff_458.out h5diff_458.out.err - h5diff_458_ERR.out - h5diff_458_ERR.out.err h5diff_459.out h5diff_459.out.err - h5diff_459_ERR.out - h5diff_459_ERR.out.err h5diff_465.out h5diff_465.out.err h5diff_466.out @@ -923,8 +815,6 @@ h5diff_600.out.err h5diff_601.out h5diff_601.out.err - h5diff_601_ERR.out - h5diff_601_ERR.out.err h5diff_603.out h5diff_603.out.err h5diff_604.out @@ -1182,7 +1072,6 @@ ADD_H5_TEST (h5diff_600 1 ${FILE1}) # 6.1: Check if non-exist object name is specified ADD_H5_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj) -ADD_H5_ERR_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj) # ############################################################################## # # -d @@ -1482,26 +1371,21 @@ ADD_H5_TEST (h5diff_453 2 --follow-symlinks -v --no-dangling-links ${FILE13} $ # dangling link found for soft links (obj to obj) ADD_H5_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist) -ADD_H5_ERR_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist) # dangling link found for soft links (obj to obj) Both dangle links ADD_H5_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist) -ADD_H5_ERR_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist) # dangling link found for ext links (FILE to FILE) ADD_H5_TEST (h5diff_456 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15}) # dangling link found for ext links (obj to obj). target file exist ADD_H5_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1) -ADD_H5_ERR_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1) # dangling link found for ext links (obj to obj). target file NOT exist ADD_H5_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2) -ADD_H5_ERR_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2) # dangling link found for ext links (obj to obj). Both dangle links ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2) -ADD_H5_ERR_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2) # dangling link --follow-symlinks (obj vs obj) # (HDFFV-7836) diff --git a/tools/test/h5diff/testfiles/dangling_link.err b/tools/test/h5diff/testfiles/dangling_link.err new file mode 100644 index 0000000..82802a1 --- /dev/null +++ b/tools/test/h5diff/testfiles/dangling_link.err @@ -0,0 +1,4 @@ +H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): + #000: (file name) line (number) in h5diff(): treat dangling link as error + major: Failure in tools library + minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.err b/tools/test/h5diff/testfiles/h5diff_454_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_454_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt b/tools/test/h5diff/testfiles/h5diff_454_ERR.txt deleted file mode 100644 index dcc2e9c..0000000 --- a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt +++ /dev/null @@ -1,2 +0,0 @@ -Warning: is a dangling link. -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.err b/tools/test/h5diff/testfiles/h5diff_455_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_455_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt b/tools/test/h5diff/testfiles/h5diff_455_ERR.txt deleted file mode 100644 index dcc2e9c..0000000 --- a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt +++ /dev/null @@ -1,2 +0,0 @@ -Warning: is a dangling link. -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.err b/tools/test/h5diff/testfiles/h5diff_457_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_457_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt b/tools/test/h5diff/testfiles/h5diff_457_ERR.txt deleted file mode 100644 index 762ccdc..0000000 --- a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt +++ /dev/null @@ -1,2 +0,0 @@ -Warning: is a dangling link. -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.err b/tools/test/h5diff/testfiles/h5diff_458_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_458_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt b/tools/test/h5diff/testfiles/h5diff_458_ERR.txt deleted file mode 100644 index 067d665..0000000 --- a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt +++ /dev/null @@ -1,2 +0,0 @@ -Warning: is a dangling link. -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.err b/tools/test/h5diff/testfiles/h5diff_459_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_459_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt b/tools/test/h5diff/testfiles/h5diff_459_ERR.txt deleted file mode 100644 index 762ccdc..0000000 --- a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt +++ /dev/null @@ -1,2 +0,0 @@ -Warning: is a dangling link. -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt b/tools/test/h5diff/testfiles/h5diff_601_ERR.txt deleted file mode 100644 index eb12f38..0000000 --- a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt +++ /dev/null @@ -1,2 +0,0 @@ -Object could not be found in -EXIT CODE: 2 diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index f790a75..5792d40 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -50,6 +50,7 @@ set (HDF5_REFERENCE_ERR_FILES h5fc_d_file.ddl.err h5fc_dname.err + h5fc_nonexistfile.ddl.err h5fc_nonexistdset_file.ddl.err ) set (HDF5_REFERENCE_TEST_FILES diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err deleted file mode 100644 index 706ea9d..0000000 --- a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.err +++ /dev/null @@ -1 +0,0 @@ -h5format_convert error: unable to open file "nonexist.h5" diff --git a/tools/test/misc/testfiles/h5clear_missing_file.err b/tools/test/misc/testfiles/h5clear_missing_file.err index 13eb2c9..ea21b76 100644 --- a/tools/test/misc/testfiles/h5clear_missing_file.err +++ b/tools/test/misc/testfiles/h5clear_missing_file.err @@ -1,23 +1 @@ -usage: h5clear [OPTIONS] file_name - OPTIONS - -h, --help Print a usage message and exit - -V, --version Print version number and exit - -s, --status Clear the status_flags field in the file's superblock - -m, --image Remove the metadata cache image from the file - --filesize Print the file's EOA and EOF - --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for the file - C is >= 0; C is optional and will default to 1M when not set -Examples of use: - -h5clear -s file_name - Clear the status_flags field in the superblock of the HDF5 file . - -h5clear -m file_name - Remove the metadata cache image from the HDF5 file . - -h5clear --increment file_name - Set the EOA to the maximum of (EOA, EOF) + 1M for the file . - -h5clear --increment=512 file_name - Set the EOA to the maximum of (EOA, EOF) + 512 for the file . h5clear error: missing file name -- cgit v0.12 From 11b4c1f3afde1016de8c75e423054854bed62001 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 6 Dec 2018 12:48:39 -0600 Subject: HDFFV-10632 update autotools test scripts to match cmake --- hl/tools/h5watch/testh5watch.sh.in | 119 +++++++++++++++++++-------- java/test/testfiles/JUnit-TestH5Edefault.txt | 26 +++--- tools/test/h5copy/testh5copy.sh.in | 7 +- tools/test/h5diff/h5diff_plugin.sh.in | 87 +++++++++++++++++++- tools/test/h5diff/testh5diff.sh.in | 6 +- tools/test/h5dump/testh5dump.sh.in | 8 -- tools/test/h5dump/testh5dumppbits.sh.in | 4 - tools/test/h5format_convert/testh5fc.sh.in | 60 ++++++++++++-- tools/test/h5ls/testh5ls.sh.in | 11 ++- tools/test/h5stat/testh5stat.sh.in | 36 +++++--- tools/test/misc/testh5clear.sh.in | 72 +++++++++++----- 11 files changed, 329 insertions(+), 107 deletions(-) diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in index 3f8f5ae..d31bcc3 100644 --- a/hl/tools/h5watch/testh5watch.sh.in +++ b/hl/tools/h5watch/testh5watch.sh.in @@ -32,19 +32,19 @@ fi #echo #exit 0 -H5WATCH=h5watch # The tool name -H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH -EXTEND_DSET=extend_dset # Routine to extend the dataset when watching -EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET +H5WATCH=h5watch # The tool name +H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH +EXTEND_DSET=extend_dset # Routine to extend the dataset when watching +EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET # EXIT_SUCCESS=0 EXIT_FAILURE=1 # -GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets -GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST +GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets +GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests -TRY_MAX=30 # Try running the test again +TRY_MAX=30 # Try running the test again # # These 3 defines should be the same as the defines in ./extend_dset.c WRITER_MESSAGE=writer_message # The message file created by the "extend" process @@ -53,7 +53,7 @@ MESSAGE_TIMEOUT=300 # Message timeout length in secs # CMP='cmp -s' DIFF='diff -c' -NLINES=20 # Max. lines of output to display if test fails +NLINES=20 # Max. lines of output to display if test fails # # Mac OS: just to make sure echo "backslash backslash" behaves properly if test `uname -s` = 'Darwin'; then @@ -83,9 +83,9 @@ TESTING() { # Overall algorithm: # # Run a test and print PASSED or FAILED -# If a test did not return with the expected return code, +# If a test did not return with the expected return code, # increment the `nerrors' global variable and (if $verbose is set) display up to $NLINES -# lines of the actual output from the test. +# lines of the actual output from the test. # If the test did return the expected code, # compare the actual output with the expected output; # If the outputs are the same, print PASSED, @@ -137,7 +137,54 @@ TOOLTEST() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err + fi +} +# +# TOOLTEST_ERR(): +# same as toolset only compare error file +# +# Arguments: +# +# $1 -- expected output +# $2 -- expected return code +# $3 and on -- arguments for h5watch +TOOLTEST_ERR() { + expect="$srcdir/../testfiles/$1" + expect_err="$srcdir/../testfiles/`basename $1 .ddl`.err" + actual="../testfiles/`basename $1 .ddl`.out" + actual_err="../testfiles/`basename $1 .ddl`.out.err" + shift + retvalexpect=$1 + shift + # Run test. + TESTING $H5WATCH $@ + ( + $RUNSERIAL $H5WATCH_BIN "$@" + ) > $actual 2>$actual_err + exitcode=$? + if [ $exitcode -ne $retvalexpect ]; then + $ECHO "*FAILED*" + nerrors="`expr $nerrors + 1`" + if [ yes = "$verbose" ]; then + $ECHO "test returned with exit code $exitcode" + $ECHO "test output: (up to $NLINES lines)" + head -$NLINES $actual + $ECHO "***end of test output***" + $ECHO "" + fi + elif $CMP $expect_err $actual_err; then + $ECHO " PASSED" + else + $ECHO "*FAILED*" + $ECHO " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err fi } @@ -176,15 +223,15 @@ do # Wait for message from "extend_dset" process to start h5watch-- # To wait for the writer message file or till the maximum # of seconds is reached # This performs similar function as the routine h5_wait_message() in test/h5test.c - mexist=0 # Indicate whether the message file is found - t0=`date +%s` # Get current time in seconds - difft=0 # Initialize the time difference - while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out + mexist=0 # Indicate whether the message file is found + t0=`date +%s` # Get current time in seconds + difft=0 # Initialize the time difference + while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out do - t1=`date +%s` # Get current time in seconds - difft=`expr $t1 - $t0` # Calculate the time difference + t1=`date +%s` # Get current time in seconds + difft=`expr $t1 - $t0` # Calculate the time difference if [ -e $WRITER_MESSAGE ]; then # If message file is found: - mexist=1 # indicate the message file is found + mexist=1 # indicate the message file is found rm $WRITER_MESSAGE # remove the message file break # get out of the while loop fi @@ -211,8 +258,8 @@ do wait $extend_pid # Wait for "extend" process to complete extend_exit=$? # Collect "extend" process' exit code sleep 1 # Sleep to make sure output is flushed - kill $watch_pid # Kill h5watch - wait $watch_pid # Wait for "h5watch" process to complete + kill $watch_pid # Kill h5watch + wait $watch_pid # Wait for "h5watch" process to complete # if [ $extend_exit -ne 0 ]; then # Error returned from "extend" process $ECHO "*FAILED*" @@ -265,7 +312,7 @@ done; # DSET_ONE: one-dimensional dataset # # DSET_TWO: two-dimensional dataset # # DSET_CMPD: one-dimensional dataset with compound type # -# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters # +# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters # # DSET_CMPD_TWO: two-dimensional dataset with compound type # # # # The following datasets are one-dimensional, chunked, max. dimension setting: # @@ -282,11 +329,11 @@ done; ################################################################################################# # # # Tests on expected failures: # -# Invalid file name # -# Unable to find dataset, invalid dataset # -# DSET_NONE and DSET_NOMAX # -# Invalid input to options --width and --polling # -# Invalid field names for -f option # +# Invalid file name # +# Unable to find dataset, invalid dataset # +# DSET_NONE and DSET_NOMAX # +# Invalid input to options --width and --polling # +# Invalid field names for -f option # # # ################################################################################################# # @@ -296,21 +343,21 @@ $GEN_TEST_BIN TOOLTEST w-help1.ddl 0 --help # # Tests on expected failures -TOOLTEST w-err-dset1.ddl 1 WATCH.h5 -TOOLTEST w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD -TOOLTEST w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE -TOOLTEST w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX -TOOLTEST w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD +TOOLTEST_ERR w-err-dset1.ddl 1 WATCH.h5 +TOOLTEST_ERR w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD +TOOLTEST_ERR w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE +TOOLTEST_ERR w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX +TOOLTEST_ERR w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD TOOLTEST w-err-width.ddl 1 --width=-8 WATCH.h5/DSET_ONE TOOLTEST w-err-poll.ddl 1 --polling=-8 WATCH.h5/DSET_ONE TOOLTEST w-err-poll0.ddl 1 --polling=0 WATCH.h5/DSET_ONE # # Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD -TOOLTEST w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD -TOOLTEST w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD -TOOLTEST w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD -TOOLTEST w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD -TOOLTEST w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD +TOOLTEST_ERR w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD +TOOLTEST_ERR w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD +TOOLTEST_ERR w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD +TOOLTEST_ERR w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD +TOOLTEST_ERR w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD # echo "DONE WITH 1st SET OF TESTS" # diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 71d1431..48c6254 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -38,17 +38,20 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Unable to open file #001: (file name) line (number) in H5VL_file_open(): open failed major: Virtual Object Layer - minor: Unable to initialize object - #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + 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 - #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + #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 - #004: (file name) line (number) in H5FD_open(): open failed + #005: (file name) line (number) in H5FD_open(): open failed major: Virtual File Layer minor: Unable to initialize object - #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + #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): @@ -57,16 +60,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Unable to open file #001: (file name) line (number) in H5VL_file_open(): open failed major: Virtual Object Layer - minor: Unable to initialize object - #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + 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 - #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + #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 - #004: (file name) line (number) in H5FD_open(): open failed + #005: (file name) line (number) in H5FD_open(): open failed major: Virtual File Layer minor: Unable to initialize object - #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + #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/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in index 203bfef..50758b5 100644 --- a/tools/test/h5copy/testh5copy.sh.in +++ b/tools/test/h5copy/testh5copy.sh.in @@ -60,6 +60,7 @@ $SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5 # List of expect files that will be copied over to local test dir LIST_OTHER_TEST_FILES=" $SRC_H5COPY_TESTFILES/h5copy_misc1.out +$SRC_H5COPY_TESTFILES/h5copy_misc1.err " H5COPY=../../src/h5copy/h5copy # The tool name @@ -396,6 +397,7 @@ CMP_OUTPUT() TOOLTEST_FAIL() { expectout="$TESTDIR/$1" + expecterr="$TESTDIR/`basename $1 .out`.err" actualout="$TESTDIR/$1.actualout" actualerr="$TESTDIR/$1.actualerr" actualout_sav=${actualout}-sav @@ -426,10 +428,7 @@ TOOLTEST_FAIL() echo " PASSED" # Verifying output text from h5copy if [ "$expectout" != "SKIP" ]; then - # combine stderr to stdout to compare the output at once. - # We may seperate stdout and stderr later. - cat $actualerr >> $actualout - CMP_OUTPUT $expectout $actualout + CMP_OUTPUT $expecterr $actualerr fi else echo "*FAILED*" diff --git a/tools/test/h5diff/h5diff_plugin.sh.in b/tools/test/h5diff/h5diff_plugin.sh.in index 212f5d6..341cba5 100644 --- a/tools/test/h5diff/h5diff_plugin.sh.in +++ b/tools/test/h5diff/h5diff_plugin.sh.in @@ -62,6 +62,7 @@ LIST_HDF5_TEST_FILES=" $SRC_H5DIFF_TESTFILES/tudfilter.h5 $SRC_H5DIFF_TESTFILES/tudfilter2.h5 $SRC_H5DIFF_TESTFILES/h5diff_ud.txt +$SRC_H5DIFF_TESTFILES/h5diff_udfail.err $SRC_H5DIFF_TESTFILES/h5diff_udfail.txt " @@ -204,7 +205,7 @@ VERIFY() { TOOLTEST() { expect="$TESTDIR/$1" actual="$TESTDIR/`basename $1 .txt`.out" - actual_err="$TESTDIR/`basename $1 .txt`.err" + actual_err="$TESTDIR/`basename $1 .txt`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -287,6 +288,90 @@ TOOLTEST() { rm -f $actual_sorted $expect_sorted fi } +# Same as TOOLSET except only err file checked +TOOLTEST_ERR() { + expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .txt`.err" + actual="$TESTDIR/`basename $1 .txt`.out" + actual_err="$TESTDIR/`basename $1 .txt`.out.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + if test -n "$pmode"; then + RUNCMD=$RUNPARALLEL + else + RUNCMD=$RUNSERIAL + fi + + # Run test. + TESTING $H5DIFF $@ + ( + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" + ) >$actual 2>$actual_err + EXIT_CODE=$? + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + # don't add exit code check in pmode, as it causes failure. (exit code + # is from mpirun not tool) + # if any problem occurs relate to an exit code, it will be caught in + # serial mode, so the test is fullfilled. + if test $h5haveexitcode = 'yes' -a -z "$pmode"; then + echo "EXIT CODE: $EXIT_CODE" >> $actual + fi + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expect_err $actual_err; then + echo " PASSED" + elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then + echo "*FAILED*" + echo " Expected result ($expect_err) differs from actual result ($actual_err)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /' + else + # parallel mode output are often of different ordering from serial + # output. If the sorted expect_err and actual_err files compare the same, + # it is safe to assume the actual output match the expected file. + expect_sorted=expect_sorted + actual_sorted=actual_sorted + sort $expect_err -o $expect_sorted + sort $actual_err -o $actual_sorted + mv $expect_sorted.noexit $expect_sorted + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi + fi + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual_sorted $expect_sorted + fi +} ############################################################################## ### T H E T E S T S diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index c464f94..557d2ff 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -226,6 +226,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_451.txt $SRC_H5DIFF_TESTFILES/h5diff_452.txt $SRC_H5DIFF_TESTFILES/h5diff_453.txt $SRC_H5DIFF_TESTFILES/h5diff_454.txt +$SRC_H5DIFF_TESTFILES/dangling_link.err $SRC_H5DIFF_TESTFILES/h5diff_455.txt $SRC_H5DIFF_TESTFILES/h5diff_456.txt $SRC_H5DIFF_TESTFILES/h5diff_457.txt @@ -286,6 +287,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_62.txt $SRC_H5DIFF_TESTFILES/h5diff_63.txt $SRC_H5DIFF_TESTFILES/h5diff_600.txt $SRC_H5DIFF_TESTFILES/h5diff_601.txt +$SRC_H5DIFF_TESTFILES/h5diff_601_ERR.err $SRC_H5DIFF_TESTFILES/h5diff_603.txt $SRC_H5DIFF_TESTFILES/h5diff_604.txt $SRC_H5DIFF_TESTFILES/h5diff_605.txt @@ -462,8 +464,9 @@ TESTING() { # TOOLTEST() { expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .txt`.err" actual="$TESTDIR/`basename $1 .txt`.out" - actual_err="$TESTDIR/`basename $1 .txt`.err" + actual_err="$TESTDIR/`basename $1 .txt`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -488,7 +491,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 42e4b07..af5d547 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -490,7 +490,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -534,7 +533,6 @@ TOOLTEST2() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -593,7 +591,6 @@ TOOLTEST2A() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -660,7 +657,6 @@ TOOLTEST2B() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expectdata ]; then # Create the expect data file if it doesn't yet exist. @@ -717,7 +713,6 @@ TOOLTEST3() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -776,7 +771,6 @@ TOOLTEST4() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - #cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -842,7 +836,6 @@ TOOLTEST5() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - #cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -886,7 +879,6 @@ TOOLTEST_HELP() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expectdata ]; then # Create the expect data file if it doesn't yet exist. diff --git a/tools/test/h5dump/testh5dumppbits.sh.in b/tools/test/h5dump/testh5dumppbits.sh.in index 9cf5c99..febce2c 100644 --- a/tools/test/h5dump/testh5dumppbits.sh.in +++ b/tools/test/h5dump/testh5dumppbits.sh.in @@ -235,7 +235,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -278,7 +277,6 @@ TOOLTEST2() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -348,7 +346,6 @@ TOOLTEST3() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -406,7 +403,6 @@ TOOLTEST4() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - #cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in index 585d389..2cdd445 100644 --- a/tools/test/h5format_convert/testh5fc.sh.in +++ b/tools/test/h5format_convert/testh5fc.sh.in @@ -103,13 +103,18 @@ $SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.h5 $SRC_H5FORMCONV_TESTFILES/h5fc_err_level.h5 " +LIST_ERR_TEST_FILES=" +$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl.err +$SRC_H5FORMCONV_TESTFILES/h5fc_dname.err +$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl.err +$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl.err +" + LIST_OTHER_TEST_FILES=" $SRC_H5FORMCONV_TESTFILES/h5fc_help.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_nooption.ddl -$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_dname.ddl -$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_non_chunked.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_bt1.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl @@ -137,7 +142,7 @@ $SRC_H5FORMCONV_TESTFILES/h5fc_v_err.ddl.err # # copy test files and expected output files from source dirs to test dir # -COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES" +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES" COPY_TESTFILES_TO_TESTDIR() { @@ -193,6 +198,9 @@ TESTING() { echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012' } +# Source in the output filter function definitions. +. $srcdir/../../../bin/output_filter.sh + # Run a test and print PASS or *FAIL*. If a test fails then increment # the `nerrors' global variable and (if $verbose is set) display the # difference between the actual output and the expected output. The @@ -212,8 +220,9 @@ TESTING() { TOOLTEST_OUT() { # Prepare expected and actual output expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .ddl`.err" actual="$TESTDIR/`basename $1 .ddl`.out" - actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav @@ -233,7 +242,6 @@ TOOLTEST_OUT() { ) >$actual 2>$actual_err cp $actual $actual_sav cp $actual_err $actual_err_sav - cat $actual_err >> $actual # Compare output COMPARE_OUT $expect $actual @@ -251,7 +259,7 @@ TOOLTEST_MASK_OUT() { expect_err="$TESTDIR/$1.err" actual_ext="$TESTDIR/$1.ext" actual="$TESTDIR/`basename $1 .ddl`.out" - actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav @@ -305,6 +313,42 @@ TOOLTEST_MASK_OUT() { $RM $actual $actual_err $actual_sav $actual_err_sav fi } +# Same as TOOLTEST_OUT except only compares error outout +TOOLTEST_ERR() { + # Prepare expected and actual output + expect="$TESTDIR/$1" + expect_err="$TESTDIR/$1.err" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + + # Prepare the test file + $RM $TESTDIR/$TMPOUTFILE + TFILE=$2 + if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then + $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE + TFILE=$TMPOUTFILE + fi + + # Run test. + TESTING $FORMCONV $3 $4 $5 $6 $2 + ( + cd $TESTDIR + $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE + ) >$actual 2>$actual_err + cp $actual $actual_sav + cp $actual_err $actual_err_sav + + # Compare output + COMPARE_OUT $expect_err $actual_err + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + $RM $actual $actual_err + $RM $actual $actual_err $actual_sav $actual_err_sav + fi +} # To check that the tool exits success, no output # Assume all short options @@ -406,7 +450,7 @@ COPY_TESTFILES_TO_TESTDIR # h5format_convert nonexist.h5 (no options, file does not exist) TOOLTEST_OUT h5fc_help.ddl '' --help TOOLTEST_OUT h5fc_nooption.ddl '' -TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5 +TOOLTEST_ERR h5fc_nonexistfile.ddl nonexist.h5 # # # h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists) @@ -416,7 +460,7 @@ TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5 TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname TOOLTEST_OUT h5fc_dname.ddl '' --dname -TOOLTEST_OUT h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist +TOOLTEST_ERR h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist # # # diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in index 8c6551b..353f1bb 100644 --- a/tools/test/h5ls/testh5ls.sh.in +++ b/tools/test/h5ls/testh5ls.sh.in @@ -53,6 +53,7 @@ SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles" SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles" SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles" SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles" +SRC_H5LS_ERRFILES="$SRC_TOOLS/test/h5ls/errfiles" TESTDIR=./testfiles test -d $TESTDIR || mkdir $TESTDIR @@ -93,6 +94,12 @@ $SRC_H5LS_TESTFILES/tvldtypes1.h5 $SRC_H5LS_TESTFILES/tdset_idx.h5 " +LIST_ERROR_TEST_FILES=" +$SRC_H5LS_ERRFILES/nosuchfile.err +$SRC_H5LS_ERRFILES/textlinksrc-nodangle-1.err +$SRC_H5LS_ERRFILES/tgroup-1.err +" + LIST_OTHER_TEST_FILES=" $SRC_H5LS_TESTFILES/help-1.ls $SRC_H5LS_TESTFILES/help-2.ls @@ -228,8 +235,9 @@ TESTING() { # $2 and on -- argument for the h5ls tool TOOLTEST() { expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .ls`.err" actual="$TESTDIR/`basename $1 .ls`.out" - actual_err="$TESTDIR/`basename $1 .ls`.err" + actual_err="$TESTDIR/`basename $1 .ls`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -251,7 +259,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in index 0a5127f..69b856e 100644 --- a/tools/test/h5stat/testh5stat.sh.in +++ b/tools/test/h5stat/testh5stat.sh.in @@ -79,6 +79,18 @@ $SRC_H5STAT_TESTFILES/h5stat_idx.h5 $SRC_H5STAT_TESTFILES/h5stat_threshold.h5 " +LIST_ERR_TEST_FILES=" +$SRC_H5STAT_TESTFILES/h5stat_err_refcount.err +$SRC_H5STAT_TESTFILES/h5stat_err_old_layout.err +$SRC_H5STAT_TESTFILES/h5stat_err_old_fill.err +$SRC_H5STAT_TESTFILES/h5stat_err1_links.err +$SRC_H5STAT_TESTFILES/h5stat_err1_dims.err +$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.err +$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.err +$SRC_H5STAT_TESTFILES/h5stat_notexist.err +$SRC_H5STAT_TESTFILES/h5stat_nofile.err +" + LIST_OTHER_TEST_FILES=" $SRC_H5STAT_TESTFILES/h5stat_err_refcount.ddl $SRC_H5STAT_TESTFILES/h5stat_err_old_layout.ddl @@ -100,17 +112,13 @@ $SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl $SRC_H5STAT_TESTFILES/h5stat_idx.ddl -$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl $SRC_H5STAT_TESTFILES/h5stat_links1.ddl $SRC_H5STAT_TESTFILES/h5stat_links2.ddl $SRC_H5STAT_TESTFILES/h5stat_links3.ddl $SRC_H5STAT_TESTFILES/h5stat_links4.ddl $SRC_H5STAT_TESTFILES/h5stat_links5.ddl -$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl $SRC_H5STAT_TESTFILES/h5stat_dims1.ddl $SRC_H5STAT_TESTFILES/h5stat_dims2.ddl -$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl -$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl @@ -120,7 +128,7 @@ $SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl # # copy test files and expected output files from source dirs to test dir # -COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES" +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES" COPY_TESTFILES_TO_TESTDIR() { @@ -184,8 +192,9 @@ TESTING() { # TOOLTEST() { expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .ddl`.err" actual="$TESTDIR/`basename $1 .ddl`.out" - actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -202,14 +211,17 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Compare error files if the expect file doesn't exist. + if $CMP $expect_err $actual_err; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.err) differs from actual result (*.out.err)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /' + fi elif $CMP $expect $actual; then echo " PASSED" else diff --git a/tools/test/misc/testh5clear.sh.in b/tools/test/misc/testh5clear.sh.in index 11c2ff9..3f2b32f 100644 --- a/tools/test/misc/testh5clear.sh.in +++ b/tools/test/misc/testh5clear.sh.in @@ -62,10 +62,10 @@ test -d $TESTDIR || mkdir -p $TESTDIR # copy test files and expected output files from source dirs to test dir # COPY_TESTFILES=" +$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.err +$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.err $SRC_H5CLEAR_TESTFILES/h5clear_usage.ddl -$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.ddl $SRC_H5CLEAR_TESTFILES/h5clear_missing_file.ddl -$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.ddl $SRC_H5CLEAR_TESTFILES/h5clear_status_noclose_after_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_noclose_before_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_noclose_after_size.ddl @@ -179,8 +179,9 @@ TOOLTEST_OUT() { expected=$5 # Prepare expected and actual output expect="$TESTDIR/$expected" + expect_err="$TESTDIR/`basename $expected .ddl`.err" actual="$TESTDIR/`basename $expected .ddl`.out" - actual_err="$TESTDIR/`basename $expected .ddl`.err" + actual_err="$TESTDIR/`basename $expected .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav @@ -192,7 +193,6 @@ TOOLTEST_OUT() { ) >$actual 2>$actual_err cp $actual $actual_sav cp $actual_err $actual_err_sav - cat $actual_err >> $actual # Compare output COMPARE_OUT $expect $actual @@ -202,6 +202,38 @@ TOOLTEST_OUT() { $RM $actual $actual_err $actual_sav $actual_err_sav fi } +# same as TOOLTEST_OUT just compare stderr +TOOLTEST_ERR() { + fname=$1 + option1=$2 + option2=$3 + option3=$4 + expected=$5 + # Prepare expected and actual output + expect_err="$TESTDIR/$expected" + expect="$TESTDIR/`basename $expected .err`.ddl" + actual="$TESTDIR/`basename $expected .err`.out" + actual_err="$TESTDIR/`basename $expected .err`.out.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + + # Run test. + TESTING $H5CLEAR $option1 $option2 $option3 $option4 $fname + ( + cd $TESTDIR + $RUNSERIAL $H5CLEAR_BIN $option1 $option2 $option3 $option4 $fname + ) >$actual 2>$actual_err + cp $actual $actual_sav + cp $actual_err $actual_err_sav + + # Compare output + COMPARE_OUT $expect_err $actual_err + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + $RM $actual $actual_err $actual_sav $actual_err_sav + fi +} # $1 is the filename to open # $2 is the expected return from the open/check program @@ -274,11 +306,11 @@ TOOLTEST_OUT "" "" "" "" h5clear_usage.ddl TOOLTEST_OUT junk.h5 "" "" "" h5clear_usage.ddl TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" "" h5clear_usage.ddl TOOLTEST_OUT "" -m "" "" h5clear_missing_file.ddl -TOOLTEST_OUT junk.h5 -s "" "" h5clear_open_fail.ddl +TOOLTEST_ERR junk.h5 -s "" "" h5clear_open_fail.err TOOLTEST_OUT "" -m -s "" h5clear_missing_file.ddl -TOOLTEST_OUT junk.h5 -m -s "" h5clear_open_fail.ddl -TOOLTEST_OUT orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.ddl -TOOLTEST_OUT orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.ddl +TOOLTEST_ERR junk.h5 -m -s "" h5clear_open_fail.err +TOOLTEST_ERR orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.err +TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err # # # The following are tests to verify the expected exit code from h5clear: @@ -308,8 +340,8 @@ TOOLTEST h5clear_sec2_v0.h5 -l -m $FAIL # # # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: -TOOLTEST_OUT mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.ddl -TOOLTEST_OUT mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.ddl +TOOLTEST_ERR mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.err +TOOLTEST_ERR mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.err # # # @@ -342,16 +374,16 @@ OPEN_CHK h5clear_sec2_v2.h5 $SUCCEED # # # -# (1) h5clear_status_noclose.h5 +# (1) h5clear_status_noclose.h5 # "h5clear --filesize h5clear_status_noclose.h5" (unable to open the file because status_flag is on) -# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) +# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) # (no output, check exit code) # "h5clear --filesize h5clear_status_noclose_user.h5" (print EOA/EOF after the last action) -TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.ddl +TOOLTEST_ERR h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.err TOOLTEST h5clear_status_noclose.h5 -s --increment=0 $SUCCEED TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_status_noclose_after_size.ddl # -# (2) h5clear_fsm_persist_noclose.h5 +# (2) h5clear_fsm_persist_noclose.h5 # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action) # "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action) @@ -364,7 +396,7 @@ TOOLTEST_OUT h5clear_fsm_persist_noclose.h5 --filesize "" "" h5clear_noclose_aft # "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_before_size.ddl -TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED +TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_size.ddl # # (4) h5clear_fsm_persist_greater.h5 @@ -372,7 +404,7 @@ TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_s # "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_before_size.ddl -TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_after_size.ddl # # (5) h5clear_fsm_persist_less.h5 @@ -380,7 +412,7 @@ TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_aft # "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_before_size.ddl -TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_size.ddl # # (6) h5clear_fsm_persist_user_equal.h5 @@ -388,7 +420,7 @@ TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_siz # "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_before_size.ddl -TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED +TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_after_size.ddl # # (7) h5clear_fsm_persist_user_greater.h5 @@ -396,7 +428,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equ # "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_before_size.ddl -TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_after_size.ddl # # (8) h5clear_fsm_persist_user_less.h5 @@ -404,7 +436,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_g # "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_before_size.ddl -TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_after_size.ddl # # -- cgit v0.12 From 962f35e761e7a40feae7941340c5608d5b54bdac Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 7 Dec 2018 16:02:00 -0600 Subject: Add stamp files for generated files --- src/CMakeLists.txt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd81ba5..12b7db0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -954,6 +954,8 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} COMMAND ${CMAKE_COMMAND} ARGS -E echo "Executed batch command to create H5Tinit.c" + COMMAND ${CMAKE_COMMAND} + ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) @@ -965,7 +967,10 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + COMMAND ${CMAKE_COMMAND} + ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () @@ -974,6 +979,8 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) @@ -982,7 +989,10 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + COMMAND ${CMAKE_COMMAND} + ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) endif () @@ -1003,6 +1013,8 @@ add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c + COMMAND ${CMAKE_COMMAND} + ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2 DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) @@ -1012,7 +1024,10 @@ if (BUILD_SHARED_LIBS) OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c" + COMMAND ${CMAKE_COMMAND} + ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2 DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c + WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () @@ -1025,8 +1040,8 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) +add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) -add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS}) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" @@ -1055,8 +1070,8 @@ set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) + add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2) - add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS}) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories(${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -- cgit v0.12 From 7ffba76bc372cec11739b2afa578138129876e7e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 10 Dec 2018 16:52:34 -0600 Subject: HDFVIEW-4 add datatype read to H5A like H5D --- java/src/hdf/hdf5lib/H5.java | 377 ++++++-- java/src/jni/h5aImp.c | 1185 +++++++++++++++++++++++--- java/src/jni/h5aImp.h | 160 +++- java/src/jni/h5dImp.h | 2 +- java/test/testfiles/JUnit-TestH5Edefault.txt | 26 +- 5 files changed, 1549 insertions(+), 201 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index f9f9b65..8b40e2c 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -852,7 +852,8 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public static long H5Aget_space(long attr_id) throws HDF5LibraryException { + public static long H5Aget_space(long attr_id) throws HDF5LibraryException + { long id = _H5Aget_space(attr_id); if (id > 0) { log.trace("OPEN_IDS: H5Aget_space add {}", id); @@ -888,7 +889,8 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public static long H5Aget_type(long attr_id) throws HDF5LibraryException { + public static long H5Aget_type(long attr_id) throws HDF5LibraryException + { long id = _H5Aget_type(attr_id); if (id > 0) { log.trace("OPEN_IDS: H5Aget_type add {}", id); @@ -918,8 +920,9 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - Name is null. **/ - public static long H5Aopen(long obj_id, String attr_name, long aapl_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Aopen(long obj_id, String attr_name, long aapl_id) + throws HDF5LibraryException, NullPointerException + { long id = _H5Aopen(obj_id, attr_name, aapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Aopen add {}", id); @@ -959,7 +962,8 @@ public class H5 implements java.io.Serializable { * - Name is null. **/ public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id, - long lapl_id) throws HDF5LibraryException, NullPointerException { + long lapl_id) throws HDF5LibraryException, NullPointerException + { long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Aopen_by_idx add {}", id); @@ -994,7 +998,8 @@ public class H5 implements java.io.Serializable { * - obj_name is null. **/ public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id) - throws HDF5LibraryException, NullPointerException { + throws HDF5LibraryException, NullPointerException + { long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Aopen_by_name add {}", id); @@ -1015,8 +1020,10 @@ public class H5 implements java.io.Serializable { * IN: Identifier of an attribute to read. * @param mem_type_id * IN: Identifier of the attribute datatype (in memory). - * @param buf - * IN: Buffer for data to be read. + * @param obj + * Buffer to store data read from the file. + * @param isCriticalPinning + * request lock on data reference. * * @return a non-negative value if successful * @@ -1025,9 +1032,19 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - data buffer is null. **/ - public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] buf) + public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] obj, boolean isCriticalPinning) throws HDF5LibraryException, NullPointerException; + public synchronized static int H5Aread(long attr_id, long mem_type_id, byte[] buf) throws HDF5LibraryException, NullPointerException + { + return H5Aread(attr_id, mem_type_id, buf, true); + } + + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + { + return H5Aread(attr_id, mem_type_id, obj, true); + } + /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with * mem_type_id. The entire attribute is read into data object from the file. @@ -1038,31 +1055,146 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the attribute datatype (in memory). * @param obj * IN: Object for data to be read. + * @param isCriticalPinning + * request lock on data reference. * * @return a non-negative value if successful * + * @exception HDF5Exception + * - Failure in the data conversion. * @exception HDF5LibraryException * - Error from the HDF-5 Library. * @exception NullPointerException * - data buffer is null. See public synchronized static native int H5Aread( ) **/ - public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, - NullPointerException { - HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.emptyBytes(); + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException + { + int status = -1; + boolean is1D = false; - // This will raise an exception if there is an error - int status = H5Aread(attr_id, mem_type_id, buf); + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Aread: data is not an array")); + } - // No exception: status really ought to be OK - if (status >= 0) { - obj = theArray.arrayify(buf); + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + log.trace("H5Aread: cname={} is1D={} dname={}", cname, is1D, dname); + + if (is1D && (dname == 'B')) { + log.trace("H5Aread_dname_B"); + status = H5Aread(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + log.trace("H5Aread_dname_S"); + status = H5Aread_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + log.trace("H5Aread_dname_I"); + status = H5Aread_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + log.trace("H5Aread_dname_J"); + status = H5Aread_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'F')) { + log.trace("H5Aread_dname_F"); + status = H5Aread_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + log.trace("H5Aread_dname_D"); + status = H5Aread_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning); + } + else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) { + log.trace("H5Aread_reg_ref"); + status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Aread_string type"); + status = H5Aread_string(attr_id, mem_type_id, (String[]) obj); + } + else { + // Create a data buffer to hold the data into a Java Array + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + log.trace("H5Aread_else"); + + // This will raise an exception if there is an error + status = H5Aread(attr_id, mem_type_id, buf, isCriticalPinning); + + // No exception: status really ought to be OK + if (status >= 0) { + obj = theArray.arrayify(buf); + } + + // clean up these: assign 'null' as hint to gc() + buf = null; + theArray = null; } return status; } - public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf) + public synchronized static native int H5Aread_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_double(long attr_id, long mem_type_id, double[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_double(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_float(long attr_id, long mem_type_id, float[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_float(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_int(long attr_id, long mem_type_id, int[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_int(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_long(long attr_id, long mem_type_id, long[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_long(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Aread_reg_ref(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Aread_reg_ref_data(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Aread_short(long attr_id, long mem_type_id, short[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Aread_short(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Aread_string(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Aread_VLStrings(long attr_id, long mem_type_id, Object[] buf) throws HDF5LibraryException, NullPointerException; public synchronized static native int H5AreadComplex(long attr_id, long mem_type_id, String[] buf) @@ -1123,7 +1255,9 @@ public class H5 implements java.io.Serializable { * @param mem_type_id * IN: Identifier of the attribute datatype (in memory). * @param buf - * IN: Data to be written. + * IN: Buffer with data to be written to the file. + * @param isCriticalPinning + * IN: request lock on data reference. * * @return a non-negative value if successful * @@ -1132,9 +1266,21 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - data is null. **/ - public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf) + public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf, boolean isCriticalPinning) throws HDF5LibraryException, NullPointerException; + public synchronized static int H5Awrite(long attr_id, long mem_type_id, byte[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite(attr_id, mem_type_id, buf, true); + } + + public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj) + throws HDF5Exception, HDF5LibraryException, NullPointerException + { + return H5Awrite(attr_id, mem_type_id, obj, true); + } + /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with * mem_type_id. The entire attribute is written from data object to the file. @@ -1145,28 +1291,140 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the attribute datatype (in memory). * @param obj * IN: Data object to be written. + * @param isCriticalPinning + * request lock on data reference. * * @return a non-negative value if successful * + * @exception HDF5Exception + * - Failure in the data conversion. * @exception HDF5LibraryException * - Error from the HDF-5 Library. * @exception NullPointerException - * - data object is null. See public synchronized static native int H5Awrite(int attr_id, int - * mem_type_id, byte[] buf); + * - data object is null **/ - public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj) - throws HDF5Exception, NullPointerException + public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException { - HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.byteify(); + int status = -1; + boolean is1D = false; - int retVal = H5Awrite(attr_id, mem_type_id, buf); - buf = null; - theArray = null; - return retVal; + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Dwrite: data is not an array")); + } + + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + + if (is1D && (dname == 'B')) { + status = H5Awrite(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + status = H5Awrite_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + status = H5Awrite_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + status = H5Awrite_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'F')) { + status = H5Awrite_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + status = H5Awrite_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Dwrite_string type"); + status = H5Awrite_string(attr_id, mem_type_id, (String[]) obj); + } + else { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + status = H5Awrite(attr_id, mem_type_id, buf); + buf = null; + theArray = null; + } + + return status; + } + + public synchronized static native int H5Awrite_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_double(long attr_id, long mem_type_id, double[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_double(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_float(long attr_id, long mem_type_id, float[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_float(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_int(long attr_id, long mem_type_id, int[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_int(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_long(long attr_id, long mem_type_id, long[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_long(attr_id, mem_type_id, buf, true); + } + + public synchronized static native int H5Awrite_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Awrite_short(long attr_id, long mem_type_id, short[] buf) + throws HDF5LibraryException, NullPointerException + { + return H5Awrite_short(attr_id, mem_type_id, buf, true); } - public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, String[] buf) + public synchronized static native int H5Awrite_string(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Awrite_VLStrings writes a variable length String dataset, specified by its identifier attr_id, from + * the application memory buffer buf into the file. + * + * ---- contributed by Rosetta Biosoftware + * + * @param attr_id + * Identifier of the attribute read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param buf + * Buffer with data to be written to the file. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + + public synchronized static native int H5Awrite_VLStrings(long attr_id, long mem_type_id, Object[] buf) throws HDF5LibraryException, NullPointerException; /** @@ -1614,8 +1872,8 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, NullPointerException + { long id = _H5Dopen2(loc_id, name, dapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Dopen add {}", id); @@ -1664,12 +1922,14 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + { return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); } @@ -1703,7 +1963,8 @@ public class H5 implements java.io.Serializable { **/ public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, - NullPointerException { + NullPointerException + { int status = -1; boolean is1D = false; @@ -1734,7 +1995,8 @@ public class H5 implements java.io.Serializable { } else if (is1D && (dname == 'J')) { log.trace("H5Dread_dname_J"); - status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj); + status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj, + isCriticalPinning); } else if (is1D && (dname == 'F')) { log.trace("H5Dread_dname_F"); @@ -1783,7 +2045,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1792,7 +2055,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1801,7 +2065,8 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1810,7 +2075,8 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1825,7 +2091,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -1929,12 +2196,14 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + { return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); } @@ -1968,7 +2237,8 @@ public class H5 implements java.io.Serializable { **/ public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, - NullPointerException { + NullPointerException + { int status = -1; boolean is1D = false; @@ -2031,7 +2301,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2040,7 +2311,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2049,7 +2321,8 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2058,7 +2331,8 @@ public class H5 implements java.io.Serializable { NullPointerException; public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } @@ -2067,7 +2341,8 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException + { return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index aba2240..68f203e 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -60,6 +60,94 @@ static herr_t H5AreadVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectAr static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data); +/********************/ +/* Local Macros */ +/********************/ + +#define PIN_BYTE_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jbyte*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_BYTE_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_SHORT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jshort*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetShortArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_SHORT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseShortArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_INT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jint*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetIntArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_INT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseIntArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_LONG_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jlong*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetLongArrayElements(ENVPAR buf,&isCopy); \ +} + +#define UNPIN_LONG_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_FLOAT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jfloat*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetFloatArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_FLOAT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseFloatArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_DOUBLE_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jdouble*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetDoubleArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_DOUBLE_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseDoubleArrayElements(ENVPAR buf, buffP, mode); \ +} + /* * Class: hdf_hdf5lib_H5 @@ -129,36 +217,129 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1idx return (jlong)attr_id; } /* end Java_hdf_hdf5lib_H5__1H5Aopen_1idx */ +static htri_t +H5Tdetect_variable_str + (hid_t tid) { + htri_t ret_val = 0; + + if (H5Tget_class(tid) == H5T_COMPOUND) { + unsigned i; + unsigned nm = (unsigned)H5Tget_nmembers(tid); + for(i = 0; i < nm; i++) { + htri_t status = 0; + hid_t mtid = 0; + if((mtid = H5Tget_member_type(tid, i)) < 0) + return -1; /* exit immediately on error */ + if((status = H5Tdetect_variable_str(mtid)) < 0) + return status; /* exit immediately on error */ + ret_val |= status; + H5Tclose (mtid); + } /* end for */ + } /* end if */ + else + ret_val = H5Tis_variable_str(tid); + + return ret_val; +} /* end H5Tdetect_variable_str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread + * Signature: (JJ[BZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument( env,"H5Aread: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Aread: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Aread: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread: buf does not support variable length type"); + } /* end else if */ + else { + PIN_BYTE_ARRAY(); + + if (buffP == NULL) { + h5JNIFatalError(env, "H5Aread: buf not pinned"); + } /* end if */ + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, buffP); + if (status < 0) { + UNPIN_BYTE_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_BYTE_ARRAY(0); /* update java buffer for return */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread */ + /* * Class: hdf_hdf5lib_H5 * Method: H5Awrite - * Signature: (JJ[B)I + * Signature: (JJ[BZ)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite - (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf) + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning) { herr_t status = -1; - jbyte *byteP; + jbyte *buffP; jboolean isCopy; + htri_t data_class; if (buf == NULL) { h5nullArgument( env,"H5Awrite: buf is NULL"); } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Awrite: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite: buf does not support variable length type"); + } /* end else if */ else { - byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); - if (byteP == NULL) { - h5JNIFatalError(env,"H5Awrite: buf is not pinned"); + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Awrite: H5Tdetect_variable_str() failed"); } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite: buf does not support variable length type"); + } /* end else if */ else { - status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, byteP); + PIN_BYTE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Awrite: buf not pinned"); + } /* end if */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP); - /* free the buffer without copying back */ - ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); + UNPIN_BYTE_ARRAY(JNI_ABORT); /* no need to update buffer */ - if (status < 0) - h5libraryError(env); - } + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ } /* end else */ return (jint)status; @@ -166,190 +347,653 @@ Java_hdf_hdf5lib_H5_H5Awrite /* * Class: hdf_hdf5lib_H5 - * Method: H5Aread - * Signature: (JJ[B)I + * Method: H5Aread_short + * Signature: (JJ[SZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Aread - (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf) +Java_hdf_hdf5lib_H5_H5Aread_1short + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning) { herr_t status = -1; - jbyte *byteP; + jshort *buffP; jboolean isCopy; + htri_t data_class; if (buf == NULL) { - h5nullArgument( env,"H5Aread: buf is NULL"); + h5nullArgument(env, "H5Aread_short: buf is NULL"); } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Aread: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_short: buf does not support variable length type"); + } /* end else if */ else { - byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); - if (byteP == NULL) { - h5JNIFatalError( env,"H5Aread: buf is not pinned"); + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Aread_short: H5Tdetect_variable_str() failed"); } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_short: buf does not support variable length type"); + } /* end else if */ else { - status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, byteP); - if (status < 0) { - ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); - h5libraryError(env); + PIN_SHORT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Aread_short: buf not pinned"); } /* end if */ - else { - ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, 0); + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, buffP); + + if (status < 0) { + UNPIN_SHORT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_SHORT_ARRAY(0); + } /* end else */ } /* end else */ } /* end else */ } /* end else */ return (jint)status; -} /* end Java_hdf_hdf5lib_H5_H5Aread */ +} /* end Java_hdf_hdf5lib_H5_H5Aread_1short */ /* * Class: hdf_hdf5lib_H5 - * Method: H5AwriteVL - * Signature: (JJ[Ljava/lang/String;)I + * Method: H5Awrite_short + * Signature: (JJ[SZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5AwriteVL - (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +Java_hdf_hdf5lib_H5_H5Awrite_1short + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning) { - herr_t status = -1; - htri_t isStr = 0; - htri_t isVlenStr = 0; - htri_t isComplex = 0; + herr_t status = -1; + jshort *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL ) { + h5nullArgument(env, "H5Awrite_short: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Awrite_short: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_short: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Awrite_short: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_short: buf does not support variable length type"); + } /* end else if */ + else { + PIN_SHORT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Awrite_short: buf not pinned"); + } /* end if */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP); + + UNPIN_SHORT_ARRAY(JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite_1short */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_int + * Signature: (JJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1int + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jint *buffP; + jboolean isCopy; + htri_t data_class; if (buf == NULL) { - h5nullArgument(env, "H5AwriteVL: buf is NULL"); + h5nullArgument(env, "H5Aread_int: buf is NULL"); } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Aread_int: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_int: buf does not support variable length type"); + } /* end else if */ else { - isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING); - if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) { - unsigned i; - int nm = H5Tget_nmembers(mem_type_id); - for(i = 0; i 0 || isVlenStr) { - status = H5AwriteVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf); - } - else if (isStr > 0) { - status = H5AwriteVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf); - } + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Aread_int: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_int: buf does not support variable length type"); + } /* end else if */ + else { + PIN_INT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Aread_int: buf not pinned"); + } /* end if */ + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, buffP); + + if (status < 0) { + UNPIN_INT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_INT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ } /* end else */ return (jint)status; -} /* end Java_hdf_hdf5lib_H5_H5Awrite_1VL */ +} /* end Java_hdf_hdf5lib_H5_H5Aread_1int */ -herr_t -H5AwriteVL_str - (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_int + * Signature: (JJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1int + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning) { - herr_t status = -1; - char **wdata; - jsize size; - jint i; + herr_t status = -1; + jint *buffP; + jboolean isCopy; + htri_t data_class; - size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf); + if (buf == NULL) { + h5nullArgument(env, "H5Awrite_int: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Awrite_int: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_int: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Awrite_int: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_int: buf does not support variable length type"); + } /* end else if */ + else { + PIN_INT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Awrite_int: buf not pinned"); + } /* end if */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP); - wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*)); - if (!wdata) { - h5JNIFatalError(env, "H5AwriteVL_str: cannot allocate buffer"); + UNPIN_INT_ARRAY(JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_long + * Signature: (JJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1long + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jlong *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Aread_long: buf is NULL"); } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Aread_long: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_long: buf does not support variable length type"); + } /* end else if */ else { - HDmemset(wdata, 0, (size_t)size * sizeof(char*)); - for (i = 0; i < size; ++i) { - jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) buf, i); - if (obj != 0) { - jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); - const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Aread_long: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_long: buf does not support variable length type"); + } /* end else if */ + else { + PIN_LONG_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Aread_long: buf not pinned"); + } /* end if */ + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, buffP); - if (utf8) { - wdata[i] = (char*)HDmalloc((size_t)length + 1); - if (wdata[i]) { - HDmemset(wdata[i], 0, ((size_t)length + 1)); - HDstrncpy(wdata[i], utf8, (size_t)length); - } /* end if */ + if (status < 0) { + UNPIN_LONG_ARRAY(JNI_ABORT); + h5libraryError(env); } /* end if */ + else { + UNPIN_LONG_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ - ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); - ENVPTR->DeleteLocalRef(ENVPAR obj); + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_long + * Signature: (JJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1long + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jlong *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Awrite_long: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_long: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Awrite_long: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_long: buf does not support variable length type"); + } /* end else if */ + else { + PIN_LONG_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Awrite_long: buf not pinned"); } /* end if */ - } /* end for (i = 0; i < size; ++i) */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP); - status = H5Awrite((hid_t)aid, (hid_t)tid, wdata); + UNPIN_LONG_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ - for (i = 0; i < size; i++) { - if(wdata[i]) { - HDfree(wdata[i]); + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_float + * Signature: (JJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1float + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jfloat *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Aread_float: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_float: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_float: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Aread_float: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_float: buf does not support variable length type"); + } /* end else if */ + else { + PIN_FLOAT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Aread_float: buf not pinned"); } /* end if */ - } /* end for */ - HDfree(wdata); + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, buffP); + + if (status < 0) { + UNPIN_FLOAT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_FLOAT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread_1float */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_float + * Signature: (JJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1float + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jfloat *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Awrite_float: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Awrite_float: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_float: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Awrite_float: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_float: buf does not support variable length type"); + } /* end else if */ + else { + PIN_FLOAT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Awrite_float: buf not pinned"); + } /* end if */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP); + + UNPIN_FLOAT_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite_1float */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_double + * Signature: (JJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1double + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jdouble *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Aread_double: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Aread_double: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_double: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Aread_double: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Aread_double: buf does not support variable length type"); + } /* end else if */ + else { + PIN_DOUBLE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Aread_double: buf not pinned"); + } /* end if */ + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, buffP); + + if (status < 0) { + UNPIN_DOUBLE_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_DOUBLE_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread_1double */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_double + * Signature: (JJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1double + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jdouble *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Awrite_double: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Awrite_double: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_double: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Awrite_double: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Awrite_double: buf does not support variable length type"); + } /* end else if */ + else { + PIN_DOUBLE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Awrite_double: buf not pinned"); + } /* end if */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, buffP); + + UNPIN_DOUBLE_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite_1double */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_string + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1string + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf) +{ + herr_t status = -1; + char *c_buf; + char *cstr; + size_t str_len; + jsize i; + jsize n; + size_t pos; + jstring jstr; + + c_buf = cstr = NULL; + if (j_buf == NULL) { + h5nullArgument(env, "H5Aread_string: buf is NULL"); + } /* end if */ + else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) { + h5nullArgument(env, "H5Aread_string: buf length <= 0"); + } /* end else if */ + else if ((str_len = H5Tget_size((hid_t)mem_type_id)) <=0) { + h5libraryError(env); + } /* end else if */ + else { + if ((cstr = (char*)HDmalloc(str_len + 1)) == NULL) { + h5JNIFatalError(env, "H5Aread_string: memory allocation failed."); + } /* end if */ + else { + if ((c_buf = (char*)HDmalloc((size_t)n * str_len)) == NULL) { + if (cstr) + HDfree(cstr); + cstr = NULL; + h5JNIFatalError(env, "H5Aread_string: memory allocation failed."); + } /* end if */ + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, c_buf); + + if (status < 0) { + if (cstr) + HDfree(cstr); + cstr = NULL; + if (c_buf) + HDfree(c_buf); + c_buf = NULL; + h5libraryError(env); + } /* end if */ + else { + pos = 0; + for (i = 0; i < n; i++) { + HDmemcpy(cstr, c_buf+pos, str_len); + cstr[str_len] = '\0'; + jstr = ENVPTR->NewStringUTF(ENVPAR cstr); + ENVPTR->SetObjectArrayElement(ENVPAR j_buf, i, jstr); + pos += str_len; + } /* end for */ + } /* end else */ - if (status < 0) - h5libraryError(env); + if (c_buf) + HDfree(c_buf); + } /* end else cbuf allocation*/ + + if (cstr) + HDfree(cstr); + } /* end else cstr allocation*/ } /* end else */ return (jint)status; -} +} /* end Java_hdf_hdf5lib_H5_H5Aread_1string */ -herr_t -H5AwriteVL_asstr - (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_string + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1string + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf) { - char **strs; - jstring jstr; - jint i; - jint n; - hid_t sid; - hsize_t dims[H5S_MAX_RANK]; herr_t status = -1; + char *c_buf; + jsize str_len; + jsize i; + jsize n; - n = ENVPTR->GetArrayLength(ENVPAR buf); - strs =(hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t)); - - if (strs == NULL) { - h5JNIFatalError(env, "H5AwriteVL_asstr: failed to allocate buff for read variable length strings"); + if (j_buf == NULL) { + h5nullArgument(env, "H5Awrite_string: buf is NULL"); } /* end if */ + else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) { + h5nullArgument(env, "H5Awrite_string: buf length <= 0"); + } /* end else if */ + else if ((str_len = (jsize)H5Tget_size((hid_t)mem_type_id)) <=0) { + h5libraryError(env); + } /* end else if */ else { - status = H5Awrite(aid, tid, strs); - - if (status < 0) { - dims[0] = (hsize_t)n; - sid = H5Screate_simple(1, dims, NULL); - H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, strs); - H5Sclose(sid); - HDfree(strs); - h5JNIFatalError(env, "H5AwriteVL_str: failed to read variable length strings"); + if ((c_buf = (char*)HDmalloc((size_t)n * (size_t)str_len)) == NULL) { + h5JNIFatalError(env, "H5Awrite_string: memory allocation failed."); } /* end if */ else { - for (i=0; i < n; i++) { - jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]); - ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); - H5free_memory (strs[i]); + for (i = 0; i < n; i++) { + jstring obj = (jstring)ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)j_buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + HDstrncpy(&c_buf[i * str_len], utf8, str_len); + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ } /* end for */ - /* - for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings, - H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect - free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings - after it is done. - H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs); - */ + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, c_buf); - HDfree(strs); + if (c_buf) + HDfree(c_buf); + c_buf = NULL; + + if (status < 0) { + h5libraryError(env); + } /* end if */ } /* end else */ } /* end else */ - return status; -} /* end H5AwriteVL_str */ + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite_1string */ /* * Class: hdf_hdf5lib_H5 * Method: H5AreadVL - * Signature: (JJJJJ[Ljava/lang/String;)I + * Signature: (JJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadVL @@ -519,6 +1163,285 @@ H5AreadVL_str /* * Class: hdf_hdf5lib_H5 + * Method: H5AwriteVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5AwriteVL + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +{ + herr_t status = -1; + htri_t isStr = 0; + htri_t isVlenStr = 0; + htri_t isComplex = 0; + + if (buf == NULL) { + h5nullArgument(env, "H5AwriteVL: buf is NULL"); + } /* end if */ + else { + isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING); + if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) { + unsigned i; + int nm = H5Tget_nmembers(mem_type_id); + for(i = 0; i 0 || isVlenStr) { + status = H5AwriteVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf); + } + else if (isStr > 0) { + status = H5AwriteVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf); + } + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite_1VL */ + +herr_t +H5AwriteVL_str + (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) +{ + herr_t status = -1; + char **wdata; + jsize size; + jint i; + + size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf); + + wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*)); + if (!wdata) { + h5JNIFatalError(env, "H5AwriteVL_str: cannot allocate buffer"); + } /* end if */ + else { + HDmemset(wdata, 0, (size_t)size * sizeof(char*)); + for (i = 0; i < size; ++i) { + jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + wdata[i] = (char*)HDmalloc((size_t)length + 1); + if (wdata[i]) { + HDmemset(wdata[i], 0, ((size_t)length + 1)); + HDstrncpy(wdata[i], utf8, (size_t)length); + } /* end if */ + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for (i = 0; i < size; ++i) */ + + status = H5Awrite((hid_t)aid, (hid_t)tid, wdata); + + for (i = 0; i < size; i++) { + if(wdata[i]) { + HDfree(wdata[i]); + } /* end if */ + } /* end for */ + HDfree(wdata); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} + +herr_t +H5AwriteVL_asstr + (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf) +{ + char **strs; + jstring jstr; + jint i; + jint n; + hid_t sid; + hsize_t dims[H5S_MAX_RANK]; + herr_t status = -1; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + strs =(hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t)); + + if (strs == NULL) { + h5JNIFatalError(env, "H5AwriteVL_asstr: failed to allocate buff for read variable length strings"); + } /* end if */ + else { + status = H5Awrite(aid, tid, strs); + + if (status < 0) { + dims[0] = (hsize_t)n; + sid = H5Screate_simple(1, dims, NULL); + H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, strs); + H5Sclose(sid); + HDfree(strs); + h5JNIFatalError(env, "H5AwriteVL_str: failed to read variable length strings"); + } /* end if */ + else { + for (i=0; i < n; i++) { + jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]); + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + H5free_memory (strs[i]); + } /* end for */ + + /* + for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings, + H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings + after it is done. + H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs); + */ + + HDfree(strs); + } /* end else */ + } /* end else */ + + return status; +} /* end H5AwriteVL_str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_reg_ref + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +{ + herr_t status = -1; + h5str_t h5str; + size_t size; + hdset_reg_ref_t *ref_data; + jint i; + jint n; + jstring jstr; + + hid_t region = -1; + hid_t aid = (hid_t) attr_id; + hid_t tid = (hid_t) mem_type_id; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ + ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); + + if (ref_data == NULL) { + h5JNIFatalError(env, "H5Aread_reg_ref: failed to allocate buff for read"); + return -1; + } /* end if */ + + status = H5Aread(aid, tid, ref_data); + + if (status < 0) { + HDfree(ref_data); + h5JNIFatalError(env, "H5Aread_reg_ref: failed to read data"); + return -1; + } /* end if */ + + HDmemset(&h5str, 0, sizeof(h5str_t)); + h5str_new(&h5str, 1024); + for (i=0; iNewStringUTF(ENVPAR h5str.s); + + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + } /* end for */ + + h5str_free(&h5str); + HDfree(ref_data); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_reg_ref_data + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref_1data + (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +{ + herr_t status = -1; + + h5unimplemented(env, "H5Aread_reg_ref_data: not implemented"); + status = -1; + +#ifdef notdef + h5str_t h5str; + size_t size; + hdset_reg_ref_t *ref_data; + jint i; + jint n; + jstring jstr; + + hid_t region_obj; + H5S_sel_type region_type; + + hid_t region = -1; + hid_t aid = (hid_t) attr_id; + hid_t tid = (hid_t) mem_type_id; + n = ENVPTR->GetArrayLength(ENVPAR buf); + size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ + ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); + + if (ref_data == NULL) { + h5JNIFatalError(env, "H5Aread_reg_ref_data: failed to allocate buff for read"); + return -1; + } /* end if */ + + status = H5Aread(aid, tid, ref_data); + + if (status < 0) { + HDfree(ref_data); + h5JNIFatalError(env, "H5Aread_reg_ref_data: failed to read data"); + return -1; + } /* end if */ + + HDmemset(&h5str, 0, sizeof(h5str_t)); + h5str_new(&h5str, 1024); + for (i=0; i= 0) { + region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]); + if (region >= 0) { + region_type = H5Sget_select_type(region); + if(region_type==H5S_SEL_POINTS) { + h5str_dump_region_points_data(&h5str, region, region_obj); + } /* end if */ + else { + h5str_dump_region_blocks_data(&h5str, region, region_obj); + } /* end else */ + + H5Sclose(region); + } /* end if */ + H5Dclose(region_obj); + } /* end if */ + jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s); + + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + } /* end for */ + + h5str_free(&h5str); + HDfree(ref_data); +#endif + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref_1data */ + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Aget_space * Signature: (J)J */ diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h index f3758eb..753a03d 100644 --- a/java/src/jni/h5aImp.h +++ b/java/src/jni/h5aImp.h @@ -51,21 +51,120 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1idx /* * Class: hdf_hdf5lib_H5 + * Method: H5Aread + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Awrite * Signature: (JJ[B)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite - (JNIEnv *, jclass, jlong, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean); /* * Class: hdf_hdf5lib_H5 - * Method: H5Aread - * Signature: (JJ[B)I + * Method: H5Aread_short + * Signature: (JJ[SZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Aread - (JNIEnv *, jclass, jlong, jlong, jbyteArray); +Java_hdf_hdf5lib_H5_H5Aread_1short + (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_short + * Signature: (JJ[SZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1short + (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_int + * Signature: (JJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1int + (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_int + * Signature: (JJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1int + (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_long + * Signature: (JJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1long + (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_long + * Signature: (JJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1long + (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_float + * Signature: (JJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1float + (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_float + * Signature: (JJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1float + (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_double + * Signature: (JJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1double + (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_double + * Signature: (JJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1double + (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AreadVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5AreadVL + (JNIEnv *, jclass, jlong, jlong, jobjectArray); /* * Class: hdf_hdf5lib_H5 @@ -78,12 +177,57 @@ Java_hdf_hdf5lib_H5_H5AwriteVL /* * Class: hdf_hdf5lib_H5 - * Method: H5AreadVL + * Method: H5Aread_string * Signature: (JJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5AreadVL - (JNIEnv *, jclass, jlong, jlong, jobjectArray); +Java_hdf_hdf5lib_H5_H5Aread_1string + (JNIEnv*, jclass, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_string + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1string +(JNIEnv*, jclass, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_VLStrings + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1VLStrings +(JNIEnv*, jclass, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite_VLStrings + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings + (JNIEnv*, jclass, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_reg_ref + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref +(JNIEnv*, jclass, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread_reg_ref_data + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref_1data + (JNIEnv*, jclass, jlong, jlong, jobjectArray); /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h index 1fe71a8..9dffef4 100644 --- a/java/src/jni/h5dImp.h +++ b/java/src/jni/h5dImp.h @@ -250,7 +250,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings /* * Class: hdf_hdf5lib_H5 * Method: H5Dwrite_VLStrings - * Signature: (JJJJJ[BZ)I + * Signature: (JJJJJ[B)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 71d1431..48c6254 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -38,17 +38,20 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Unable to open file #001: (file name) line (number) in H5VL_file_open(): open failed major: Virtual Object Layer - minor: Unable to initialize object - #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + 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 - #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + #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 - #004: (file name) line (number) in H5FD_open(): open failed + #005: (file name) line (number) in H5FD_open(): open failed major: Virtual File Layer minor: Unable to initialize object - #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + #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): @@ -57,16 +60,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Unable to open file #001: (file name) line (number) in H5VL_file_open(): open failed major: Virtual Object Layer - minor: Unable to initialize object - #002: (file name) line (number) in H5VL_native_file_open(): unable to open file + 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 - #003: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1 + #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 - #004: (file name) line (number) in H5FD_open(): open failed + #005: (file name) line (number) in H5FD_open(): open failed major: Virtual File Layer minor: Unable to initialize object - #005: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2 + #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 -- cgit v0.12 From deb7d2fb9714acc8222815328f71b0aae7e74275 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 12 Dec 2018 06:53:26 -0600 Subject: Use version 2 functions in test file to address compile errors for --with-default-api-version=v16 option. --- test/tvlstr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/tvlstr.c b/test/tvlstr.c index 68d1070..da6195c 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -880,7 +880,7 @@ static void test_write_same_element(void) fspace = H5Screate_simple(SPACE1_RANK, fdim, NULL); CHECK(fspace, FAIL, "H5Screate_simple"); - dataset1 = H5Dcreate(file1, DATASET, dtype, fspace, H5P_DEFAULT, + dataset1 = H5Dcreate2(file1, DATASET, dtype, fspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset1, FAIL, "H5Dcreate"); @@ -905,7 +905,7 @@ static void test_write_same_element(void) file1 = H5Fopen(DATAFILE3, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fopen"); - dataset1 = H5Dopen(file1, DATASET, H5P_DEFAULT); + dataset1 = H5Dopen2(file1, DATASET, H5P_DEFAULT); CHECK(dataset1, FAIL, "H5Dopen"); fspace = H5Dget_space(dataset1); -- cgit v0.12 From ce9bcb0ddacce2c1ed74c4f32004a1772acd5df5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 12 Dec 2018 08:50:58 -0600 Subject: HDFVIEW-4 removed unused functions --- java/src/hdf/hdf5lib/H5.java | 5 --- java/src/jni/h5aImp.c | 79 -------------------------------------------- java/src/jni/h5aImp.h | 9 ----- java/src/jni/h5dImp.c | 78 ------------------------------------------- java/src/jni/h5dImp.h | 9 ----- 5 files changed, 180 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 8b40e2c..99de786 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -1175,8 +1175,6 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Aread_reg_ref(long attr_id, long mem_type_id, String[] buf) throws HDF5LibraryException, NullPointerException; - - public synchronized static native int H5Aread_reg_ref_data(long attr_id, long mem_type_id, String[] buf) throws HDF5LibraryException, NullPointerException; public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning) @@ -2083,9 +2081,6 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; - public synchronized static native int H5Dread_reg_ref_data(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; - public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) throws HDF5LibraryException, NullPointerException; diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index 68f203e..e0ec4ca 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1363,85 +1363,6 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref /* * Class: hdf_hdf5lib_H5 - * Method: H5Aread_reg_ref_data - * Signature: (JJ[Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref_1data - (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) -{ - herr_t status = -1; - - h5unimplemented(env, "H5Aread_reg_ref_data: not implemented"); - status = -1; - -#ifdef notdef - h5str_t h5str; - size_t size; - hdset_reg_ref_t *ref_data; - jint i; - jint n; - jstring jstr; - - hid_t region_obj; - H5S_sel_type region_type; - - hid_t region = -1; - hid_t aid = (hid_t) attr_id; - hid_t tid = (hid_t) mem_type_id; - n = ENVPTR->GetArrayLength(ENVPAR buf); - size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ - ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); - - if (ref_data == NULL) { - h5JNIFatalError(env, "H5Aread_reg_ref_data: failed to allocate buff for read"); - return -1; - } /* end if */ - - status = H5Aread(aid, tid, ref_data); - - if (status < 0) { - HDfree(ref_data); - h5JNIFatalError(env, "H5Aread_reg_ref_data: failed to read data"); - return -1; - } /* end if */ - - HDmemset(&h5str, 0, sizeof(h5str_t)); - h5str_new(&h5str, 1024); - for (i=0; i= 0) { - region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]); - if (region >= 0) { - region_type = H5Sget_select_type(region); - if(region_type==H5S_SEL_POINTS) { - h5str_dump_region_points_data(&h5str, region, region_obj); - } /* end if */ - else { - h5str_dump_region_blocks_data(&h5str, region, region_obj); - } /* end else */ - - H5Sclose(region); - } /* end if */ - H5Dclose(region_obj); - } /* end if */ - jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s); - - ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); - } /* end for */ - - h5str_free(&h5str); - HDfree(ref_data); -#endif - - return (jint)status; -} /* end Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref_1data */ - -/* - * Class: hdf_hdf5lib_H5 * Method: H5Aget_space * Signature: (J)J */ diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h index 753a03d..15cc83e 100644 --- a/java/src/jni/h5aImp.h +++ b/java/src/jni/h5aImp.h @@ -222,15 +222,6 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref /* * Class: hdf_hdf5lib_H5 - * Method: H5Aread_reg_ref_data - * Signature: (JJ[Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref_1data - (JNIEnv*, jclass, jlong, jlong, jobjectArray); - -/* - * Class: hdf_hdf5lib_H5 * Method: H5Aget_space * Signature: (J)J */ diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 652c873..79a5d0a 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1574,84 +1574,6 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref /* * Class: hdf_hdf5lib_H5 - * Method: H5Dread_reg_ref_data - * Signature: (JJJJJ[Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data - (JNIEnv *env, jclass clss, - jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) -{ - herr_t status = -1; - h5str_t h5str; - size_t size; - hdset_reg_ref_t *ref_data; - jint i; - jint n; - jstring jstr; - - hid_t region_obj; - H5S_sel_type region_type; - - hid_t region = -1; - hid_t did = (hid_t) dataset_id; - hid_t tid = (hid_t) mem_type_id; - hid_t mem_sid = (hid_t) mem_space_id; - hid_t file_sid = (hid_t) file_space_id; - - n = ENVPTR->GetArrayLength(ENVPAR buf); - size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ - ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); - - if (ref_data == NULL) { - h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to allocate buff for read"); - return -1; - } /* end if */ - - status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data); - - if (status < 0) { - HDfree(ref_data); - h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to read data"); - return -1; - } /* end if */ - - HDmemset(&h5str, 0, sizeof(h5str_t)); - h5str_new(&h5str, 1024); - for (i=0; i= 0) { - region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]); - if (region >= 0) { - region_type = H5Sget_select_type(region); - if(region_type==H5S_SEL_POINTS) { - h5str_dump_region_points_data(&h5str, region, region_obj); - } /* end if */ - else { - h5str_dump_region_blocks_data(&h5str, region, region_obj); - } /* end else */ - - H5Sclose(region); - } /* end if */ - H5Dclose(region_obj); - } /* end if */ - jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s); - - ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); - } /* end for */ - - h5str_free(&h5str); - HDfree(ref_data); - - return (jint)status; -} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data */ - -/* - * Class: hdf_hdf5lib_H5 * Method: _H5Dcreate2 * Signature: (JLjava/lang/String;JJJJJ)J */ diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h index 9dffef4..f824452 100644 --- a/java/src/jni/h5dImp.h +++ b/java/src/jni/h5dImp.h @@ -267,15 +267,6 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref /* * Class: hdf_hdf5lib_H5 - * Method: H5Dread_reg_ref_data - * Signature: (JJJJJ[Ljava/lang/String;)I - */ -JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data - (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); - -/* - * Class: hdf_hdf5lib_H5 * Method: _H5Dcreate2 * Signature: (JLjava/lang/String;JJJJJ)J */ -- cgit v0.12 From ef6c80bbdbe6ce1ee4665a352099976d0fddf255 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 12 Dec 2018 09:12:50 -0600 Subject: HDFVIEW-4 note --- release_docs/RELEASE.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c5c8300..3f47f06 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -110,7 +110,7 @@ New Features (ADB - 2018/07/16) - + Library: -------- - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. @@ -181,6 +181,15 @@ New Features Java Library: ---------------- + - Duplicate the data read/write functions of Datasets for Attributes. + + Region references could not be displayed for attributes as they could + for datasets. Datasets had overloaded read and write functions for different + datatypes that were not available for attributes. After adding similar + functions, attribute region references work normally. + + (ADB - 2018/12/12, HDFVIEW-4) + Tools: ------ @@ -285,9 +294,9 @@ Bug Fixes since HDF5-1.10.3 release - Made Fortran specific subroutines PRIVATE in generic procedures. Effected generic procedures were functions in H5A, H5D, H5P, H5R and H5T. - + (MSB, 2018/12/04, HDFFV-10511) - + Tools ----- - -- cgit v0.12 From ace20fc9872512012503d987a2c42cf7da8acbbe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 12 Dec 2018 09:27:45 -0600 Subject: HDFFV-10632 stder/stdout change note --- release_docs/RELEASE.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3f47f06..53a2e2d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,15 @@ New Features Configuration: ------------- + - Keep stderr and stdout separate in tests + + Changed test handling of output capture. Tests now keep the stderr + output separate from the stdout output. It is up to the test to decide + which output to check against a reference. Also added the option + to grep for a string in either output. + + (ADB - 2018/12/12, HDFFV-10594) + - Add toolchain and cross-compile support Added info on using a toolchain file to INSTALL_CMAKE.txt. A -- cgit v0.12 From 139a12d13cda046fd3cd64a4f097eb3485f50173 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 12 Dec 2018 09:28:51 -0600 Subject: HDFFV-10632 correct number --- release_docs/RELEASE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 53a2e2d..e386c8b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -55,7 +55,7 @@ New Features which output to check against a reference. Also added the option to grep for a string in either output. - (ADB - 2018/12/12, HDFFV-10594) + (ADB - 2018/12/12, HDFFV-10632) - Add toolchain and cross-compile support -- cgit v0.12