diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-02-11 20:51:38 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-02-11 20:51:38 (GMT) |
commit | 702f719e0c6771c8eb56d63566d20b3cef961f2c (patch) | |
tree | 5e879b35c08dcb0f6b50cb1c457cb6fac0083d26 /tools/h5jam | |
parent | 84c4ade7146b9a0f43ba22e4263bef7e56700c4d (diff) | |
download | hdf5-702f719e0c6771c8eb56d63566d20b3cef961f2c.zip hdf5-702f719e0c6771c8eb56d63566d20b3cef961f2c.tar.gz hdf5-702f719e0c6771c8eb56d63566d20b3cef961f2c.tar.bz2 |
HDFFV-11012, sanitize, warnings and tools ids
Diffstat (limited to 'tools/h5jam')
-rw-r--r-- | tools/h5jam/CMakeTests.cmake | 28 | ||||
-rw-r--r-- | tools/h5jam/getub.c | 2 | ||||
-rw-r--r-- | tools/h5jam/h5jam.c | 8 | ||||
-rw-r--r-- | tools/h5jam/h5unjam.c | 4 | ||||
-rw-r--r-- | tools/h5jam/testh5jam.sh.in | 28 |
5 files changed, 33 insertions, 37 deletions
diff --git a/tools/h5jam/CMakeTests.cmake b/tools/h5jam/CMakeTests.cmake index 3a07929..61efdb1 100644 --- a/tools/h5jam/CMakeTests.cmake +++ b/tools/h5jam/CMakeTests.cmake @@ -47,12 +47,6 @@ ############################################################################## ############################################################################## - if (NOT BUILD_SHARED_LIBS) - set (tgt_ext "") - else () - set (tgt_ext "-shared") - endif () - # ============================================================ # TEST_H5JAM_OUTPUT # For the purpose to verify only output & exitcode from h5jam @@ -60,7 +54,7 @@ macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jam${tgt_ext}> ${ARGN}) + add_test (NAME H5JAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jam${tgt_file_ext}> ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -69,7 +63,7 @@ NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5jam${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5jam${tgt_file_ext}>" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -89,7 +83,7 @@ macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5unjam${tgt_ext}> ${ARGN}) + add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5unjam${tgt_file_ext}> ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -98,7 +92,7 @@ NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam${tgt_file_ext}>" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -116,7 +110,7 @@ NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" -D "TEST_ARGS:STRING=testfiles/${expected}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.new" @@ -130,7 +124,7 @@ NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>" -D "TEST_ARGS:STRING=${actual}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.out" @@ -165,7 +159,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${ufile} ) set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) - add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5unjam${tgt_ext}> -i ${infile} -u ${ufile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5unjam${tgt_file_ext}> -i ${infile} -u ${ufile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test ${ufile}) else () @@ -174,7 +168,7 @@ NAME H5JAM-${testname}-UNJAM COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam${tgt_ext}>" + -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam${tgt_file_ext}>" -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${outfile}.ufile.txt" @@ -185,7 +179,7 @@ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") else () - add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5unjam${tgt_ext}> -i ${infile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5unjam${tgt_file_ext}> -i ${infile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "") endif () @@ -247,7 +241,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) endif () - add_test (NAME H5JAM-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jam${tgt_ext}> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) + add_test (NAME H5JAM-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jam${tgt_file_ext}> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) if (NOT HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) set (compare_test ${outfile}) @@ -302,7 +296,7 @@ ) set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP) - add_test (NAME H5JAM-${testname}_NONE COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jam${tgt_ext}> -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) + add_test (NAME H5JAM-${testname}_NONE COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5jam${tgt_file_ext}> -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY) set (compare_test ${chkfile}) diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 26a427d..f496a7a 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -81,7 +81,7 @@ parse_command_line(int argc, const char *argv[]) int main(int argc, const char *argv[]) { - int fd = -1; + int fd = H5I_INVALID_HID; unsigned size; char *filename = NULL; long res; diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index fae7b9e..fefa640 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -197,8 +197,8 @@ main (int argc, const char *argv[]) int ofid = -1; void *edata; H5E_auto2_t func; - hid_t ifile = -1; - hid_t plist = -1; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; herr_t status; htri_t testval; hsize_t usize; @@ -522,7 +522,9 @@ compute_user_block_size(hsize_t ublock_size) /*------------------------------------------------------------------------- * Write zeroes to fill the file from 'where' to 512, 1024, etc. bytes. * - * Returns the size of the padded file. + * Sets new_where to the size of the padded file and + * returns SUCCEED/FAIL. + *------------------------------------------------------------------------- */ herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where) diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index ffe2aca..33c5a1b 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -199,8 +199,8 @@ main(int argc, const char *argv[]) { void *edata; H5E_auto2_t func; - hid_t ifile = -1; - hid_t plist = -1; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; off_t fsize; hsize_t usize; htri_t testval; diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in index 187054b..1185e7d 100644 --- a/tools/h5jam/testh5jam.sh.in +++ b/tools/h5jam/testh5jam.sh.in @@ -326,20 +326,20 @@ CHECK_NOUB() { # call 'ubsize' to get the size of the user block ubsize=`$JAM_BIN/tellub $hfile` - if [ "$?" != "0" ]; - then - # error - result2=1; - else - if [ "$ubsize" = "0" ]; - then - # pass - result2=0; - else - # fail - result2=1; - fi - fi + if [ "$?" != "0" ]; + then + # error + result2=1; + else + if [ "$ubsize" = "0" ]; + then + # pass + result2=0; + else + # fail + result2=1; + fi + fi } # JAMTEST user_block file.h5 [--clobber] [ofile.h5] |