diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-11-04 20:55:57 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-11-04 20:55:57 (GMT) |
commit | 75d7bbe89b0610fb076fd6237ad57a3e215c9571 (patch) | |
tree | fd3d31054349bb18c1f8e9e779beddd966c06f02 /test | |
parent | c583c6a1460a4b080af3b8df152a00c2fedcf025 (diff) | |
parent | 52bff896a7e57d1c1b19438b8be76b2cb01ae94b (diff) | |
download | hdf5-75d7bbe89b0610fb076fd6237ad57a3e215c9571.zip hdf5-75d7bbe89b0610fb076fd6237ad57a3e215c9571.tar.gz hdf5-75d7bbe89b0610fb076fd6237ad57a3e215c9571.tar.bz2 |
[svn-r25782] - Merge latest trunk into branch.
- Modify Dataset IO code with Quincey's changes.
- fix bugs.
tested on Jam.
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | test/CMakeTests.cmake | 23 | ||||
-rw-r--r-- | test/Makefile.in | 2 | ||||
-rw-r--r-- | test/accum.c | 199 | ||||
-rw-r--r-- | test/cache_api.c | 14 | ||||
-rw-r--r-- | test/cache_tagging.c | 2 | ||||
-rw-r--r-- | test/cmpd_dset.c | 2 | ||||
-rw-r--r-- | test/dangle.c | 6 | ||||
-rw-r--r-- | test/dsets.c | 78 | ||||
-rw-r--r-- | test/dt_arith.c | 4 | ||||
-rw-r--r-- | test/dtypes.c | 43 | ||||
-rw-r--r-- | test/enc_dec_plist.c | 1 | ||||
-rw-r--r-- | test/err_compat.c | 2 | ||||
-rw-r--r-- | test/error_test.c | 2 | ||||
-rw-r--r-- | test/external.c | 2 | ||||
-rw-r--r-- | test/fillval.c | 28 | ||||
-rw-r--r-- | test/gen_bogus.c | 2 | ||||
-rw-r--r-- | test/getname.c | 16 | ||||
-rw-r--r-- | test/h5test.c | 119 | ||||
-rw-r--r-- | test/h5test.h | 4 | ||||
-rw-r--r-- | test/links.c | 19 | ||||
-rw-r--r-- | test/ntypes.c | 2 | ||||
-rw-r--r-- | test/objcopy.c | 16 | ||||
-rw-r--r-- | test/tattr.c | 84 | ||||
-rw-r--r-- | test/testfiles/err_compat_1 | 8 | ||||
-rw-r--r-- | test/testfiles/error_test_1 | 16 | ||||
-rw-r--r-- | test/testframe.c | 23 | ||||
-rw-r--r-- | test/tfile.c | 20 | ||||
-rw-r--r-- | test/th5s.c | 5 | ||||
-rw-r--r-- | test/tid.c | 14 | ||||
-rw-r--r-- | test/trefer.c | 55 | ||||
-rw-r--r-- | test/tunicode.c | 2 |
32 files changed, 496 insertions, 323 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 67bba2b..2554bbf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TEST) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -add_definitions (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Generate the H5srcdir_str.h file containing user settings needed by compilation @@ -64,7 +64,7 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) - add_definitions (${HDF5_EXTRA_C_FLAGS}) + add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) @@ -95,7 +95,7 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}") set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}") set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME}) - add_definitions (${HDF5_EXTRA_C_FLAGS}) + add_definitions (${HDF_EXTRA_C_FLAGS}) INCLUDE_DIRECTORIES (${HDF5_SRC_DIR}) add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index cf3c54b..4e22529 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -254,6 +254,9 @@ foreach (test ${H5_TESTS}) endforeach (test ${H5_TESTS}) set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) +set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) +set_tests_properties (H5TEST-testmeta PROPERTIES TIMEOUT 1800) +set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) ############################################################################## ############################################################################## @@ -322,7 +325,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-err_compat PROPERTIES DEPENDS H5TEST-clear-err_compat-objects) endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) @@ -343,7 +346,7 @@ add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-error_test PROPERTIES DEPENDS H5TEST-clear-error_test-objects) set_tests_properties (H5TEST-error_test PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PRELOAD=::") @@ -368,7 +371,7 @@ add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" -D "TEST_OUTPUT=links_env.txt" -D "TEST_REFERENCE=links_env.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-links_env PROPERTIES DEPENDS H5TEST-clear-links_env-objects) @@ -438,7 +441,7 @@ if (HDF5_TEST_VFD) objcopy links unlink - big +# big mtime fillval mount @@ -467,7 +470,10 @@ if (HDF5_TEST_VFD) testmeta links_env unregister -) + ) + if (NOT CYGWIN) + set (H5_VFD_TESTS ${H5_VFD_TESTS} big) + endif (NOT CYGWIN) if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) @@ -484,9 +490,11 @@ if (HDF5_TEST_VFD) -D "TEST_EXPECT=${resultcode}" -D "TEST_OUTPUT=${test}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) endforeach (test ${H5_VFD_TESTS}) + set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10) + set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10) if (HDF5_TEST_FHEAP_VFD) add_test ( NAME VFD-${vfdname}-fheap @@ -497,8 +505,9 @@ if (HDF5_TEST_VFD) -D "TEST_EXPECT=${resultcode}" -D "TEST_OUTPUT=fheap" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) + set_tests_properties (VFD-${vfdname}-fheap PROPERTIES TIMEOUT 1800) endif (HDF5_TEST_FHEAP_VFD) ENDMACRO (ADD_VFD_TEST) diff --git a/test/Makefile.in b/test/Makefile.in index 848dcfc..29f05c7 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -909,14 +909,12 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ -MPI_GET_SIZE = @MPI_GET_SIZE@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ diff --git a/test/accum.c b/test/accum.c index e981b38..a924517 100644 --- a/test/accum.c +++ b/test/accum.c @@ -38,18 +38,18 @@ H5F_t * f = NULL; /* Function Prototypes */ -unsigned test_write_read(void); -unsigned test_write_read_nonacc_front(void); -unsigned test_write_read_nonacc_end(void); -unsigned test_accum_overlap(void); -unsigned test_accum_overlap_clean(void); -unsigned test_accum_overlap_size(void); -unsigned test_accum_non_overlap_size(void); -unsigned test_accum_adjust(void); -unsigned test_read_after(void); -unsigned test_free(void); -unsigned test_big(void); -unsigned test_random_write(void); +unsigned test_write_read(const H5F_io_info_t *fio_info); +unsigned test_write_read_nonacc_front(const H5F_io_info_t *fio_info); +unsigned test_write_read_nonacc_end(const H5F_io_info_t *fio_info); +unsigned test_accum_overlap(const H5F_io_info_t *fio_info); +unsigned test_accum_overlap_clean(const H5F_io_info_t *fio_info); +unsigned test_accum_overlap_size(const H5F_io_info_t *fio_info); +unsigned test_accum_non_overlap_size(const H5F_io_info_t *fio_info); +unsigned test_accum_adjust(const H5F_io_info_t *fio_info); +unsigned test_read_after(const H5F_io_info_t *fio_info); +unsigned test_free(const H5F_io_info_t *fio_info); +unsigned test_big(const H5F_io_info_t *fio_info); +unsigned test_random_write(const H5F_io_info_t *fio_info); /* Helper Function Prototypes */ void accum_printf(void); @@ -57,9 +57,9 @@ void accum_printf(void); /* Private Test H5Faccum Function Wrappers */ #define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b)) #define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b)) -#define accum_free(a,s) H5F_accum_free(f, H5P_DATASET_XFER_DEFAULT, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) -#define accum_flush() H5F_accum_flush(f, H5P_DATASET_XFER_DEFAULT) -#define accum_reset() H5F_accum_reset(f, H5P_DATASET_XFER_DEFAULT, TRUE) +#define accum_free(fio_info,a,s) H5F__accum_free(fio_info, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) +#define accum_flush(fio_info) H5F__accum_flush(fio_info) +#define accum_reset(fio_info) H5F__accum_reset(fio_info, TRUE) /* ================= */ /* Main Test Routine */ @@ -82,6 +82,7 @@ void accum_printf(void); int main(void) { + H5F_io_info_t fio_info; /* I/O info for operation */ unsigned nerrors = 0; /* track errors */ hid_t fid = -1; @@ -98,22 +99,26 @@ main(void) file a ways. 10MB should do. */ if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024*1024*10)) < 0) FAIL_STACK_ERROR + /* Set up I/O info for operation */ + fio_info.f = f; + if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) FAIL_STACK_ERROR + /* Reset metadata accumulator for the file */ - if(accum_reset() < 0) FAIL_STACK_ERROR + if(accum_reset(&fio_info) < 0) FAIL_STACK_ERROR /* Test Functions */ - nerrors += test_write_read(); - nerrors += test_write_read_nonacc_front(); - nerrors += test_write_read_nonacc_end(); - nerrors += test_accum_overlap(); - nerrors += test_accum_overlap_clean(); - nerrors += test_accum_overlap_size(); - nerrors += test_accum_non_overlap_size(); - nerrors += test_accum_adjust(); - nerrors += test_read_after(); - nerrors += test_free(); - nerrors += test_big(); - nerrors += test_random_write(); + nerrors += test_write_read(&fio_info); + nerrors += test_write_read_nonacc_front(&fio_info); + nerrors += test_write_read_nonacc_end(&fio_info); + nerrors += test_accum_overlap(&fio_info); + nerrors += test_accum_overlap_clean(&fio_info); + nerrors += test_accum_overlap_size(&fio_info); + nerrors += test_accum_non_overlap_size(&fio_info); + nerrors += test_accum_adjust(&fio_info); + nerrors += test_read_after(&fio_info); + nerrors += test_free(&fio_info); + nerrors += test_big(&fio_info); + nerrors += test_random_write(&fio_info); /* End of test code, close and delete file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -149,7 +154,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_write_read(void) +test_write_read(const H5F_io_info_t *fio_info) { int i = 0; int *write_buf, *read_buf; @@ -172,7 +177,7 @@ test_write_read(void) if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -205,7 +210,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_write_read_nonacc_front(void) +test_write_read_nonacc_front(const H5F_io_info_t *fio_info) { int i = 0; int *write_buf, *read_buf; @@ -225,13 +230,13 @@ test_write_read_nonacc_front(void) /* Do a simple write/read/verify of data */ /* Write 1KB at Address 0 */ if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR; - if(accum_flush() < 0) FAIL_STACK_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR; if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -264,7 +269,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_write_read_nonacc_end(void) +test_write_read_nonacc_end(const H5F_io_info_t *fio_info) { int i = 0; int *write_buf, *read_buf; @@ -284,13 +289,13 @@ test_write_read_nonacc_end(void) /* Do a simple write/read/verify of data */ /* Write 1KB at Address 0 */ if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR; - if(accum_flush() < 0) FAIL_STACK_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR; if(accum_read(1024, 1024, read_buf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -323,7 +328,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_free(void) +test_free(const H5F_io_info_t *fio_info) { int i = 0; int32_t *wbuf = NULL; @@ -346,38 +351,38 @@ test_free(void) if(accum_write(0, 256 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; - if(accum_free(0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Free an empty accumulator */ - if(accum_free(0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Write second quarter of the accumulator */ if(accum_write(64 * sizeof(int32_t), 64 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; /* Free the second quarter of the accumulator, the requested area * is bigger than the data region on the right side. */ - if(accum_free(64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Write half of the accumulator. */ if(accum_write(0, 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; /* Free the first block of 4B */ - if(accum_free(0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(1 * sizeof(int32_t), 127 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf + 1, rbuf, 127 * sizeof(int32_t)) != 0) TEST_ERROR; /* Free the block of 4B at 127*4B */ - if(accum_free(127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(1 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf + 1, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR; /* Free the block of 4B at 2*4B */ - if(accum_free(2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(1 * sizeof(int32_t), 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; @@ -390,10 +395,10 @@ test_free(void) * entirely before dirty section */ if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t)); - if(accum_free(62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(66 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; @@ -404,10 +409,10 @@ test_free(void) * completely contains dirty section */ if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t)); - if(accum_free(62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; @@ -418,10 +423,10 @@ test_free(void) * before dirty section */ if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t)); - if(accum_free(66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(70 * sizeof(int32_t), 122 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; @@ -432,10 +437,10 @@ test_free(void) * dirty section, and ends in dirty section */ if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t)); - if(accum_free(70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(74 * sizeof(int32_t), 118 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; @@ -446,10 +451,10 @@ test_free(void) * contains dirty section */ if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t)); - if(accum_free(70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; @@ -460,10 +465,10 @@ test_free(void) * of dirty section, and ends in dirty section */ if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t)); - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; if(accum_write(72 * sizeof(int32_t), 8 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; HDmemcpy(expect + 72, wbuf, 8 * sizeof(int32_t)); - if(accum_free(72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; + if(accum_free(fio_info, 72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR; /* Check that the accumulator still contains the correct data */ if(accum_read(76 * sizeof(int32_t), 116 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; @@ -476,7 +481,7 @@ test_free(void) HDfree(expect); expect = NULL; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -510,7 +515,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_accum_overlap(void) +test_accum_overlap(const H5F_io_info_t *fio_info) { int i = 0; int32_t *wbuf, *rbuf; @@ -646,7 +651,7 @@ test_accum_overlap(void) if(accum_read(112, 6 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -682,7 +687,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_accum_overlap_clean(void) +test_accum_overlap_clean(const H5F_io_info_t *fio_info) { int i = 0; int32_t *wbuf, *rbuf; @@ -708,7 +713,7 @@ test_accum_overlap_clean(void) /* Case 2: End of new piece aligns with start of clean accumulated data */ /* Write 5 2's at address 20 */ /* @0:| 222221111111111| */ - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; for(i = 0; i < 5; i++) wbuf[i] = 2; if(accum_write(20, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; @@ -748,7 +753,7 @@ test_accum_overlap_clean(void) /* Case 6: New piece completely within clean accumulated data */ /* Write 3 6's at address 44 */ /* @0:| 333334666511111| */ - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; for(i = 0; i < 3; i++) wbuf[i] = 6; if(accum_write(44, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; @@ -758,7 +763,7 @@ test_accum_overlap_clean(void) /* Case 7: New piece overlaps start of clean accumulated data */ /* Write 2 7's at address 16 */ /* @0:| 7733334666511111| */ - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; for(i = 0; i < 2; i++) wbuf[i] = 7; if(accum_write(16, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; @@ -778,7 +783,7 @@ test_accum_overlap_clean(void) /* Case 9: Start of new piece aligns with end of clean accumulated data */ /* Write 3 9's at address 80 */ /* @0:| 88883334666511111999| */ - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; for(i = 0; i < 3; i++) wbuf[i] = 9; if(accum_write(80, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; @@ -788,7 +793,7 @@ test_accum_overlap_clean(void) /* Case 10: New piece overlaps end of clean accumulated data */ /* Write 3 2's at address 88 */ /* @0:| 888833346665111119922| */ - if(accum_flush() < 0) FAIL_STACK_ERROR; + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR; for(i = 0; i < 2; i++) wbuf[i] = 2; if(accum_write(88, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR; @@ -826,7 +831,7 @@ test_accum_overlap_clean(void) if(accum_read(12, 22 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf, rbuf, 22 * sizeof(int32_t)) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -861,7 +866,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_accum_non_overlap_size(void) +test_accum_non_overlap_size(const H5F_io_info_t *fio_info) { int i = 0; int32_t *wbuf, *rbuf; @@ -893,7 +898,7 @@ test_accum_non_overlap_size(void) if(accum_read(0, 20 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf, rbuf, 20 * sizeof(int32_t)) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -928,7 +933,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_accum_overlap_size(void) +test_accum_overlap_size(const H5F_io_info_t *fio_info) { int i = 0; int32_t *wbuf, *rbuf; @@ -960,7 +965,7 @@ test_accum_overlap_size(void) if(accum_read(60, 72 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf, rbuf, 72 * sizeof(int32_t)) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -1006,7 +1011,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_accum_adjust(void) +test_accum_adjust(const H5F_io_info_t *fio_info) { int i = 0; int s = 1048576; /* size of buffer */ @@ -1052,7 +1057,7 @@ test_accum_adjust(void) if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR; /* Reset accumulator for next case */ - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* ================================================================ */ /* Case 2: Prepending large block to large, fully dirty accumulator */ @@ -1081,7 +1086,7 @@ test_accum_adjust(void) if(HDmemcmp(wbuf, rbuf, 1048571) != 0) TEST_ERROR; /* Reset accumulator for next case */ - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* ========================================================= */ /* Case 3: Appending small block to large, clean accumulator */ @@ -1095,7 +1100,7 @@ test_accum_adjust(void) /* Flush the accumulator -- we want to test the case when accumulator contains clean data */ - if(accum_flush() < 0) FAIL_STACK_ERROR + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR /* Write a small (1KB) block to the end of the accumulator */ /* ==> Accumulator will need more buffer space */ @@ -1116,7 +1121,7 @@ test_accum_adjust(void) if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR; /* Reset accumulator for next case */ - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* ==================================================================== */ /* Case 4: Appending small block to large, partially dirty accumulator, */ @@ -1130,7 +1135,7 @@ test_accum_adjust(void) if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR; /* Flush the accumulator to clean it */ - if(accum_flush() < 0) FAIL_STACK_ERROR + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR /* write to part of the accumulator so just the start of it is dirty */ if(accum_write(0, 5, wbuf) < 0) FAIL_STACK_ERROR; @@ -1156,7 +1161,7 @@ test_accum_adjust(void) if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR; /* Reset accumulator for next case */ - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* ==================================================================== */ /* Case 5: Appending small block to large, partially dirty accumulator, */ @@ -1167,7 +1172,7 @@ test_accum_adjust(void) if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR; /* Flush the accumulator to clean it */ - if(accum_flush() < 0) FAIL_STACK_ERROR + if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR /* write to part of the accumulator so it's dirty, but not entirely dirty */ /* (just the begging few bytes will be clean) */ @@ -1193,7 +1198,7 @@ test_accum_adjust(void) if(HDmemcmp(wbuf, rbuf, 10) != 0) TEST_ERROR; /* Reset accumulator for next case */ - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* ================================================================= */ /* Case 6: Appending small block to large, fully dirty accumulator */ @@ -1224,7 +1229,7 @@ test_accum_adjust(void) if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -1262,7 +1267,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_read_after(void) +test_read_after(const H5F_io_info_t *fio_info) { int i = 0; int s = 128; /* size of buffer */ @@ -1307,7 +1312,7 @@ test_read_after(void) if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR; if(HDmemcmp(wbuf, rbuf, 128) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -1341,7 +1346,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_big(void) +test_big(const H5F_io_info_t *fio_info) { uint8_t *wbuf, *wbuf2, *rbuf, *zbuf; /* Buffers for reading & writing, etc */ unsigned u; /* Local index variable */ @@ -1377,7 +1382,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section to middle of accumulator */ @@ -1396,7 +1401,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(1024, 1024, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section to overlap with end of "big" region */ @@ -1414,7 +1419,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(BIG_BUF_SIZE - 512, 1024, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section to overlap with beginning of "big" region */ @@ -1432,7 +1437,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(0, 1024, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section to middle of accumulator */ @@ -1454,7 +1459,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section to overlap with end of "big" region */ @@ -1477,7 +1482,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(0, BIG_BUF_SIZE + 512, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE + 512); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section to be past "big" region */ @@ -1505,7 +1510,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE + 1024); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section to be past "big" region */ @@ -1533,7 +1538,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(1536, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section before "big" region */ @@ -1560,7 +1565,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(512, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE + 512); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section before "big" region */ @@ -1588,7 +1593,7 @@ test_big(void) /* Reset data in file back to zeros & reset the read buffer */ if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR; HDmemset(rbuf, 0, BIG_BUF_SIZE + 1536); - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; /* Write small section before "big" region */ @@ -1612,7 +1617,7 @@ test_big(void) if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); @@ -1649,7 +1654,7 @@ error: *------------------------------------------------------------------------- */ unsigned -test_random_write(void) +test_random_write(const H5F_io_info_t *fio_info) { uint8_t *wbuf, *rbuf; /* Buffers for reading & writing */ unsigned seed = 0; /* Random # seed */ @@ -1749,7 +1754,7 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed); /* Verify data read back in */ if(HDmemcmp(wbuf, rbuf, RANDOM_BUF_SIZE) != 0) TEST_ERROR; - if(accum_reset() < 0) FAIL_STACK_ERROR; + if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR; PASSED(); diff --git a/test/cache_api.c b/test/cache_api.c index 66f8143..b1ccef1 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -3038,7 +3038,7 @@ check_fapl_mdc_api_errs(void) if ( pass ) { H5E_BEGIN_TRY { - result = H5Pget_mdc_config(-1, &scratch); + result = H5Pget_mdc_config((hid_t)-1, &scratch); } H5E_END_TRY; if ( result >= 0 ) { @@ -3109,7 +3109,7 @@ check_fapl_mdc_api_errs(void) if ( pass ) { H5E_BEGIN_TRY { - result = H5Pset_mdc_config(-1, &default_config); + result = H5Pset_mdc_config((hid_t)-1, &default_config); } H5E_END_TRY; if ( result >= 0 ) { @@ -3258,7 +3258,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fget_mdc_config(-1, &scratch); + result = H5Fget_mdc_config((hid_t)-1, &scratch); } H5E_END_TRY; if ( result >= 0 ) { @@ -3317,7 +3317,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fset_mdc_config(-1, &default_config); + result = H5Fset_mdc_config((hid_t)-1, &default_config); } H5E_END_TRY; if ( result >= 0 ) { @@ -3385,7 +3385,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fget_mdc_hit_rate(-1, &hit_rate); + result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate); } H5E_END_TRY; if ( result >= 0 ) { @@ -3425,7 +3425,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Freset_mdc_hit_rate_stats(-1); + result = H5Freset_mdc_hit_rate_stats((hid_t)-1); } H5E_END_TRY; if ( result >= 0 ) { @@ -3446,7 +3446,7 @@ check_file_mdc_api_errs(void) } H5E_BEGIN_TRY { - result = H5Fget_mdc_size(-1, &max_size, &min_clean_size, + result = H5Fget_mdc_size((hid_t)-1, &max_size, &min_clean_size, &cur_size, &cur_num_entries); } H5E_END_TRY; diff --git a/test/cache_tagging.c b/test/cache_tagging.c index f644235..30ca1de 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -666,7 +666,7 @@ check_file_open_tags(hid_t fcpl, int type) /* =================== */ /* TEST: Open The File */ /* =================== */ - if ( (fid = H5Fopen(FILENAME, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index b3d17dc..a782fb0 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2183,7 +2183,7 @@ main (int argc, char *argv[]) fprintf(stderr, "usage: %s [--noopt]\n", argv[0]); exit(1); } - H5Tunregister(H5T_PERS_DONTCARE, NULL, -1, -1, H5T__conv_struct_opt); + H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, H5T__conv_struct_opt); } /* Create the file */ diff --git a/test/dangle.c b/test/dangle.c index dfa73ba..4c8ce6b 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -599,7 +599,7 @@ test_dangle_force(void) FAIL_STACK_ERROR /* Get the number of open objects */ - if((count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0) + if((count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0) FAIL_STACK_ERROR if(0 == count) TEST_ERROR; @@ -608,7 +608,7 @@ test_dangle_force(void) objs = (hid_t*)HDmalloc(sizeof(hid_t) * (size_t)count); /* Get the list of open IDs */ - if(H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) + if(H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) FAIL_STACK_ERROR /* Close all open IDs */ @@ -617,7 +617,7 @@ test_dangle_force(void) H5Idec_ref(objs[u]); /* Get the number of open objects */ - if((count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0) + if((count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL)) < 0) FAIL_STACK_ERROR if(0 != count) TEST_ERROR; diff --git a/test/dsets.c b/test/dsets.c index 3cd303f..3055943 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -50,6 +50,7 @@ const char *FILENAME[] = { "chunk_expand", "copy_dcpl_newfile", "layout_extend", + "zero_chunk", NULL }; #define FILENAME_BUF_SIZE 1024 @@ -3842,7 +3843,7 @@ test_nbit_compound_3(hid_t file) for(k = 0; k < (i+1); k++) ((unsigned int *)orig_data[i].v.p)[k] = (unsigned int)(i*100 + k); /* Create reference to the dataset "nbit_obj_ref" */ - if(H5Rcreate(&orig_data[i].r, file, "nbit_obj_ref", H5R_OBJECT, -1) < 0) goto error; + if(H5Rcreate(&orig_data[i].r, file, "nbit_obj_ref", H5R_OBJECT, (hid_t)-1) < 0) goto error; for(j = 0; j < 5; j++) orig_data[i].o[j] = (unsigned char)(i + j); } @@ -8192,6 +8193,80 @@ error: /*------------------------------------------------------------------------- + * Function: test_zero_dim_dset + * + * Purpose: Tests support for reading a 1D chunled dataset with + * dimension size = 0. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * Wednesdat, July 9, 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_zero_dim_dset(hid_t fapl) +{ + char filename[FILENAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t dcpl = -1; /* Dataset creation property list ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dsid = -1; /* Dataset ID */ + hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */ + int data[1]; + + TESTING("shrinking large chunk"); + + h5_fixname(FILENAME[13], fapl, filename, sizeof filename); + + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + + /* Create dataset creation property list */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + + /* Set 1 chunk size */ + chunk_dim = 1; + if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR + + /* Create 1D dataspace with 0 dim size */ + dim = 0; + if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR + + /* Create chunked dataset */ + if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* write 0 elements from dataset */ + if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR + + /* Read 0 elements from dataset */ + if(H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR + + /* Close everything */ + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dsid); + H5Sclose(sid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end test_zero_dim_dset() */ + + +/*------------------------------------------------------------------------- * Function: test_scatter * * Purpose: Tests H5Dscatter with a variety of different selections @@ -9340,6 +9415,7 @@ main(void) nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); + nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0); if(H5Fclose(file) < 0) goto error; diff --git a/test/dt_arith.c b/test/dt_arith.c index 1922f72..a93d1b8 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -1204,8 +1204,8 @@ test_derived_flt(void) src_size = H5Tget_size(tid2); dst_size = H5Tget_size(tid1); endian = H5Tget_order(tid2); - buf = (unsigned char *)HDmalloc(nelmts*(MAX(src_size, dst_size))); - saved_buf = (unsigned char *)HDmalloc(nelmts*src_size); + buf = (unsigned char *)HDmalloc(nelmts * (MAX(src_size, dst_size))); + saved_buf = (unsigned char *)HDmalloc(nelmts * src_size); HDmemset(buf, 0, nelmts * MAX(src_size, dst_size)); HDmemset(saved_buf, 0, nelmts*src_size); diff --git a/test/dtypes.c b/test/dtypes.c index f297b58..b2783c3 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -65,8 +65,8 @@ FAIL_STACK_ERROR \ if((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \ H5_FAILED(); \ - printf(" #dtype ids expected: %d; found: %d\n", NMEMBS, \ - H5I_nmembers(H5I_DATATYPE)); \ + printf(" #dtype ids expected: %lld; found: %lld\n", \ + (long long)NMEMBS, (long long)H5I_nmembers(H5I_DATATYPE)); \ goto error; \ } @@ -688,8 +688,9 @@ test_compound_2(void) const hsize_t four = 4; unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; hid_t st=-1, dt=-1; - hid_t array_dt; - int i, nmembs; + hid_t array_dt; + int64_t nmembs; + int i; TESTING("compound element reordering"); @@ -809,8 +810,9 @@ test_compound_3(void) const hsize_t four = 4; unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; hid_t st=-1, dt=-1; - hid_t array_dt; - int i, nmembs; + hid_t array_dt; + int64_t nmembs; + int i; TESTING("compound subset conversions"); @@ -931,8 +933,9 @@ test_compound_4(void) const hsize_t four = 4; unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; hid_t st=-1, dt=-1; - hid_t array_dt; - int i, nmembs; + hid_t array_dt; + int64_t nmembs; + int i; TESTING("compound element shrinking & reordering"); @@ -1066,14 +1069,7 @@ test_compound_5(void) void *bkg = HDcalloc((size_t)2, sizeof(dst_type_t)); int retval = 1; -#if 1 TESTING("optimized struct converter"); -#else - /* Turn off optimized compound conversion function to work around - * the problem. */ - TESTING("optimized struct converter bug workaround"); - H5Tunregister(H5T_PERS_DONTCARE, "struct(opt)", -1, -1, NULL); -#endif /* Build datatypes */ short_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(short)); @@ -1167,7 +1163,8 @@ test_compound_6(void) const size_t nelmts = NTESTELEM; unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; hid_t st=-1, dt=-1; - int i, nmembs; + int64_t nmembs; + int i; TESTING("compound element growing"); @@ -1560,7 +1557,7 @@ test_compound_8(void) if(tsize != (sizeof(char) + sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed compound datatype is incorrect\n"); + printf("The size of the packed compound datatype is incorrect: tsize = %zu\n", tsize); goto error; } /* end if */ @@ -3011,7 +3008,7 @@ test_compound_16(void) if(H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, (size_t)2, open_dtypes) < 0) TEST_ERROR if(open_dtypes[1]) { H5_FAILED(); AT(); - printf(" H5Fget_obj_ids returned as second id: %d; expected: 0\n", open_dtypes[1]); + printf(" H5Fget_obj_ids returned as second id: %lld; expected: 0\n", (long long)open_dtypes[1]); goto error; } @@ -3552,6 +3549,7 @@ test_transient (hid_t fapl) static hsize_t ds_size[2] = {10, 20}; hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1; char filename[1024]; + hid_t ret_id; /* Generic hid_t return value */ herr_t status; TESTING("transient datatypes"); @@ -3586,9 +3584,9 @@ test_transient (hid_t fapl) /* It should not be possible to create an attribute for a transient type */ H5E_BEGIN_TRY { - status = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); + ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; - if (status>=0) { + if (ret_id>=0) { H5_FAILED(); HDputs (" Attributes should not be allowed for transient types!"); goto error; @@ -5150,6 +5148,7 @@ test_encode(void) size_t enum_buf_size = 0; size_t vlstr_buf_size = 0; unsigned char *cmpd_buf=NULL, *enum_buf=NULL, *vlstr_buf=NULL; + hid_t ret_id; herr_t ret; TESTING("functions of encoding and decoding datatypes"); @@ -5250,9 +5249,9 @@ test_encode(void) /* Try decoding bogus buffer */ H5E_BEGIN_TRY { - ret = H5Tdecode(cmpd_buf); + ret_id = H5Tdecode(cmpd_buf); } H5E_END_TRY; - if(ret!=FAIL) { + if(ret_id!=FAIL) { H5_FAILED(); printf("Decoded bogus buffer!\n"); goto error; diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index bc1f5c3..6869a0a 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -18,6 +18,7 @@ */ #include "h5test.h" +#include "H5ACprivate.h" #include "H5Pprivate.h" static int diff --git a/test/err_compat.c b/test/err_compat.c index 346d397..576433e 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -40,7 +40,7 @@ const char *FILENAME[] = { int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; #define DSET_NAME "a_dataset" -#define FAKE_ID -1 +#define FAKE_ID (hid_t)-1 herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data); herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data); diff --git a/test/error_test.c b/test/error_test.c index 1ca9686..0d945d2 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -57,7 +57,7 @@ hid_t ERR_MIN_WRITE; hid_t ERR_MIN_GETNUM; #define DSET_NAME "a_dataset" -#define FAKE_ID 0 +#define FAKE_ID (hid_t)0 #define ERR_CLS_NAME "Error Test" #define ERR_CLS2_NAME "Second Test" diff --git a/test/external.c b/test/external.c index ae1008c..cbc9fc6 100644 --- a/test/external.c +++ b/test/external.c @@ -791,7 +791,7 @@ test_3 (hid_t fapl) } /* end if */ } /* end for */ - /* Extend the dataset by another 100 elements */ + /* Extend the dataset by another 100 elements */ if(H5Dset_extent(dset, &max_size) < 0) goto error; if(H5Sclose(file_space) < 0) goto error; if((file_space = H5Dget_space(dset)) < 0) goto error; diff --git a/test/fillval.c b/test/fillval.c index fc44f86..459620d 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -469,7 +469,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* 6. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)!=FAIL) @@ -510,7 +510,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* 4. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; H5E_BEGIN_TRY { if(H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)!=FAIL) goto error; @@ -1111,34 +1111,34 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0; nerrors += test_rdwr_cases(file, dcpl, "dset1", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset2", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset3", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset4", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */ /* This case has been tested in test_create() function */ /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset5", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined * as compound type */ @@ -1164,34 +1164,34 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0; nerrors += test_rdwr_cases(file, dcpl, "dset6", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset7", &fillval, H5D_FILL_TIME_NEVER, layout, - H5T_INTEGER, -1); + H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; fillval = 0x4c70f1cd; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset8", &fillval, H5D_FILL_TIME_ALLOC, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset9", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */ /* This case has been tested in test_create() function */ /* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; - if(H5Pset_fill_value(dcpl, -1, NULL) < 0) goto error; + if(H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset10", &fillval, H5D_FILL_TIME_NEVER, - layout, H5T_INTEGER, -1); + layout, H5T_INTEGER, (hid_t)-1); /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined * as compound type */ diff --git a/test/gen_bogus.c b/test/gen_bogus.c index 7456ae6..7d8d073 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -20,7 +20,7 @@ * Purpose: This program is run to generate an HDF5 data file with several * datasets that have "bogus" messages in their object header. */ -
+ #include "H5private.h" #include "hdf5.h" #include "H5Oprivate.h" diff --git a/test/getname.c b/test/getname.c index 31440d6..2d999b9 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2487,30 +2487,30 @@ test_obj_ref(hid_t fapl) FAIL_STACK_ERROR /* Create reference to dataset */ - if(H5Rcreate(&wbuf[0], fid1, "/Dataset3", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[0], fid1, "/Dataset3", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to dataset */ - if(H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to group */ - if(H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to named datatype */ - if(H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR - if(H5Rcreate(&wbuf[4], fid1, "/Group1/Group2/Dataset4", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[4], fid1, "/Group1/Group2/Dataset4", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR - if(H5Rcreate(&wbuf[5], fid1, "/Group1/Group2", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[5], fid1, "/Group1/Group2", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR - if(H5Rcreate(&wbuf[6], fid1, "/Group1/Group2/Link/Dataset5", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[6], fid1, "/Group1/Group2/Link/Dataset5", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Create reference to root group */ - if(H5Rcreate(&wbuf[7], fid1, "/", H5R_OBJECT, -1) < 0) + if(H5Rcreate(&wbuf[7], fid1, "/", H5R_OBJECT, (hid_t)-1) < 0) FAIL_STACK_ERROR /* Write selection to disk */ diff --git a/test/h5test.c b/test/h5test.c index 769e03f..693760c 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -92,6 +92,8 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ static const char *multi_letters = "msbrglo"; static herr_t h5_errors(hid_t estack, void *client_data); +static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix, + char *fullname, size_t size); /*------------------------------------------------------------------------- @@ -268,9 +270,59 @@ h5_reset(void) char * h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) { + return (h5_fixname_real(base_name, fapl, ".h5", fullname, size)); +} + + +/*------------------------------------------------------------------------- + * Function: h5_fixname_no_suffix + * + * Purpose: Same as h5_fixname but with no suffix appended + * + * Return: Success: The FULLNAME pointer. + * + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. + * + *------------------------------------------------------------------------- + */ +char * +h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size) +{ + return (h5_fixname_real(base_name, fapl, NULL, fullname, size)); +} + + +/*------------------------------------------------------------------------- + * Function: h5_fixname_real + * + * Purpose: Create a file name from a file base name like `test' and + * return it through the FULLNAME (at most SIZE characters + * counting the null terminator). The full name is created by + * prepending the contents of HDF5_PREFIX (separated from the + * base name by a slash) and appending a file extension based on + * the driver supplied, resulting in something like + * `ufs:/u/matzke/test.h5'. + * + * Return: Success: The FULLNAME pointer. + * + * Failure: NULL if BASENAME or FULLNAME is the null + * pointer or if FULLNAME isn't large enough for + * the result. + * + * Programmer: Robb Matzke + * Thursday, November 19, 1998 + * + *------------------------------------------------------------------------- + */ +static char * +h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, + char *fullname, size_t size) +{ const char *prefix = NULL; - const char *suffix = ".h5"; /* suffix has default */ char *ptr, last = '\0'; + const char *suffix = _suffix; size_t i, j; hid_t driver = -1; int isppdriver = 0; /* if the driver is MPI parallel */ @@ -285,10 +337,12 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) if((driver = H5Pget_driver(fapl)) < 0) return NULL; - if(H5FD_FAMILY == driver) - suffix = "%05d.h5"; - else if (H5FD_MULTI == driver) - suffix = NULL; + if(suffix) { + if(H5FD_FAMILY == driver) + suffix = "%05d.h5"; + else if (H5FD_MULTI == driver) + suffix = NULL; + } } /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX @@ -318,11 +372,11 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) */ if(isppdriver) { #ifdef H5_HAVE_PARALLEL - /* + /* * For parallel: * First use command line option, then the environment * variable, then try the constant - */ + */ static int explained = 0; prefix = (paraprefix ? paraprefix : getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX")); @@ -335,12 +389,12 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) if (mpi_rank == 0) printf("*** Hint ***\n" - "You can use environment variable HDF5_PARAPREFIX to " - "run parallel test files in a\n" - "different directory or to add file type prefix. E.g.,\n" - " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" - " export HDF5_PARAPREFIX\n" - "*** End of Hint ***\n"); + "You can use environment variable HDF5_PARAPREFIX to " + "run parallel test files in a\n" + "different directory or to add file type prefix. E.g.,\n" + " HDF5_PARAPREFIX=pfs:/PFS/user/me\n" + " export HDF5_PARAPREFIX\n" + "*** End of Hint ***\n"); explained = TRUE; #ifdef HDF5_PARAPREFIX @@ -352,7 +406,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) /* * For serial: * First use the environment variable, then try the constant - */ + */ prefix = HDgetenv("HDF5_PREFIX"); #ifdef HDF5_PREFIX @@ -425,18 +479,18 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) return NULL; } } else if (HDstrlen(base_name) >= size) { - /* Buffer is too small */ - return NULL; + /* Buffer is too small */ + return NULL; } else { - HDstrcpy(fullname, base_name); - } + HDstrcpy(fullname, base_name); + } /* Append a suffix */ if (suffix) { - if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) return NULL; - HDstrcat(fullname, suffix); + HDstrcat(fullname, suffix); } /* Remove any double slashes in the filename */ @@ -623,7 +677,7 @@ h5_fileaccess(void) void h5_no_hwconv(void) { - H5Tunregister(H5T_PERS_HARD, NULL, -1, -1, NULL); + H5Tunregister(H5T_PERS_HARD, NULL, (hid_t)-1, (hid_t)-1, NULL); } @@ -854,7 +908,7 @@ h5_get_file_size(const char *filename, hid_t fapl) { char temp[2048]; /* Temporary buffer for file names */ h5_stat_t sb; /* Structure for querying file info */ - int j = 0; + int j = 0; if(fapl == H5P_DEFAULT) { /* Get the file's statistics */ @@ -870,9 +924,6 @@ h5_get_file_size(const char *filename, hid_t fapl) /* Check for simple cases */ if(driver == H5FD_SEC2 || driver == H5FD_STDIO || driver == H5FD_CORE || -#ifdef H5_HAVE_PARALLEL - driver == H5FD_MPIO || -#endif /* H5_HAVE_PARALLEL */ #ifdef H5_HAVE_WINDOWS driver == H5FD_WINDOWS || #endif /* H5_HAVE_WINDOWS */ @@ -907,6 +958,22 @@ h5_get_file_size(const char *filename, hid_t fapl) /* Return total size */ return(tot_size); } /* end if */ +#ifdef H5_HAVE_PARALLEL + else if(driver == H5FD_MPIO) { + MPI_File fh; /* MPI file handle used to open the file and verify its size */ + int mpi_ret; + MPI_Offset file_size; + + mpi_ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh); + if (mpi_ret != MPI_SUCCESS) return -1; + mpi_ret = MPI_File_get_size(fh, &file_size); + if (mpi_ret != MPI_SUCCESS) return -1; + mpi_ret = MPI_File_close(&fh); + if (mpi_ret != MPI_SUCCESS) return -1; + + return file_size; + } +#endif /* H5_HAVE_PARALLEL */ else if(driver == H5FD_FAMILY) { h5_stat_size_t tot_size = 0; @@ -1113,7 +1180,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) * *------------------------------------------------------------------------- */ -hid_t +int h5_make_local_copy(const char *origfilename, const char *local_copy_name) { int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ diff --git a/test/h5test.h b/test/h5test.h index 7813b51..ce224d8 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -142,8 +142,8 @@ extern "C" { /* Generally useful testing routines */ H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl); -H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, - size_t size); +H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size); +H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL hid_t h5_fileaccess(void); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); diff --git a/test/links.c b/test/links.c index d3ca5e4..00d8d04 100644 --- a/test/links.c +++ b/test/links.c @@ -4145,7 +4145,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) op_data.target_file = filename2; /* Core file driver has issues when used as the member file driver for a family file */ /* Family file driver cannot be used with family or multi drivers for member files */ - /* Also disable parellel member drivers, because IS_H5FD_MPI whould report FALSE, causing problems */ + /* Also disable parallel member drivers, because IS_H5FD_MPI whould report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI || base_driver == H5FD_MPIO || base_driver == H5FD_CORE) ? H5P_DEFAULT : fapl; @@ -6077,7 +6077,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) } H5E_END_TRY /* Test H5Rcreate */ - if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (-1)) < 0) TEST_ERROR + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR /* Test unlink */ if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR @@ -6307,7 +6307,6 @@ external_link_strong(hid_t fapl, hbool_t new_format) if(H5Gclose(gid2) < 0) TEST_ERROR if(H5Fclose(fid2) < 0) TEST_ERROR - PASSED(); return 0; @@ -11423,6 +11422,12 @@ delete_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR + /* Check for deletion on non-existing group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { hid_t group_id2; /* Group ID */ @@ -12601,13 +12606,13 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, /* Check for iteration w/bad location ID */ skip = 0; H5E_BEGIN_TRY { - ret = H5Literate((-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS H5E_BEGIN_TRY { - ret = H5Giterate((-1), ".", &gskip, group_iterate_old_cb, iter_info); + ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12873,7 +12878,7 @@ open_by_idx(hid_t fapl) char valname[NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t ret; /* Generic return value */ /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR @@ -13098,7 +13103,7 @@ open_by_idx_old(hid_t fapl) char valname[NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t ret; /* Generic return value */ /* Create file to mount */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); diff --git a/test/ntypes.c b/test/ntypes.c index c52c08f..bb6c973 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2148,7 +2148,7 @@ test_refer_dtype(hid_t file) TEST_ERROR; /* Create reference to named datatype */ - if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, -1) < 0) + if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR; if(H5Rget_obj_type2(dataset, H5R_OBJECT, wbuf, &obj_type) < 0) TEST_ERROR; diff --git a/test/objcopy.c b/test/objcopy.c index 1377b96..0a1d7a0 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -269,8 +269,8 @@ attach_ref_attr(hid_t file_id, hid_t loc_id) if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR /* create an attribute with two object references */ - if(H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, -1) < 0) TEST_ERROR - if(H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, -1) < 0) TEST_ERROR + if(H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR + if(H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF_OBJ, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Awrite(aid, H5T_STD_REF_OBJ, ref) < 0) TEST_ERROR @@ -750,8 +750,8 @@ compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_ /* Check raw data read in against data written out */ if(wbuf) { - if(!compare_data(aid, 0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner)) TEST_ERROR - if(!compare_data(aid2, 0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner)) TEST_ERROR + if(!compare_data(aid, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner)) TEST_ERROR + if(!compare_data(aid2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner)) TEST_ERROR } /* end if */ /* Don't have written data, just compare data between the two attributes */ else @@ -1303,8 +1303,8 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) /* Check raw data read in against data written out */ if(wbuf) { - if(!compare_data(did, 0, pid, tid, (size_t)nelmts, wbuf, rbuf, did)) TEST_ERROR - if(!compare_data(did2, 0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2)) TEST_ERROR + if(!compare_data(did, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, did)) TEST_ERROR + if(!compare_data(did2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2)) TEST_ERROR } /* end if */ /* Don't have written data, just compare data between the two datasets */ else @@ -8045,8 +8045,8 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create references */ - if(H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, -1) < 0) TEST_ERROR - if(H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, -1) < 0) TEST_ERROR + if(H5Rcreate(&obj_buf[0], did1, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR + if(H5Rcreate(&obj_buf[1], did2, ".", H5R_OBJECT, (hid_t)-1) < 0) TEST_ERROR if(H5Rcreate(®_buf[0], did1, ".", H5R_DATASET_REGION, sid) < 0) TEST_ERROR if(H5Rcreate(®_buf[1], did2, ".", H5R_DATASET_REGION, sid) < 0) diff --git a/test/tattr.c b/test/tattr.c index 962883f..2885124 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -178,6 +178,7 @@ test_attr_basic_write(hid_t fapl) hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; int read_data1[ATTR1_DIM1]={0}; /* Buffer for reading 1st attribute */ int i; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -228,8 +229,8 @@ test_attr_basic_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1); @@ -366,8 +367,8 @@ test_attr_basic_write(hid_t fapl) VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5Aget_storage_size"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(group, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2); @@ -682,6 +683,7 @@ test_attr_compound_write(hid_t fapl) hid_t attr; /* Attribute ID */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2}; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -725,8 +727,8 @@ test_attr_compound_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write complex attribute data */ ret = H5Awrite(attr, tid1, attr_data4); @@ -917,6 +919,7 @@ test_attr_scalar_write(hid_t fapl) hid_t sid1,sid2; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -943,8 +946,8 @@ test_attr_scalar_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write attribute information */ ret = H5Awrite(attr, H5T_NATIVE_FLOAT, &attr_data5); @@ -1057,6 +1060,7 @@ test_attr_mult_write(hid_t fapl) hsize_t dims2[] = {ATTR1_DIM1}; hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1087,8 +1091,8 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 1st attribute data */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1); @@ -1111,8 +1115,8 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 2nd attribute information */ ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2); @@ -1135,8 +1139,8 @@ test_attr_mult_write(hid_t fapl) CHECK(attr, FAIL, "H5Acreate2"); /* Try to create the same attribute again (should fail) */ - ret = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Acreate2"); + ret_id = H5Acreate2(dataset, ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Acreate2"); /* Write 3rd attribute information */ ret = H5Awrite(attr, H5T_NATIVE_DOUBLE, attr_data3); @@ -4086,7 +4090,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) /* Get number of attributes with bad ID */ - ret = H5Aget_num_attrs(-1); + ret = H5Aget_num_attrs((hid_t)-1); VERIFY(ret, FAIL, "H5Aget_num_attrs"); /* Get number of attributes */ @@ -7203,6 +7207,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ @@ -7297,8 +7302,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for opening an attribute on an object with no attributes */ - ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_idx"); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -7330,8 +7335,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for out of bound opening an attribute on an object */ - ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_idx"); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ ret = attr_open_by_idx_check(my_dataset, idx_type, order, u); @@ -7403,8 +7408,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for out of bound opening an attribute on an object */ - ret = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_idx"); + ret_id = H5Aopen_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_idx"); /* Test opening attributes by index stored compactly */ ret = attr_open_by_idx_check(my_dataset, idx_type, order, u); @@ -7549,6 +7554,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) char attrname[NAME_BUF_SIZE]; /* Name of attribute */ unsigned curr_dset; /* Current dataset to work on */ unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ @@ -7618,14 +7624,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with no attributes */ - ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen"); + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen"); - ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -7657,14 +7663,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); /* Check for opening a non-existant attribute on an object with compact attribute storage */ - ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen"); + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen"); - ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Test opening attributes stored compactly */ ret = attr_open_check(fid, dsetname, my_dataset, u); @@ -7739,14 +7745,14 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) } /* end if */ /* Check for opening a non-existant attribute on an object with dense attribute storage */ - ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen"); + ret_id = H5Aopen(my_dataset, "foo", H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen"); - ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); - ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); - VERIFY(ret, FAIL, "H5Aopen_by_name"); + ret_id = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret_id, FAIL, "H5Aopen_by_name"); /* Test opening attributes stored compactly */ ret = attr_open_check(fid, dsetname, my_dataset, u); diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index 3a85b86..a761552 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -54,9 +54,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in test_error2(): H5Dwrite shouldn't succeed major: Error API minor: Write failed - #002: (file name) line (number) in H5Dwrite(): can't prepare for writing data - major: Dataset - minor: Write failed - #003: (file name) line (number) in H5D__pre_write(): not a dataset + #002: (file name) line (number) in H5Dwrite(): can't init dataset info + major: Invalid arguments to routine + minor: Inappropriate type + #003: (file name) line (number) in H5D__init_dset_info(): not a dataset major: Invalid arguments to routine minor: Inappropriate type diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index 6daf731..f5687f3 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -21,10 +21,10 @@ Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): Testing error API based on data I/O HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dwrite(): can't prepare for writing data - major: Dataset - minor: Write failed - #001: (file name) line (number) in H5D__pre_write(): not a dataset + #000: (file name) line (number) in H5Dwrite(): can't init dataset info + major: Invalid arguments to routine + minor: Inappropriate type + #001: (file name) line (number) in H5D__init_dset_info(): not a dataset major: Invalid arguments to routine minor: Inappropriate type Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): @@ -35,10 +35,10 @@ Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): major: Error in IO minor: Error in H5Dwrite HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #002: (file name) line (number) in H5Dwrite(): can't prepare for writing data - major: Dataset - minor: Write failed - #003: (file name) line (number) in H5D__pre_write(): not a dataset + #002: (file name) line (number) in H5Dwrite(): can't init dataset info + major: Invalid arguments to routine + minor: Inappropriate type + #003: (file name) line (number) in H5D__init_dset_info(): not a dataset major: Invalid arguments to routine minor: Inappropriate type diff --git a/test/testframe.c b/test/testframe.c index af6e975..2dd181b 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -67,6 +67,8 @@ static int (*TestPrivateParser)(int ac, char *av[]) = NULL; * TheDescr--Long description of the test. * Parameters--pointer to extra parameters. Use NULL if none used. * Since only the pointer is copied, the contents should not change. + * Return: Void + * exit EXIT_FAILURE if error is encountered. */ void AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters) @@ -75,17 +77,17 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con if (Index >= MAXNUMOFTESTS) { printf("Too many tests added, increase MAXNUMOFTESTS(%d).\n", MAXNUMOFTESTS); - exit(-1); + exit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { printf("Test description too long, increase MAXTESTDESC(%d).\n", MAXTESTDESC); - exit(-1); + exit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { printf("Test name too long, increase MAXTESTNAME(%d).\n", MAXTESTNAME); - exit(-1); + exit(EXIT_FAILURE); } /* end if */ /* Set up test function */ @@ -203,6 +205,9 @@ void TestInfo(const char *ProgName) * Parse command line information. * argc, argv: the usual command line argument count and strings * + * Return: Void + * exit EXIT_FAILURE if error is encountered. + * * Modification: * 2004/08/18 Albert Cheng. Add extra_parse feature. */ @@ -218,7 +223,7 @@ void TestParseCmdLine(int argc, char *argv[]) ParseTestVerbosity(*argv); }else{ TestUsage(); - exit(1); + exit(EXIT_FAILURE); } } else if (((HDstrcmp(*argv, "-exclude") == 0) || @@ -228,7 +233,7 @@ void TestParseCmdLine(int argc, char *argv[]) SetTest(*argv, SKIPTEST); }else{ TestUsage(); - exit(1); + exit(EXIT_FAILURE); } } else if (((HDstrcmp(*argv, "-begin") == 0) || @@ -238,7 +243,7 @@ void TestParseCmdLine(int argc, char *argv[]) SetTest(*argv, BEGINTEST); }else{ TestUsage(); - exit(1); + exit(EXIT_FAILURE); } } else if (((HDstrcmp(*argv, "-only") == 0) || @@ -252,14 +257,14 @@ void TestParseCmdLine(int argc, char *argv[]) SetTest(*argv, ONLYTEST); }else{ TestUsage(); - exit(1); + exit(EXIT_FAILURE); } } else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) Summary = 1; else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { TestUsage(); - exit(0); + exit(EXIT_SUCCESS); } else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) SetTestNoCleanup(); @@ -274,7 +279,7 @@ void TestParseCmdLine(int argc, char *argv[]) if (NULL != TestPrivateParser){ ret_code=TestPrivateParser(argc+1, argv-1); if (ret_code != 0) - exit(-1); + exit(EXIT_FAILURE); } } diff --git a/test/tfile.c b/test/tfile.c index 797b4fa..4bef41c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1061,7 +1061,7 @@ test_get_obj_ids(void) H5Fclose(fid); /* Get the number of all opened objects */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, NDSETS, "H5Fget_obj_count"); @@ -1069,7 +1069,7 @@ test_get_obj_ids(void) CHECK(oid_list, NULL, "HDcalloc"); /* Get the list of all opened objects */ - ret_count = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); + ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, NDSETS, "H5Fget_obj_count"); @@ -1121,7 +1121,7 @@ test_get_file_id(void) CHECK(ret, FAIL, "H5Fclose"); /* Test H5Iget_file_id() */ - check_file_id(-1, group_id); + check_file_id((hid_t)-1, group_id); ret = H5Gclose(group_id); CHECK(ret, FAIL, "H5Gclose"); @@ -1260,32 +1260,32 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, CHECK(fid4, FAIL, "H5Fcreate"); /* test object count of all files IDs open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_FILE); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_FILE); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count"); /* test object count of all datasets open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATASET); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_1, "H5Fget_obj_count"); /* test object count of all groups open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_GROUP); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_GROUP); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_3, "H5Fget_obj_count"); /* test object count of all named datatypes open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_DATATYPE); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATATYPE); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count"); /* test object count of all attributes open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ATTR); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ATTR); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_0, "H5Fget_obj_count"); /* test object count of all objects currently open */ - oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL); + oid_count = H5Fget_obj_count((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_8, "H5Fget_obj_count"); @@ -1296,7 +1296,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, if(oid_list != NULL) { int i; - ret_count = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); + ret_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); for(i = 0; i < oid_count; i++) { diff --git a/test/th5s.c b/test/th5s.c index ebbaa37..43ad1bb 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1171,6 +1171,7 @@ test_h5s_encode(void) H5S_sel_type sel_type; H5S_class_t space_type; hssize_t nblocks; + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1195,9 +1196,9 @@ test_h5s_encode(void) /* Try decoding bogus buffer */ H5E_BEGIN_TRY { - ret = H5Sdecode(sbuf); + ret_id = H5Sdecode(sbuf); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sdecode"); + VERIFY(ret_id, FAIL, "H5Sdecode"); ret = H5Sencode(sid1, sbuf, &sbuf_size); CHECK(ret, FAIL, "H5Sencode"); @@ -56,7 +56,7 @@ static int basic_id_test(void) /* Try to access IDs with ficticious types */ H5E_BEGIN_TRY - testPtr = H5Iobject_verify(100, (H5I_type_t) 0); + testPtr = H5Iobject_verify((hid_t)100, (H5I_type_t) 0); H5E_END_TRY VERIFY(testPtr, NULL, "H5Iobject_verify"); @@ -64,7 +64,7 @@ static int basic_id_test(void) goto out; H5E_BEGIN_TRY - testPtr = H5Iobject_verify(700, (H5I_type_t) 700); + testPtr = H5Iobject_verify((hid_t)700, (H5I_type_t) 700); H5E_END_TRY VERIFY(testPtr, NULL, "H5Iobject_verify"); @@ -336,8 +336,8 @@ out: static int test_is_valid(void) { hid_t dtype; /* datatype id */ - int nmembs1; /* number of type memnbers */ - int nmembs2; + int64_t nmembs1; /* number of type memnbers */ + int64_t nmembs2; htri_t tri_ret; /* htri_t return value */ herr_t ret; /* return value */ @@ -393,7 +393,7 @@ static int test_is_valid(void) goto out; /* Check that an id of -1 is invalid */ - tri_ret = H5Iis_valid(-1); + tri_ret = H5Iis_valid((hid_t)-1); VERIFY(tri_ret, FALSE, "H4Iis_valid"); if (tri_ret != FALSE) goto out; @@ -427,13 +427,13 @@ static int test_get_type(void) goto out; /* Check that the ID is correct */ - type_ret = H5Iget_type(H5T_STRING); + type_ret = H5Iget_type((hid_t)H5T_STRING); VERIFY(type_ret, H5I_BADID, "H5Iget_type"); if (type_ret != H5I_BADID) goto out; /* Check that the ID is correct */ - type_ret = H5Iget_type(-1); + type_ret = H5Iget_type((hid_t)-1); VERIFY(type_ret, H5I_BADID, "H5Iget_type"); if (type_ret != H5I_BADID) goto out; diff --git a/test/trefer.c b/test/trefer.c index 8f8a28e..9cb7f26 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -83,6 +83,7 @@ test_reference_params(void) unsigned *tu32; /* Temporary pointer to uint32 data */ int i; /* counting variables */ const char *write_comment = "Foo!"; /* Comments for group */ + hid_t ret_id; /* Generic hid_t return value */ herr_t ret; /* Generic return value */ size_t name_size; /* Size of reference name */ @@ -168,25 +169,25 @@ test_reference_params(void) CHECK(ret, FAIL, "H5Dcreate2"); /* Test parameters to H5Rcreate */ - ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate ref"); - ret = H5Rcreate(&wbuf[0], -1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], (hid_t)-1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate loc_id"); - ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate name"); - ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate null name"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, -1); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate type"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, -1); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, (hid_t)-1); VERIFY(ret, FAIL, "H5Rcreate region space"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, 0); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)0); VERIFY(ret, FAIL, "H5Rcreate space"); /* Test parameters to H5Rdereference */ - dset2 = H5Rdereference2(-1, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]); + dset2 = H5Rdereference2((hid_t)-1, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]); VERIFY(dset2, FAIL, "H5Rdereference2 loc_id"); - dset2 = H5Rdereference2(dataset, -1, H5R_OBJECT, &rbuf[0]); + dset2 = H5Rdereference2(dataset, (hid_t)-1, H5R_OBJECT, &rbuf[0]); VERIFY(dset2, FAIL, "H5Rdereference2 oapl_id"); dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL); VERIFY(dset2, FAIL, "H5Rdereference2 ref"); @@ -194,7 +195,7 @@ test_reference_params(void) VERIFY(dset2, FAIL, "H5Rdereference2 type"); /* Test parameters to H5Rget_obj_type2 */ - ret = H5Rget_obj_type2(-1, H5R_OBJECT, &rbuf[0], NULL); + ret = H5Rget_obj_type2((hid_t)-1, H5R_OBJECT, &rbuf[0], NULL); VERIFY(ret, FAIL, "H5Rget_obj_type2 loc_id"); ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL); VERIFY(ret, FAIL, "H5Rget_obj_type2 ref"); @@ -202,7 +203,7 @@ test_reference_params(void) VERIFY(ret, FAIL, "H5Rget_obj_type2 type"); /* Test parameters to H5Rget_name */ - name_size = H5Rget_name(-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0); + name_size = H5Rget_name((hid_t)-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0); VERIFY(name_size, FAIL, "H5Rget_name loc_id"); name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0); VERIFY(name_size, FAIL, "H5Rget_name ref"); @@ -210,12 +211,12 @@ test_reference_params(void) VERIFY(name_size, FAIL, "H5Rget_name type"); /* Test parameters to H5Rget_region */ - ret = H5Rget_region(-1, H5R_OBJECT, &rbuf[0]); - VERIFY(ret, FAIL, "H5Rget_region loc_id"); - ret = H5Rget_region(fid1, H5R_OBJECT, NULL); - VERIFY(ret, FAIL, "H5Rget_region ref"); - ret = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); - VERIFY(ret, FAIL, "H5Rget_region type"); + ret_id = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret_id, FAIL, "H5Rget_region loc_id"); + ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL); + VERIFY(ret_id, FAIL, "H5Rget_region ref"); + ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); + VERIFY(ret_id, FAIL, "H5Rget_region type"); /* Close disk dataspace */ ret = H5Sclose(sid1); @@ -349,28 +350,28 @@ test_reference_obj(void) CHECK(ret, FAIL, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[0], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[1], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); /* Create reference to group */ - ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[2], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type2"); /* Create reference to named datatype */ - ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[3], &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); @@ -1092,7 +1093,7 @@ test_reference_obj_deleted(void) CHECK(dataset, FAIL, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &oref, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type2"); @@ -1247,7 +1248,7 @@ test_reference_group(void) CHECK(did, FAIL, "H5Dcreate2"); /* Create reference to group */ - ret = H5Rcreate(&wref, fid, GROUPNAME, H5R_OBJECT, -1); + ret = H5Rcreate(&wref, fid, GROUPNAME, H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Write reference to disk */ @@ -1416,19 +1417,19 @@ test_reference_compat(void) CHECK(ret, FAIL, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Create reference to dataset */ - ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Create reference to group */ - ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Create reference to named datatype */ - ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, -1); + ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Write references to disk */ diff --git a/test/tunicode.c b/test/tunicode.c index 10ddddd..7dc3391 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -454,7 +454,7 @@ void test_objnames(hid_t fid, const char* string) CHECK(ret, FAIL, "H5Dcreate2"); /* Create reference to named datatype */ - ret = H5Rcreate(&obj_ref, grp2_id, string, H5R_OBJECT, -1); + ret = H5Rcreate(&obj_ref, grp2_id, string, H5R_OBJECT, (hid_t)-1); CHECK(ret, FAIL, "H5Rcreate"); /* Write selection and read it back*/ ret = H5Dwrite(dset_id, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &obj_ref); |