diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-10-03 19:13:47 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-10-03 19:13:47 (GMT) |
commit | e6a2a9f43fe85ba2f3a6b03c4d16afd194c49da7 (patch) | |
tree | 317a582e2b1f370e00a295b2d404740afeefee53 | |
parent | 8caeed7e5449351ae902eae1088d75e72c59f542 (diff) | |
parent | 68a9844991cfaaca2d0f97d7828f1f6f59af1349 (diff) | |
download | hdf5-e6a2a9f43fe85ba2f3a6b03c4d16afd194c49da7.zip hdf5-e6a2a9f43fe85ba2f3a6b03c4d16afd194c49da7.tar.gz hdf5-e6a2a9f43fe85ba2f3a6b03c4d16afd194c49da7.tar.bz2 |
Merge pull request #688 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
buildbot tests passing
* commit '68a9844991cfaaca2d0f97d7828f1f6f59af1349':
VS2012 and earlier cannot have execute stmnts before declare
Correct depends name
Fix list of names
new reference file
Fix repack plugin test - reorganize test macros
Adjust filter available variables
Fix STREQUAL if commands.
Update error handling to support ARGS and tools stack
26 files changed, 739 insertions, 817 deletions
diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 7af0590..b66f3a8 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -122,7 +122,7 @@ if (TEST_MASK_ERROR) endif () # if the return value is !=0 bail out -if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") message (STATUS "ERROR OUTPUT: ${TEST_STREAM}") message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") endif () @@ -141,13 +141,13 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} RESULT_VARIABLE TEST_RESULT ) - if (NOT ${TEST_RESULT} STREQUAL 0) + 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") + 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) @@ -160,14 +160,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () endif () - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -175,7 +175,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 output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () @@ -191,14 +191,14 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} RESULT_VARIABLE TEST_RESULT ) - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") + 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) @@ -211,14 +211,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () endif() - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -239,15 +239,15 @@ if (TEST_GREP_COMPARE) # 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") + 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") + 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") + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 67a2566..66a97c0 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -60,12 +60,12 @@ if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) endif () # if the return value is !=${TEST_EXPECT} bail out -if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) - message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") - endif () + message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") + endif () endif () message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index 5b0e8fd..b812d73 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -57,15 +57,15 @@ 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") +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") +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") + if (NOT "${TEST_RESULT}" STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif () endif () diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 3a02614..2479728 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -87,7 +87,7 @@ if (TEST_REGEX) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM}) string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT) - if (${REGEX_RESULT} STREQUAL "0") + if ("${REGEX_RESULT}" STREQUAL "0") message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}") endif () endif () @@ -106,7 +106,7 @@ if (TEST_APPEND) endif () # if the return value is !=${TEST_EXPECT} bail out -if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) +if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) @@ -193,13 +193,13 @@ if (NOT TEST_SKIP_COMPARE) endif () endif () - if (NOT ${TEST_RESULT} STREQUAL 0) + 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") + 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) @@ -212,14 +212,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") endif () endif () - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -227,7 +227,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 output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif () @@ -243,14 +243,14 @@ if (NOT TEST_SKIP_COMPARE) COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} RESULT_VARIABLE TEST_RESULT ) - if (NOT ${TEST_RESULT} STREQUAL 0) + if (NOT "${TEST_RESULT}" STREQUAL "0") set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) list (LENGTH test_act len_act) file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) list (LENGTH test_ref len_ref) math (EXPR _FP_LEN "${len_ref} - 1") - if (NOT ${len_act} STREQUAL "0" AND NOT ${len_ref} STREQUAL "0") + 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) @@ -263,14 +263,14 @@ if (NOT TEST_SKIP_COMPARE) endif () endforeach () else () - if (${len_act} STREQUAL "0") + if ("${len_act}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") endif () - if (${len_ref} STREQUAL "0") + if ("${len_ref}" STREQUAL "0") message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") endif () endif () - if (NOT ${len_act} STREQUAL ${len_ref}) + if (NOT "${len_act}" STREQUAL "${len_ref}") set (TEST_RESULT 1) endif () endif () @@ -278,7 +278,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/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index d698cfd..3972ec8 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -101,7 +101,7 @@ if (BUILD_TESTING) endif (H5_HAVE_FILTER_SZIP) foreach (example ${HDF_JAVA_EXAMPLES}) - if (${example} STREQUAL "H5Ex_D_External") + if ("${example}" STREQUAL "H5Ex_D_External") add_test ( NAME JAVA_datasets-${example}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -129,7 +129,7 @@ if (BUILD_TESTING) ) set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clear-objects) set (last_test "JAVA_datasets-${example}-copy-objects") - if (${example} STREQUAL "H5Ex_D_Szip") + if ("${example}" STREQUAL "H5Ex_D_Szip") if (USE_FILTER_SZIP) ADD_H5_TEST (${example} 0) endif () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index bb5f80f..b912208 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -90,8 +90,8 @@ ENDMACRO () if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) - if (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") - if (${example} STREQUAL "H5Ex_G_Compact") + if (NOT "${example}" STREQUAL "H5Ex_G_Iterate" AND NOT "${example}" STREQUAL "H5Ex_G_Visit") + if ("${example}" STREQUAL "H5Ex_G_Compact") add_test ( NAME JAVA_groups-${example}-clear-h5s COMMAND ${CMAKE_COMMAND} diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 5d2f30b..f4c52b6 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -661,7 +661,7 @@ foreach (test ${H5TEST_TESTS}) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) else () - if (${test} STREQUAL "big" AND CYGWIN) + if ("${test}" STREQUAL "big" AND CYGWIN) add_test (NAME H5TEST-${test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" ) @@ -702,7 +702,7 @@ if (BUILD_SHARED_LIBS) ) foreach (test ${H5TEST_TESTS}) - if (${test} STREQUAL "big" AND CYGWIN) + if ("${test}" STREQUAL "big" AND CYGWIN) add_test (NAME H5TEST-shared-${test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" ) @@ -1115,8 +1115,8 @@ if (HDF5_TEST_VFD) # Windows only macro macro (CHECK_VFD_TEST vfdtest vfdname resultcode) - if (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") - if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") + if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") + if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" @@ -1205,7 +1205,7 @@ if (HDF5_TEST_VFD) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS AND NOT ${vfdtest} STREQUAL "cache") + if (BUILD_SHARED_LIBS AND NOT "${vfdtest}" STREQUAL "cache") add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>" diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 32ce3db..09894e6 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -640,8 +640,8 @@ static hsize_t diff_datum( * compared, we convert both bit patterns to their corresponding * enumeration constant and do a string comparison */ + h5difftrace("diff_datum H5T_ENUM\n"); { - h5difftrace("diff_datum H5T_ENUM\n"); char enum_name1[1024]; char enum_name2[1024]; herr_t err1; diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index a556b0a..2cdaf74 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -65,16 +65,16 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; * H5TOOLS_INFO macro, used to facilitate error reporting . The arguments are the major * error number, the minor error number, and a description of the error. */ -#define H5TOOLS_INFO(min_id, str) { \ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, str); \ +#define H5TOOLS_INFO(min_id, ...) { \ + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ } /* * HERROR macro, used to facilitate error reporting . The arguments are the major * error number, the minor error number, and a description of the error. */ -#define HERROR(maj_id, min_id, str) { \ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, str); \ +#define HERROR(maj_id, min_id, ...) { \ + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \ ret_value = FAIL; \ } @@ -103,8 +103,8 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; * The return value is assigned to a variable `ret_value' and control branches * to the `catch_except' label, if we're not already past it. */ -#define H5E_THROW(fail_value, min_id, str) { \ - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, str); \ +#define H5E_THROW(fail_value, min_id, ...) { \ + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ H5_LEAVE(fail_value) \ } @@ -114,8 +114,8 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g; * error string. The return value is assigned to a variable `ret_value' and * control branches to the `done' label. */ -#define HGOTO_ERROR(fail_value, min_id, str) { \ - HERROR(H5E_tools_g, min_id, str); \ +#define HGOTO_ERROR(fail_value, min_id, ...) { \ + HERROR(H5E_tools_g, min_id, __VA_ARGS__); \ HGOTO_DONE(fail_value) \ } diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 76ca117..7ed9a90 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -39,11 +39,6 @@ static int have_request(pack_opt_t *options); * object name requests * * Return: 0, ok, -1, fail - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 - * *------------------------------------------------------------------------- */ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { @@ -68,7 +63,6 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { * Purpose: initialize options * * Return: 0, ok, -1, fail - * *------------------------------------------------------------------------- */ int @@ -96,7 +90,6 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest) * Function: h5repack_end * * Purpose: free options table - * *------------------------------------------------------------------------- */ @@ -111,18 +104,17 @@ int h5repack_end(pack_opt_t *options) { * Example: -f dset:GZIP=6 * * Return: 0, ok, -1, fail - * *------------------------------------------------------------------------- */ int -h5repack_addfilter(const char* str, pack_opt_t *options) +h5repack_addfilter(const char *str, pack_opt_t *options) { obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */ filter_info_t filter; /* filter info for the current -f option entry */ unsigned n_objs; /* number of objects in the current -f or -l option entry */ int is_glb; /* is the filter global */ - /* parse the -f option */ + /* parse the -f (--filter) option */ if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb))) return -1; @@ -152,11 +144,10 @@ h5repack_addfilter(const char* str, pack_opt_t *options) * Purpose: add a layout option * * Return: 0, ok, -1, fail - * *------------------------------------------------------------------------- */ int -h5repack_addlayout(const char* str, pack_opt_t *options) +h5repack_addlayout(const char *str, pack_opt_t *options) { obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */ unsigned n_objs; /*number of objects in the current -t or -c option entry */ @@ -220,11 +211,6 @@ h5repack_addlayout(const char* str, pack_opt_t *options) * returned must be closed after it is no longer needed. * named_datatype_free must be called before the program exits * to free the stack. - * - * Programmer: Neil Fortner - * - * Date: April 14, 2009 - * *------------------------------------------------------------------------- */ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, @@ -304,18 +290,13 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, ret_value = -1; done: - return (ret_value); + return ret_value; } /* end copy_named_datatype */ /*------------------------------------------------------------------------- * Function: named_datatype_free * * Purpose: Frees the stack of named datatypes. - * - * Programmer: Neil Fortner - * - * Date: April 14, 2009 - * *------------------------------------------------------------------------- */ int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) { @@ -346,11 +327,6 @@ done: * loc_id = H5Topen2( fid, name); * * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October, 28, 2003 - * *------------------------------------------------------------------------- */ int @@ -477,7 +453,6 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, buf = (void *)HDmalloc((size_t)(nelmts * msize)); if (buf == NULL) { - error_msg("h5repack", "cannot read into memory\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if (H5Aread(attr_id, wtype_id, buf) < 0) @@ -489,7 +464,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, */ if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed on ,%s>", name); if (H5Awrite(attr_out, wtype_id, buf) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); @@ -553,13 +528,10 @@ done: * Purpose: print options, checks for invalid options * * Return: void, return -1 on error - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 *------------------------------------------------------------------------- */ static int check_options(pack_opt_t *options) { + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ unsigned int i; int k, j, has_cp = 0, has_ck = 0; char slayout[30]; @@ -586,11 +558,10 @@ static int check_options(pack_opt_t *options) { break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: - error_msg("invalid layout\n"); - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid layout"); default: strcpy(slayout, "invalid layout\n"); - return -1; + HGOTO_DONE(FAIL); } printf(" Apply %s layout to all\n", slayout); if (H5D_CHUNKED == options->layout_g) { @@ -609,25 +580,20 @@ static int check_options(pack_opt_t *options) { if (options->verbose) { printf(" <%s> with chunk size ", name); for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - printf("%d ", - (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); + printf("%d ", (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); printf("\n"); } has_ck = 1; } else if (options->op_tbl->objs[i].chunk.rank == -2) { if (options->verbose) - printf(" <%s> %s\n", name, "NONE (contigous)"); + printf(" <%s> %s\n", name, "NONE (contiguous)"); has_ck = 1; } } - if (options->all_layout == 1 && has_ck) { - error_msg( - "invalid chunking input: 'all' option\ - is present with other objects\n"); - return -1; - } + if (options->all_layout == 1 && has_ck) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid chunking input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * objects to filter @@ -649,8 +615,7 @@ static int check_options(pack_opt_t *options) { break; case H5Z_FILTER_SZIP: case H5Z_FILTER_DEFLATE: - printf(" All with %s, parameter %d\n", get_sfilter(filtn), - options->filter_g[k].cd_values[0]); + printf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]); break; default: printf(" User Defined %d\n", filtn); @@ -666,48 +631,29 @@ static int check_options(pack_opt_t *options) { for (j = 0; j < pack.nfilters; j++) { if (options->verbose) { - printf(" <%s> with %s filter\n", name, - get_sfilter(pack.filter[j].filtn)); + printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); } - has_cp = 1; - } /* j */ } /* i */ - if (options->all_filter == 1 && has_cp) { - error_msg( - "invalid compression input: 'all' option\ - is present with other objects\n"); - return -1; - } + if (options->all_filter == 1 && has_cp) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid compression input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * check options for the latest format *------------------------------------------------------------------------- */ - if (options->grp_compact < 0) { - error_msg( - "invalid maximum number of links to store as header messages\n"); - return -1; - } - if (options->grp_indexed < 0) { - error_msg( - "invalid minimum number of links to store in the indexed format\n"); - return -1; - } - if (options->grp_indexed > options->grp_compact) { - error_msg( - "minimum indexed size is greater than the maximum compact size\n"); - return -1; - } - for (i = 0; i < 8; i++) { - if (options->msg_size[i] < 0) { - error_msg("invalid shared message size\n"); - return -1; - } - } + if (options->grp_compact < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid maximum number of links to store as header messages"); + if (options->grp_indexed < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid minimum number of links to store in the indexed format"); + if (options->grp_indexed > options->grp_compact) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "minimum indexed size is greater than the maximum compact size"); + for (i = 0; i < 8; i++) + if (options->msg_size[i] < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid shared message size"); /*-------------------------------------------------------------------------------- * verify new user userblock options; file name must be present @@ -715,30 +661,25 @@ static int check_options(pack_opt_t *options) { */ if (options->ublock_filename != NULL && options->ublock_size == 0) { if (options->verbose) { - printf( - "Warning: user block size missing for file %s. Assigning a default size of 1024...\n", + printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename); options->ublock_size = 1024; } } - if (options->ublock_filename == NULL && options->ublock_size != 0) { - error_msg("file name missing for user block\n", - options->ublock_filename); - return -1; - } + if (options->ublock_filename == NULL && options->ublock_size != 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file name missing for user block", options->ublock_filename); /*-------------------------------------------------------------------------------- * verify alignment options; threshold is zero default but alignment not *--------------------------------------------------------------------------------- */ - if (options->alignment == 0 && options->threshold != 0) { - error_msg("alignment for H5Pset_alignment missing\n"); - return -1; - } + if (options->alignment == 0 && options->threshold != 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "alignment for H5Pset_alignment missing"); - return 0; +done: + return ret_value; } /*------------------------------------------------------------------------- @@ -748,11 +689,6 @@ static int check_options(pack_opt_t *options) { * supplied list * * Return: 0, ok, -1 no - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: September, 23, 2003 - * *------------------------------------------------------------------------- */ static int check_objects(const char* fname, pack_opt_t *options) { @@ -768,8 +704,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { * open the file *------------------------------------------------------------------------- */ - if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) - < 0) { + if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) { printf("<%s>: %s\n", fname, H5FOPENERROR); return -1; } @@ -786,7 +721,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { /* get the list of objects in the file */ if (h5trav_gettable(fid, travt) < 0) - goto out; + goto done; /*------------------------------------------------------------------------- * compare with user supplied list @@ -794,8 +729,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { */ if (options->verbose) - printf("Opening file <%s>. Searching for objects to modify...\n", - fname); + printf("Opening file <%s>. Searching for objects to modify...\n", fname); for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; @@ -806,7 +740,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { if (h5trav_getindext(name, travt) < 0) { error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); - goto out; + goto done; } if (options->verbose) printf("...Found\n"); @@ -831,26 +765,25 @@ static int check_objects(const char* fname, pack_opt_t *options) { } else { if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - goto out; + goto done; if ((sid = H5Dget_space(did)) < 0) - goto out; + goto done; if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) - goto out; + goto done; HDmemset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - goto out; + goto done; for (j = 0; j < rank; j++) csize *= dims[j]; if (H5Sclose(sid) < 0) - goto out; + goto done; if (H5Dclose(did) < 0) - goto out; + goto done; } if (csize < ppb) { - printf( - " <warning: SZIP settins, chunk size is smaller than pixels per block>\n"); - goto out; + printf(" <warning: SZIP settins, chunk size is smaller than pixels per block>\n"); + goto done; } } break; @@ -867,7 +800,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { trav_table_free(travt); return 0; -out: +done: H5Fclose(fid); trav_table_free(travt); return -1; @@ -879,9 +812,6 @@ out: * Purpose: check if a filter or layout was requested * * Return: 1 yes, 0 no - * - * Date: May, 24, 2007 - * *------------------------------------------------------------------------- */ static int have_request(pack_opt_t *options) { @@ -899,7 +829,6 @@ static int have_request(pack_opt_t *options) { * Purpose: return the filter as a string name * * Return: name of filter, exit on error - * *------------------------------------------------------------------------- */ diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 501f084..47cad13 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -110,8 +110,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) *------------------------------------------------------------------------- */ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) { - error_msg("<%s>: %s\n", fnamein, H5FOPENERROR); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR); } /* get user block size and file space strategy/persist/threshold */ @@ -121,25 +120,21 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) hid_t gcpl_in = -1; /* group creation property list */ if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); } if (H5Pget_userblock(fcpl_in, &ub_size) < 0) { - error_msg("failed to retrieve userblock size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size"); } /* If the -S option is not set, get "strategy" from the input file */ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) { - error_msg("failed to retrieve file space strategy\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy"); } /* If the -G option is not set, get "pagesize" from the input file */ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) { - error_msg("failed to retrieve file space threshold\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space threshold"); } /* open root group */ if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0) @@ -154,8 +149,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); if (H5Pclose(fcpl_in) < 0) { - error_msg("failed to close property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list"); } } @@ -163,14 +157,12 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if (options->latest || ub_size > 0) { /* Create file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); } if (ub_size > 0) { if (H5Pset_userblock(fcpl, ub_size) < 0) { - error_msg("failed to set non-default userblock size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size"); } } @@ -181,8 +173,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* (So that it is created in "dense storage" form) */ if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) { - error_msg("fail to adjust group creation parameters for root group\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed to adjust group creation parameters for root group"); } for (i = 0; i < 5; i++) { @@ -219,28 +210,24 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if (nindex > 0) { if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { - error_msg("fail to set the number of shared object header message indexes\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes"); } /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ for (i = 0; i < (nindex - 1); i++) { if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) { - error_msg("fail to configure the specified shared object header message index\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); } /* end if */ } /* end for */ } /* if (nindex>0) */ /* Create file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); } /* end if */ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - error_msg("Could not set property for using latest version of the format\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format"); } /* end if */ } /* end if */ } /* end if */ @@ -257,15 +244,13 @@ print_user_block(fnamein, fidin); if (fcpl == H5P_DEFAULT) { /* create a file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); } } /* set user block size */ if (H5Pset_userblock(fcpl, options->ublock_size) < 0) { - error_msg("failed to set userblock size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set userblock size"); } } @@ -278,14 +263,12 @@ print_user_block(fnamein, fidin); if (fapl == H5P_DEFAULT) { /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); } } if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { - error_msg("failed to set alignment\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alignment failed to set alignment"); } } @@ -298,14 +281,12 @@ print_user_block(fnamein, fidin); if (fapl == H5P_DEFAULT) { /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg("Could not create file access property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); } } if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) { - error_msg("failed to set metadata block size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_meta_block_size failed to set metadata block size"); } } @@ -318,8 +299,7 @@ print_user_block(fnamein, fidin); if (fcpl == H5P_DEFAULT) { /* create a file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg("fail to create a file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); } } @@ -349,8 +329,7 @@ print_user_block(fnamein, fidin); /* Set file space information as specified */ if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) { - error_msg("failed to set file space strategy\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_strategy failed to set file space strategy"); } if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */ @@ -360,8 +339,7 @@ print_user_block(fnamein, fidin); if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */ if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) { - error_msg("failed to set file space page size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_page_size failed to set file space page size"); } /*------------------------------------------------------------------------- @@ -372,8 +350,7 @@ print_user_block(fnamein, fidin); printf("Making file <%s>...\n", fnameout); if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { - error_msg("<%s>: Could not create file\n", fnameout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout); } /*------------------------------------------------------------------------- @@ -382,8 +359,7 @@ print_user_block(fnamein, fidin); */ if (options->ublock_size > 0) { if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) { - error_msg("Could not copy user block. Exiting...\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); } } @@ -399,15 +375,14 @@ print_user_block(fnamein, fidin); /* get the list of objects in the file */ if (h5trav_gettable(fidin, travt) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); /*------------------------------------------------------------------------- * do the copy *------------------------------------------------------------------------- */ if (do_copy_objects(fidin, fidout, travt, options) < 0) { - error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout); } /* end if */ /*------------------------------------------------------------------------- @@ -416,8 +391,7 @@ print_user_block(fnamein, fidin); *------------------------------------------------------------------------- */ if (do_copy_refobjs(fidin, fidout, travt, options) < 0) { - printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout); } /*------------------------------------------------------------------------- @@ -445,8 +419,7 @@ print_user_block(fnamein, fidin); if (ub_size > 0 && options->ublock_size == 0) { if (copy_user_block(fnamein, fnameout, ub_size) < 0) { - error_msg("Could not copy user block. Exiting...\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); } } @@ -533,7 +506,7 @@ int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], /* get chunk dims */ rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); if (rank_chunk < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); for (k = rank_dset; k > 0; --k) size_chunk *= dims_chunk[k - 1]; @@ -595,7 +568,7 @@ int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], hslab_nbytes *= dims_hslab[k - 1]; if (hslab_nbytes <= 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed"); } } } @@ -619,7 +592,7 @@ int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], hslab_nbytes *= dims_hslab[k - 1]; if (hslab_nbytes <= 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed"); } } @@ -1488,9 +1461,9 @@ static int copy_user_block(const char *infile, const char *outfile, hsize_t size /* Open files */ if ((infid = HDopen(infile, O_RDONLY)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed input file <%s>", infile); if ((outfid = HDopen(outfile, O_WRONLY)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed output file <%s>", outfile); /* Copy the userblock from the input file to the output file */ while (size > 0) { @@ -1504,7 +1477,7 @@ static int copy_user_block(const char *infile, const char *outfile, hsize_t size else nread = HDread(infid, rbuf, (size_t)size); if (nread < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed to read userblock"); /* Write buffer to destination file */ /* (compensating for interrupted writes & checking for errors, etc.) */ @@ -1566,24 +1539,20 @@ void print_user_block(const char *filename, hid_t fid) /* get user block size */ if(( fcpl = H5Fget_create_plist(fid)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed"); + HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); } if(H5Pget_userblock(fcpl, &ub_size) < 0) { - error_msg("failed to retrieve userblock size\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed"); + HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size"); } if(H5Pclose(fcpl) < 0) { - error_msg("failed to close property list\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed"); + HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed to close property list"); } /* open file */ if((fh = HDopen(filename, O_RDONLY)) < 0) { - error_msg("failed to open file\n"); - HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed"); + HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed to open file <%s>", filename); } size = ub_size; diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 5ccb2ef..a74e5f3 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -199,6 +199,7 @@ int apply_filters(const char* name, /* object name from traverse list */ pack_opt_t *options, /* repack options */ int *has_filter) /* (OUT) object NAME has a filter */ { + int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ int nfilters; /* number of filters in DCPL */ hsize_t chsize[64]; /* chunk size in elements */ H5D_layout_t layout; @@ -208,7 +209,7 @@ int apply_filters(const char* name, /* object name from traverse list */ *has_filter = 0; if (rank == 0) /* scalar dataset, do not apply */ - return 0; + HGOTO_DONE(0); /*------------------------------------------------------------------------- * initialize the assigment object @@ -221,11 +222,11 @@ int apply_filters(const char* name, /* object name from traverse list */ *------------------------------------------------------------------------- */ if (aux_assign_obj(name, options, &obj) == 0) - return 0; + HGOTO_DONE(0); /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); /*------------------------------------------------------------------------- * check if we have filters in the pipeline @@ -236,7 +237,7 @@ int apply_filters(const char* name, /* object name from traverse list */ if (nfilters && obj.nfilters) { *has_filter = 1; if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); } /*------------------------------------------------------------------------- @@ -246,11 +247,11 @@ int apply_filters(const char* name, /* object name from traverse list */ */ if (obj.layout == -1) { if ((layout = H5Pget_layout(dcpl_id)) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); if (layout == H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); obj.layout = H5D_CHUNKED; obj.chunk.rank = rank; for (i = 0; i < rank; i++) @@ -323,9 +324,9 @@ int apply_filters(const char* name, /* object name from traverse list */ aggression = obj.filter[i].cd_values[0]; /* set up for deflated data */ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_deflate(dcpl_id, aggression) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_deflate failed"); } break; @@ -343,9 +344,9 @@ int apply_filters(const char* name, /* object name from traverse list */ /* set up for szip data */ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_szip failed"); } break; @@ -355,9 +356,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_SHUFFLE: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_shuffle(dcpl_id) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shuffle failed"); break; /*------------------------------------------------------------------------- @@ -366,9 +367,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_FLETCHER32: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_fletcher32(dcpl_id) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fletcher32 failed"); break; /*----------- ------------------------------------------------------------- * H5Z_FILTER_NBIT , NBIT compression @@ -376,9 +377,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_NBIT: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_nbit(dcpl_id) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_nbit failed"); break; /*----------- ------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET , scale+offset compression @@ -394,9 +395,9 @@ int apply_filters(const char* name, /* object name from traverse list */ scale_factor = (int) obj.filter[i].cd_values[1]; if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_scaleoffset failed"); } break; default: @@ -404,9 +405,9 @@ int apply_filters(const char* name, /* object name from traverse list */ if (H5Pset_filter(dcpl_id, obj.filter[i].filtn, obj.filter[i].filt_flag, obj.filter[i].cd_nelmts, obj.filter[i].cd_values) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_filter failed"); if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); } break; } /* switch */ @@ -422,24 +423,25 @@ int apply_filters(const char* name, /* object name from traverse list */ if (obj.layout >= 0) { /* a layout was defined */ if (H5Pset_layout(dcpl_id, obj.layout) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_layout failed"); if (H5D_CHUNKED == obj.layout) { if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); } else if (H5D_COMPACT == obj.layout) { if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alloc_time failed"); } /* remove filters for the H5D_CONTIGUOUS case */ else if (H5D_CONTIGUOUS == obj.layout) { if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); } } - return 0; +done: + return ret_value; } diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index a3f5678..3860451 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -221,10 +221,6 @@ static void usage(const char *prog) { * Purpose: Shutdown MPI & HDF5 and call exit() * * Return: Does not return - * - * Programmer: Quincey Koziol - * Saturday, 31. January 2004 - * *------------------------------------------------------------------------- */ static void leave(int ret) @@ -239,11 +235,6 @@ static void leave(int ret) * Purpose: read comp and chunk options from a file * * Return: void, exit on error - * - * Programmer: pvn@ncsa.uiuc.edu - * - * Date: September, 22, 2003 - * *------------------------------------------------------------------------- */ static @@ -425,7 +416,6 @@ set_sort_order(const char *form) * Function: parse_command_line * * Purpose: parse command line input - * *------------------------------------------------------------------------- */ static @@ -674,13 +664,6 @@ done: * Return: Success: EXIT_SUCCESS(0) * * Failure: EXIT_FAILURE(1) - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * *------------------------------------------------------------------------- */ int main(int argc, const char **argv) diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 93e34b3..6c409ec 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -21,23 +21,22 @@ * Purpose: initialize a pack_info_t structure * * Return: void - * - *------------------------------------------------------------------------- + *------------------------------------------------------------------------- */ void init_packobject(pack_info_t *obj) { - int j, k; - - HDstrcpy(obj->path, "\0"); - for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) { - obj->filter[j].filtn = -1; - for (k = 0; k < CD_VALUES; k++) - obj->filter[j].cd_values[k] = 0; - } - obj->chunk.rank = -1; - obj->refobj_id = -1; - obj->layout = H5D_LAYOUT_ERROR; - obj->nfilters = 0; + int j, k; + + HDstrcpy(obj->path, "\0"); + for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) { + obj->filter[j].filtn = -1; + for (k = 0; k < CD_VALUES; k++) + obj->filter[j].cd_values[k] = 0; + } + obj->chunk.rank = -1; + obj->refobj_id = -1; + obj->layout = H5D_LAYOUT_ERROR; + obj->nfilters = 0; } /*------------------------------------------------------------------------- @@ -46,20 +45,14 @@ void init_packobject(pack_info_t *obj) { * Purpose: auxiliary function, inserts the filter in object OBJS[ I ] * * Return: void - * *------------------------------------------------------------------------- */ -static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, - filter_info_t filt) { - if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) { - table->objs[I].filter[table->objs[I].nfilters++] = filt; - } - else { - error_msg( - "cannot insert the filter in this object.\ - Maximum capacity exceeded\n"); - } +static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt) { + if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) + table->objs[I].filter[table->objs[I].nfilters++] = filt; + else + H5TOOLS_INFO(H5E_tools_min_id_g, "cannot insert the filter in this object. Maximum capacity exceeded"); } /*------------------------------------------------------------------------- @@ -68,30 +61,27 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, * Purpose: auxiliary function, inserts the layout in object OBJS[ I ] * * Return: void - * *------------------------------------------------------------------------- */ - -static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, - pack_info_t *pack) { - int k; - - table->objs[I].layout = pack->layout; - if (H5D_CHUNKED == pack->layout) { - /* -2 means the NONE option, remove chunking - and set the layout to contiguous */ - if (pack->chunk.rank == -2) { - table->objs[I].layout = H5D_CONTIGUOUS; - table->objs[I].chunk.rank = -2; - } - /* otherwise set the chunking type */ - else { - table->objs[I].chunk.rank = pack->chunk.rank; - for (k = 0; k < pack->chunk.rank; k++) - table->objs[I].chunk.chunk_lengths[k] = - pack->chunk.chunk_lengths[k]; - } - } +static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack) { + int k; + + table->objs[I].layout = pack->layout; + if (H5D_CHUNKED == pack->layout) { + /* -2 means the NONE option, remove chunking + and set the layout to contiguous */ + if (pack->chunk.rank == -2) { + table->objs[I].layout = H5D_CONTIGUOUS; + table->objs[I].chunk.rank = -2; + } + /* otherwise set the chunking type */ + else { + table->objs[I].chunk.rank = pack->chunk.rank; + for (k = 0; k < pack->chunk.rank; k++) + table->objs[I].chunk.chunk_lengths[k] = + pack->chunk.chunk_lengths[k]; + } + } } /*------------------------------------------------------------------------- @@ -100,7 +90,6 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, * Purpose: auxiliary function, increases the size of the collection by N_OBJS * * Return: 0, ok, -1, fail - * *------------------------------------------------------------------------- */ static int @@ -111,7 +100,7 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) table->size += n_objs; table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs == NULL) { - error_msg("not enough memory for options table\n"); + H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); return -1; } @@ -128,32 +117,30 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) * Purpose: init options table * * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- + *------------------------------------------------------------------------- */ int options_table_init(pack_opttbl_t **tbl) { - unsigned int i; - pack_opttbl_t *table; - - if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { - error_msg("not enough memory for options table\n"); - return -1; - } - - table->size = 30; - table->nelems = 0; - if (NULL == (table->objs = - (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { - error_msg("not enough memory for options table\n"); - HDfree(table); - return -1; - } - - for (i = 0; i < table->size; i++) - init_packobject(&table->objs[i]); - - *tbl = table; - return 0; + unsigned int i; + pack_opttbl_t *table; + + if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { + H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); + return -1; + } + + table->size = 30; + table->nelems = 0; + if (NULL == (table->objs = (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { + H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); + HDfree(table); + return -1; + } + + for (i = 0; i < table->size; i++) + init_packobject(&table->objs[i]); + + *tbl = table; + return 0; } @@ -163,14 +150,13 @@ int options_table_init(pack_opttbl_t **tbl) { * Purpose: free table memory * * Return: 0 - * *------------------------------------------------------------------------- */ int options_table_free(pack_opttbl_t *table) { - HDfree(table->objs); - HDfree(table); - return 0; + HDfree(table->objs); + HDfree(table); + return 0; } /*------------------------------------------------------------------------- @@ -179,12 +165,10 @@ int options_table_free(pack_opttbl_t *table) { * Purpose: add a layout option to the option list * * Return: 0, ok, -1, fail - * - *------------------------------------------------------------------------- + *------------------------------------------------------------------------- */ int -options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, - pack_opttbl_t *table) +options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table) { unsigned i, j, I; unsigned added = 0; @@ -205,7 +189,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { /* already chunk info inserted for this one; exit */ if (table->objs[i].chunk.rank > 0) { - error_msg("chunk information already inserted for <%s>\n", obj_list[j].obj); + H5TOOLS_INFO(H5E_tools_min_id_g, "chunk information already inserted for <%s>\n", obj_list[j].obj); HDexit(EXIT_FAILURE); } /* insert the layout info */ @@ -261,12 +245,10 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, * Purpose: add a compression -f option to the option list * * Return: 0, ok, -1, fail - * *------------------------------------------------------------------------- */ int -options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, - pack_opttbl_t *table) +options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pack_opttbl_t *table) { unsigned int i, j, I; unsigned added = 0; @@ -337,29 +319,26 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, * Purpose: get object from table; "path" is the key * * Return: pack_info_t* OBJECT or NULL if not found; PATH is the key - * *------------------------------------------------------------------------- */ pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) { - unsigned int i; - char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */ - - for (i = 0; i < table->nelems; i++) { - /* make full path (start with "/") to compare correctly */ - if (HDstrncmp(table->objs[i].path, "/", 1)) { - HDstrcpy(tbl_path, "/"); - HDstrcat(tbl_path, table->objs[i].path); - } - else - HDstrcpy(tbl_path, table->objs[i].path); - - /* found it */ - if (HDstrcmp(tbl_path, path) == 0) { - return (&table->objs[i]); - } - } - - return NULL; -} + unsigned int i; + char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */ + + for (i = 0; i < table->nelems; i++) { + /* make full path (start with "/") to compare correctly */ + if (HDstrncmp(table->objs[i].path, "/", 1)) { + HDstrcpy(tbl_path, "/"); + HDstrcat(tbl_path, table->objs[i].path); + } + else + HDstrcpy(tbl_path, table->objs[i].path); + /* found it */ + if (HDstrcmp(tbl_path, path) == 0) { + return (&table->objs[i]); + } + } + return NULL; +} diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index 1a0dab7..e276b7b 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -33,11 +33,6 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil * 1 match * 0 do not match * -1 error - * - * Programmer: Pedro Vicente, pvn@hdfgroup.org - * - * Date: December 19, 2003 - * *------------------------------------------------------------------------- */ @@ -63,11 +58,10 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* open the output file */ if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - return -1; + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on <%s>", out_fname); - for(i = 0; i < options->op_tbl->nelems; i++) - { - char* name = options->op_tbl->objs[i].path; + for(i = 0; i < options->op_tbl->nelems; i++) { + char *name = options->op_tbl->objs[i].path; pack_info_t *obj = &options->op_tbl->objs[i]; /*------------------------------------------------------------------------- @@ -75,7 +69,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name); if((sid = H5Dget_space(did)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) @@ -119,9 +113,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ - if(options->all_filter == 1 || options->all_layout == 1) - { - + if(options->all_filter == 1 || options->all_layout == 1) { /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); /* init table */ @@ -131,19 +123,16 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options if(h5trav_gettable(fidout, travt) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); - for(i = 0; i < travt->nobjs; i++) - { + for(i = 0; i < travt->nobjs; i++) { char *name = travt->objs[i].name; - if(travt->objs[i].type == H5TRAV_TYPE_DATASET) - { - + if(travt->objs[i].type == H5TRAV_TYPE_DATASET) { /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name); if((sid = H5Dget_space(did)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) @@ -155,8 +144,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * filter check *------------------------------------------------------------------------- */ - if(options->all_filter == 1) - { + if(options->all_filter == 1) { if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0) ok = 0; } @@ -165,8 +153,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options * layout check *------------------------------------------------------------------------- */ - if(options->all_layout == 1) - { + if(options->all_layout == 1) { pack_info_t pack; init_packobject(&pack); @@ -204,43 +191,37 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* open the input file */ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on file <%s>", in_fname); /* Get file creation property list for input file */ if((fcpl_in = H5Fget_create_plist(fidin)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); } /* Get file space info for input file */ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) { - error_msg("failed to retrieve file space strategy & threshold\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); } /* Get file space page size for input file */ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) { - error_msg("failed to retrieve file space page size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); } /* Output file is already opened */ /* Get file creation property list for output file */ if((fcpl_out = H5Fget_create_plist(fidout)) < 0) { - error_msg("failed to retrieve file creation property list\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); } /* Get file space info for output file */ if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0) { - error_msg("failed to retrieve file space strategy & threshold\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); } /* Get file space page size for output file */ if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0) { - error_msg("failed to retrieve file space page size\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); } /* @@ -250,12 +231,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_strategy) { if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) { - error_msg("file space strategy not set as unexpected\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); } - } else { + } + else { if(out_strategy != in_strategy) { - error_msg("file space strategy not set as unexpected\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); } } @@ -267,13 +247,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_persist) { if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist)) { - error_msg("free-space persist status is not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); } - } else { + } + else { if(out_persist != in_persist) { - error_msg("free-space persist status is not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); } } @@ -284,13 +263,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_threshold) { if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold)) { - error_msg("threshold is not set as unexpectec\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); } - } else { + } + else { if(out_threshold != in_threshold) { - error_msg("threshold is not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); } } @@ -301,13 +279,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_pagesize) { if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize)) { - error_msg("file space page size is not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); } - } else { /* "-G" is not set */ + } + else { /* "-G" is not set */ if(out_pagesize != in_pagesize) { - error_msg("file space page size is not set as unexpected\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); } } @@ -339,8 +316,6 @@ done: return ret_value; } /* h5repack_verify() */ - - /*------------------------------------------------------------------------- * Function: verify_layout * @@ -351,16 +326,10 @@ done: * H5D_CHUNKED = 2 * * Return: 1 has, 0 does not, -1 error - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 30, 2003 - * *------------------------------------------------------------------------- */ -int verify_layout(hid_t pid, - pack_info_t *obj) +int verify_layout(hid_t pid, pack_info_t *obj) { hsize_t chsize[64]; /* chunk size in elements */ H5D_layout_t layout; /* layout */ @@ -383,8 +352,7 @@ int verify_layout(hid_t pid, if (obj->layout != layout) return 0; - if (layout==H5D_CHUNKED) - { + if (layout==H5D_CHUNKED) { if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0) return -1; if (obj->chunk.rank != rank) @@ -403,16 +371,10 @@ int verify_layout(hid_t pid, * Purpose: compare 2 files for identical property lists of all objects * * Return: 1=identical, 0=not identical, -1=error - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: December 31, 2003 - * *------------------------------------------------------------------------- */ -int h5repack_cmp_pl(const char *fname1, - const char *fname2) +int h5repack_cmp_pl(const char *fname1, const char *fname2) { int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ hid_t fid1=-1; /* file ID */ @@ -439,13 +401,11 @@ int h5repack_cmp_pl(const char *fname1, { /* Open the files */ - if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) - { + if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { error_msg("<%s>: %s\n", fname1, H5FOPENERROR ); return -1; } - if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) - { + if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { error_msg("<%s>: %s\n", fname2, H5FOPENERROR ); H5Fclose(fid1); return -1; @@ -468,14 +428,10 @@ int h5repack_cmp_pl(const char *fname1, * traverse the suppplied object list *------------------------------------------------------------------------- */ - for(i = 0; i < trav->nobjs; i++) - { - - if(trav->objs[i].type == H5TRAV_TYPE_GROUP) - { - + for(i = 0; i < trav->nobjs; i++) { + if(trav->objs[i].type == H5TRAV_TYPE_GROUP) { if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on first <%s>", trav->objs[i].name); if ((gcplid = H5Gget_create_plist(gid)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0) @@ -486,7 +442,7 @@ int h5repack_cmp_pl(const char *fname1, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on second <%s>", trav->objs[i].name); if ((gcplid = H5Gget_create_plist(gid)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0) @@ -497,20 +453,14 @@ int h5repack_cmp_pl(const char *fname1, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); if (crt_order_flag1 != crt_order_flag2) { - error_msg("property lists for <%s> are different\n",trav->objs[i].name); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); } - } - - - - else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) - { + else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) { if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on first <%s>", trav->objs[i].name); if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on second <%s>", trav->objs[i].name); if((dcpl1 = H5Dget_create_plist(dset1)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(dset2)) < 0) @@ -524,8 +474,7 @@ int h5repack_cmp_pl(const char *fname1, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed"); if(ret == 0) { - error_msg("property lists for <%s> are different\n",trav->objs[i].name); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed for <%s> are different",trav->objs[i].name); } /*------------------------------------------------------------------------- @@ -593,11 +542,6 @@ done: * 1 match * 0 do not match * -1 error - * - * Programmer: Pedro Vicente, pvn@hdfgroup.org - * - * Date: December 21, 2007 - * *------------------------------------------------------------------------- */ @@ -621,11 +565,11 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) /* if we do not have filters and the requested filter is NONE, return 1 */ if(!nfilters_dcpl && nfilters == 1 && - filter[0].filtn == H5Z_FILTER_NONE ) + filter[0].filtn == H5Z_FILTER_NONE) return 1; /* else the numbers of filters must match */ - if (nfilters_dcpl != nfilters ) + if (nfilters_dcpl != nfilters) return 0; /*------------------------------------------------------------------------- @@ -633,8 +577,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) *------------------------------------------------------------------------- */ - for( i = 0; i < nfilters_dcpl; i++) - { + for (i = 0; i < nfilters_dcpl; i++) { cd_nelmts = NELMTS(cd_values); filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL); @@ -644,15 +587,13 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) return 0; /* compare client data values. some filters do return local values */ - switch (filtn) - { - + switch (filtn) { case H5Z_FILTER_NONE: break; case H5Z_FILTER_SHUFFLE: /* 1 private client value is returned by DCPL */ - if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS ) + if (cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS) return 0; /* get dataset's type size */ @@ -660,31 +601,31 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) return -1; /* the private client value holds the dataset's type size */ - if ( size != cd_values[0] ) + if (size != cd_values[0]) return 0; break; case H5Z_FILTER_SZIP: /* 4 private client values are returned by DCPL */ - if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS ) + if (cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS) return 0; /* "User" parameter for pixels-per-block (index 1) */ - if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] ) + if (cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB]) return 0; break; case H5Z_FILTER_NBIT: /* only client data values number of values checked */ - if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts) + if (H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts) return 0; break; case H5Z_FILTER_SCALEOFFSET: /* only client data values checked */ - for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++) + for (j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++) if (cd_values[j] != filter[i].cd_values[j]) return 0; break; @@ -693,20 +634,20 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter) case H5Z_FILTER_FLETCHER32: case H5Z_FILTER_DEFLATE: - if ( cd_nelmts != filter[i].cd_nelmts) + if (cd_nelmts != filter[i].cd_nelmts) return 0; - for( j = 0; j < cd_nelmts; j++) + for (j = 0; j < cd_nelmts; j++) if (cd_values[j] != filter[i].cd_values[j]) return 0; break; default: - if ( cd_nelmts != filter[i].cd_nelmts) + if (cd_nelmts != filter[i].cd_nelmts) return 0; - for( j = 0; j < cd_nelmts; j++) + for (j = 0; j < cd_nelmts; j++) if (cd_values[j] != filter[i].cd_values[j]) return 0; break; diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 2536ef3..58879cf 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -71,13 +71,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} STREQUAL "2") + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_F-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) SET_TESTS_PROPERTIES(H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) - if (${resultcode} STREQUAL "1") + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -107,13 +107,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} STREQUAL "2") + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if (${resultcode} STREQUAL "1") + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -157,13 +157,13 @@ ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} STREQUAL "2") + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if (${resultcode} STREQUAL "1") + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -198,13 +198,13 @@ ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT ${resultcode} STREQUAL "2") + if (NOT "${resultcode}" STREQUAL "2") add_test ( NAME H5COPY_SAME-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) SET_TESTS_PROPERTIES(H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) - if (${resultcode} STREQUAL "1") + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -218,7 +218,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) - if (${resultcode} STREQUAL "1") + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 0f61539..6dae99d 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -366,7 +366,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DIFF-${resultfile} COMMAND $<TARGET_FILE:h5diff> ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") @@ -396,7 +396,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DIFF_ERR-${resultfile} COMMAND $<TARGET_FILE:h5diff> --enable-error-stack ${ARGN}) set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") @@ -428,7 +428,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PH5DIFF-${resultfile} COMMAND $<TARGET_FILE:ph5diff> ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} ${ARGN}) set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") @@ -467,7 +467,7 @@ testfiles/${resultfile}.out testfiles/${resultfile}.out.err ) - if (${resultcode} STREQUAL "2") + if ("${resultcode}" STREQUAL "2") add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -512,7 +512,7 @@ testfiles/${resultfile}_ERR.out testfiles/${resultfile}_ERR.out.err ) - if (${resultcode} STREQUAL "2") + if ("${resultcode}" STREQUAL "2") add_test ( NAME H5DIFF_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index d3d1c4d..4bc33f8 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -422,7 +422,7 @@ endmacro () macro (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype) - if (${testtype} STREQUAL "SKIP") + if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${skipresultfile}-SKIPPED @@ -439,7 +439,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") @@ -472,7 +472,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-N-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") @@ -505,7 +505,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") @@ -545,7 +545,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 310f9ce..1344b9a 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -103,7 +103,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_vds_test}" STREQUAL "") @@ -129,7 +129,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_vds_test}" STREQUAL "") diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index e068c5e..18148a1 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -161,7 +161,7 @@ ############################################################################## macro (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) - if (${testtype} STREQUAL "SKIP") + if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-XML-${skipresultfile}-SKIPPED @@ -177,7 +177,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-XML-${resultfile} COMMAND $<TARGET_FILE:h5dump> --xml ${ARGN}) set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_xml_test}" STREQUAL "") diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index a04a4b6..97b453b 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -129,7 +129,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (${resultcode} STREQUAL "1") + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 4a665a5..c573323 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -74,7 +74,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (${resultcode} STREQUAL "1") + if ("${resultcode}" STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index dfdbb14..c68f18a 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -76,6 +76,7 @@ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_shuffle.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_soffset.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_szip.h5 + # fsm ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_aggr.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fsm_aggr_nopersist.h5 ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_fsm_aggr_persist.h5 @@ -124,39 +125,62 @@ ) set (LIST_OTHER_TEST_FILES - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack-help.txt - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_ext.bin - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/ublock.bin - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack.info - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/deflate_limit.h5repack_layout.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5-gzip_verbose_filters.tst - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_test.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5.tst - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5-plugin_none.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5.tst - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_version_test.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_version_test.h5repack_layout.h5.tst - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_zero.tst - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/crtorder.tordergr.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/SP.h5repack_fsm_aggr_nopersist.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/S.h5repack_fsm_aggr_persist.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/STG.h5repack_none.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/GS.h5repack_paged_nopersist.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/SP.h5repack_paged_persist.h5.ddl - ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/SPT.h5repack_aggr.h5.ddl + h5repack-help.txt + h5repack_ext.bin + h5repack.info + ublock.bin ) - foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + set (LIST_TST_TEST_FILES + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_filters.h5-gzip_verbose_filters + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_version_test.h5repack_layout.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_zero.h5repack_layout.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5 + ) + + set (LIST_DDL_TEST_FILES + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/crtorder.tordergr.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/deflate_limit.h5repack_layout.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_test + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_version_test + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.h5-plugin_zero + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5-plugin_none + # fsm + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/STG.h5repack_none.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/SPT.h5repack_aggr.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/SP.h5repack_fsm_aggr_nopersist.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/S.h5repack_fsm_aggr_persist.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/GS.h5repack_paged_nopersist.h5 + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/SP.h5repack_paged_persist.h5 + # vds + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_chunk3x6x9-v + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/3_1_vds.h5-vds_chunk2x5x8-v + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v + ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v + ) + + foreach (h5_file ${LIST_HDF5_TEST_FILES}) get_filename_component(fname "${h5_file}" NAME) HDFTEST_COPY_FILE("${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5repack_files") endforeach () + + foreach (h5_file ${LIST_OTHER_TEST_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5repack_files") + endforeach () + + foreach (h5_file ${LIST_TST_TEST_FILES}) + get_filename_component(fname "${h5_file}" NAME) + HDFTEST_COPY_FILE("${h5_file}.tst" "${PROJECT_BINARY_DIR}/testfiles/${fname}.tst" "h5repack_files") + endforeach () + + foreach (h5_file ${LIST_DDL_TEST_FILES}) + get_filename_component(fname "${h5_file}" NAME) + HDFTEST_COPY_FILE("${h5_file}.ddl" "${PROJECT_BINARY_DIR}/testfiles/${fname}.ddl" "h5repack_files") + endforeach () add_custom_target(h5repack_files ALL COMMENT "Copying files needed by h5repack tests" DEPENDS ${h5repack_files_list}) ############################################################################## @@ -168,14 +192,24 @@ macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5REPACK-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN}) - set_tests_properties (H5REPACK-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + add_test (NAME H5REPACK-h5repack-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN}) + set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "H5REPACK-${testname}") + set (last_test "H5REPACK-h5repack-${testname}") else () add_test ( + NAME H5REPACK-h5repack-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/h5repack-${testname}.out + testfiles/h5repack-${testname}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>" @@ -186,6 +220,7 @@ -D "TEST_REFERENCE=h5repack-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) + set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS H5REPACK-h5repack-${testname}-clear-objects) endif () endmacro () @@ -199,13 +234,20 @@ endif () else () add_test ( - NAME H5REPACK_OLD-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + NAME H5REPACK_OLD-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${testfile} ) if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( + NAME H5REPACK_OLD-${testname} + COMMAND $<TARGET_FILE:h5repack> ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects) + add_test ( NAME H5REPACK_OLD-${testname}_DFF COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) @@ -223,13 +265,20 @@ endif () else () add_test ( - NAME H5REPACK-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + NAME H5REPACK-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${testfile} ) if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( + NAME H5REPACK-${testname} + COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects) + add_test ( NAME H5REPACK-${testname}_DFF COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) @@ -252,8 +301,22 @@ NAME H5REPACK_CMP-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) + endif () else () add_test ( + NAME H5REPACK_CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${resultfile} + testfiles/${resultfile}-${testname}.out + testfiles/${resultfile}-${testname}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>" @@ -265,9 +328,7 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS H5REPACK_CMP-${testname}-clear-objects) endif () endif () endmacro () @@ -287,8 +348,22 @@ NAME H5REPACK_MASK-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( + NAME H5REPACK_MASK-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${resultfile} + testfiles/${resultfile}-${testname}.out + testfiles/${resultfile}-${testname}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>" @@ -300,9 +375,7 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects) endif () endif () endmacro () @@ -316,14 +389,22 @@ ) endif () else () - # If using memchecker add tests without using scripts add_test ( - NAME H5REPACK_DMP-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + NAME H5REPACK_DMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${resultfile} + testfiles/${resultfile}-${testname}.out + testfiles/${resultfile}-${testname}.out.err ) if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + add_test ( + NAME H5REPACK_DMP-${testname} + COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-h5dump-${testname} @@ -350,14 +431,22 @@ ) endif () else () - # If using memchecker add tests without using scripts add_test ( - NAME H5REPACK_STAT-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + NAME H5REPACK_STAT-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${statarg}.${resultfile} + testfiles/${resultfile}-${testname}.out + testfiles/${resultfile}-${testname}.out.err ) if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + add_test ( + NAME H5REPACK_STAT-${testname} + COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + ) + set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_STAT-h5stat-${testname} @@ -386,13 +475,22 @@ else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5REPACK_VERIFY_LAYOUT-${testname} - COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + NAME H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${testfile} + testfiles/${testfile}-${testname}-v.out + testfiles/${testfile}-${testname}-v.out.err ) if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( + NAME H5REPACK_VERIFY_LAYOUT-${testname} + COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects) + add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) @@ -449,14 +547,24 @@ endif () else () if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}.${testfile} + testfiles/${testfile}-${testname}-v.out + testfiles/${testfile}-${testname}-v.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -475,14 +583,23 @@ endmacro () macro (ADD_H5_TEST_META testname testfile) + # Remove any output file left over from previous test run add_test ( - NAME H5REPACK_META-${testname}_N - COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + NAME H5REPACK_META-${testname}_N-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/out-${testname}_N.${testname}.h5 + testfiles/out-${testname}_M.${testname}.h5 ) if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( + NAME H5REPACK_META-${testname}_N + COMMAND $<TARGET_FILE:h5repack> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + ) + set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}_N-clear-objects) + add_test ( NAME H5REPACK_META-${testname}_M COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 ) @@ -497,11 +614,18 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( - NAME H5REPACK_UD-${testname}-clearall-objects + NAME H5REPACK_UD-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + testfiles/${testname}.${resultfile}.out + testfiles/${testname}.${resultfile}.out.err + testfiles/${resultfile}-${testname}.out + testfiles/${resultfile}-${testname}.out.err ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () add_test ( NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -516,21 +640,21 @@ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clearall-objects) + set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clear-objects) add_test ( - NAME H5REPACK_UD-h5dump-${testname} + NAME H5REPACK_UD-${testname}-h5dump COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>" -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" - -D "TEST_EXPECT=${resultcode}" + -D "TEST_EXPECT=0" -D "TEST_REFERENCE=${resultfile}-${testname}.ddl" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_UD-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_UD-${testname}") + set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES DEPENDS "H5REPACK_UD-${testname}") endif () endmacro () @@ -571,205 +695,182 @@ set (FILEV4 4_vds.h5) set (FILEV5 5_vds.h5) - # Remove any output file left over from previous test run - add_test ( - NAME H5REPACK-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/h5dump-help.out - ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out - ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out.err - ./testfiles/h5repack_layout.h5-chunk_18x13-v.out - ./testfiles/h5repack_layout.h5-chunk_18x13-v.out.err - ./testfiles/h5repack_layout.h5-chunk_20x10-v.out - ./testfiles/h5repack_layout.h5-chunk_20x10-v.out.err - ./testfiles/h5repack_layout.h5-chunk_compa-v.out - ./testfiles/h5repack_layout.h5-chunk_compa-v.out.err - ./testfiles/h5repack_layout.h5-chunk_conti-v.out - ./testfiles/h5repack_layout.h5-chunk_conti-v.out.err - ./testfiles/h5repack_layout.h5-compa-v.out - ./testfiles/h5repack_layout.h5-compa-v.out.err - ./testfiles/h5repack_layout.h5-conti-v.out - ./testfiles/h5repack_layout.h5-conti-v.out.err - ./testfiles/h5repack_layout.h5-deflate_limit.out - ./testfiles/h5repack_layout.h5-deflate_limit.out.err - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-v.out.err - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.out - ./testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.out.err - ./testfiles/h5repack_layout.h5-dset2_compa-v.out - ./testfiles/h5repack_layout.h5-dset2_compa-v.out.err - ./testfiles/h5repack_layout.h5-dset2_conti-v.out - ./testfiles/h5repack_layout.h5-dset2_conti-v.out.err - ./testfiles/h5repack_layout.h5-dset_compa_chunk-v.out - ./testfiles/h5repack_layout.h5-dset_compa_chunk-v.out.err - ./testfiles/h5repack_layout.h5-dset_compa_compa-v.out - ./testfiles/h5repack_layout.h5-dset_compa_compa-v.out.err - ./testfiles/h5repack_layout.h5-dset_compa_conti-v.out - ./testfiles/h5repack_layout.h5-dset_compa_conti-v.out.err - ./testfiles/h5repack_layout.h5-dset_conti_chunk-v.out - ./testfiles/h5repack_layout.h5-dset_conti_chunk-v.out.err - ./testfiles/h5repack_layout.h5-dset_conti_compa-v.out - ./testfiles/h5repack_layout.h5-dset_conti_compa-v.out.err - ./testfiles/h5repack_layout.h5-dset_conti_conti-v.out - ./testfiles/h5repack_layout.h5-dset_conti_conti-v.out.err - ./testfiles/h5repack_layout.h5-layout_long_switches-v.out - ./testfiles/h5repack_layout.h5-layout_long_switches-v.out.err - ./testfiles/h5repack_layout.h5-layout_short_switches-v.out - ./testfiles/h5repack_layout.h5-layout_short_switches-v.out.err - ./testfiles/h5repack_layout.h5-plugin_test.out - ./testfiles/h5repack_layout.h5-plugin_test.out.err - ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out - ./testfiles/h5repack_layout2.h5-contig_small_compa-v.out.err - ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out - ./testfiles/h5repack_layout2.h5-contig_small_fixed_compa-v.out.err - ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out - ./testfiles/h5repack_layout3.h5-ckdim_biger-v.out.err - ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out - ./testfiles/h5repack_layout3.h5-ckdim_smaller-v.out.err - ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out - ./testfiles/h5repack_layout3.h5-chunk2chunk-v.out.err - ./testfiles/h5repack_layout3.h5-chunk2compa-v.out - ./testfiles/h5repack_layout3.h5-chunk2compa-v.out.err - ./testfiles/h5repack_layout3.h5-chunk2conti-v.out - ./testfiles/h5repack_layout3.h5-chunk2conti-v.out.err - ./testfiles/h5repack_layout3.h5-error1-v.out - ./testfiles/h5repack_layout3.h5-error1-v.out.err - ./testfiles/h5repack_layout3.h5-error2-v.out - ./testfiles/h5repack_layout3.h5-error2-v.out.err - ./testfiles/h5repack_layout3.h5-error3-v.out - ./testfiles/h5repack_layout3.h5-error3-v.out.err - ./testfiles/out-family.tfamily%05d.h5 - ./testfiles/out-HDFFV-7840.h5diff_attr1.h5 - ./testfiles/out-attr.h5repack_attr.h5 - ./testfiles/out-native_attr.h5repack_attr.h5 - ./testfiles/out-HDFFV-5932.h5repack_attr_refs.h5 - ./testfiles/out-deflate_copy.h5repack_deflate.h5 - ./testfiles/out-deflate_remove.h5repack_deflate.h5 - ./testfiles/out-early.h5repack_early.h5 - ./testfiles/out-fill.h5repack_fill.h5 - ./testfiles/out-native_fill.h5repack_fill.h5 - ./testfiles/out-gzip_verbose_filters.h5repack_filters.h5 - ./testfiles/out-fletcher_copy.h5repack_fletcher.h5 - ./testfiles/out-fletcher_remove.h5repack_fletcher.h5 - ./testfiles/out-hlink.h5repack_hlink.h5 - ./testfiles/out-chunk_18x13.h5repack_layout.h5 - ./testfiles/out-chunk_20x10.h5repack_layout.h5 - ./testfiles/out-chunk_compa.h5repack_layout.h5 - ./testfiles/out-chunk_conti.h5repack_layout.h5 - ./testfiles/out-compa.h5repack_layout.h5 - ./testfiles/out-conti.h5repack_layout.h5 - ./testfiles/out-deflate_file.h5repack_layout.h5 - ./testfiles/out-deflate_limit.h5repack_layout.h5 - ./testfiles/out-dset2_chunk_20x10.h5repack_layout.h5 - ./testfiles/out-dset2_compa.h5repack_layout.h5 - ./testfiles/out-dset2_conti.h5repack_layout.h5 - ./testfiles/out-dset_compa_chunk.h5repack_layout.h5 - ./testfiles/out-dset_compa_compa.h5repack_layout.h5 - ./testfiles/out-dset_compa_conti.h5repack_layout.h5 - ./testfiles/out-dset_conti_chunk.h5repack_layout.h5 - ./testfiles/out-dset_conti_compa.h5repack_layout.h5 - ./testfiles/out-dset_conti_conti.h5repack_layout.h5 - ./testfiles/out-fletcher_all.h5repack_layout.h5 - ./testfiles/out-fletcher_individual.h5repack_layout.h5 - ./testfiles/out-global_filters.h5repack_layout.h5 - ./testfiles/out-gzip_all.h5repack_layout.h5 - ./testfiles/out-gzip_individual.h5repack_layout.h5 - ./testfiles/out-layout.h5repack_layout.h5 - ./testfiles/out-layout_long_switches.h5repack_layout.h5 - ./testfiles/out-layout_short_switches.h5repack_layout.h5 - ./testfiles/out-old_style_layout_short_switches.h5repack_layout.h5 - ./testfiles/out-plugin_test.h5repack_layout.h5 - ./testfiles/out-shuffle_all.h5repack_layout.h5 - ./testfiles/out-shuffle_individual.h5repack_layout.h5 - ./testfiles/out-upgrade_layout.h5repack_layouto.h5 - ./testfiles/out-contig_small_compa.h5repack_layout2.h5 - ./testfiles/out-contig_small_fixed_compa.h5repack_layout2.h5 - ./testfiles/out-ckdim_biger.h5repack_layout3.h5 - ./testfiles/out-ckdim_smaller.h5repack_layout3.h5 - ./testfiles/out-chunk2chunk.h5repack_layout3.h5 - ./testfiles/out-chunk2compa.h5repack_layout3.h5 - ./testfiles/out-chunk2conti.h5repack_layout3.h5 - ./testfiles/out-error1.h5repack_layout3.h5 - ./testfiles/out-error2.h5repack_layout3.h5 - ./testfiles/out-error3.h5repack_layout3.h5 - ./testfiles/out-error4.h5repack_layout3.h5 - ./testfiles/out-committed_dt.h5repack_named_dtypes.h5 - ./testfiles/out-nbit_add.h5repack_nbit.h5 - ./testfiles/out-nbit_copy.h5repack_nbit.h5 - ./testfiles/out-nbit_remove.h5repack_nbit.h5 - ./testfiles/out-add_alignment.h5repack_objs.h5 - ./testfiles/out-add_userblock.h5repack_objs.h5 - ./testfiles/out-objs.h5repack_objs.h5 - ./testfiles/out-gt_mallocsize.h5repack_objs.h5 - ./testfiles/out-bug1814.h5repack_refs.h5 - ./testfiles/out-shuffle_copy.h5repack_shuffle.h5 - ./testfiles/out-shuffle_remove.h5repack_shuffle.h5 - ./testfiles/out-scale_add.h5repack_soffset.h5 - ./testfiles/out-scale_copy.h5repack_soffset.h5 - ./testfiles/out-scale_remove.h5repack_soffset.h5 - ./testfiles/out-meta_short_M.meta_short.h5 - ./testfiles/out-meta_short_N.meta_short.h5 - ./testfiles/out-meta_long_M.meta_long.h5 - ./testfiles/out-meta_long_N.meta_long.h5 - ./testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.out - ./testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.out.err - ./testfiles/2_vds.h5-vds_chunk3x6x9-v.out - ./testfiles/2_vds.h5-vds_chunk3x6x9-v.out.err - ./testfiles/3_1_vds.h5-vds_chunk2x5x8-v.out - ./testfiles/3_1_vds.h5-vds_chunk2x5x8-v.out.err - ./testfiles/4_vds.h5-vds_compa-v.out - ./testfiles/4_vds.h5-vds_compa-v.out.err - ./testfiles/4_vds.h5-vds_conti-v.out - ./testfiles/4_vds.h5-vds_conti-v.out.err - ./testfiles/out-vds_compa.4_vds.h5 - ./testfiles/out-vds_conti.4_vds.h5 - ./testfiles/out-vds_chunk2x5x8.3_1_vds.h5 - ./testfiles/out-vds_chunk3x6x9.2_vds.h5 - ./testfiles/out-vds_dset_chunk20x10x5.1_vds.h5 - h5repack_attr.h5 - h5repack_attr_out.h5 - h5repack_attr_refs.h5 - h5repack_big.h5 - h5repack_deflate.h5 - h5repack_deflate_out.h5 - h5repack_early2.h5 - h5repack_early.h5 - h5repack_early_out.h5 - h5repack_ext.h5 - h5repack_ext_out.h5 - h5repack_fill.h5 - h5repack_fill_out.h5 - h5repack_filters.h5 - h5repack_filters_out.h5 - h5repack_fletcher.h5 - h5repack_fletcher_out.h5 - h5repack_hlink.h5 - h5repack_hlink_out.h5 - h5repack_layout.h5 - h5repack_layout_out.h5 - h5repack_layout2.h5 - h5repack_layout3.h5 - h5repack_named_dtypes.h5 - h5repack_named_dtypes_out.h5 - h5repack_nbit.h5 - h5repack_nbit_out.h5 - h5repack_objs.h5 - h5repack_objs_out.h5 - h5repack_refs.h5 - h5repack_shuffle.h5 - h5repack_shuffle_out.h5 - h5repack_soffset.h5 - h5repack_soffset_out.h5 - h5repack_szip.h5 - h5repack_szip_out.h5 - h5repack_ub.h5 - h5repack_ub_out.h5 - h5repack_ext.bin - ublock.bin - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) + if (HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + set (LIST_TO_CLEAR + h5dump-help.out + h5repack_layout.h5-chunk_18x13-v.out + h5repack_layout.h5-chunk_18x13-v.out.err + h5repack_layout.h5-chunk_20x10-v.out + h5repack_layout.h5-chunk_20x10-v.out.err + h5repack_layout.h5-chunk_compa-v.out + h5repack_layout.h5-chunk_compa-v.out.err + h5repack_layout.h5-chunk_conti-v.out + h5repack_layout.h5-chunk_conti-v.out.err + h5repack_layout.h5-compa-v.out + h5repack_layout.h5-compa-v.out.err + h5repack_layout.h5-conti-v.out + h5repack_layout.h5-conti-v.out.err + h5repack_layout.h5-deflate_limit.out + h5repack_layout.h5-deflate_limit.out.err + h5repack_layout.h5-dset2_chunk_20x10-v.out + h5repack_layout.h5-dset2_chunk_20x10-v.out.err + h5repack_layout.h5-dset2_chunk_20x10-errstk.out + h5repack_layout.h5-dset2_chunk_20x10-errstk.out.err + h5repack_layout.h5-dset2_compa-v.out + h5repack_layout.h5-dset2_compa-v.out.err + h5repack_layout.h5-dset2_conti-v.out + h5repack_layout.h5-dset2_conti-v.out.err + h5repack_layout.h5-dset_compa_chunk-v.out + h5repack_layout.h5-dset_compa_chunk-v.out.err + h5repack_layout.h5-dset_compa_compa-v.out + h5repack_layout.h5-dset_compa_compa-v.out.err + h5repack_layout.h5-dset_compa_conti-v.out + h5repack_layout.h5-dset_compa_conti-v.out.err + h5repack_layout.h5-dset_conti_chunk-v.out + h5repack_layout.h5-dset_conti_chunk-v.out.err + h5repack_layout.h5-dset_conti_compa-v.out + h5repack_layout.h5-dset_conti_compa-v.out.err + h5repack_layout.h5-dset_conti_conti-v.out + h5repack_layout.h5-dset_conti_conti-v.out.err + h5repack_layout.h5-layout_long_switches-v.out + h5repack_layout.h5-layout_long_switches-v.out.err + h5repack_layout.h5-layout_short_switches-v.out + h5repack_layout.h5-layout_short_switches-v.out.err + h5repack_layout.h5-plugin_test.out + h5repack_layout.h5-plugin_test.out.err + h5repack_layout2.h5-contig_small_compa-v.out + h5repack_layout2.h5-contig_small_compa-v.out.err + h5repack_layout2.h5-contig_small_fixed_compa-v.out + h5repack_layout2.h5-contig_small_fixed_compa-v.out.err + h5repack_layout3.h5-ckdim_biger-v.out + h5repack_layout3.h5-ckdim_biger-v.out.err + h5repack_layout3.h5-ckdim_smaller-v.out + h5repack_layout3.h5-ckdim_smaller-v.out.err + h5repack_layout3.h5-chunk2chunk-v.out + h5repack_layout3.h5-chunk2chunk-v.out.err + h5repack_layout3.h5-chunk2compa-v.out + h5repack_layout3.h5-chunk2compa-v.out.err + h5repack_layout3.h5-chunk2conti-v.out + h5repack_layout3.h5-chunk2conti-v.out.err + h5repack_layout3.h5-error1-v.out + h5repack_layout3.h5-error1-v.out.err + h5repack_layout3.h5-error2-v.out + h5repack_layout3.h5-error2-v.out.err + h5repack_layout3.h5-error3-v.out + h5repack_layout3.h5-error3-v.out.err + out-family.tfamily%05d.h5 + out-HDFFV-7840.h5diff_attr1.h5 + out-attr.h5repack_attr.h5 + out-native_attr.h5repack_attr.h5 + out-HDFFV-5932.h5repack_attr_refs.h5 + out-deflate_copy.h5repack_deflate.h5 + out-deflate_remove.h5repack_deflate.h5 + out-early.h5repack_early.h5 + out-fill.h5repack_fill.h5 + out-native_fill.h5repack_fill.h5 + out-gzip_verbose_filters.h5repack_filters.h5 + out-fletcher_copy.h5repack_fletcher.h5 + out-fletcher_remove.h5repack_fletcher.h5 + out-hlink.h5repack_hlink.h5 + out-chunk_18x13.h5repack_layout.h5 + out-chunk_20x10.h5repack_layout.h5 + out-chunk_compa.h5repack_layout.h5 + out-chunk_conti.h5repack_layout.h5 + out-compa.h5repack_layout.h5 + out-conti.h5repack_layout.h5 + out-deflate_file.h5repack_layout.h5 + out-deflate_limit.h5repack_layout.h5 + out-dset2_chunk_20x10.h5repack_layout.h5 + out-dset2_compa.h5repack_layout.h5 + out-dset2_conti.h5repack_layout.h5 + out-dset_compa_chunk.h5repack_layout.h5 + out-dset_compa_compa.h5repack_layout.h5 + out-dset_compa_conti.h5repack_layout.h5 + out-dset_conti_chunk.h5repack_layout.h5 + out-dset_conti_compa.h5repack_layout.h5 + out-dset_conti_conti.h5repack_layout.h5 + out-fletcher_all.h5repack_layout.h5 + out-fletcher_individual.h5repack_layout.h5 + out-global_filters.h5repack_layout.h5 + out-gzip_all.h5repack_layout.h5 + out-gzip_individual.h5repack_layout.h5 + out-layout.h5repack_layout.h5 + out-layout_long_switches.h5repack_layout.h5 + out-layout_short_switches.h5repack_layout.h5 + out-old_style_layout_short_switches.h5repack_layout.h5 + out-plugin_test.h5repack_layout.h5 + out-shuffle_all.h5repack_layout.h5 + out-shuffle_individual.h5repack_layout.h5 + out-upgrade_layout.h5repack_layouto.h5 + out-contig_small_compa.h5repack_layout2.h5 + out-contig_small_fixed_compa.h5repack_layout2.h5 + out-ckdim_biger.h5repack_layout3.h5 + out-ckdim_smaller.h5repack_layout3.h5 + out-chunk2chunk.h5repack_layout3.h5 + out-chunk2compa.h5repack_layout3.h5 + out-chunk2conti.h5repack_layout3.h5 + out-error1.h5repack_layout3.h5 + out-error2.h5repack_layout3.h5 + out-error3.h5repack_layout3.h5 + out-error4.h5repack_layout3.h5 + out-committed_dt.h5repack_named_dtypes.h5 + out-nbit_add.h5repack_nbit.h5 + out-nbit_copy.h5repack_nbit.h5 + out-nbit_remove.h5repack_nbit.h5 + out-add_alignment.h5repack_objs.h5 + out-add_userblock.h5repack_objs.h5 + out-objs.h5repack_objs.h5 + out-gt_mallocsize.h5repack_objs.h5 + out-bug1814.h5repack_refs.h5 + out-shuffle_copy.h5repack_shuffle.h5 + out-shuffle_remove.h5repack_shuffle.h5 + out-scale_add.h5repack_soffset.h5 + out-scale_copy.h5repack_soffset.h5 + out-scale_remove.h5repack_soffset.h5 + out-meta_short_M.meta_short.h5 + out-meta_short_N.meta_short.h5 + out-meta_long_M.meta_long.h5 + out-meta_long_N.meta_long.h5 + out-vds_compa.4_vds.h5 + out-vds_conti.4_vds.h5 + out-vds_chunk2x5x8.3_1_vds.h5 + out-vds_chunk3x6x9.2_vds.h5 + out-vds_dset_chunk20x10x5.1_vds.h5 + ) + + set (LIST_TO_CLEAR ${LIST_TO_CLEAR} ${LIST_OTHER_TEST_FILES}) + + foreach (h5_file ${LIST_HDF5_TEST_FILES}) + get_filename_component(fname "${h5_file}" NAME) + set (LIST_TO_CLEAR ${LIST_TO_CLEAR} + ${h5_file}.h5 + ) + endforeach () + + foreach (h5_file ${LIST_TST_TEST_FILES}) + get_filename_component(fname "${h5_file}" NAME) + set (LIST_TO_CLEAR ${LIST_TO_CLEAR} + ${h5_file}.tst.out + ${h5_file}.tst.out.err + ) + endforeach () + + foreach (h5_file ${LIST_DDL_TEST_FILES}) + get_filename_component(fname "${h5_file}" NAME) + set (LIST_TO_CLEAR ${LIST_TO_CLEAR} + ${h5_file}.ddl.out + ${h5_file}.ddl.out.err + ) + endforeach () + add_test ( + NAME H5REPACK-clearall-objects + COMMAND ${CMAKE_COMMAND} -E remove ${LIST_TO_CLEAR} + ) + set_tests_properties (H5REPACK-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif () endif () ADD_HELP_TEST(help 0 -h) @@ -807,17 +908,17 @@ # filters are defined. # detect whether the encoder is present. - set (USE_FILTER_SZIP_ENCODER "no") +# set (USE_FILTER_SZIP_ENCODER 0) if (HDF5_ENABLE_SZIP_ENCODING) set (USE_FILTER_SZIP_ENCODER ${testh5repack_detect_szip}) endif () if (H5_HAVE_FILTER_DEFLATE) - set (USE_FILTER_DEFLATE "true") + set (USE_FILTER_DEFLATE 1) endif () if (H5_HAVE_FILTER_SZIP) - set (USE_FILTER_SZIP "true") + set (USE_FILTER_SZIP 1) endif () # copy files (these files have no filters) @@ -856,16 +957,20 @@ # szip with individual object set (arg ${FILE4} -f dset2:SZIP=8,EC -l dset2:CHUNK=20x10) set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (szip_individual ${TESTTYPE} ${arg}) # szip for all set (arg ${FILE4} -f SZIP=8,NN) set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (szip_all ${TESTTYPE} ${arg}) @@ -888,8 +993,10 @@ # all filters set (arg ${FILE4} -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2:GZIP=1 -l dset2:CHUNK=20x10) set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (all_filters ${TESTTYPE} ${arg}) @@ -908,16 +1015,20 @@ # szip copy set (arg ${FILE7}) set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (szip_copy ${TESTTYPE} ${arg}) # szip remove set (arg ${FILE7} --filter=dset_szip:NONE) set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (szip_remove ${TESTTYPE} ${arg}) @@ -980,23 +1091,29 @@ # remove all filters set (arg ${FILE11} -f NONE) set (TESTTYPE "TEST") - if (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (remove_all ${TESTTYPE} ${arg}) #filter conversions set (arg ${FILE8} -f dset_deflate:SZIP=8,NN) set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (deflate_convert ${TESTTYPE} ${arg}) set (arg ${FILE7} -f dset_szip:GZIP=1) set (TESTTYPE "TEST") - if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE) - set (TESTTYPE "SKIP") + if (NOT USE_FILTER_SZIP_ENCODER) + if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) + set (TESTTYPE "SKIP") + endif () endif () ADD_H5_TEST (szip_convert ${TESTTYPE} ${arg}) @@ -1264,7 +1381,7 @@ if (WIN32) set (TESTRETVAL -1) endif () - ADD_H5_CMP_TEST (plugin_zero "" "TEST" ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0,0) + ADD_H5_UD_TEST (plugin_zero ${TESTRETVAL} h5repack_layout.h5 -v -f UD=250,0,0) if (HDF5_TEST_VFD) # Run test with different Virtual File Driver diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl new file mode 100644 index 0000000..97cbfc0 --- /dev/null +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.ddl @@ -0,0 +1,4 @@ +HDF5 "out-plugin_zero.h5repack_layout.h5" { +GROUP "/" { +} +} diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst b/tools/test/h5repack/testfiles/plugin_zero.h5repack_layout.h5.tst index 0993d5b..20f8a40 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst +++ b/tools/test/h5repack/testfiles/plugin_zero.h5repack_layout.h5.tst @@ -1,9 +1,7 @@ Objects to modify layout are... Objects to apply filter are... User Defined 250 -Making file <out-plugin_zero.h5repack_layout.h5>... ----------------------------------------- Type Filter (Compression) Name ----------------------------------------- group / -h5repack error: <h5repack_layout.h5>: Could not copy data to: out-plugin_zero.h5repack_layout.h5 diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index cd52886..bab6593 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -78,7 +78,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat> ${ARGN}) - if (NOT ${resultcode} STREQUAL "0") + if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () if (NOT "${last_test}" STREQUAL "") |