summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
commit42efc1c2b591e4cd45ec6cb3bdf32044343118d2 (patch)
tree0ab542871c32246199479e8933ff26286aaf629a /test
parent3360c3af0c100ac4d3a2fe2865f34661da862ec5 (diff)
downloadhdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.zip
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.gz
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.bz2
[svn-r18451] Description:
Bring r18172:18446 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'test')
-rw-r--r--test/H5srcdir.h74
-rw-r--r--test/H5srcdir_str.h.in22
-rw-r--r--test/Makefile.am2
-rw-r--r--test/Makefile.in50
-rw-r--r--test/cache.c1034
-rw-r--r--test/cache_common.c130
-rw-r--r--test/cache_common.h25
-rwxr-xr-xtest/cross_read.c12
-rw-r--r--test/dsets.c344
-rw-r--r--test/dtransform.c451
-rw-r--r--test/dtypes.c588
-rw-r--r--test/err_compat.c19
-rw-r--r--test/error_test.c31
-rw-r--r--test/external.c16
-rw-r--r--test/farray.c24
-rw-r--r--test/fillval.c12
-rw-r--r--test/gen_filespace.c8
-rw-r--r--test/h5test.c27
-rw-r--r--test/h5test.h20
-rw-r--r--test/hyperslab.c1715
-rw-r--r--test/links.c1130
-rw-r--r--test/mf.c70
-rw-r--r--test/mtime.c17
-rw-r--r--test/ntypes.c12
-rwxr-xr-xtest/objcopy.c263
-rw-r--r--test/ohdr.c23
-rw-r--r--test/set_extent.c2190
-rw-r--r--test/tarray.c10
-rw-r--r--test/tattr.c72
-rw-r--r--test/tconfig.c2
-rw-r--r--test/testhdf5.h33
-rw-r--r--test/tfile.c101
-rw-r--r--test/tgenprop.c48
-rw-r--r--test/th5s.c10
-rw-r--r--test/tmisc.c43
-rw-r--r--test/trefstr.c1
-rw-r--r--test/tselect.c465
-rw-r--r--test/tsohm.c16
-rw-r--r--test/tvlstr.c82
-rw-r--r--test/vfd.c2
40 files changed, 5226 insertions, 3968 deletions
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
new file mode 100644
index 0000000..55700cb
--- /dev/null
+++ b/test/H5srcdir.h
@@ -0,0 +1,74 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Wednesday, March 17, 2010
+ *
+ * Purpose: srcdir querying support.
+ */
+#ifndef _H5SRCDIR_H
+#define _H5SRCDIR_H
+
+/* Include the header file with the correct relative path for the srcdir string */
+#include "H5srcdir_str.h"
+
+/* Buffer to construct path in and return pointer to */
+static char srcdir_path[1024] = "";
+
+/* Buffer to construct file in and return pointer to */
+static char srcdir_testpath[1024] = "";
+
+/* Append the test file name to the srcdir path and return the whole string */
+static const char *H5_get_srcdir_filename(const char *filename)
+{
+ const char *srcdir = HDgetenv("srcdir");
+
+ /* Check for using the srcdir from configure time */
+ if(NULL == srcdir)
+ srcdir = config_srcdir;
+
+ /* Build path to test file */
+ if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
+ HDstrcpy(srcdir_testpath, srcdir);
+ HDstrcat(srcdir_testpath, "/");
+ HDstrcat(srcdir_testpath, filename);
+ return(srcdir_testpath);
+ } /* end if */
+ else
+ return(NULL);
+}
+
+/* Just return the srcdir path */
+static const char *H5_get_srcdir(void)
+{
+ const char *srcdir = HDgetenv("srcdir");
+
+ /* Check for using the srcdir from configure time */
+ if(NULL == srcdir)
+ srcdir = config_srcdir;
+
+ /* Build path to all test files */
+ if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
+ HDstrcpy(srcdir_path, srcdir);
+ HDstrcat(srcdir_path, "/");
+ return(srcdir_path);
+ } /* end if */
+ else
+ return(NULL);
+}
+#endif /* _H5SRCDIR_H */
+
+
diff --git a/test/H5srcdir_str.h.in b/test/H5srcdir_str.h.in
new file mode 100644
index 0000000..d472124
--- /dev/null
+++ b/test/H5srcdir_str.h.in
@@ -0,0 +1,22 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* If you are reading this file and it has a '.h' suffix, it was automatically
+ * generated from the '.in' version. Make changes there.
+ */
+
+/* Set the 'srcdir' path from configure time */
+static const char *config_srcdir = "@srcdir@";
+
diff --git a/test/Makefile.am b/test/Makefile.am
index accd774..4ce0b0c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -110,7 +110,7 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 \
max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \
huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \
chunk_expand.h5 \
- extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \
+ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \
sys_file1 tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 \
stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
diff --git a/test/Makefile.in b/test/Makefile.in
index 609c79d..ab9e3ee 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -52,9 +52,10 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/testcheck_version.sh.in $(srcdir)/testerror.sh.in \
- $(srcdir)/testlibinfo.sh.in $(top_srcdir)/config/commence.am \
+DIST_COMMON = $(srcdir)/H5srcdir_str.h.in $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/testcheck_version.sh.in \
+ $(srcdir)/testerror.sh.in $(srcdir)/testlibinfo.sh.in \
+ $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
bin_PROGRAMS = swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) \
swmr_writer$(EXEEXT)
@@ -69,7 +70,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
-CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh testlibinfo.sh
+CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh H5srcdir_str.h \
+ testlibinfo.sh
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libh5test_la_LIBADD =
@@ -691,25 +693,25 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
compact_dataset.h5 dataset.h5 dset_offset.h5 \
max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \
huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \
- chunk_expand.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 \
- links*.h5 sys_file1 tfile[1-4].h5 th5s[1-3].h5 lheap.h5 \
- fheap.h5 ohdr.h5 stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw \
- gheap[0-4].h5 dt_arith[1-2] links.h5 links[0-6]*.h5 \
- extlinks[0-15].h5 tmp big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
- stdio.h5 sec2.h5 dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 \
- tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
- fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 \
- ttime.h5 trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 \
- flush.h5 enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \
- tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin getname.h5 \
- getname[1-3].h5 sec2_file.h5 direct_file.h5 \
- family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \
- multi_file-[rs].h5 core_file new_move_[ab].h5 ntypes.h5 \
- dangle.h5 error_test.h5 err_compat.h5 dtransform.h5 \
- test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
- unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \
- objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \
- earray.h5 swmr_data.h5
+ chunk_expand.h5 copy_dcpl_newfile.h5 extend.h5 istore.h5 \
+ extlinks*.h5 frspace.h5 links*.h5 sys_file1 tfile[1-4].h5 \
+ th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 extern_[1-3].h5 \
+ extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2] links.h5 \
+ links[0-6]*.h5 extlinks[0-15].h5 tmp big.data \
+ big[0-9][0-9][0-9][0-9][0-9].h5 stdio.h5 sec2.h5 \
+ dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 \
+ unlink.h5 unicode.h5 coord.h5 fillval_[0-9].h5 fillval.raw \
+ mount_[0-9].h5 testmeta.h5 ttime.h5 trefer[1-3].h5 tvltypes.h5 \
+ tvlstr.h5 tvlstr2.h5 flush.h5 enum1.h5 titerate.h5 ttsafe.h5 \
+ tarray1.h5 tgenprop.h5 tmisc[0-9]*.h5 set_extent[1-5].h5 \
+ ext[12].bin getname.h5 getname[1-3].h5 sec2_file.h5 \
+ direct_file.h5 family_file000[0-3][0-9].h5 \
+ new_family_v16_000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
+ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 \
+ err_compat.h5 dtransform.h5 test_filters.h5 get_file_name.h5 \
+ tstint[1-2].h5 unlink_chunked.h5 btree2.h5 objcopy_src.h5 \
+ objcopy_dst.h5 objcopy_ext.dat trefer1.h5 trefer2.h5 \
+ app_ref.h5 farray.h5 earray.h5 swmr_data.h5
INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
# Test script for error_test and err_compat
@@ -822,6 +824,8 @@ testcheck_version.sh: $(top_builddir)/config.status $(srcdir)/testcheck_version.
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testerror.sh: $(top_builddir)/config.status $(srcdir)/testerror.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+H5srcdir_str.h: $(top_builddir)/config.status $(srcdir)/H5srcdir_str.h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testlibinfo.sh: $(top_builddir)/config.status $(srcdir)/testlibinfo.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
diff --git a/test/cache.c b/test/cache.c
index 74900ec..e02f14a 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -3011,7 +3011,7 @@ check_flush_cache(void)
if ( show_progress ) {
- HDfprintf(stdout, "%s: calling check_flush_cache__empty_cache().\n",
+ HDfprintf(stdout, "%s: calling check_flush_cache__empty_cache().\n",
fcn_name);
}
@@ -6139,7 +6139,7 @@ check_flush_cache__flush_ops(H5F_t * file_ptr)
*/
if ( pass ) {
- spec[0].flush_ops[0].flag = TRUE;
+ spec[0].flush_ops[1].flag = TRUE;
test_num = 10;
check_flush_cache__flush_op_test(file_ptr,
@@ -9263,7 +9263,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(1).\n",
+ HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(1).\n",
fcn_name, test_num, (int)pass);
}
@@ -9296,7 +9296,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(2).\n",
+ HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(2).\n",
fcn_name, test_num, (int)pass);
}
@@ -9324,7 +9324,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(3).\n",
+ HDfprintf(stdout, "%s:%d:%d: running sanity checks on entry(3).\n",
fcn_name, test_num, (int)pass);
}
@@ -9367,7 +9367,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Setting up the test.\n",
+ HDfprintf(stdout, "%s:%d:%d: Setting up the test.\n",
fcn_name, test_num, (int)pass);
}
@@ -9378,7 +9378,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout,
+ HDfprintf(stdout,
"%s:%d: Inserting entry(%d,%d) with flags 0x%x.\n",
fcn_name, test_num,
(int)(spec[i].entry_type),
@@ -9393,7 +9393,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout,
+ HDfprintf(stdout,
"%s:%d: Protecting entry(%d,%d).\n",
fcn_name, test_num,
(int)(spec[i].entry_type),
@@ -9404,7 +9404,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout,
+ HDfprintf(stdout,
"%s:%d: Unprotecting entry(%d,%d) with flags 0x%x ns = %d.\n",
fcn_name, test_num,
(int)(spec[i].entry_type),
@@ -9457,7 +9457,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Running the test.\n",
+ HDfprintf(stdout, "%s:%d:%d: Running the test.\n",
fcn_name, test_num, (int)pass);
}
@@ -9478,7 +9478,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Checking test results(1).\n",
+ HDfprintf(stdout, "%s:%d:%d: Checking test results(1).\n",
fcn_name, test_num, (int)pass);
}
@@ -9521,7 +9521,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Checking test results(2).\n",
+ HDfprintf(stdout, "%s:%d:%d: Checking test results(2).\n",
fcn_name, test_num, (int)pass);
}
@@ -9645,7 +9645,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Checking test results(3).\n",
+ HDfprintf(stdout, "%s:%d:%d: Checking test results(3).\n",
fcn_name, test_num, (int)pass);
}
@@ -9680,7 +9680,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(1).\n",
+ HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(1).\n",
fcn_name, test_num, (int)pass);
}
@@ -9723,7 +9723,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(2).\n",
+ HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(2).\n",
fcn_name, test_num, (int)pass);
}
@@ -9745,7 +9745,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if ( show_progress ) {
- HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(3).\n",
+ HDfprintf(stdout, "%s:%d:%d: Cleaning up after test(3).\n",
fcn_name, test_num, (int)pass);
}
@@ -9886,7 +9886,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
( cache_ptr->min_clean_size != (1 * 1024 * 1024 ) ) ) {
pass = FALSE;
- failure_mssg =
+ failure_mssg =
"unexpected cache config at start of flush op eviction test.";
} else {
@@ -9922,39 +9922,39 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
*/
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 0,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 0,
H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG,
(VARIABLE_ENTRY_SIZE / 2));
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 1,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 1,
H5C__NO_FLAGS_SET, (size_t)0);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 2,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 2,
H5C__NO_FLAGS_SET, (size_t)0);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 3,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 3,
H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG,
(VARIABLE_ENTRY_SIZE / 2));
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 4,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 4,
H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG,
(VARIABLE_ENTRY_SIZE / 2));
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 5,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 5,
H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG,
(VARIABLE_ENTRY_SIZE / 2));
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 6,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 6,
H5C__NO_FLAGS_SET, (size_t)0);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7);
- unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 7,
+ unprotect_entry_with_size_change(file_ptr, VARIABLE_ENTRY_TYPE, 7,
H5C__NO_FLAGS_SET, (size_t)0);
if ( ( cache_ptr->index_len != 8 ) ||
@@ -10057,14 +10057,14 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
for ( i = 0; i < 1; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10132,7 +10132,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
num_large_entries = 2;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 1,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 1,
H5C__DIRTIED_FLAG, (size_t)0);
if ( ( cache_ptr->index_len != 40 ) ||
@@ -10198,7 +10198,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
num_large_entries = 3;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 2,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 2,
H5C__DIRTIED_FLAG, (size_t)0);
if ( ( cache_ptr->index_len != 40 ) ||
@@ -10271,11 +10271,11 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
num_large_entries = 5;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 3,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 3,
H5C__DIRTIED_FLAG, (size_t)0);
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 4,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, 4,
H5C__DIRTIED_FLAG, (size_t)0);
/* verify cache size */
@@ -10312,14 +10312,14 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
for ( i = 0; i < 5; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10379,7 +10379,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 5; i < 8; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10441,7 +10441,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 8; i < 9; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10507,7 +10507,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 9; i < 10; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10543,14 +10543,14 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < 31; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
for ( i = 0; i < 10; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10654,7 +10654,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 10; i < 12; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10687,14 +10687,14 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 0; i < num_monster_entries; i++ )
{
protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, MONSTER_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
for ( i = 0; i < num_large_entries; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -10781,7 +10781,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
for ( i = 12; i < 14; i++ )
{
protect_entry(file_ptr, LARGE_ENTRY_TYPE, i);
- unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
+ unprotect_entry_with_size_change(file_ptr, LARGE_ENTRY_TYPE, i,
H5C__DIRTIED_FLAG, (size_t)0);
}
@@ -13534,8 +13534,8 @@ check_get_entry_status(void)
hbool_t is_pinned;
size_t entry_size;
H5F_t * file_ptr = NULL;
- test_entry_t * base_addr;
- test_entry_t * entry_ptr;
+ test_entry_t * base_addr = NULL;
+ test_entry_t * entry_ptr = NULL;
TESTING("H5C_get_entry_status() functionality");
@@ -13548,8 +13548,18 @@ check_get_entry_status(void)
file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
(size_t)(1 * 1024 * 1024));
- base_addr = entries[0];
- entry_ptr = &(base_addr[0]);
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "file_ptr NULL from setup_cache.";
+
+ }
+ else {
+
+ base_addr = entries[0];
+ entry_ptr = &(base_addr[0]);
+
+ }
}
if ( pass ) {
@@ -13576,9 +13586,13 @@ check_get_entry_status(void)
}
}
- protect_entry(file_ptr, 0, 0);
+ if ( pass ) {
- unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, 0, 0);
+
+ unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( pass ) {
@@ -13600,7 +13614,11 @@ check_get_entry_status(void)
}
}
- protect_entry(file_ptr, 0, 0);
+ if ( pass ) {
+
+ protect_entry(file_ptr, 0, 0);
+
+ }
if ( pass ) {
@@ -13622,7 +13640,11 @@ check_get_entry_status(void)
}
}
- unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG);
+ if ( pass ) {
+
+ unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG);
+
+ }
if ( pass ) {
@@ -13644,7 +13666,11 @@ check_get_entry_status(void)
}
}
- mark_pinned_entry_dirty(0, 0, FALSE, (size_t)0);
+ if ( pass ) {
+
+ mark_pinned_entry_dirty(0, 0, FALSE, (size_t)0);
+
+ }
if ( pass ) {
@@ -13666,7 +13692,11 @@ check_get_entry_status(void)
}
}
- unpin_entry(0, 0);
+ if ( pass ) {
+
+ unpin_entry(0, 0);
+
+ }
if ( pass ) {
@@ -14736,9 +14766,20 @@ check_pin_protected_entry(void)
file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
(size_t)(1 * 1024 * 1024));
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "file_ptr NULL from setup_cache.";
+
+ }
}
- protect_entry(file_ptr, 0, 0);
+ if ( pass ) {
+
+ protect_entry(file_ptr, 0, 0);
+
+ }
if ( pass ) {
@@ -14862,11 +14903,20 @@ check_resize_entry(void)
file_ptr = setup_cache((size_t)(2 * 1024 * 1024),
(size_t)(1 * 1024 * 1024));
- cache_ptr = file_ptr->shared->cache;
+ if ( file_ptr == NULL ) {
- base_addr = entries[LARGE_ENTRY_TYPE];
- entry_ptr = &(base_addr[0]);
- entry_size = LARGE_ENTRY_SIZE;
+ pass = FALSE;
+ failure_mssg = "file_ptr NULL from setup_cache.";
+
+ }
+ else
+ {
+ cache_ptr = file_ptr->shared->cache;
+
+ base_addr = entries[LARGE_ENTRY_TYPE];
+ entry_ptr = &(base_addr[0]);
+ entry_size = LARGE_ENTRY_SIZE;
+ }
}
if ( pass ) {
@@ -14883,7 +14933,11 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+ if ( pass ) {
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+
+ }
if ( pass ) {
@@ -14902,8 +14956,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -14935,7 +14989,7 @@ check_resize_entry(void)
if ( pass ) {
result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
+ &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, (LARGE_ENTRY_SIZE / 2));
if ( result < 0 ) {
@@ -14971,8 +15025,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15002,12 +15056,16 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+ if ( pass ) {
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+
+ }
if ( pass ) {
result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
+ &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
(H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), LARGE_ENTRY_SIZE);
if ( result < 0 ) {
@@ -15043,8 +15101,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15074,9 +15132,13 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+ if ( pass ) {
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__PIN_ENTRY_FLAG);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__PIN_ENTRY_FLAG);
+ }
if ( pass ) {
@@ -15108,8 +15170,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15169,8 +15231,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15200,10 +15262,14 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+ if ( pass ) {
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE,
- H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE,
+ H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
+
+ }
if ( pass ) {
@@ -15270,14 +15336,18 @@ check_resize_entry(void)
entry_size = LARGE_ENTRY_SIZE;
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, TRUE, H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__NO_FLAGS_SET);
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__NO_FLAGS_SET);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, TRUE, H5C__NO_FLAGS_SET);
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( pass ) {
@@ -15294,7 +15364,11 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+ if ( pass ) {
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+
+ }
if ( pass ) {
@@ -15313,8 +15387,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15346,7 +15420,7 @@ check_resize_entry(void)
if ( pass ) {
result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
+ &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
H5C__SIZE_CHANGED_FLAG | H5C__DIRTIED_FLAG, (LARGE_ENTRY_SIZE / 2));
if ( result < 0 ) {
@@ -15384,8 +15458,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15415,12 +15489,16 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+ if ( pass ) {
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+
+ }
if ( pass ) {
result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
+ &(types[LARGE_ENTRY_TYPE]), entry_ptr->addr, (void *)entry_ptr,
(H5C__DIRTIED_FLAG | H5C__SIZE_CHANGED_FLAG), LARGE_ENTRY_SIZE);
if ( result < 0 ) {
@@ -15456,8 +15534,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15487,9 +15565,13 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+ if ( pass ) {
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, FALSE, H5C__PIN_ENTRY_FLAG);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, FALSE, H5C__PIN_ENTRY_FLAG);
+
+ }
if ( pass ) {
@@ -15523,8 +15605,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15584,8 +15666,8 @@ check_resize_entry(void)
if ( pass ) {
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
- &reported_entry_size, &in_cache,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ &reported_entry_size, &in_cache,
&is_dirty, &is_protected, &is_pinned,
NULL, NULL);
@@ -15615,10 +15697,14 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+ if ( pass ) {
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, FALSE,
- H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
+
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, FALSE,
+ H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG);
+
+ }
if ( pass ) {
@@ -15665,15 +15751,18 @@ check_resize_entry(void)
}
}
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__DELETED_FLAG);
+ if ( pass ) {
+
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, FALSE, H5C__DELETED_FLAG);
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, FALSE, H5C__DELETED_FLAG);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, FALSE, H5C__DELETED_FLAG);
- protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__DELETED_FLAG);
+ protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, FALSE, H5C__DELETED_FLAG);
+ }
if ( pass ) {
@@ -15738,7 +15827,7 @@ check_evictions_enabled(void)
int mile_stone = 1;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
- test_entry_t * base_addr;
+ test_entry_t * base_addr = NULL;
test_entry_t * entry_ptr;
TESTING("evictions enabled/disabled functionality");
@@ -15791,9 +15880,18 @@ check_evictions_enabled(void)
file_ptr = setup_cache((size_t)(1 * 1024 * 1024),
(size_t)( 512 * 1024));
- cache_ptr = file_ptr->shared->cache;
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "file_ptr NULL from setup_cache.";
- base_addr = entries[MONSTER_ENTRY_TYPE];
+ }
+ else
+ {
+ cache_ptr = file_ptr->shared->cache;
+
+ base_addr = entries[MONSTER_ENTRY_TYPE];
+ }
}
if ( show_progress ) /* 2 */
@@ -15837,12 +15935,16 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* fill the cache */
- for ( i = 0; i < 16 ; i++ )
- {
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i,
- FALSE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* fill the cache */
+ for ( i = 0; i < 16 ; i++ )
+ {
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i,
+ FALSE, H5C__NO_FLAGS_SET);
+ }
+
}
if ( show_progress ) /* 5 */
@@ -15870,10 +15972,14 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* protect and unprotect another entry */
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16,
- FALSE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* protect and unprotect another entry */
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 16,
+ FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 7 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -15903,7 +16009,7 @@ check_evictions_enabled(void)
entry_ptr = &(base_addr[0]);
- result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
+ result = H5C_get_entry_status(file_ptr, entry_ptr->addr,
NULL, &in_cache, NULL, NULL, NULL,
NULL, NULL);
@@ -15936,8 +16042,12 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* insert an entry */
- insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, TRUE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* insert an entry */
+ insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 17, TRUE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 10 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -16036,10 +16146,14 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* protect and unprotect another entry */
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18,
- FALSE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* protect and unprotect another entry */
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 18,
+ FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 15 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -16065,8 +16179,12 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* insert another entry */
- insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, TRUE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* insert another entry */
+ insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 19, TRUE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 17 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -16109,10 +16227,14 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* protect and unprotect an entry that is in the cache */
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19,
- FALSE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* protect and unprotect an entry that is in the cache */
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 19,
+ FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 20 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -16138,10 +16260,14 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* protect and unprotect an entry that isn't in the cache */
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20,
- FALSE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* protect and unprotect an entry that isn't in the cache */
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 20,
+ FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 22 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -16259,13 +16385,16 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* protect and unprotect an entry that isn't in the cache, forcing
- * the cache to grow.
- */
- protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21);
- unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21,
- FALSE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+ /* protect and unprotect an entry that isn't in the cache, forcing
+ * the cache to grow.
+ */
+ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21);
+ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 21,
+ FALSE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 27 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -16308,8 +16437,12 @@ check_evictions_enabled(void)
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* insert an entry */
- insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, TRUE, H5C__NO_FLAGS_SET);
+ if ( pass ) {
+
+ /* insert an entry */
+ insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 22, TRUE, H5C__NO_FLAGS_SET);
+
+ }
if ( show_progress ) /* 30 */
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
@@ -21635,11 +21768,11 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
H5C__NO_FLAGS_SET);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
H5C__NO_FLAGS_SET);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
@@ -21808,7 +21941,7 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE);
@@ -21847,7 +21980,7 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE);
@@ -21868,7 +22001,7 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE);
@@ -21892,15 +22025,15 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
H5C__UNPIN_ENTRY_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
H5C__UNPIN_ENTRY_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
H5C__UNPIN_ENTRY_FLAG);
if ( ( pass ) &&
@@ -21960,7 +22093,7 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024);
@@ -21999,7 +22132,7 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024);
@@ -22020,7 +22153,7 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
H5C__PIN_ENTRY_FLAG);
resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024);
@@ -22044,15 +22177,15 @@ check_auto_cache_resize(void)
if ( pass ) {
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE,
H5C__UNPIN_ENTRY_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE,
H5C__UNPIN_ENTRY_FLAG);
protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12);
- unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
+ unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE,
H5C__UNPIN_ENTRY_FLAG);
if ( ( pass ) &&
@@ -22173,7 +22306,7 @@ check_auto_cache_resize(void)
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE,
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE,
H5C__NO_FLAGS_SET);
if ( ( pass ) &&
@@ -22200,7 +22333,7 @@ check_auto_cache_resize(void)
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, NO_CHANGE,
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, NO_CHANGE,
H5C__NO_FLAGS_SET);
if ( ( pass ) &&
@@ -22226,10 +22359,10 @@ check_auto_cache_resize(void)
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, NO_CHANGE,
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, NO_CHANGE,
H5C__NO_FLAGS_SET);
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, NO_CHANGE,
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, NO_CHANGE,
H5C__NO_FLAGS_SET);
if ( ( pass ) &&
@@ -22283,7 +22416,7 @@ check_auto_cache_resize(void)
rpt_fcn_called = FALSE;
protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0);
- unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE,
+ unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE,
H5C__NO_FLAGS_SET);
if ( ( pass ) &&
@@ -22445,7 +22578,17 @@ check_auto_cache_resize_disable(void)
file_ptr = setup_cache((size_t)(2 * 1024),
(size_t)(1 * 1024));
- cache_ptr = file_ptr->shared->cache;
+
+ if ( file_ptr == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "file_ptr NULL from setup_cache.";
+
+ }
+ else {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
}
if ( pass ) {
@@ -23506,8 +23649,11 @@ check_auto_cache_resize_disable(void)
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
- /* flush the cache and destroy all entries so we start from a known point */
- flush_cache(file_ptr, TRUE, FALSE, FALSE);
+ if ( pass ) {
+
+ /* flush the cache and destroy all entries so we start from a known point */
+ flush_cache(file_ptr, TRUE, FALSE, FALSE);
+ }
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
@@ -23734,8 +23880,11 @@ check_auto_cache_resize_disable(void)
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
- /* flush the cache and destroy all entries so we start from a known point */
- flush_cache(file_ptr, TRUE, FALSE, FALSE);
+ if ( pass ) {
+
+ /* flush the cache and destroy all entries so we start from a known point */
+ flush_cache(file_ptr, TRUE, FALSE, FALSE);
+ }
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
@@ -23969,8 +24118,11 @@ check_auto_cache_resize_disable(void)
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
- /* flush the cache and destroy all entries so we start from a known point */
- flush_cache(file_ptr, TRUE, FALSE, FALSE);
+ if ( pass ) {
+
+ /* flush the cache and destroy all entries so we start from a known point */
+ flush_cache(file_ptr, TRUE, FALSE, FALSE);
+ }
if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++);
@@ -28786,7 +28938,7 @@ check_auto_cache_resize_aux_fcns(void)
failure_mssg =
"H5C_get_cache_size reports unexpected cur_size 5.\n";
- }
+ }
}
if ( pass ) {
@@ -28836,13 +28988,13 @@ check_auto_cache_resize_aux_fcns(void)
*
* A 'metadata blizzard' in this context occurs when the cache
* gets completely filled with all dirty entries. Upon needing
- * to make space in the cache, the cache then has no clean
+ * to make space in the cache, the cache then has no clean
* entries ready to evict, and must clean every dirty entry
* in the cache first, due to the second chance replacement
* policy. (i.e. after cleaning an entry, it is bumped to the
* top of the LRU to make a second pass before eviction).
- * The massive amount of sequential writes to disk while
- * flushing the entire cache is what constitutes a 'metadata
+ * The massive amount of sequential writes to disk while
+ * flushing the entire cache is what constitutes a 'metadata
* blizzard'.
*
* Return: void
@@ -28865,11 +29017,11 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
hbool_t show_progress = FALSE;
- int32_t checkpoint = 0;
+ int32_t checkpoint = 0;
int32_t entry_idx = 0;
int32_t i;
- /* Expected loaded status of entries depends on how they get into
+ /* Expected loaded status of entries depends on how they get into
* the cache. Insertions = not loaded, protect/unprotect = loaded.
*/
hbool_t loaded = (hbool_t)!(fill_via_insertion);
@@ -29045,19 +29197,19 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 0 */
- HDfprintf(stdout, "\n%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "\n%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
-
+
/* Set up the cache.
*
- * The max_cache_size should have room for 50 entries.
- * The min_clean_size is half of that, or 25 entries.
+ * The max_cache_size should have room for 50 entries.
+ * The min_clean_size is half of that, or 25 entries.
*/
file_ptr = setup_cache((size_t)(50 * entry_size), /* max_cache_size */
(size_t)(25 * entry_size)); /* min_clean_size */
-
+
if ( file_ptr == NULL) {
pass = FALSE;
@@ -29066,37 +29218,37 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
else
cache_ptr = file_ptr->shared->cache;
- }
+ }
if ( show_progress) /* 1 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
* Phase 1:
- *
- * Inserting dirty entries into an empty cache, until the cache
+ *
+ * Inserting dirty entries into an empty cache, until the cache
* violates the min_clean_size requirement. The expected result is
* that none of the inserted entries during this phase will get
* flushed or evicted.
- *
+ *
* This verifies that while maintaining min_clean_size, we don't go
* overboard and flush entries that we don't need to flush.
- *
+ *
* ========================================================================
* ========================================================================
*/
if ( pass ) {
- /* Insert 26 entries (indexes 0 through 25) into the cache.
+ /* Insert 26 entries (indexes 0 through 25) into the cache.
*
- * Note that we are inserting 26 entries, and not 25, because the cache
- * will only try to adhere to the min_clean_size if it's currently
- * being violated. Thus, on insertion of the 26th entry, since the
- * min_clean_size will not be violated, it will accept the insertion
- * without having to make clean space.
+ * Note that we are inserting 26 entries, and not 25, because the cache
+ * will only try to adhere to the min_clean_size if it's currently
+ * being violated. Thus, on insertion of the 26th entry, since the
+ * min_clean_size will not be violated, it will accept the insertion
+ * without having to make clean space.
*/
for (entry_idx = 0; entry_idx < 26; entry_idx++) {
@@ -29120,8 +29272,8 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
H5C__NO_FLAGS_SET); /* unsigned int flags */
}
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[entry_idx].in_cache = TRUE;
expected[entry_idx].is_dirty = TRUE;
@@ -29135,30 +29287,30 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 2 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
* Phase 2:
- *
+ *
* Inserting entries into a cache that violates the min_clean_size,
* until the cache is full. The expected result is that each insertion
- * will result in the flushing of a dirty entry in the cache.
+ * will result in the flushing of a dirty entry in the cache.
*
* This verifies that we maintain the min_clean_size. By doing so, we
* prevent building the situation in which a 'metadata blizzard' would
* occur (i.e., the cache being completely filled with dirty entries).
- *
+ *
* ========================================================================
* ========================================================================
*/
-
+
if ( pass ) {
/* Insert the 27th entry (index = 26) into the cache.
- *
- * This should cause the cache to flush its least recently used entry
+ *
+ * This should cause the cache to flush its least recently used entry
* before the insertion because it doesn't satisfy the min_clean_size
* constraint.
*/
@@ -29181,15 +29333,15 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
/* Verify the status of the entries.
- *
+ *
* Expected status is that there are 27 entries in the cache, and
* entry number 0 has been cleaned.
- *
+ *
* Changes from last entry verification:
* - entry w/ index 0 has now been flushed and is now clean.
* - entry w/ index 26 is now in the cache and dirty.
*/
-
+
/* entry w/ index 0 has now been flushed and is now clean. */
expected[0].flushed = TRUE;
expected[0].is_dirty = FALSE;
@@ -29207,7 +29359,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 3 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
@@ -29237,10 +29389,10 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
/* Verify the status of the entries.
- *
+ *
* Expected status is that there are 28 entries in the cache, and
* entry numbers 0 and 1 have been cleaned.
- *
+ *
* Changes from last entry verification:
* - entry w/ index 1 has now been flushed and is now clean.
* - entry w/ index 27 is now in the cache and dirty.
@@ -29263,7 +29415,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 4 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
@@ -29291,7 +29443,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
/* Expected staus is that after each insertion, the entry
- * inserted 26 insertions ago has been flushed, and the
+ * inserted 26 insertions ago has been flushed, and the
* entry currently getting inserted is now in the cache and
* dirty.
*/
@@ -29301,7 +29453,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
expected[entry_idx].in_cache = TRUE;
expected[entry_idx].is_dirty = TRUE;
expected[entry_idx].loaded = (unsigned char)loaded;
-
+
/* verify the status */
verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */
entry_idx, /* int tag */
@@ -29318,23 +29470,23 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 5 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
* Phase 3:
- *
- * Inserting entries into a cache that is completely full. Insertions
+ *
+ * Inserting entries into a cache that is completely full. Insertions
* of new entries will force evictions of old entries, but since the
- * min_clean_size has been maintained, doing so will not result in
+ * min_clean_size has been maintained, doing so will not result in
* the entire cache getting flushed in order to evict a single entry,
* as a clean entry will be available to flush reasonably close to
* the bottom of the LRU.
- *
+ *
* This verifies that with a maintained min_clean_size, a metadata
* blizzard does not occur on insertion.
- *
+ *
* ========================================================================
* ========================================================================
*/
@@ -29342,7 +29494,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
if ( pass ) {
/* Insert the 51st entry (index = 50) into the cache.
- *
+ *
* The cache is full prior to the insertion, so it will
* have to evict in order to make room for the new entry.
*/
@@ -29365,13 +29517,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
/* Verify the status of the entries.
- *
+ *
* Changes from last entry verification:
* - entry w/ index 0 has been evicted.
* - entries w/ indices 24,25 have now been flushed and are clean.
* - entry w/ index 50 is now in the cache and dirty.
*/
-
+
/* entry w/ index 0 has been evicted. */
expected[0].in_cache = FALSE;
expected[0].destroyed = TRUE;
@@ -29395,16 +29547,16 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 6 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
/* Insert 49 more entries (indices 51-99) into the cache.
- *
- * The cache will be flushing an entry on each insertion, and
- * evicting an entry on each insertion.
+ *
+ * The cache will be flushing an entry on each insertion, and
+ * evicting an entry on each insertion.
*
* After each insertion, verify the expected status of the
* entries in the cache.
@@ -29421,7 +29573,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
protect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
entry_idx); /* int32-t idx */
-
+
unprotect_entry(file_ptr, /* H5F_t * file_ptr */
entry_type, /* int32_t type */
entry_idx, /* int32_t idx */
@@ -29438,21 +29590,21 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
expected[entry_idx - 50].in_cache = FALSE;
expected[entry_idx - 50].destroyed = TRUE;
- /* If the newly inserted entry is among the first 24
+ /* If the newly inserted entry is among the first 24
* insertions in this loop, then the insertion will
* have resulted in a flush of the entry inserted
* 25 insertions ago. */
if (entry_idx < 75) {
-
+
expected[entry_idx - 25].flushed = TRUE;
expected[entry_idx - 25].is_dirty = FALSE;
}
/* If the newly inserted entry is among the last
* 25 insertions in this loop, then the insertion will
* have resulted in a flush of the entry inserted 26
- * insertions ago. This switch is because there was two
+ * insertions ago. This switch is because there was two
* consecutive clean entries in the cache (due to 51/49
- * dirty/clean ratio when full), so instead of
+ * dirty/clean ratio when full), so instead of
* flush-then-evict, it switches to evict-then-flush. */
else {
@@ -29469,13 +29621,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 7 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
/* ========================================================================
* ========================================================================
* Phase 4:
- *
+ *
* Flushing the entire cache, and then inserting entries into a cache
* that is completely full, but all clean.
*
@@ -29483,18 +29635,18 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
* into an empty cache, we're inserting into a full cache that's all
* clean, thus an eviction occurs before each insertion.
*
- * When the cache finally hits the point of violating the
+ * When the cache finally hits the point of violating the
* min_clean_size, the bottom half of the LRU will be filled with
* clean entries and the top half will be filled with recently inserted
* dirty entries. We'll then verify that an insertion will only evict
* one entry and flush one entry, and no more.
- *
+ *
* ========================================================================
* ========================================================================
*/
if ( pass ) {
-
+
/* Flush the cache.
*
* We're doing this so we can repeat the above insertions, but
@@ -29506,12 +29658,12 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
FALSE, /* hbool_t destory_entries */
FALSE, /* hbool_t dump_stats */
FALSE); /* hbool_t dump_detailed_stats */
-
+
/* Verify that the cache is clean */
verify_clean();
/* Verify the status of the entries.
- *
+ *
* Changes from last entry verification:
* - entries w/ indices 74-99 have been flushed.
*/
@@ -29529,7 +29681,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 8 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
@@ -29580,7 +29732,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 9 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
@@ -29605,7 +29757,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
/* Verify the status of the entries.
- *
+ *
* Changes from last entry verification:
* - entry w/ index 76 is evicted.
* - entry w/ index 100 is cleaned.
@@ -29615,7 +29767,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
/* entry w/ index 76 has been evicted. */
expected[76].in_cache = FALSE;
expected[76].destroyed = TRUE;
-
+
/* entry w/ index 100 has now been flushed and is now clean. */
expected[100].flushed = TRUE;
expected[100].is_dirty = FALSE;
@@ -29633,7 +29785,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 10 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
@@ -29683,18 +29835,18 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
}
if ( show_progress) /* 11 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) {
-
+
/* We're done with testing. We can take down the cache. */
takedown_cache(file_ptr, FALSE, FALSE);
reset_entries();
}
if ( show_progress) /* 12 */
- HDfprintf(stdout, "%s: check point %d -- pass %d\n",
+ HDfprintf(stdout, "%s: check point %d -- pass %d\n",
fcn_name, checkpoint++, pass);
if ( pass ) { PASSED(); } else { H5_FAILED(); }
@@ -29756,8 +29908,8 @@ check_flush_deps(void)
insert_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET);
if ( !pass ) CACHE_ERROR("insert_entry failed")
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[u].in_cache = TRUE;
expected[u].is_dirty = TRUE;
@@ -29779,7 +29931,7 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
/* Check the parent's entry status */
entry_ptr = &(base_addr[1]);
if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache,
@@ -29815,7 +29967,7 @@ check_flush_deps(void)
if(!in_cache || is_flush_dep_parent || !is_flush_dep_child)
CACHE_ERROR("invalid entry status")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -29845,7 +29997,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -29869,14 +30021,14 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -29911,7 +30063,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -29939,11 +30091,11 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -29962,11 +30114,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -29985,11 +30137,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 3);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 3, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type = entry_type;
@@ -30019,7 +30171,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[2].flush_dep_par_type = -1;
@@ -30046,7 +30198,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -30073,7 +30225,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -30099,11 +30251,11 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -30122,11 +30274,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -30145,11 +30297,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 3);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 3, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type = entry_type;
@@ -30179,7 +30331,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -30212,7 +30364,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -30242,7 +30394,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[2].flush_dep_par_type = -1;
@@ -30268,11 +30420,11 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 3);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 3, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type = entry_type;
@@ -30291,11 +30443,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -30317,11 +30469,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -30357,7 +30509,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[2].flush_dep_par_type = -1;
@@ -30384,7 +30536,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -30411,7 +30563,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -30437,11 +30589,11 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 3);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 3, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type = entry_type;
@@ -30460,11 +30612,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -30486,11 +30638,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -30526,7 +30678,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -30559,7 +30711,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -30589,7 +30741,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[2].flush_dep_par_type = -1;
@@ -30613,12 +30765,12 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
for(u = 0; u < 4; u++) {
create_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[u].flush_dep_par_type = entry_type;
@@ -30643,7 +30795,7 @@ check_flush_deps(void)
destroy_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[u].flush_dep_par_type = -1;
@@ -30659,7 +30811,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].is_protected = FALSE;
@@ -30686,11 +30838,11 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -30709,11 +30861,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type = entry_type;
@@ -30732,11 +30884,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 0, entry_type, 4);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type = entry_type;
@@ -30770,7 +30922,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].flush_dep_par_type = -1;
@@ -30800,7 +30952,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_par_type = -1;
@@ -30827,7 +30979,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -30855,11 +31007,11 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -30878,11 +31030,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -30901,11 +31053,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type = entry_type;
@@ -30925,7 +31077,7 @@ check_flush_deps(void)
create_flush_dependency(entry_type, 1, entry_type, 4);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type = entry_type;
@@ -30950,7 +31102,7 @@ check_flush_deps(void)
destroy_flush_dependency(entry_type, 1, entry_type, 4);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].flush_dep_par_type = -1;
@@ -30978,7 +31130,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_par_type = -1;
@@ -31005,7 +31157,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -31032,7 +31184,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -31060,11 +31212,11 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -31083,11 +31235,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -31106,11 +31258,11 @@ check_flush_deps(void)
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type = entry_type;
@@ -31130,7 +31282,7 @@ check_flush_deps(void)
create_flush_dependency(entry_type, 2, entry_type, 4);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type = entry_type;
@@ -31151,7 +31303,7 @@ check_flush_deps(void)
destroy_flush_dependency(entry_type, 2, entry_type, 4);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].flush_dep_par_type = -1;
@@ -31175,7 +31327,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_par_type = -1;
@@ -31202,7 +31354,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -31229,7 +31381,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -31255,14 +31407,14 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
pin_entry(entry_type, 1);
if ( !pass ) CACHE_ERROR("pin_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -31295,7 +31447,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -31321,14 +31473,14 @@ check_flush_deps(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
pin_entry(entry_type, 1);
if ( !pass ) CACHE_ERROR("pin_entry failed")
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -31368,7 +31520,7 @@ check_flush_deps(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -31388,7 +31540,7 @@ check_flush_deps(void)
done:
- if(file_ptr)
+ if(file_ptr)
takedown_cache(file_ptr, FALSE, FALSE);
if ( pass )
@@ -31456,7 +31608,7 @@ check_flush_deps_err(void)
case 1:
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
result = H5C_create_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[0]));
if( result != FAIL ) CACHE_ERROR("Creating flush dependency with parent == child")
@@ -31472,13 +31624,13 @@ check_flush_deps_err(void)
case 2:
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 0, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
result = H5C_create_flush_dependency(&((entries[entry_type])[1]), &((entries[entry_type])[2]));
if( result != FAIL ) CACHE_ERROR("Creating second flush dependency for child")
@@ -31504,43 +31656,43 @@ check_flush_deps_err(void)
case 3:
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 0, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 3);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 3, entry_type, 4);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 4, entry_type, 5);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 5);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 5, entry_type, 6);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
protect_entry(file_ptr, entry_type, 6);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
result = H5C_create_flush_dependency(&((entries[entry_type])[6]), &((entries[entry_type])[7]));
if( result != FAIL ) CACHE_ERROR("Creating flush dependency that's too tall")
@@ -31553,7 +31705,7 @@ check_flush_deps_err(void)
protect_entry(file_ptr, entry_type, 7);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
result = H5C_create_flush_dependency(&((entries[entry_type])[7]), &((entries[entry_type])[0]));
if( result != FAIL ) CACHE_ERROR("Creating flush dependency that's too tall")
@@ -31630,7 +31782,7 @@ check_flush_deps_err(void)
result = H5C_destroy_flush_dependency(&((entries[entry_type])[0]), &((entries[entry_type])[1]));
if( result != FAIL ) CACHE_ERROR("Destroying [non-existant] dependency when parent isn't protected")
break;
-
+
/* Verify that parent entry has flush dependency */
case 5:
protect_entry(file_ptr, entry_type, 0);
@@ -31646,7 +31798,7 @@ check_flush_deps_err(void)
H5C__NO_FLAGS_SET); /* unsigned int flags */
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
break;
-
+
/* Verify that child entry is in flush dependency relationship */
case 6:
protect_entry(file_ptr, entry_type, 0);
@@ -31773,7 +31925,7 @@ check_flush_deps_err(void)
done:
- if(file_ptr)
+ if(file_ptr)
takedown_cache(file_ptr, FALSE, FALSE);
if ( pass )
@@ -31839,8 +31991,8 @@ check_flush_deps_order(void)
insert_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET);
if ( !pass ) CACHE_ERROR("insert_entry failed")
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[u].in_cache = TRUE;
expected[u].is_dirty = TRUE;
@@ -31859,11 +32011,11 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -31903,7 +32055,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -31933,7 +32085,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -31956,11 +32108,11 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 0, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].is_protected = TRUE;
@@ -32011,7 +32163,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -32035,7 +32187,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 0, entry_type, 1);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_pinned = FALSE;
@@ -32060,14 +32212,14 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -32125,7 +32277,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -32155,7 +32307,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -32182,14 +32334,14 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 0, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
create_flush_dependency(entry_type, 0, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].is_protected = TRUE;
@@ -32247,7 +32399,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -32277,7 +32429,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 0, entry_type, 2);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_pinned = FALSE;
@@ -32304,11 +32456,11 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -32327,11 +32479,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -32350,11 +32502,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 3);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 3, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[2].flush_dep_par_type = entry_type;
@@ -32429,7 +32581,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -32460,7 +32612,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 3, entry_type, 2);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[2].flush_dep_par_type = -1;
@@ -32479,7 +32631,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -32498,7 +32650,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -32523,11 +32675,11 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 0, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].is_protected = TRUE;
@@ -32546,11 +32698,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 2);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].child_flush_dep_height_rc[0] = 0;
@@ -32572,11 +32724,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].child_flush_dep_height_rc[1] = 0;
@@ -32657,7 +32809,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -32689,7 +32841,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 2, entry_type, 3);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].child_flush_dep_height_rc[2] = 0;
@@ -32714,7 +32866,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 1, entry_type, 2);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].child_flush_dep_height_rc[1] = 0;
@@ -32736,7 +32888,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 0, entry_type, 1);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].is_pinned = FALSE;
@@ -32759,12 +32911,12 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
for(u = 0; u < 4; u++) {
create_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[u].flush_dep_par_type = entry_type;
@@ -32831,7 +32983,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -32865,7 +33017,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 4, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[u].flush_dep_par_type = -1;
@@ -32874,7 +33026,7 @@ check_flush_deps_order(void)
/* Check for destroying flush dependency on last entry */
if(3 == u) {
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].is_pinned = FALSE;
@@ -32896,12 +33048,12 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
for(u = 1; u < 5; u++) {
create_flush_dependency(entry_type, 0, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[u].flush_dep_par_type = entry_type;
@@ -32968,7 +33120,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -33002,7 +33154,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 0, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[u].flush_dep_par_type = -1;
@@ -33011,7 +33163,7 @@ check_flush_deps_order(void)
/* Check for destroying flush dependency on last entry */
if(4 == u) {
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].is_pinned = FALSE;
@@ -33037,11 +33189,11 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -33060,11 +33212,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type = entry_type;
@@ -33083,11 +33235,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 0);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 0, entry_type, 4);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type = entry_type;
@@ -33169,7 +33321,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -33203,7 +33355,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 0, entry_type, 4);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].flush_dep_par_type = -1;
@@ -33225,7 +33377,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_par_type = -1;
@@ -33244,7 +33396,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -33271,11 +33423,11 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -33294,11 +33446,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -33317,11 +33469,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type = entry_type;
@@ -33341,7 +33493,7 @@ check_flush_deps_order(void)
create_flush_dependency(entry_type, 1, entry_type, 4);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type = entry_type;
@@ -33423,7 +33575,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -33459,7 +33611,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 1, entry_type, 4);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].flush_dep_par_type = -1;
@@ -33480,7 +33632,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_par_type = -1;
@@ -33499,7 +33651,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -33518,7 +33670,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -33545,11 +33697,11 @@ check_flush_deps_order(void)
{
protect_entry(file_ptr, entry_type, 1);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[0].flush_dep_par_type = entry_type;
@@ -33568,11 +33720,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 2);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[1].flush_dep_par_type = entry_type;
@@ -33591,11 +33743,11 @@ check_flush_deps_order(void)
protect_entry(file_ptr, entry_type, 4);
if ( !pass ) CACHE_ERROR("protect_entry failed")
-
+
create_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[3].flush_dep_par_type = entry_type;
@@ -33615,7 +33767,7 @@ check_flush_deps_order(void)
create_flush_dependency(entry_type, 2, entry_type, 4);
if ( !pass ) CACHE_ERROR("create_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after creating flush dependency
*/
expected[4].flush_dep_par_type = entry_type;
@@ -33693,7 +33845,7 @@ check_flush_deps_order(void)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroy flush dependency
*/
expected[0].is_dirty = FALSE;
@@ -33729,7 +33881,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 2, entry_type, 4);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[4].flush_dep_par_type = -1;
@@ -33746,7 +33898,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 4, entry_type, 3);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[3].flush_dep_par_type = -1;
@@ -33765,7 +33917,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 2, entry_type, 1);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[1].flush_dep_par_type = -1;
@@ -33784,7 +33936,7 @@ check_flush_deps_order(void)
destroy_flush_dependency(entry_type, 1, entry_type, 0);
if ( !pass ) CACHE_ERROR("destroy_flush_dependency failed")
- /* Change expected values, and verify the status of the entries
+ /* Change expected values, and verify the status of the entries
* after destroying flush dependency
*/
expected[0].flush_dep_par_type = -1;
@@ -33803,7 +33955,7 @@ check_flush_deps_order(void)
done:
- if(file_ptr)
+ if(file_ptr)
takedown_cache(file_ptr, FALSE, FALSE);
if ( pass )
@@ -33870,8 +34022,8 @@ check_notify_cb(void)
insert_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET);
if ( !pass ) CACHE_ERROR("insert_entry failed")
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[u].in_cache = TRUE;
expected[u].is_dirty = TRUE;
@@ -33896,8 +34048,8 @@ check_notify_cb(void)
expunge_entry(file_ptr, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("expunge_entry failed")
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[u].in_cache = FALSE;
expected[u].is_dirty = FALSE;
@@ -33924,8 +34076,8 @@ check_notify_cb(void)
protect_entry(file_ptr, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("protect_entry failed")
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[u].in_cache = TRUE;
expected[u].is_dirty = FALSE;
@@ -33952,8 +34104,8 @@ check_notify_cb(void)
unprotect_entry(file_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET);
if ( !pass ) CACHE_ERROR("unprotect_entry failed")
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[u].in_cache = TRUE;
expected[u].is_dirty = TRUE;
@@ -33979,8 +34131,8 @@ check_notify_cb(void)
expunge_entry(file_ptr, entry_type, (int32_t)u);
if ( !pass ) CACHE_ERROR("expunge_entry failed")
- /* Change expected values, and verify the status of the entries
- * after each insertion
+ /* Change expected values, and verify the status of the entries
+ * after each insertion
*/
expected[u].in_cache = FALSE;
expected[u].is_dirty = FALSE;
@@ -34003,7 +34155,7 @@ check_notify_cb(void)
} /* end for */
done:
- if(file_ptr)
+ if(file_ptr)
takedown_cache(file_ptr, FALSE, FALSE);
if ( pass )
@@ -34091,8 +34243,8 @@ main(void)
nerrs += check_auto_cache_resize_epoch_markers();
nerrs += check_auto_cache_resize_input_errs();
nerrs += check_auto_cache_resize_aux_fcns();
- nerrs += check_metadata_blizzard_absence(TRUE);
- nerrs += check_metadata_blizzard_absence(FALSE);
+ nerrs += check_metadata_blizzard_absence(TRUE);
+ nerrs += check_metadata_blizzard_absence(FALSE);
nerrs += check_flush_deps();
nerrs += check_flush_deps_err();
nerrs += check_flush_deps_order();
diff --git a/test/cache_common.c b/test/cache_common.c
index 335704d..0c94a22 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -35,20 +35,20 @@ const char *FILENAME[] = {
NULL
};
-hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between
- * cache setup and takedown. Note
+hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between
+ * cache setup and takedown. Note
* that if saved_fapl_id == H5P_DEFAULT,
- * we assume that there is no fapl to
+ * we assume that there is no fapl to
* close.
*/
-hid_t saved_fid = -1; /* store the file id here between cache setup
+hid_t saved_fid = -1; /* store the file id here between cache setup
* and takedown.
*/
-H5C_t * saved_cache = NULL; /* store the pointer to the instance of
- * of H5C_t created by H5Fcreate()
- * here between test cache setup and
+H5C_t * saved_cache = NULL; /* store the pointer to the instance of
+ * of H5C_t created by H5Fcreate()
+ * here between test cache setup and
* shutdown.
*/
@@ -1626,7 +1626,7 @@ execute_flush_op(H5F_t * file_ptr,
/* change the size of some other entry */
- resize_entry(file_ptr, op_ptr->type, op_ptr->idx,
+ resize_entry(file_ptr, op_ptr->type, op_ptr->idx,
op_ptr->size, op_ptr->flag);
}
break;
@@ -1695,7 +1695,7 @@ entry_in_cache(H5C_t * cache_ptr,
HDassert( entry_ptr->type == type );
HDassert( entry_ptr == entry_ptr->self );
- H5C__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr)
+ H5C_TEST__SEARCH_INDEX(cache_ptr, entry_ptr->addr, test_ptr)
if ( test_ptr != NULL ) {
@@ -2011,7 +2011,7 @@ resize_pinned_entry(H5C_t * cache_ptr,
entry_ptr->size = new_size;
- result = H5C_resize_pinned_entry((void *)entry_ptr,
+ result = H5C_resize_pinned_entry((void *)entry_ptr,
new_size);
if ( result != SUCCEED ) {
@@ -2586,13 +2586,13 @@ setup_cache(size_t max_cache_size,
< 0 ) {
core_file_driver_failed = TRUE;
-
+
if ( verbose ) {
HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", fcn_name);
}
} else {
-
+
saved_fapl_id = fapl_id;
}
}
@@ -2601,12 +2601,12 @@ setup_cache(size_t max_cache_size,
HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
fcn_name, mile_stone++, (int)pass);
- /* if we either aren't using the core file driver, or a create
+ /* if we either aren't using the core file driver, or a create
* with the core file driver failed, try again with a regular file.
* If this fails, we are cooked.
*/
if ( ( pass ) && ( fid < 0 ) ) {
-
+
fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
saved_fid = fid;
@@ -2615,7 +2615,7 @@ setup_cache(size_t max_cache_size,
pass = FALSE;
failure_mssg = "H5Fcreate() failed.";
-
+
if ( verbose ) {
HDfprintf(stdout, "%s: H5Fcreate() failed.\n", fcn_name);
}
@@ -2636,7 +2636,7 @@ setup_cache(size_t max_cache_size,
pass = FALSE;
failure_mssg = "H5Fflush() failed.";
-
+
if ( verbose ) {
HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name);
}
@@ -2649,7 +2649,7 @@ setup_cache(size_t max_cache_size,
pass = FALSE;
failure_mssg = "Can't get file_ptr.";
-
+
if ( verbose ) {
HDfprintf(stdout, "%s: H5Fflush() failed.\n", fcn_name);
}
@@ -2679,15 +2679,15 @@ setup_cache(size_t max_cache_size,
* and we have modified many cache routines to use a file
* pointer to look up the target cache.
*
- * Thus we now make note of the address of the instance of
- * H5C_t created by the call to H5Fcreate(), set
+ * Thus we now make note of the address of the instance of
+ * H5C_t created by the call to H5Fcreate(), set
* file_ptr->shared->cache to NULL, call H5C_create()
* to allocate a new instance of H5C_t for test purposes,
- * and store than new instance's address in
+ * and store than new instance's address in
* file_ptr->shared->cache.
*
* On shut down, we call H5C_dest on our instance of H5C_t,
- * set file_ptr->shared->cache to point to the original
+ * set file_ptr->shared->cache to point to the original
* instance, and then close the file normally.
*/
@@ -2714,7 +2714,7 @@ setup_cache(size_t max_cache_size,
fcn_name, mile_stone++, (int)pass);
if ( pass ) {
-
+
if ( cache_ptr == NULL ) {
pass = FALSE;
@@ -2741,14 +2741,14 @@ setup_cache(size_t max_cache_size,
if ( pass ) { /* allocate space for test entries */
- actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT,
+ actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT,
(hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
if ( actual_base_addr == HADDR_UNDEF ) {
pass = FALSE;
failure_mssg = "H5MF_alloc() failed.";
-
+
if ( verbose ) {
HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", fcn_name);
}
@@ -2763,7 +2763,7 @@ setup_cache(size_t max_cache_size,
failure_mssg = "actual_base_addr > BASE_ADDR";
if ( verbose ) {
- HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n",
+ HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n",
fcn_name);
}
}
@@ -2820,7 +2820,7 @@ takedown_cache(H5F_t * file_ptr,
H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
}
-
+
flush_cache(file_ptr, TRUE, FALSE, FALSE);
H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT);
@@ -2846,7 +2846,7 @@ takedown_cache(H5F_t * file_ptr,
if ( NULL == file_ptr ) {
file_ptr = (H5F_t *)H5I_object_verify(saved_fid, H5I_FILE);
HDassert ( file_ptr );
- }
+ }
H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr,
(hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
@@ -2977,61 +2977,59 @@ flush_cache(H5F_t * file_ptr,
hbool_t dump_detailed_stats)
{
const char * fcn_name = "flush_cache()";
- H5C_t * cache_ptr;
- herr_t result = 0;
hbool_t verbose = FALSE;
verify_unprotected();
- if ( pass ) {
+ if(pass) {
+ H5C_t * cache_ptr = NULL;
+ herr_t result = 0;
HDassert(file_ptr);
cache_ptr = file_ptr->shared->cache;
- if ( destroy_entries ) {
+ if(destroy_entries) {
- result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- H5C__FLUSH_INVALIDATE_FLAG);
+ result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG);
- } else {
+ }
+ else {
- result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- H5C__NO_FLAGS_SET);
+ result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
}
- }
- if ( dump_stats ) {
+ if(dump_stats) {
- H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
- }
+ H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
+ }
- if ( result < 0 ) {
+ if(result < 0) {
- pass = FALSE;
- failure_mssg = "error in H5C_flush_cache().";
- }
- else if ( ( destroy_entries ) &&
- ( ( cache_ptr->index_len != 0 ) ||
- ( cache_ptr->index_size != 0 ) ||
- ( cache_ptr->clean_index_size != 0 ) ||
- ( cache_ptr->dirty_index_size != 0 ) ) ) {
-
- if ( verbose ) {
- HDfprintf(stdout,
- "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
- fcn_name,
- (long long)(cache_ptr->index_len),
- (long long)(cache_ptr->index_size),
- (long long)(cache_ptr->clean_index_size),
- (long long)(cache_ptr->dirty_index_size));
- }
- pass = FALSE;
- failure_mssg =
- "non zero index len/sizes after H5C_flush_cache() with invalidate.";
+ pass = FALSE;
+ failure_mssg = "error in H5C_flush_cache().";
+ }
+ else if((destroy_entries) && ((cache_ptr->index_len != 0)
+ || (cache_ptr->index_size != 0)
+ || (cache_ptr->clean_index_size != 0)
+ || (cache_ptr->dirty_index_size != 0))) {
+
+ if(verbose) {
+ HDfprintf(stdout,
+ "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
+ fcn_name,
+ (long long)(cache_ptr->index_len),
+ (long long)(cache_ptr->index_size),
+ (long long)(cache_ptr->clean_index_size),
+ (long long)(cache_ptr->dirty_index_size));
+ }
+ pass = FALSE;
+ failure_mssg = "non zero index len/sizes after H5C_flush_cache() with invalidate.";
+ }
}
-
return;
} /* flush_cache() */
@@ -4020,7 +4018,7 @@ unprotect_entry_with_size_change(H5F_t * file_ptr,
if ( result < 0 )
HDfprintf(stdout, "%s: H5C_unprotect() failed.\n", fcn_name);
- if ( entry_ptr->header.is_protected )
+ if ( entry_ptr->header.is_protected )
HDfprintf(stdout, "%s: entry still protected?!?.\n", fcn_name);
if ( entry_ptr->header.type != &(types[type]) )
@@ -4549,7 +4547,7 @@ row_major_scan_backward(H5F_t * file_ptr,
if ( pass ) {
cache_ptr = file_ptr->shared->cache;
-
+
HDassert( cache_ptr != NULL );
HDassert( lag >= 10 );
@@ -5324,7 +5322,7 @@ hl_col_major_scan_backward(H5F_t * file_ptr,
if ( pass ) {
cache_ptr = file_ptr->shared->cache;
-
+
HDassert( cache_ptr != NULL );
HDassert( lag > 5 );
HDassert( max_index >= 500 );
diff --git a/test/cache_common.h b/test/cache_common.h
index 7f2af16..0e20b97 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -81,10 +81,10 @@
#define MAX_ENTRIES (10 * 1024)
-/* The choice of the BASE_ADDR below is arbitrary -- it just has to be
+/* The choice of the BASE_ADDR below is arbitrary -- it just has to be
* larger than the superblock.
*/
-#define BASE_ADDR (haddr_t)1024
+#define BASE_ADDR (haddr_t)1024
#define PICO_BASE_ADDR BASE_ADDR
#define NANO_BASE_ADDR (haddr_t)(PICO_BASE_ADDR + \
(PICO_ENTRY_SIZE * NUM_PICO_ENTRIES))
@@ -337,21 +337,25 @@ typedef struct test_entry_t
#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3)
#define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3)
-#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
+#define H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
if ( ( (cache_ptr) == NULL ) || \
( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
( ! H5F_addr_defined(Addr) ) || \
( H5C__HASH_FCN(Addr) < 0 ) || \
( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \
HDfprintf(stdout, "Pre HT search SC failed.\n"); \
}
-#define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
+#define H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
if ( ( (cache_ptr) == NULL ) || \
( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \
( (cache_ptr)->index_len < 1 ) || \
( (entry_ptr) == NULL ) || \
( (cache_ptr)->index_size < (entry_ptr)->size ) || \
+ ( (cache_ptr)->index_size != \
+ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \
( H5F_addr_ne((entry_ptr)->addr, (Addr)) ) || \
( (entry_ptr)->size <= 0 ) || \
( ((cache_ptr)->index)[k] == NULL ) || \
@@ -366,12 +370,18 @@ if ( ( (cache_ptr) == NULL ) || \
HDfprintf(stdout, "Post successful HT search SC failed.\n"); \
}
+#define H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
+if ( ( (cache_ptr) == NULL ) || \
+ ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \
+ ( (entry_ptr)->ht_prev != NULL ) ) { \
+ HDfprintf(stdout, "Post HT shift to front failed.\n"); \
+}
-#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
+#define H5C_TEST__SEARCH_INDEX(cache_ptr, Addr, entry_ptr) \
{ \
int k; \
int depth = 0; \
- H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
+ H5C_TEST__PRE_HT_SEARCH_SC(cache_ptr, Addr) \
k = H5C__HASH_FCN(Addr); \
entry_ptr = ((cache_ptr)->index)[k]; \
while ( ( entry_ptr ) && ( H5F_addr_ne(Addr, (entry_ptr)->addr) ) ) \
@@ -381,7 +391,7 @@ if ( ( (cache_ptr) == NULL ) || \
} \
if ( entry_ptr ) \
{ \
- H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
+ H5C_TEST__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, Addr, k) \
if ( entry_ptr != ((cache_ptr)->index)[k] ) \
{ \
if ( (entry_ptr)->ht_next ) \
@@ -394,6 +404,7 @@ if ( ( (cache_ptr) == NULL ) || \
(entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \
(entry_ptr)->ht_prev = NULL; \
((cache_ptr)->index)[k] = (entry_ptr); \
+ H5C_TEST__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k) \
} \
} \
}
diff --git a/test/cross_read.c b/test/cross_read.c
index b036217..6b2badf 100755
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -22,6 +22,7 @@
*/
#include "h5test.h"
+#include "H5srcdir.h"
const char *FILENAME[] = {
"vms_data",
@@ -37,8 +38,7 @@ const char *FILENAME[] = {
static int read_data(char *fname)
{
- char pathname[1024];
- char *srcdir = getenv("srcdir"); /*where the src code is located*/
+ const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */
hid_t file, dataset; /* handles */
hid_t datatype;
hid_t dt;
@@ -47,14 +47,6 @@ static int read_data(char *fname)
int i, j;
unsigned nerrors = 0;
- pathname[0] = '\0';
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((strlen(srcdir) + strlen(fname) + 1) < sizeof(pathname))) {
- strcpy(pathname, srcdir);
- strcat(pathname, "/");
- }
- strcat(pathname, fname);
-
/*
* Data and output buffer initialization.
*/
diff --git a/test/dsets.c b/test/dsets.c
index 84b40bb..b7ba484 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -24,6 +24,7 @@
#include <time.h>
#include "h5test.h"
+#include "H5srcdir.h"
#include "H5Vprivate.h"
#ifdef H5_HAVE_SZLIB_H
# include "szlib.h"
@@ -57,6 +58,7 @@ const char *FILENAME[] = {
"chunk_fast", /* 10 */
"chunk_expand", /* 11 */
"chunk_fixed", /* 12 */
+ "copy_dcpl_newfile",
NULL
};
#define FILENAME_BUF_SIZE 1024
@@ -107,6 +109,9 @@ const char *FILENAME[] = {
#define DSET_SCALEOFFSET_DOUBLE_NAME_2 "scaleoffset_double_2"
#define DSET_COMPARE_DCPL_NAME "compare_dcpl"
#define DSET_COMPARE_DCPL_NAME_2 "compare_dcpl_2"
+#define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1"
+#define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2"
+#define COPY_DCPL_EXTFILE_NAME "ext_file"
#define DSET_DEPREC_NAME "deprecated"
#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
@@ -714,93 +719,100 @@ test_compact_io(hid_t fapl)
* Purpose: Tests compact dataset of maximal size.
*
* Return: Success: 0
- *
* Failure: -1
*
* Programmer: Raymond Lu
* August 8, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_max_compact(hid_t fapl)
{
- hid_t file, dataset, space, plist;
+ hid_t file = -1;
+ hid_t dataset = -1;
+ hid_t space = -1;
+ hid_t plist = -1;
hsize_t dims[1];
- hsize_t compact_size;
- herr_t status;
- int *wbuf, *rbuf;
+ size_t compact_size;
+ int *wbuf = NULL;
+ int *rbuf = NULL;
char filename[FILENAME_BUF_SIZE];
- int i, n;
+ int n;
+ size_t u;
TESTING("compact dataset of maximal size");
/* Test compact dataset of size 64KB-64 */
/* Initialize data */
- compact_size = (SIXTY_FOUR_KB-64)/sizeof(int);
+ compact_size = (SIXTY_FOUR_KB - 64) / sizeof(int);
- wbuf = (int*)HDmalloc(sizeof(int)*(size_t)compact_size);
- assert(wbuf);
- rbuf = (int*)HDmalloc(sizeof(int)*(size_t)compact_size);
- assert(rbuf);
+ if(NULL == (wbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
+ TEST_ERROR
+ if(NULL == (rbuf = (int *)HDmalloc(sizeof(int) * compact_size)))
+ TEST_ERROR
- n=0;
- for(i=0; i<(int)compact_size; i++)
- wbuf[i] = n++;
+ n = 0;
+ for(u = 0; u < compact_size; u++)
+ wbuf[u] = n++;
/* Create a small data space for compact dataset */
- dims[0] = compact_size;
- space = H5Screate_simple(1, dims, NULL);
- assert(space>=0);
+ dims[0] = (hsize_t)compact_size;
+ if((space = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Create a file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Create property list for compact dataset creation */
- plist = H5Pcreate(H5P_DATASET_CREATE);
- assert(plist >= 0);
- status = H5Pset_layout(plist, H5D_COMPACT);
- assert(status >= 0);
+ if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(plist, H5D_COMPACT) < 0)
+ FAIL_STACK_ERROR
/* Create and write to a compact dataset */
if((dataset = H5Dcreate2(file, DSET_COMPACT_MAX_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR
if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
- goto error;
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Sclose(space) < 0) goto error;
- if(H5Pclose(plist) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(plist) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
/*
* Open the file and check data
*/
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- goto error;
+ FAIL_STACK_ERROR
if((dataset = H5Dopen2(file, DSET_COMPACT_MAX_NAME, H5P_DEFAULT)) < 0)
- goto error;
+ FAIL_STACK_ERROR
if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- goto error;
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written */
- for(i = 0; i < (int)compact_size; i++)
- if(rbuf[i] != wbuf[i]) {
+ for(u = 0; u < compact_size; u++)
+ if(rbuf[u] != wbuf[u]) {
H5_FAILED();
printf(" Read different values than written.\n");
- printf(" At index %d\n", i);
+ printf(" At index %u\n", (unsigned)u);
goto error;
} /* end if */
- if(H5Dclose(dataset) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
HDfree(wbuf);
wbuf = NULL;
HDfree(rbuf);
@@ -809,20 +821,20 @@ test_max_compact(hid_t fapl)
/* Test compact dataset of size 64KB */
/* Create a data space for compact dataset */
- compact_size = SIXTY_FOUR_KB/sizeof(int);
- dims[0] = compact_size;
- space = H5Screate_simple(1, dims, NULL);
- assert(space>=0);
+ compact_size = SIXTY_FOUR_KB / sizeof(int);
+ dims[0] = (hsize_t)compact_size;
+ if((space = H5Screate_simple(1, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Open file */
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
goto error;
/* Create property list for compact dataset creation */
- plist = H5Pcreate(H5P_DATASET_CREATE);
- assert(plist >= 0);
- status = H5Pset_layout(plist, H5D_COMPACT);
- assert(status >= 0);
+ if((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_layout(plist, H5D_COMPACT) < 0)
+ FAIL_STACK_ERROR
/* Create and write to a compact dataset */
H5E_BEGIN_TRY {
@@ -830,9 +842,12 @@ test_max_compact(hid_t fapl)
} H5E_END_TRY;
/* Close file */
- H5Sclose(space);
- H5Pclose(plist);
- H5Fclose(file);
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(plist) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
PASSED();
return 0;
@@ -842,7 +857,7 @@ error:
HDfree(wbuf);
if(rbuf)
HDfree(rbuf);
-
+
H5E_BEGIN_TRY {
/* Close file */
H5Sclose(space);
@@ -852,7 +867,7 @@ error:
} H5E_END_TRY;
return -1;
-}
+} /* end test_max_compact() */
/*-------------------------------------------------------------------------
@@ -1027,10 +1042,10 @@ test_tconv(hid_t file)
hid_t space = -1, dataset = -1;
int i;
- out = (char *)HDmalloc((size_t)(4 * 1000 * 1000));
- HDassert(out);
- in = (char *)HDmalloc((size_t)(4 * 1000 * 1000));
- HDassert(in);
+ if ((out = (char *)HDmalloc((size_t)(4 * 1000 * 1000))) == NULL)
+ goto error;
+ if ((in = (char *)HDmalloc((size_t)(4 * 1000 * 1000))) == NULL)
+ goto error;
TESTING("data type conversion");
@@ -1080,16 +1095,16 @@ test_tconv(hid_t file)
return 0;
error:
- if(out)
+ if(out)
HDfree(out);
- if(in)
+ if(in)
HDfree(in);
-
+
H5E_BEGIN_TRY {
H5Dclose(dataset);
H5Sclose(space);
} H5E_END_TRY;
-
+
return -1;
}
@@ -1293,8 +1308,6 @@ const H5Z_class2_t H5Z_CORRUPT[1] = {{
* Programmer: Raymond Lu
* Jan 14, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
@@ -1302,7 +1315,7 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts,
const unsigned int *cd_values, size_t nbytes,
size_t *buf_size, void **buf)
{
- void *data;
+ void *data = NULL;
unsigned char *dst = (unsigned char*)(*buf);
unsigned int offset;
unsigned int length;
@@ -1310,20 +1323,21 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts,
size_t ret_value = 0;
if(cd_nelmts != 3 || !cd_values)
- return 0;
+ TEST_ERROR
offset = cd_values[0];
length = cd_values[1];
value = cd_values[2];
if(offset > nbytes || (offset + length) > nbytes || length < sizeof(unsigned int))
- return 0;
+ TEST_ERROR
- data = HDmalloc((size_t)length);
+ if(NULL == (data = HDmalloc((size_t)length)))
+ TEST_ERROR
HDmemset(data, (int)value, (size_t)length);
if(flags & H5Z_FLAG_REVERSE) { /* Varify data is actually corrupted during read */
dst += offset;
if(HDmemcmp(data, dst, (size_t)length) != 0)
- ret_value = 0;
+ TEST_ERROR
else {
*buf_size = nbytes;
ret_value = nbytes;
@@ -1336,11 +1350,12 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts,
ret_value = *buf_size;
} /* end else */
+error:
if(data)
HDfree(data);
return ret_value;
-}
+} /* end filter_corrupt() */
/*-------------------------------------------------------------------------
@@ -1759,7 +1774,7 @@ error:
*
* Modifications:
* Make copy of data file since the test writes to the file.
- * Larry Knox, October 14, 2009
+ * Larry Knox, October 14, 2009
*
*-------------------------------------------------------------------------
*/
@@ -1777,12 +1792,12 @@ test_filter_noencoder(const char *dset_name)
int test_ints[10] = { 12 };
int read_buf[10];
int i;
-
+
/* Make a local copy of the file since this test writes to the data file
- from svn. */
- if (h5_make_local_copy(NOENCODER_FILENAME, NOENCODER_COPY_FILENAME) < 0)
+ from svn. */
+ if (h5_make_local_copy(NOENCODER_FILENAME, NOENCODER_COPY_FILENAME) < 0)
goto error;
-
+
/* Open file */
file_id = H5Fopen(NOENCODER_COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
if(file_id < 0) goto error;
@@ -2275,8 +2290,7 @@ test_missing_filter(hid_t file)
hsize_t dset_size; /* Dataset size */
size_t i,j; /* Local index variables */
herr_t ret; /* Generic return value */
- char testfile[512]=""; /* Buffer to hold name of existing test file */
- char *srcdir = HDgetenv("srcdir"); /* The source directory, if we are using the --srcdir configure option */
+ const char *testfile = H5_get_srcdir_filename(FILE_DEFLATE_NAME); /* Corrected test file name */
TESTING("dataset access with missing filter");
@@ -2422,13 +2436,6 @@ test_missing_filter(hid_t file)
/* Try reading existing dataset with deflate filter */
- /* Compose the name of the file to open, using the srcdir, if appropriate */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_DEFLATE_NAME) + 1) < sizeof(testfile))){
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, FILE_DEFLATE_NAME);
-
/* Open existing file */
if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
H5_FAILED();
@@ -5588,6 +5595,138 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_copy_dcpl
+ *
+ * Purpose: Verifies whether the copy of dataset creation property
+ * list works. It tests the DCPL for chunked layout with
+ * filter and for contiguous layout with external storage.
+ * (Please see #1608 in Bugzilla)
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 28 January 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_copy_dcpl(hid_t file, hid_t fapl)
+{
+ hid_t dsid1=(-1), dsid2=(-1); /* Dataset ID */
+ hid_t new_dsid1=(-1), new_dsid2=(-1); /* Dataset ID */
+ hid_t sid=(-1); /* Dataspace ID */
+ hid_t dcpl=(-1); /* Dataset creation property list ID */
+ hid_t dcpl1=(-1),dcpl2=(-1); /* Copies of creation property list IDs */
+ hid_t dcpl1_copy=(-1),dcpl2_copy=(-1);/* Copies of creation property list IDs */
+ const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
+ const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t new_file=(-1);
+
+ TESTING("copying dataset creation property lists");
+
+ /* Create the data space */
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+
+ /* Create dcpl with special filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR
+ if(H5Pset_fletcher32(dcpl) < 0) TEST_ERROR
+
+ /* Create first dataset of chunking with filter */
+ if((dsid1 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose (dsid1) < 0) TEST_ERROR
+
+ /* Reopen the first dataset */
+ if((dsid1 = H5Dopen2(file, DSET_COPY_DCPL_NAME_1, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Get the copy of dataset's creation property list */
+ if((dcpl1=H5Dget_create_plist(dsid1)) < 0) TEST_ERROR
+ if((dcpl1_copy = H5Pcopy(dcpl1)) < 0) TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose (dsid1) < 0) TEST_ERROR
+
+ /* Change the DCPL for contiguous layout with external storage. The size of the reserved
+ * space in the external file is the size of the dataset - 500*4096*sizeof(int).
+ * There's no need to clean up the external file since the library doesn't create it
+ * until the data is written to it. */
+ if(H5Pset_layout(dcpl, H5D_CONTIGUOUS) < 0) TEST_ERROR
+ if(H5Premove_filter(dcpl, H5Z_FILTER_FLETCHER32) < 0) TEST_ERROR
+ if(H5Pset_external(dcpl, COPY_DCPL_EXTFILE_NAME, 0, 500*4096*sizeof(int)) < 0) TEST_ERROR
+
+ /* Create second dataset of contiguous layout with external storage */
+ if((dsid2 = H5Dcreate2(file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose (dsid2) < 0) TEST_ERROR
+
+ /* Reopen the second dataset */
+ if((dsid2 = H5Dopen2(file, DSET_COPY_DCPL_NAME_2, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Get copy of dataset's dataset creation property list */
+ if((dcpl2=H5Dget_create_plist(dsid2)) < 0) TEST_ERROR
+ if((dcpl2_copy = H5Pcopy(dcpl2)) < 0) TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose (dsid2) < 0) TEST_ERROR
+
+ /* Create a second file and create 2 datasets with the copies of the DCPLs in the first
+ * file. Test whether the copies of DCPLs work. */
+ h5_fixname(FILENAME[11], fapl, filename, sizeof filename);
+ if((new_file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ if((new_dsid1 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_1, H5T_NATIVE_INT, sid,
+ H5P_DEFAULT, dcpl1_copy, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ if((new_dsid2 = H5Dcreate2(new_file, DSET_COPY_DCPL_NAME_2, H5T_NATIVE_INT, sid,
+ H5P_DEFAULT, dcpl2_copy, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ /* Close datasets */
+ if(H5Dclose (new_dsid1) < 0) TEST_ERROR
+ if(H5Dclose (new_dsid2) < 0) TEST_ERROR
+
+ /* Close the second file */
+ if(H5Fclose (new_file) < 0) TEST_ERROR
+
+ /* Close dataset creation property lists */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR
+ if(H5Pclose(dcpl1) < 0) TEST_ERROR
+ if(H5Pclose(dcpl2) < 0) TEST_ERROR
+ if(H5Pclose(dcpl1_copy) < 0) TEST_ERROR
+ if(H5Pclose(dcpl2_copy) < 0) TEST_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dsid1);
+ H5Dclose(dsid2);
+ H5Dclose(new_dsid1);
+ H5Dclose(new_dsid2);
+ H5Sclose(sid);
+ H5Pclose(dcpl);
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
+ H5Pclose(dcpl1_copy);
+ H5Pclose(dcpl2_copy);
+ } H5E_END_TRY;
+ return -1;
+} /* end test_copy_dcpl() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_filter_delete
*
* Purpose: Tests deletion of filters from a dataset creation property list
@@ -5822,8 +5961,7 @@ test_filters_endianess(void)
hid_t dsid=-1; /* dataset ID */
hid_t sid=-1; /* dataspace ID */
hid_t dcpl=-1; /* dataset creation property list ID */
- char *srcdir = getenv("srcdir"); /* the source directory */
- char data_file[512]=""; /* buffer to hold name of existing file */
+ const char *data_file = H5_get_srcdir_filename("test_filters_le.hdf5"); /* Corrected test file name */
TESTING("filters with big-endian/little-endian data");
@@ -5833,14 +5971,6 @@ test_filters_endianess(void)
*-------------------------------------------------------------------------
*/
- /* compose the name of the file to open, using the srcdir, if appropriate */
- HDstrcpy(data_file, "");
- if(srcdir) {
- HDstrcpy(data_file, srcdir);
- HDstrcat(data_file, "/");
- }
- HDstrcat(data_file, "test_filters_le.hdf5");
-
/* open */
if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@@ -5856,12 +5986,7 @@ test_filters_endianess(void)
*/
/* compose the name of the file to open, using the srcdir, if appropriate */
- HDstrcpy(data_file, "");
- if(srcdir) {
- HDstrcpy(data_file, srcdir);
- HDstrcat(data_file, "/");
- }
- HDstrcat(data_file, "test_filters_be.hdf5");
+ data_file = H5_get_srcdir_filename("test_filters_be.hdf5"); /* Corrected test file name */
/* open */
if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@@ -6803,7 +6928,7 @@ error:
*
* Purpose: When the chunk size is bigger than the cache size and the
* chunk isn't on disk, this test verifies that the library
- * bypasses the cache.
+ * bypasses the cache.
*
* Note: This test is not very conclusive - it doesn't actually check
* if the chunks bypass the cache... :-( -QAK
@@ -6829,7 +6954,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
size_t rdcc_nelmts, rdcc_nbytes;
int fvalue = BYPASS_FILL_VALUE;
hsize_t count, stride, offset, block;
- static int wdata[BYPASS_CHUNK_DIM/2], rdata1[BYPASS_DIM],
+ static int wdata[BYPASS_CHUNK_DIM/2], rdata1[BYPASS_DIM],
rdata2[BYPASS_CHUNK_DIM/2];
int i, j;
@@ -6873,7 +6998,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
count = 1;
stride = 1;
block = BYPASS_CHUNK_DIM / 2;
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &offset, &stride, &count, &block) < 0)
+ if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, &offset, &stride, &count, &block) < 0)
FAIL_STACK_ERROR
/* Initialize data to write */
@@ -6889,9 +7014,9 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Reopen the dataset */
if((dsid = H5Dopen2(fid, BYPASS_DATASET1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Reads both 2 chunks. Reading the second chunk should bypass the cache because the
+ /* Reads both 2 chunks. Reading the second chunk should bypass the cache because the
* chunk is bigger than the cache size and it isn't allocated on disk. */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0)
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0)
FAIL_STACK_ERROR
for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
@@ -6910,9 +7035,9 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Close the first dataset */
if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
-
+
/* Create a second dataset without fill value. This time, both write
- * and read should bypass the cache because the chunk is bigger than the
+ * and read should bypass the cache because the chunk is bigger than the
* cache size and it's not allocated on disk. */
if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) FAIL_STACK_ERROR
@@ -6927,10 +7052,10 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Reopen the dataset */
if((dsid = H5Dopen2(fid, BYPASS_DATASET2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Read back only the part that was written to the file. Reading the
+ /* Read back only the part that was written to the file. Reading the
* half chunk should bypass the cache because the chunk is bigger than
* the cache size. */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0)
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0)
for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
if(rdata2[i] != i) {
@@ -8326,6 +8451,7 @@ main(void)
nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
+ nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
nerrors += (test_filters_endianess() < 0 ? 1 : 0);
nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
@@ -8355,7 +8481,7 @@ main(void)
printf("All dataset tests passed.\n");
#ifdef H5_HAVE_FILTER_SZIP
if (GetTestCleanup())
- HDremove(NOENCODER_COPY_FILENAME);
+ HDremove(NOENCODER_COPY_FILENAME);
#endif /* H5_HAVE_FILTER_SZIP */
h5_cleanup(FILENAME, fapl);
diff --git a/test/dtransform.c b/test/dtransform.c
index cb58a6c..9af1dfb 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -27,10 +27,10 @@ static int test_set(void);
static int test_getset(const hid_t dxpl_id_simple);
/* These are needed for multiple tests, so are declared here globally and are init'ed in init_test */
-hid_t dset_id_int;
-hid_t dset_id_float;
-hid_t dset_id_int_chunk;
-hid_t dset_id_float_chunk;
+hid_t dset_id_int = -1;
+hid_t dset_id_float = -1;
+hid_t dset_id_int_chunk = -1;
+hid_t dset_id_float_chunk = -1;
const float windchillFfloat[ROWS][COLS] =
@@ -68,15 +68,15 @@ const int transformData[ROWS][COLS] =
size_t i,j; \
\
for(i=0; i<ROWS; i++) \
- for(j=0; j<COLS; j++) \
- { \
- if(!( (((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || ( ((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) \
- { \
- H5_FAILED(); \
- fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
- goto error; \
- } \
- } \
+ for(j=0; j<COLS; j++) \
+ { \
+ if(!( (((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || ( ((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) \
+ { \
+ H5_FAILED(); \
+ fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
+ goto error; \
+ } \
+ } \
PASSED(); \
}
@@ -85,15 +85,15 @@ const int transformData[ROWS][COLS] =
size_t i,j; \
\
for(i=0; i<ROWS; i++) \
- for(j=0; j<COLS; j++) \
- { \
- if( !(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL))) ) \
- { \
- H5_FAILED(); \
- fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
- goto error; \
- } \
- } \
+ for(j=0; j<COLS; j++) \
+ { \
+ if( !(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL))) ) \
+ { \
+ H5_FAILED(); \
+ fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
+ goto error; \
+ } \
+ } \
PASSED(); \
}
@@ -172,17 +172,17 @@ const int transformData[ROWS][COLS] =
\
hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \
hsize_t dim[2] = {ROWS, COLS}; \
- hsize_t offset[2] = {0, 0}; \
+ hsize_t offset[2] = {0, 0}; \
\
\
if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR; \
\
- cparms = H5Pcreate(H5P_DATASET_CREATE); \
- if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR; \
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; \
+ if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR; \
\
if((dset_chunk = H5Dcreate2(file_id, "/transformtest_chunk_"TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR; \
- filespace = H5Dget_space (dset_chunk); \
- memspace = H5Screate_simple(2, dim, NULL); \
+ if((filespace = H5Dget_space(dset_chunk)) < 0) TEST_ERROR \
+ if((memspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR \
if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR; \
\
if(SIGNED) \
@@ -190,14 +190,14 @@ const int transformData[ROWS][COLS] =
if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR; \
if(H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \
- if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \
+ if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \
} \
else \
{ \
if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \
if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR; \
if(H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \
- if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \
+ if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \
} \
\
\
@@ -211,17 +211,17 @@ const int transformData[ROWS][COLS] =
\
if(SIGNED) \
{ \
- TESTING("chunked, with type conversion (float->"TEST_STR")") \
+ TESTING("chunked, with type conversion (float->"TEST_STR")") \
\
if(H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \
- COMPARE(TYPE, array, COMPARE_DATA, 2) \
+ COMPARE(TYPE, array, COMPARE_DATA, 2) \
} \
\
- \
- if(H5Pclose(cparms) < 0) TEST_ERROR; \
+ \
+ if(H5Pclose(cparms) < 0) TEST_ERROR; \
if(H5Dclose(dset_chunk) < 0) TEST_ERROR; \
- if(H5Sclose(dataspace) < 0) TEST_ERROR; \
- if(H5Sclose(memspace) < 0) TEST_ERROR; \
+ if(H5Sclose(dataspace) < 0) TEST_ERROR; \
+ if(H5Sclose(memspace) < 0) TEST_ERROR; \
}
#define INVALID_SET_TEST(TRANSFORM) \
@@ -240,7 +240,13 @@ const int transformData[ROWS][COLS] =
int main(void)
{
- hid_t dxpl_id_c_to_f, dxpl_id_c_to_f_copy, dxpl_id_simple, dxpl_id_polynomial, dxpl_id_polynomial_copy, dxpl_id_utrans_inv, file_id;
+ hid_t dxpl_id_c_to_f = -1;
+ hid_t dxpl_id_c_to_f_copy = 1;
+ hid_t dxpl_id_simple = -1;
+ hid_t dxpl_id_polynomial = -1;
+ hid_t dxpl_id_polynomial_copy = -1;
+ hid_t dxpl_id_utrans_inv = -1;
+ hid_t file_id = -1;
const char* c_to_f = "(9/5.0)*x + 32";
const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
@@ -344,6 +350,19 @@ int main(void)
return 0;
error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset_id_int);
+ H5Dclose(dset_id_int_chunk);
+ H5Dclose(dset_id_float);
+ H5Dclose(dset_id_float_chunk);
+ H5Fclose(file_id);
+ H5Pclose(dxpl_id_c_to_f);
+ H5Pclose(dxpl_id_c_to_f_copy);
+ H5Pclose(dxpl_id_polynomial);
+ H5Pclose(dxpl_id_polynomial_copy);
+ H5Pclose(dxpl_id_simple);
+ H5Pclose(dxpl_id_utrans_inv);
+ } H5E_END_TRY
return -1;
}
@@ -354,93 +373,132 @@ init_test(hid_t file_id)
/* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */
const char* utrans = "((x+100)/4)*3";
- hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, filespace;
- hsize_t dim[2] = {ROWS, COLS};
- hsize_t offset[2] = {0, 0};
-
- if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
- if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
+ hid_t dataspace = -1;
+ hid_t dxpl_id_f_to_c = -1;
+ hid_t dxpl_id_utrans = -1;
+ hid_t cparms = -1;
+ hid_t filespace = -1;
+ hsize_t dim[2] = { ROWS, COLS };
+ hsize_t offset[2] = { 0, 0 };
- if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR;
- if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR;
+ if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
+ if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0)
+ TEST_ERROR
+ if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0)
+ TEST_ERROR
cparms = H5Pcreate(H5P_DATASET_CREATE);
- if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR;
+ if(H5Pset_chunk(cparms, 2, dim) < 0)
+ TEST_ERROR
- if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR;
+ if((dataspace = H5Screate_simple(2, dim, NULL)) < 0)
+ TEST_ERROR
TESTING("Intializing test...")
- if((dset_id_int = H5Dcreate2(file_id, "/default_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR;
-
- if((dset_id_float = H5Dcreate2(file_id, "/default_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR;
-
- if((dset_id_int_chunk = H5Dcreate2(file_id, "/default_chunk_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR;
-
- filespace = H5Dget_space (dset_id_int_chunk);
- if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR;
- if(H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR;
-
- if((dset_id_float_chunk = H5Dcreate2(file_id, "/default_chunk_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR;
-
+ if((dset_id_int = H5Dcreate2(file_id, "/default_int", H5T_NATIVE_INT,
+ dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+ dxpl_id_f_to_c, windchillFfloat) < 0)
+ TEST_ERROR
+
+ if((dset_id_float = H5Dcreate2(file_id, "/default_float",
+ H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+ dxpl_id_f_to_c, windchillFfloat) < 0)
+ TEST_ERROR
+
+ if((dset_id_int_chunk = H5Dcreate2(file_id, "/default_chunk_int",
+ H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ if((filespace = H5Dget_space(dset_id_int_chunk)) < 0)
+ TEST_ERROR
+ if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace,
+ dxpl_id_f_to_c, windchillFfloat) < 0)
+ TEST_ERROR
+
+ if((dset_id_float_chunk = H5Dcreate2(file_id, "/default_chunk_float",
+ H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace,
+ dxpl_id_f_to_c, windchillFfloat) < 0)
+ TEST_ERROR
+
+ if(H5Pclose(cparms) < 0)
+ TEST_ERROR
+ if(H5Pclose(dxpl_id_f_to_c) < 0)
+ TEST_ERROR
+ if(H5Pclose(dxpl_id_utrans) < 0)
+ TEST_ERROR
+ if(H5Sclose(dataspace) < 0)
+ TEST_ERROR
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(cparms);
+ H5Pclose(dxpl_id_f_to_c);
+ H5Pclose(dxpl_id_utrans);
+ H5Sclose(dataspace);
+ H5Sclose(filespace);
+ } H5E_END_TRY
- if(H5Pclose(cparms) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR;
- if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR;
- if(H5Sclose(dataspace) < 0) TEST_ERROR;
-
- return 0;
-error:
- return -1;
+ return -1;
}
static int
test_poly(const hid_t dxpl_id_polynomial)
{
float polyflres[ROWS][COLS];
- int polyintread[ROWS][COLS];
+ int polyintread[ROWS][COLS];
float polyflread[ROWS][COLS];
int windchillC;
int row, col;
- for(row = 0; row<ROWS; row++)
- {
- for(col = 0; col<COLS; col++)
- {
- windchillC = (int)((5.0/9.0)*(windchillFfloat[row][col] - 32));
- polyflres[row][col] = (float)((2.0+windchillC)*((windchillC-8.0)/2.0));
- }
- }
+ for(row = 0; row < ROWS; row++)
+ for(col = 0; col < COLS; col++) {
+ windchillC = (int) ((5.0 / 9.0) * (windchillFfloat[row][col] - 32));
+ polyflres[row][col] = (float) ((2.0 + windchillC) * ((windchillC - 8.0) / 2.0));
+ }
TESTING("data transform, polynomial transform (int->float)")
- if(H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread) < 0) TEST_ERROR;
+ if(H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+ dxpl_id_polynomial, polyflread) < 0)
+ TEST_ERROR
+
COMPARE(float, polyflread, polyflres, 2.0)
-
- for(row = 0; row<ROWS; row++)
- {
- for(col = 0; col<COLS; col++)
- {
- windchillC = (int)((5.0/9.0)*(windchillFfloat[row][col] - 32));
- polyflres[row][col] = (float)((2+windchillC)*((windchillC-8)/2));
- }
- }
+ for(row = 0; row < ROWS; row++)
+ for(col = 0; col < COLS; col++) {
+ windchillC = (int) ((5.0 / 9.0) * (windchillFfloat[row][col] - 32));
+ polyflres[row][col] = (float) ((2 + windchillC) * ((windchillC - 8) / 2));
+ }
TESTING("data transform, polynomial transform (float->int)")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread) < 0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ dxpl_id_polynomial, polyintread) < 0)
+ TEST_ERROR
+
COMPARE(int, polyintread, polyflres, 4)
return 0;
-error:
- return -1;
+error:
+ return -1;
}
static int
@@ -452,27 +510,29 @@ test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy)
int windchillFintread[ROWS][COLS];
int row, col;
- for(row = 0; row<ROWS; row++)
- {
- for(col = 0; col<COLS; col++)
- {
- windchillC = (int)((5.0/9.0)*(windchillFfloat[row][col] - 32));
- polyflres[row][col] = (float)((2+windchillC)*((windchillC-8)/2));
- }
- }
-
+ for(row = 0; row < ROWS; row++)
+ for(col = 0; col < COLS; col++) {
+ windchillC = (int) ((5.0 / 9.0) * (windchillFfloat[row][col] - 32));
+ polyflres[row][col] = (float) ((2 + windchillC) * ((windchillC - 8) / 2));
+ }
TESTING("data transform, linear transform w/ copied property")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread) < 0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ dxpl_id_c_to_f_copy, windchillFintread) < 0)
+ TEST_ERROR
+
COMPARE(int, windchillFintread, windchillFfloat, 2)
TESTING("data transform, polynomial transform w/ copied property")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread) < 0) TEST_ERROR;
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ dxpl_id_polynomial_copy, polyintread) < 0)
+ TEST_ERROR
+
COMPARE(int, polyintread, polyflres, 2)
return 0;
-error:
+error:
return -1;
}
@@ -484,36 +544,28 @@ test_trivial(const hid_t dxpl_id_simple)
int row, col;
TESTING("data transform, trivial transform, without type conversion")
- if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread) < 0) TEST_ERROR;
- for(row = 0; row<ROWS; row++)
- {
- for(col = 0; col<COLS; col++)
- {
- if((windchillFfloatread[row][col] - 4.8) > FLOAT_TOL)
- {
- H5_FAILED();
- fprintf(stderr, " ERROR: Conversion failed to match computed data\n");
- goto error;
- }
- }
- }
- PASSED();
+ if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+ dxpl_id_simple, windchillFfloatread) < 0)
+ TEST_ERROR
+ for(row = 0; row < ROWS; row++)
+ for(col = 0; col < COLS; col++) {
+ if((windchillFfloatread[row][col] - 4.8) > FLOAT_TOL)
+ FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n");
+ }
+
+ PASSED()
TESTING("data transform, trivial transform, with type conversion")
- if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread) < 0) TEST_ERROR;
- for(row = 0; row<ROWS; row++)
- {
- for(col = 0; col<COLS; col++)
- {
- if(windchillFintread[row][col] != 4)
- {
- H5_FAILED();
- fprintf(stderr, " ERROR: Conversion failed to match computed data\n");
- goto error;
- }
- }
- }
- PASSED();
+ if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ dxpl_id_simple, windchillFintread) < 0)
+ TEST_ERROR
+ for(row = 0; row < ROWS; row++)
+ for(col = 0; col < COLS; col++) {
+ if(windchillFintread[row][col] != 4)
+ FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n")
+ }
+
+ PASSED()
return 0;
error:
@@ -523,92 +575,96 @@ error:
static int
test_getset(const hid_t dxpl_id_c_to_f)
{
- int row, col;
- float windchillFfloatread[ROWS][COLS];
- const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
- const char* c_to_f = "(9/5.0)*x + 32";
- char* ptrgetTest = (char *) HDmalloc(HDstrlen(simple)+1);
+ int row;
+ int col;
+ float windchillFfloatread[ROWS][COLS];
+ const char *simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */
+ const char *c_to_f = "(9/5.0)*x + 32";
+ char *ptrgetTest = NULL;
TESTING("H5Pget_data_transform")
- H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(c_to_f)+1);
+
+ if(NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(simple) + 1)))
+ TEST_ERROR
+
+ if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(c_to_f) + 1) < 0)
+ TEST_ERROR
if(HDstrcmp(c_to_f, ptrgetTest) != 0)
- {
- H5_FAILED();
- fprintf(stderr, " ERROR: Data transform failed to match what was set\n");
- goto error;
- }
- else
- PASSED();
- free(ptrgetTest);
+ FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n")
- if(H5Pset_data_transform(dxpl_id_c_to_f, simple) < 0) TEST_ERROR;
+ PASSED()
+
+ HDfree(ptrgetTest);
+ ptrgetTest = NULL;
TESTING("data transform, read after reseting of transform property")
- if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread) < 0) TEST_ERROR;
- for(row = 0; row<ROWS; row++)
- {
- for(col = 0; col<COLS; col++)
- {
- if((windchillFfloatread[row][col] - 4.8) > FLOAT_TOL)
- {
- H5_FAILED();
- fprintf(stderr, " ERROR: Conversion failed to match computed data\n");
- goto error;
- }
- }
- }
- PASSED();
+ if(H5Pset_data_transform(dxpl_id_c_to_f, simple) < 0)
+ TEST_ERROR
+
+ if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+ dxpl_id_c_to_f, windchillFfloatread) < 0)
+ TEST_ERROR
+
+ for(row = 0; row < ROWS; row++)
+ for(col = 0; col < COLS; col++) {
+ if((windchillFfloatread[row][col] - 4.8) > FLOAT_TOL)
+ FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n")
+ }
- ptrgetTest = (char *) malloc(strlen(simple)+1);
+ PASSED()
- HDmemset(ptrgetTest, 0, strlen(simple)+1);
TESTING("H5Pget_data_transform, after resetting transform property")
- H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, strlen(simple)+1);
- if(strcmp(simple, ptrgetTest) != 0)
- {
- H5_FAILED();
- fprintf(stderr, " ERROR: Data transform failed to match what was set\n");
- goto error;
- }
- else
- PASSED();
-
- free(ptrgetTest);
+
+ if(NULL == (ptrgetTest = (char *)HDcalloc(1, HDstrlen(simple) + 1)))
+ TEST_ERROR
+ if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0)
+ TEST_ERROR
+ if(HDstrcmp(simple, ptrgetTest) != 0)
+ FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n")
+
+ PASSED()
+
+ HDfree(ptrgetTest);
+ ptrgetTest = NULL;
return 0;
error:
- return -1;
+ if(ptrgetTest)
+ HDfree(ptrgetTest);
+
+ return -1;
}
static int
test_set(void)
{
- hid_t dxpl_id;
+ hid_t dxpl_id = -1;
H5E_auto2_t func;
- const char* str = "(9/5.0)*x + 32";
- char* ptrgetTest = (char *) malloc(strlen(str)+1);
+ const char *str = "(9/5.0)*x + 32";
+ char *ptrgetTest = NULL;
+
+ TESTING("H5Pget_data_transform (get before set)")
+
+ if(NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(str) + 1)))
+ TEST_ERROR
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ TEST_ERROR
/* Test get before set */
- H5Eget_auto2(H5E_DEFAULT,&func,NULL);
+ H5Eget_auto2(H5E_DEFAULT, &func, NULL);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
- TESTING("H5Pget_data_transform (get before set)")
- if(H5Pget_data_transform(dxpl_id, ptrgetTest, strlen(str)+1) < 0)
- {
- PASSED();
- }
- else
- {
- H5_FAILED();
- fprintf(stderr, " ERROR: Data transform get before set succeeded (it shouldn't have)\n");
- free(ptrgetTest);
- goto error;
- }
- free(ptrgetTest);
+
+ if(H5Pget_data_transform(dxpl_id, ptrgetTest, HDstrlen(str) + 1) < 0)
+ PASSED()
+ else
+ FAIL_PUTS_ERROR(" ERROR: Data transform get before set succeeded (it shouldn't have)\n");
+
+ HDfree(ptrgetTest);
+ ptrgetTest = NULL;
TESTING("H5Pset_data_transform (set with NULL transform)");
INVALID_SET_TEST(NULL);
@@ -639,9 +695,18 @@ test_set(void)
H5Eset_auto2(H5E_DEFAULT, func, NULL);
+ if(H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
+
return 0;
error:
- return -1;
+ if(ptrgetTest)
+ HDfree(ptrgetTest);
+ H5E_BEGIN_TRY {
+ H5Pclose(dxpl_id);
+ } H5E_END_TRY
+ return -1;
}
+
diff --git a/test/dtypes.c b/test/dtypes.c
index f32afe5..3af2b8a 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -34,9 +34,6 @@
/* For test_compound_8 and test_compound_10 */
#define ARRAY_DIM 4
-/* Epsilon for floating-point comparisons */
-#define FP_EPSILON 0.000001
-
/*
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
@@ -92,13 +89,6 @@ typedef struct complex_t {
double im;
} complex_t;
-/*
- * Count up or down depending on whether the machine is big endian or little
- * endian. If local variable `endian' is H5T_ORDER_BE then the result will
- * be I, otherwise the result will be Z-(I+1).
- */
-#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1))
-
typedef enum dtype_t {
INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, FLT_FLOAT, FLT_DOUBLE,
@@ -327,7 +317,7 @@ test_copy(void)
* Modifications:
* Raymond Lu
* 8 December 2009
- * I added a field of VL string in the compound type to test
+ * I added a field of VL string in the compound type to test
* H5Tdetect_class correctly detect it as string type.
*-------------------------------------------------------------------------
*/
@@ -523,12 +513,12 @@ test_compound_1(void)
TESTING("compound datatypes");
/* Create the empty type */
- if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0)
+ if ((complex_id = H5Tcreate(H5T_COMPOUND, sizeof(complex_t))) < 0)
goto error;
/* Attempt to add the new compound datatype as a field within itself */
H5E_BEGIN_TRY {
- ret=H5Tinsert(complex_id, "compound", 0, complex_id);
+ ret=H5Tinsert(complex_id, "compound", (size_t)0, complex_id);
} H5E_END_TRY;
if (ret>=0) {
FAIL_PUTS_ERROR("Inserted compound datatype into itself?");
@@ -626,7 +616,7 @@ test_compound_1(void)
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
- if (H5Tclose (complex_id) < 0)
+ if (H5Tclose (complex_id) < 0)
goto error;
PASSED();
@@ -1045,8 +1035,8 @@ test_compound_5(void)
{"two", 202, {204, 205, 206, 207}}};
dst_type_t *dst;
- void *buf = calloc(2, sizeof(dst_type_t));
- void *bkg = calloc(2, sizeof(dst_type_t));
+ void *buf = HDcalloc((size_t)2, sizeof(dst_type_t));
+ void *bkg = HDcalloc((size_t)2, sizeof(dst_type_t));
int retval = 1;
#if 1
@@ -1061,16 +1051,16 @@ test_compound_5(void)
/* Build datatypes */
short_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(short));
array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
- H5Tinsert(short_array, "_", 0, array_dt);
+ H5Tinsert(short_array, "_", (size_t)0, array_dt);
H5Tclose(array_dt);
int_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(int));
array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, dims);
- H5Tinsert(int_array, "_", 0, array_dt);
+ H5Tinsert(int_array, "_", (size_t)0, array_dt);
H5Tclose(array_dt);
string = H5Tcopy(H5T_C_S1);
- H5Tset_size(string, 16);
+ H5Tset_size(string, (size_t)16);
src_type = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t));
H5Tinsert(src_type, "name", HOFFSET(src_type_t, name), string );
@@ -1084,7 +1074,7 @@ test_compound_5(void)
/* Convert data */
HDmemcpy(buf, src, sizeof(src));
- H5Tconvert(src_type, dst_type, 2, buf, bkg, H5P_DEFAULT);
+ H5Tconvert(src_type, dst_type, (size_t)2, buf, bkg, H5P_DEFAULT);
dst = (dst_type_t*)buf;
/* Cleanup */
@@ -2072,14 +2062,14 @@ test_compound_11(void)
if((bkg=HDmalloc(sizeof(big_t)*NTESTELEM))==NULL) TEST_ERROR
/* Initialize buffer */
- for(u=0; u<NTESTELEM; u++) {
- ((big_t *)buf)[u].d1=(double)u*(double)1.5;
- ((big_t *)buf)[u].d2=(double)u*(double)2.5;
- ((big_t *)buf)[u].d3=(double)u*(double)3.5;
- ((big_t *)buf)[u].i1=u*3;
- ((big_t *)buf)[u].i2=u*5;
- ((big_t *)buf)[u].s1=HDmalloc(32);
- sprintf(((big_t *)buf)[u].s1,"%u",(unsigned)u);
+ for(u = 0; u < NTESTELEM; u++) {
+ ((big_t *)buf)[u].d1 = (double)u * (double)1.5;
+ ((big_t *)buf)[u].d2 = (double)u * (double)2.5;
+ ((big_t *)buf)[u].d3 = (double)u * (double)3.5;
+ ((big_t *)buf)[u].i1 = u * 3;
+ ((big_t *)buf)[u].i2 = u * 5;
+ ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32);
+ sprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u);
} /* end for */
/* Make copy of buffer before conversion */
@@ -2092,7 +2082,7 @@ test_compound_11(void)
if((little_tid2=H5Tcopy(little_tid)) < 0) TEST_ERROR
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid2,little_tid2,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tconvert(big_tid2,little_tid2,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
@@ -2120,9 +2110,9 @@ test_compound_11(void)
} /* end for */
/* Build source and destination types for conversion routine */
- if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
if(H5Tset_tag(opaq_src_tid, "opaque source type") < 0) TEST_ERROR
- if((opaq_dst_tid=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if((opaq_dst_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
if(H5Tset_tag(opaq_dst_tid, "opaque destination type") < 0) TEST_ERROR
/* Register new type conversion routine */
@@ -2132,7 +2122,7 @@ test_compound_11(void)
HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM);
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tconvert(big_tid,little_tid,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
@@ -2166,7 +2156,7 @@ test_compound_11(void)
HDmemcpy(buf,buf_orig,sizeof(big_t)*NTESTELEM);
/* Convert buffer from 'big' to 'little' struct */
- if(H5Tconvert(big_tid,little_tid,NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tconvert(big_tid,little_tid,(size_t)NTESTELEM,buf,bkg,H5P_DEFAULT) < 0) TEST_ERROR
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
@@ -2247,7 +2237,7 @@ test_compound_12(void)
TESTING("adjust size of compound datatypes");
/* Create a compound type of minimal size */
- if ((complex_id = H5Tcreate(H5T_COMPOUND, 1)) < 0) goto error;
+ if ((complex_id = H5Tcreate(H5T_COMPOUND, (size_t)1)) < 0) goto error;
/* Verify the size */
if((new_size=H5Tget_size(complex_id))==0) goto error;
@@ -2429,7 +2419,7 @@ test_compound_14(void)
char c2;
char* str;
} cmpd_struct_1;
-
+
typedef struct cmpd_struct_2 {
char c1;
char c2;
@@ -2441,7 +2431,7 @@ test_compound_14(void)
} cmpd_struct_2;
cmpd_struct_1 wdata1 = {'A', 'B', "variable-length string"};
-
+
cmpd_struct_1 rdata1;
cmpd_struct_2 wdata2 = {'C', 'D', "another vlen!", 1, 2, -1, 9001};
cmpd_struct_2 rdata2;
@@ -2501,19 +2491,19 @@ test_compound_14(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid,"c1",0,H5T_STD_I64BE) < 0) {
+ if(H5Tinsert(cmpd_f1_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid,"c2",8,H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_f1_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f1_tid, "vl_string",8 + 1, str_id) < 0) {
+ if(H5Tinsert(cmpd_f1_tid, "vl_string",(size_t)(8 + 1), str_id) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'vl_string'\n");
goto error;
@@ -2575,19 +2565,19 @@ test_compound_14(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"c1",0,H5T_STD_I64BE) < 0) {
+ if(H5Tinsert(cmpd_f2_tid,"c1",(size_t)0,H5T_STD_I64BE) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c1'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid,"c2",8,H5T_NATIVE_CHAR) < 0) {
+ if(H5Tinsert(cmpd_f2_tid,"c2",(size_t)8,H5T_NATIVE_CHAR) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'c2'\n");
goto error;
} /* end if */
- if(H5Tinsert(cmpd_f2_tid, "vl_string", 8 + 1, str_id) < 0) {
+ if(H5Tinsert(cmpd_f2_tid, "vl_string", (size_t)(8 + 1), str_id) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'vl_string'\n");
goto error;
@@ -2836,7 +2826,7 @@ test_compound_15(void)
goto error;
} /* end if */
- if(H5Tinsert(cmpd_m_tid,"i1",0,H5T_NATIVE_INT) < 0) {
+ if(H5Tinsert(cmpd_m_tid,"i1",(size_t)0,H5T_NATIVE_INT) < 0) {
H5_FAILED(); AT();
printf("Can't insert field 'i1'\n");
goto error;
@@ -2971,7 +2961,7 @@ test_compound_16(void)
/* Create file compound datatype */
if((cmpd_f_tid = H5Tcreate(H5T_COMPOUND, 2 * sizeof(int) + 2)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_f_tid, "i1", 0, int_id) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_f_tid, "i1", (size_t)0, int_id) < 0) TEST_ERROR
if(H5Tinsert(cmpd_f_tid, "i2", sizeof(int) + 1, int_id) < 0) TEST_ERROR
/* Create memory compound datatype */
@@ -2992,7 +2982,7 @@ test_compound_16(void)
}
/* Check behavior of H5Fget_obj_ids */
- if(H5Fget_obj_ids(file, H5F_OBJ_DATATYPE, 2, open_dtypes) < 0) TEST_ERROR
+ 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]);
@@ -3046,8 +3036,8 @@ test_compound_17(void)
/* Create inner compound datatype. This type will be "packed" according
* to the internal field, but will have trailing space at the end. */
- if((cmpd_int = H5Tcreate(H5T_COMPOUND, 4)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_int, "c", 0, H5T_NATIVE_CHAR) < 0) TEST_ERROR
+ if((cmpd_int = H5Tcreate(H5T_COMPOUND, (size_t)4)) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_int, "c", (size_t)0, H5T_NATIVE_CHAR) < 0) TEST_ERROR
/* Create inner array datatype */
if((arr_int = H5Tarray_create2(cmpd_int, 1, dims)) < 0) TEST_ERROR
@@ -3055,8 +3045,8 @@ test_compound_17(void)
/* Create outer compound datatype. This type will be truly packed, with no
* trailing space. However, the internal compound contained within is not
* packed. */
- if((cmpd_ext = H5Tcreate(H5T_COMPOUND, 8)) < 0) TEST_ERROR
- if(H5Tinsert(cmpd_ext, "arr", 0, arr_int) < 0) TEST_ERROR
+ if((cmpd_ext = H5Tcreate(H5T_COMPOUND, (size_t)8)) < 0) TEST_ERROR
+ if(H5Tinsert(cmpd_ext, "arr", (size_t)0, arr_int) < 0) TEST_ERROR
/* Create outer array datatype */
if((arr_ext = H5Tarray_create2(cmpd_ext, 1, dims)) < 0) TEST_ERROR
@@ -3066,7 +3056,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(2 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 2\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3076,7 +3066,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(4 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 4\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3110,7 +3100,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(2 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 2\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 2\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3120,7 +3110,7 @@ test_compound_17(void)
if(H5Tpack(tmp_dt) < 0) TEST_ERROR
if(4 != H5Tget_size(tmp_dt)) {
H5_FAILED(); AT();
- printf(" Size after packing: %d; expected: 4\n", H5Tget_size(tmp_dt));
+ printf(" Size after packing: %u; expected: 4\n", (unsigned)H5Tget_size(tmp_dt));
goto error;
}
if(H5Tclose(tmp_dt) < 0) TEST_ERROR
@@ -3342,7 +3332,7 @@ test_query(void)
/* Query member name by member value, for enumeration type */
enum_val = 14;
- if(H5Tenum_nameof(tid2, &enum_val, enum_name, 16) < 0) {
+ if(H5Tenum_nameof(tid2, &enum_val, enum_name, (size_t)16) < 0) {
H5_FAILED();
printf("Can't get name for enum member\n");
goto error;
@@ -3418,7 +3408,7 @@ test_transient (hid_t fapl)
/* Predefined types cannot be modified or closed */
H5E_BEGIN_TRY {
- status = H5Tset_precision (H5T_NATIVE_INT, 256);
+ status = H5Tset_precision(H5T_NATIVE_INT, (size_t)256);
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@@ -3435,8 +3425,8 @@ test_transient (hid_t fapl)
}
/* Copying a predefined type results in a modifiable copy */
- if ((type=H5Tcopy (H5T_NATIVE_INT)) < 0) goto error;
- if (H5Tset_precision (type, 256) < 0) goto error;
+ if((type=H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
+ if(H5Tset_precision(type, (size_t)256) < 0) goto error;
/* It should not be possible to create an attribute for a transient type */
H5E_BEGIN_TRY {
@@ -3457,7 +3447,7 @@ test_transient (hid_t fapl)
/* The type returned from a dataset should not be modifiable */
if((t2 = H5Dget_type(dset)) < 0) goto error;
H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, 256);
+ status = H5Tset_precision(t2, (size_t)256);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
@@ -3474,7 +3464,7 @@ test_transient (hid_t fapl)
if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error;
if((t2 = H5Dget_type(dset)) < 0) goto error;
H5E_BEGIN_TRY {
- status = H5Tset_precision(t2, 256);
+ status = H5Tset_precision(t2, (size_t)256);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
@@ -3488,7 +3478,7 @@ test_transient (hid_t fapl)
* result should be modifiable.
*/
if((t2=H5Tcopy(dset)) < 0) goto error;
- if(H5Tset_precision(t2, 256) < 0) goto error;
+ if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
if(H5Tclose(t2) < 0) goto error;
@@ -3568,7 +3558,7 @@ test_named (hid_t fapl)
/* We should not be able to modify a type after it has been committed. */
H5E_BEGIN_TRY {
- status = H5Tset_precision (type, 256);
+ status = H5Tset_precision (type, (size_t)256);
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@@ -3606,7 +3596,7 @@ test_named (hid_t fapl)
HDputs (" Copying a named type should result in a transient type!");
goto error;
}
- if(H5Tset_precision(t2, 256) < 0) goto error;
+ if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
if(H5Tclose(t2) < 0) goto error;
/*
@@ -3674,7 +3664,7 @@ test_named (hid_t fapl)
* result should be modifiable.
*/
if((t2 = H5Tcopy(dset)) < 0) goto error;
- if(H5Tset_precision(t2, 256) < 0) goto error;
+ if(H5Tset_precision(t2, (size_t)256) < 0) goto error;
if(H5Tclose(t2) < 0) goto error;
if(H5Dclose(dset) < 0) goto error;
@@ -3756,14 +3746,11 @@ error:
* Purpose: Create a new string datatype
*
* Return: Success: New type
- *
* Failure: -1
*
* Programmer: Robb Matzke
* Monday, August 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -3771,9 +3758,13 @@ mkstr(size_t len, H5T_str_t strpad)
{
hid_t t;
- if ((t=H5Tcopy(H5T_C_S1)) < 0) return -1;
- if (H5Tset_size(t, len) < 0) return -1;
- if (H5Tset_strpad(t, strpad) < 0) return -1;
+ if((t = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if(H5Tset_size(t, len) < 0)
+ return -1;
+ if(H5Tset_strpad(t, strpad) < 0)
+ return -1;
+
return t;
}
@@ -3784,21 +3775,19 @@ mkstr(size_t len, H5T_str_t strpad)
* Purpose: Test string conversions
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Monday, August 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_conv_str_1(void)
{
- char *buf=NULL;
- hid_t src_type, dst_type;
+ char *buf = NULL;
+ hid_t src_type = -1;
+ hid_t dst_type = -1;
TESTING("string conversions");
@@ -3806,69 +3795,72 @@ test_conv_str_1(void)
* Convert a null-terminated string to a shorter and longer null
* terminated string.
*/
- src_type = mkstr(10, H5T_STR_NULLTERM);
- dst_type = mkstr(5, H5T_STR_NULLTERM);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20)) {
H5_FAILED();
HDputs(" Truncated C-string test failed");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Extended C-string test failed");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Convert a null padded string to a shorter and then longer string.
*/
- src_type = mkstr(10, H5T_STR_NULLPAD);
- dst_type = mkstr(5, H5T_STR_NULLPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Truncated C buffer test failed");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Extended C buffer test failed");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Convert a space-padded string to a shorter and then longer string.
*/
- src_type = mkstr(10, H5T_STR_SPACEPAD);
- dst_type = mkstr(5, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Truncated Fortran-string test failed");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde abcde ", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde abcde ", (size_t)20)) {
H5_FAILED();
HDputs(" Extended Fortran-string test failed");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
@@ -3878,151 +3870,161 @@ test_conv_str_1(void)
* the destination is a different size or type of string then the right
* thing should happen.
*/
- src_type = mkstr(10, H5T_STR_NULLTERM);
- dst_type = mkstr(10, H5T_STR_NULLTERM);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Non-terminated string test 1");
goto error;
}
H5Tclose(dst_type);
- dst_type = mkstr(5, H5T_STR_NULLTERM);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", 20)) {
+ if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Non-terminated string test 2");
goto error;
}
- HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", 20);
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", (size_t)20);
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Non-terminated string test 2");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Test C string to Fortran and vice versa.
*/
- src_type = mkstr(10, H5T_STR_NULLTERM);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghi\0abcdefghi\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghi abcdefghi ", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20)) {
H5_FAILED();
HDputs(" C string to Fortran test 1");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C string test 1");
goto error;
}
if (H5Tclose(dst_type) < 0) goto error;
- dst_type = mkstr(5, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) {
+ if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" C string to Fortran test 2");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C string test 2");
goto error;
}
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
- src_type = mkstr(5, H5T_STR_NULLTERM);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd abcd ", 20)) {
+ if((src_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" C string to Fortran test 3");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C string test 3");
goto error;
}
HDfree(buf);
+ buf = NULL;
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
/*
* Test C buffer to Fortran and vice versa.
*/
- src_type = mkstr(10, H5T_STR_NULLPAD);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(2, 10);
- HDmemcpy(buf, "abcdefghijabcdefghij", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) {
+ if((src_type = mkstr((size_t)10, H5T_STR_NULLPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc((size_t)2, (size_t)10))) goto error;
+ HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" C buffer to Fortran test 1");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdefghijabcdefghij", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C buffer test 1");
goto error;
}
if (H5Tclose(dst_type) < 0) goto error;
- dst_type = mkstr(5, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) {
+ if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" C buffer to Fortran test 2");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C buffer test 2");
goto error;
}
if (H5Tclose(src_type) < 0) goto error;
if (H5Tclose(dst_type) < 0) goto error;
- src_type = mkstr(5, H5T_STR_NULLPAD);
- dst_type = mkstr(10, H5T_STR_SPACEPAD);
- HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20);
- if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd abcd ", 20)) {
+ if((src_type = mkstr((size_t)5, H5T_STR_NULLPAD)) < 0) goto error;
+ if((dst_type = mkstr((size_t)10, H5T_STR_SPACEPAD)) < 0) goto error;
+ HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20);
+ if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" C buffer to Fortran test 3");
goto error;
}
- if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT) < 0) goto error;
- if (HDmemcmp(buf, "abcd\0abcd\0abcd ", 20)) {
+ if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) {
H5_FAILED();
HDputs(" Fortran to C buffer test 3");
goto error;
}
+ if(H5Tclose(src_type) < 0) goto error;
+ if(H5Tclose(dst_type) < 0) goto error;
HDfree(buf);
- if (H5Tclose(src_type) < 0) goto error;
- if (H5Tclose(dst_type) < 0) goto error;
PASSED();
reset_hdf5();
return 0;
- error:
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(src_type);
+ H5Tclose(dst_type);
+ } H5E_END_TRY;
+
+ if(buf)
+ HDfree(buf);
+
reset_hdf5();
return 1;
}
@@ -4034,21 +4036,19 @@ test_conv_str_1(void)
* Purpose: Tests C-to-Fortran and Fortran-to-C string conversion speed.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Monday, August 10, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_conv_str_2(void)
{
- char *buf=NULL, s[80];
- hid_t c_type, f_type;
+ char *buf = NULL, s[80];
+ hid_t c_type = -1;
+ hid_t f_type = -1;
const size_t nelmts = NTESTELEM, ntests=NTESTS;
size_t i, j, nchars;
int ret_value = 1;
@@ -4056,37 +4056,43 @@ test_conv_str_2(void)
/*
* Initialize types and buffer.
*/
- c_type = mkstr(8, H5T_STR_NULLPAD);
- f_type = mkstr(8, H5T_STR_SPACEPAD);
- buf = (char*)HDcalloc(nelmts, 8);
- for (i=0; i<nelmts; i++) {
+ if((c_type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0) goto error;
+ if((f_type = mkstr((size_t)8, H5T_STR_SPACEPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8))) goto error;
+ for(i = 0; i < nelmts; i++) {
nchars = HDrand() % 8;
- for (j=0; j<nchars; j++)
- buf[i*8+j] = 'a' + HDrand()%26;
- while (j<nchars)
- buf[i*8+j++] = '\0';
- }
+ for(j = 0; j < nchars; j++)
+ buf[i * 8 + j] = 'a' + HDrand() % 26;
+ while(j < nchars)
+ buf[i * 8 + j++] = '\0';
+ } /* end for */
/* Do the conversions */
- for (i=0; i<ntests; i++) {
- if (ntests>1) {
- sprintf(s, "Testing random string conversion speed (test %d/%d)",
- (int)(i+1), (int)ntests);
- } else {
+ for(i = 0; i < ntests; i++) {
+ if(ntests > 1)
+ sprintf(s, "Testing random string conversion speed (test %d/%d)", (int)(i + 1), (int)ntests);
+ else
sprintf(s, "Testing random string conversion speed");
- }
- printf("%-70s", s);
- HDfflush(stdout);
- if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
+ if(H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
- PASSED();
- }
+ PASSED();
+ } /* end for */
+
ret_value = 0;
- error:
- if (buf) HDfree(buf);
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(c_type);
+ H5Tclose(f_type);
+ } H5E_END_TRY;
+
+ if(buf)
+ HDfree(buf);
+
reset_hdf5();
return ret_value;
}
@@ -4099,21 +4105,19 @@ test_conv_str_2(void)
* for string type.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Raymond Lu
* Tuesday, April 4, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_conv_str_3(void)
{
char *buf=NULL;
- hid_t type, super;
+ hid_t type = -1;
+ hid_t super = -1;
const size_t nelmts = NTESTELEM;
size_t i, j, nchars;
int ret_value = 1;
@@ -4128,63 +4132,64 @@ test_conv_str_3(void)
/*
* Initialize types and buffer.
*/
- type = mkstr(8, H5T_STR_NULLPAD);
- buf = (char*)HDcalloc(nelmts, 8);
- for (i=0; i<nelmts; i++) {
+ if((type = mkstr((size_t)8, H5T_STR_NULLPAD)) < 0) goto error;
+ if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8)))
+ FAIL_PUTS_ERROR("Allocation failed.");
+ for(i = 0; i < nelmts; i++) {
nchars = HDrand() % 8;
- for (j=0; j<nchars; j++)
- buf[i*8+j] = 'a' + HDrand()%26;
- while (j<nchars)
- buf[i*8+j++] = '\0';
- }
+ for(j = 0; j < nchars; j++)
+ buf[i * 8 + j] = 'a' + HDrand() % 26;
+ while(j < nchars)
+ buf[i * 8 + j++] = '\0';
+ } /* end for */
if(H5Tget_precision(type) == 0) FAIL_STACK_ERROR
if(H5Tget_size(type) == 0) FAIL_STACK_ERROR
if(H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE) < 0) FAIL_STACK_ERROR
if(H5Tget_cset(type) < 0) FAIL_STACK_ERROR
if(H5Tget_strpad(type) < 0) FAIL_STACK_ERROR
- if(H5Tset_offset(type, 0) < 0) FAIL_STACK_ERROR
+ if(H5Tset_offset(type, (size_t)0) < 0) FAIL_STACK_ERROR
if(H5Tget_order(type) < 0) FAIL_STACK_ERROR
H5E_BEGIN_TRY {
- ret=H5Tset_precision(type, nelmts);
+ ret = H5Tset_precision(type, nelmts);
} H5E_END_TRY;
- if (ret>=0) {
+ if(ret >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
size = H5Tget_ebias(type);
} H5E_END_TRY;
- if (size>0) {
+ if(size > 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
- inpad=H5Tget_inpad(type);
+ inpad = H5Tget_inpad(type);
} H5E_END_TRY;
- if (inpad>-1) {
+ if(inpad > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
- sign=H5Tget_sign(type);
+ sign = H5Tget_sign(type);
} H5E_END_TRY;
- if (sign>-1) {
+ if(sign > -1) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
tag = H5Tget_tag(type);
} H5E_END_TRY;
- if (tag) {
+ if(tag) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
H5E_BEGIN_TRY {
super = H5Tget_super(type);
} H5E_END_TRY;
- if (super>=0) {
+ if(super >= 0) {
FAIL_PUTS_ERROR("Operation not allowed for this type.");
} /* end if */
@@ -4192,10 +4197,16 @@ test_conv_str_3(void)
ret_value = 0;
error:
+ H5E_BEGIN_TRY {
+ H5Tclose(type);
+ H5Tclose(super);
+ } H5E_END_TRY;
+
if(buf)
HDfree(buf);
- if(tag)
+ if(tag)
HDfree(tag);
+
reset_hdf5();
return ret_value; /* Number of errors */
}
@@ -4223,57 +4234,62 @@ test_conv_enum_1(void)
const size_t nelmts=NTESTELEM;
const int ntests=NTESTS;
int i, val, *buf=NULL;
- hid_t t1, t2;
+ hid_t t1 = -1;
+ hid_t t2 = -1;
char s[80];
int ret_value = 1;
+ size_t u;
/* Build the datatypes */
- t1 = H5Tcreate(H5T_ENUM, sizeof(int));
- t2 = H5Tenum_create(H5T_NATIVE_INT);
+ if((t1 = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) goto error;
+ if((t2 = H5Tenum_create(H5T_NATIVE_INT)) < 0) goto error;
s[1] = '\0';
- for (i=0; i<26; i++) {
- s[0] = 'A'+i;
+ for(i = 0; i < 26; i++) {
+ s[0] = 'A' + i;
H5Tenum_insert(t1, s, &i);
- H5Tenum_insert(t2, s, (val=i*1000+i, &val));
- }
+ H5Tenum_insert(t2, s, (val = i * 1000 + i, &val));
+ } /* end for */
/* Initialize the buffer */
- buf = (int*)HDmalloc(nelmts*MAX(H5Tget_size(t1), H5Tget_size(t2)));
- for (i=0; i<(int)nelmts; i++)
- buf[i] = HDrand() % 26;
+ if(NULL == (buf = (int*)HDmalloc(nelmts * MAX(H5Tget_size(t1), H5Tget_size(t2)))))
+ goto error;
+ for(u = 0; u < nelmts; u++)
+ buf[u] = HDrand() % 26;
/* Conversions */
- for (i=0; i<ntests; i++) {
- if (ntests>1) {
- sprintf(s, "Testing random enum conversion O(N) (test %d/%d)",
- i+1, ntests);
- } else {
+ for(i = 0; i < ntests; i++) {
+ if(ntests > 1)
+ sprintf(s, "Testing random enum conversion O(N) (test %d/%d)", i + 1, ntests);
+ else
sprintf(s, "Testing random enum conversion O(N)");
- }
- printf("%-70s", s);
- HDfflush(stdout);
- if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
- }
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
+ } /* end for */
- for (i=0; i<ntests; i++) {
- if (ntests>1) {
- sprintf(s, "Testing random enum conversion O(N log N) "
- "(test %d/%d)", i+1, ntests);
- } else {
+ for(i = 0; i < ntests; i++) {
+ if(ntests > 1)
+ sprintf(s, "Testing random enum conversion O(N log N) (test %d/%d)", i + 1, ntests);
+ else
sprintf(s, "Testing random enum conversion O(N log N)");
- }
- printf("%-70s", s);
- HDfflush(stdout);
- if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
- PASSED();
+ printf("%-70s", s);
+ HDfflush(stdout);
+ if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ PASSED();
}
+
ret_value = 0;
- error:
- H5Tclose(t1);
- H5Tclose(t2);
- if (buf) HDfree(buf);
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(t1);
+ H5Tclose(t2);
+ } H5E_END_TRY;
+
+ if(buf)
+ HDfree(buf);
+
reset_hdf5();
return ret_value;
}
@@ -4311,7 +4327,7 @@ test_conv_enum_2(void)
/* Source enum type */
oddsize = H5Tcopy(H5T_STD_I32BE);
- H5Tset_size(oddsize, 3); /*reduce to 24 bits, not corresponding to any native size*/
+ H5Tset_size(oddsize, (size_t)3); /*reduce to 24 bits, not corresponding to any native size*/
srctype = H5Tenum_create(oddsize);
for (i=7; i>=0; --i) {
char pattern[3];
@@ -4322,7 +4338,7 @@ test_conv_enum_2(void)
/* Destination enum type */
dsttype = H5Tenum_create(H5T_NATIVE_INT);
- assert(H5Tget_size(dsttype)>H5Tget_size(srctype));
+ assert(H5Tget_size(dsttype) > H5Tget_size(srctype));
for (i=0; i<8; i++)
H5Tenum_insert(dsttype, mname[i], &i);
@@ -4335,7 +4351,7 @@ test_conv_enum_2(void)
}
/* Convert to destination type */
- H5Tconvert(srctype, dsttype, NTESTELEM, data, NULL, H5P_DEFAULT);
+ H5Tconvert(srctype, dsttype, (size_t)NTESTELEM, data, NULL, H5P_DEFAULT);
/* Check results */
for (i=0; i<NTESTELEM; i++) {
@@ -4399,7 +4415,7 @@ test_conv_bitfield(void)
dt = H5Tcopy(H5T_STD_B32LE);
buf[0] = buf[1] = 0xAA;
buf[2] = buf[3] = 0x55; /*irrelevant*/
- if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) {
H5_FAILED();
printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n",
@@ -4413,12 +4429,12 @@ test_conv_bitfield(void)
* __10 1010 1010 10__
* ____ ____ __10 1010 1010 10__ ____ ____
*/
- H5Tset_precision(st, 12);
- H5Tset_offset(st, 2);
- H5Tset_precision(dt, 12);
- H5Tset_offset(dt, 10);
+ H5Tset_precision(st, (size_t)12);
+ H5Tset_offset(st, (size_t)2);
+ H5Tset_precision(dt, (size_t)12);
+ H5Tset_offset(dt, (size_t)10);
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
- if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) {
H5_FAILED();
printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n",
@@ -4432,7 +4448,7 @@ test_conv_bitfield(void)
*/
H5Tset_pad(dt, H5T_PAD_ONE, H5T_PAD_ONE);
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
- if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) {
H5_FAILED();
printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n",
@@ -4494,8 +4510,8 @@ test_bitfield_funcs(void)
* field. Pad unused bits with ones.
* ____ ____ __10 1010 1010 10__ ____ ____
*/
- if(H5Tset_precision(type, 12) < 0) goto error;
- if(H5Tset_offset(type, 10) < 0) goto error;
+ if(H5Tset_precision(type, (size_t)12) < 0) goto error;
+ if(H5Tset_offset(type, (size_t)10) < 0) goto error;
if(H5Tset_pad(type, H5T_PAD_ONE, H5T_PAD_ONE)) goto error;
if((size=H5Tget_size(type))==0) goto error;
if(H5Tset_order(type, H5T_ORDER_BE) < 0) goto error;
@@ -4659,11 +4675,6 @@ test_opaque(void)
* Programmer: Robb Matzke
* Thursday, May 20, 1999
*
- * Modifications:
- * Raymond Lu
- * June 2, 2004
- * Made tag for one opaque type optional.
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4678,10 +4689,10 @@ opaque_check(int tag_it)
saved = num_opaque_conversions_g = 0;
/* Build source and destination types */
- if ((st=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error;
+ if ((st=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) goto error;
if (H5Tset_tag(st, "opaque source type") < 0) goto error;
- if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) goto error;
+ if ((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) goto error;
if (tag_it) {
if (H5Tset_tag(dt, "opaque destination type") < 0)
goto error;
@@ -4689,7 +4700,7 @@ opaque_check(int tag_it)
/* Make sure that we can't convert between the types yet */
H5E_BEGIN_TRY {
- status = H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
+ status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@@ -4702,7 +4713,7 @@ opaque_check(int tag_it)
goto error;
/* Try the conversion again, this time it should work */
- if (H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error;
+ if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (saved+1 != num_opaque_conversions_g) {
H5_FAILED();
printf(" unexpected number of opaque conversions\n");
@@ -4731,14 +4742,11 @@ opaque_check(int tag_it)
* Purpose: Test named (committed) opaque datatypes w/very long tags
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Quincey Koziol
* Tuesday, June 14, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4749,18 +4757,18 @@ opaque_long(void)
herr_t ret;
/* Build opaque type */
- if ((dt=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
/* Create long tag */
- long_tag = HDmalloc(16384+1);
- HDmemset(long_tag, 'a', 16384);
+ if(NULL == (long_tag = (char *)HDmalloc((size_t)(16384 + 1)))) TEST_ERROR
+ HDmemset(long_tag, 'a', (size_t)16384);
long_tag[16384] = '\0';
/* Set opaque type's tag */
H5E_BEGIN_TRY {
ret = H5Tset_tag(dt, long_tag);
} H5E_END_TRY;
- if(ret!=FAIL) TEST_ERROR
+ if(ret != FAIL) TEST_ERROR
/* Close datatype */
if(H5Tclose(dt) < 0) TEST_ERROR
@@ -4770,9 +4778,11 @@ opaque_long(void)
return 0;
- error:
- if (dt>0) H5Tclose(dt);
- if (long_tag != NULL) HDfree(long_tag);
+error:
+ if(dt>0)
+ H5Tclose(dt);
+ if(long_tag)
+ HDfree(long_tag);
H5_FAILED();
return 1;
}
@@ -4807,13 +4817,13 @@ opaque_funcs(void)
herr_t ret;
/* Build opaque type */
- if ((type=H5Tcreate(H5T_OPAQUE, 4)) < 0) TEST_ERROR
+ if ((type=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
if (H5Tset_tag(type, "opaque source type") < 0) TEST_ERROR
if ((size=H5Tget_size(type))==0) goto error;
H5E_BEGIN_TRY {
- ret=H5Tset_precision(type, 32);
+ ret=H5Tset_precision(type, (size_t)32);
} H5E_END_TRY;
if (ret>=0) {
printf("Operation not allowed for this type.\n");
@@ -4861,7 +4871,7 @@ opaque_funcs(void)
} /* end if */
H5E_BEGIN_TRY {
- ret=H5Tset_offset(type, 16);
+ ret=H5Tset_offset(type, (size_t)16);
} H5E_END_TRY;
if (ret>=0) {
printf("Operation not allowed for this type.\n");
@@ -5016,7 +5026,7 @@ test_encode(void)
printf("Can't copy a string type\n");
goto error;
} /* end if */
- if(H5Tset_size(tid3, H5T_VARIABLE) < 0) {
+ if(H5Tset_size(tid3, H5T_VARIABLE) < 0) {
H5_FAILED();
printf("Can't the string type to be variable-length\n");
goto error;
@@ -5034,7 +5044,7 @@ test_encode(void)
} /* end if */
if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+ cmpd_buf = (unsigned char*)HDcalloc((size_t)1, cmpd_buf_size);
/* Try decoding bogus buffer */
H5E_BEGIN_TRY {
@@ -5084,7 +5094,7 @@ test_encode(void)
} /* end if */
if(enum_buf_size>0)
- enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+ enum_buf = (unsigned char*)HDcalloc((size_t)1, enum_buf_size);
if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
H5_FAILED();
@@ -5127,7 +5137,7 @@ test_encode(void)
} /* end if */
if(vlstr_buf_size>0)
- vlstr_buf = (unsigned char*)calloc(1, vlstr_buf_size);
+ vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
H5_FAILED();
@@ -5235,7 +5245,7 @@ test_encode(void)
} /* end if */
if(cmpd_buf_size>0)
- cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
+ cmpd_buf = (unsigned char*)HDcalloc((size_t)1, cmpd_buf_size);
if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
H5_FAILED();
@@ -5274,7 +5284,7 @@ test_encode(void)
} /* end if */
if(enum_buf_size>0)
- enum_buf = (unsigned char*)calloc(1, enum_buf_size);
+ enum_buf = (unsigned char*)HDcalloc((size_t)1, enum_buf_size);
if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
H5_FAILED();
@@ -5316,7 +5326,7 @@ test_encode(void)
} /* end if */
if(vlstr_buf_size>0)
- vlstr_buf = (unsigned char*)calloc(1, vlstr_buf_size);
+ vlstr_buf = (unsigned char*)HDcalloc((size_t)1, vlstr_buf_size);
if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) {
H5_FAILED();
@@ -5829,7 +5839,7 @@ test_set_order(void)
/* Fixed length string */
if ((dtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
- if (H5Tset_size(dtype, 5) < 0) TEST_ERROR
+ if (H5Tset_size(dtype, (size_t)5) < 0) TEST_ERROR
if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR;
if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR;
@@ -5856,7 +5866,7 @@ test_set_order(void)
if (H5Tclose(dtype) < 0) TEST_ERROR
/* Opaque - functions should fail */
- if ((dtype = H5Tcreate(H5T_OPAQUE, 96)) < 0) TEST_ERROR
+ if ((dtype = H5Tcreate(H5T_OPAQUE, (size_t)96)) < 0) TEST_ERROR
H5E_BEGIN_TRY
ret = H5Tset_order(dtype, H5T_ORDER_LE);
order = H5Tget_order(dtype);
@@ -5866,7 +5876,7 @@ test_set_order(void)
if (H5Tclose(dtype) < 0) TEST_ERROR
/* Compound - functions should fail */
- if ((dtype = H5Tcreate(H5T_COMPOUND, 48)) < 0) TEST_ERROR
+ if ((dtype = H5Tcreate(H5T_COMPOUND, (size_t)48)) < 0) TEST_ERROR
H5E_BEGIN_TRY
ret = H5Tset_order(dtype, H5T_ORDER_LE);
order = H5Tget_order(dtype);
@@ -5976,7 +5986,7 @@ test_named_indirect_reopen(hid_t fapl)
if((strtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR
if(H5Tset_size(strtype, H5T_VARIABLE) < 0) TEST_ERROR
if((type = H5Tcreate(H5T_COMPOUND, sizeof(char *))) < 0) TEST_ERROR
- if(H5Tinsert(type, "vlstr", 0, strtype) < 0) TEST_ERROR
+ if(H5Tinsert(type, "vlstr", (size_t)0, strtype) < 0) TEST_ERROR
if(H5Tclose(strtype) < 0) TEST_ERROR
/* Get size of compound type */
@@ -6059,7 +6069,7 @@ test_named_indirect_reopen(hid_t fapl)
*/
/* Create opaque type */
- if((type = H5Tcreate(H5T_OPAQUE, 13)) < 0) TEST_ERROR
+ if((type = H5Tcreate(H5T_OPAQUE, (size_t)13)) < 0) TEST_ERROR
if(H5Tset_tag(type, tag) < 0) TEST_ERROR
/* Get size of opaque type */
@@ -6228,7 +6238,7 @@ test_deprec(hid_t fapl)
/* We should not be able to modify a type after it has been committed. */
H5E_BEGIN_TRY {
- status = H5Tset_precision(type, 256);
+ status = H5Tset_precision(type, (size_t)256);
} H5E_END_TRY;
if(status >= 0)
FAIL_PUTS_ERROR(" Committed type is not constant!")
diff --git a/test/err_compat.c b/test/err_compat.c
index 33c172f..be86a2d 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -186,10 +186,10 @@ dump_error(void)
herr_t
custom_print_cb(int n, H5E_error1_t *err_desc, void* client_data)
{
- FILE *stream = (FILE *)client_data;
- char *maj;
- char *min;
- const int indent = 4;
+ FILE *stream = (FILE *)client_data;
+ char *maj = NULL;
+ char *min = NULL;
+ const int indent = 4;
if(NULL == (min = H5Eget_minor(err_desc->min_num)))
TEST_ERROR;
@@ -200,14 +200,21 @@ custom_print_cb(int n, H5E_error1_t *err_desc, void* client_data)
fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
indent, "", n, err_desc->file_name,
err_desc->func_name, err_desc->line);
- fprintf(stream, "%*smajor: %s\n", indent*2, "", maj);
+
+ fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
+ fprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
+
HDfree(maj);
- fprintf (stream, "%*sminor: %s\n", indent*2, "", min);
HDfree(min);
return 0;
error:
+ if(maj)
+ HDfree(maj);
+ if(min)
+ HDfree(min);
+
return -1;
}
diff --git a/test/error_test.c b/test/error_test.c
index 89a81a3..e784eb9 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -186,11 +186,16 @@ test_error(hid_t file)
static herr_t
init_error(void)
{
- ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME)+1;
- char *cls_name = (char*)HDmalloc(HDstrlen(ERR_CLS_NAME)+1);
+ ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME) + 1;
ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1;
- char *msg = (char*)HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG)+1);
- H5E_type_t *msg_type= (H5E_type_t *)HDmalloc(sizeof(H5E_type_t));
+ char *cls_name = NULL;
+ char *msg = NULL;
+ H5E_type_t msg_type;
+
+ if(NULL == (cls_name = (char *)HDmalloc(HDstrlen(ERR_CLS_NAME) + 1)))
+ TEST_ERROR
+ if(NULL == (msg = (char *)HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1)))
+ TEST_ERROR
if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS)) < 0)
TEST_ERROR;
@@ -218,24 +223,28 @@ init_error(void)
if((ERR_MIN_GETNUM = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_GETNUM_MSG)) < 0)
TEST_ERROR;
- if(msg_size != H5Eget_msg(ERR_MIN_SUBROUTINE, msg_type, msg, (size_t)msg_size) + 1)
+ if(msg_size != H5Eget_msg(ERR_MIN_SUBROUTINE, &msg_type, msg, (size_t)msg_size) + 1)
TEST_ERROR;
- if(*msg_type != H5E_MINOR)
+ if(msg_type != H5E_MINOR)
TEST_ERROR;
if(HDstrcmp(msg, ERR_MIN_SUBROUTINE_MSG))
TEST_ERROR;
- HDfree(cls_name);
- HDfree(msg);
- HDfree(msg_type);
-
/* Register another class for later testing. */
if((ERR_CLS2 = H5Eregister_class(ERR_CLS2_NAME, PROG2_NAME, PROG_VERS)) < 0)
TEST_ERROR;
+ HDfree(cls_name);
+ HDfree(msg);
+
return 0;
error:
+ if(cls_name)
+ HDfree(cls_name);
+ if(msg)
+ HDfree(msg);
+
return -1;
} /* end init_error() */
@@ -586,7 +595,7 @@ main(void)
/* Delete an error from the top of error stack */
H5Epop(ERR_STACK, 1);
- /* Make sure we can use other class's major or minor errors. */
+ /* Make sure we can use other class's major or minor errors. */
H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS2, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
"Error stack test failed");
diff --git a/test/external.c b/test/external.c
index b3831ad..7fd344e 100644
--- a/test/external.c
+++ b/test/external.c
@@ -20,6 +20,7 @@
* Purpose: Tests datasets stored in external raw files.
*/
#include "h5test.h"
+#include "H5srcdir.h"
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
@@ -60,14 +61,14 @@ same_contents (const char *name1, const char *name2)
fd2 = HDopen(name2, O_RDONLY, 0666);
assert(fd1 >= 0 && fd2 >= 0);
- while(1) {
+ while(1) {
/* Asserts will catch negative return values */
n1 = HDread(fd1, buf1, sizeof(buf1));
n2 = HDread(fd2, buf2, sizeof(buf2));
assert(n1 >= 0 && (size_t)n1 <= sizeof(buf1));
assert(n2 >= 0 && (size_t)n2 <= sizeof(buf2));
assert(n1 == n2);
-
+
if(n1 == 0 && n2 == 0)
break;
if(HDmemcmp(buf1, buf2, (size_t)n1)) {
@@ -845,8 +846,7 @@ test_4 (hid_t fapl)
hid_t xid = -1;
hid_t xid2 = -1;
char filename[1024]; /*file name */
- char pathname[1024];
- char *srcdir = getenv("srcdir"); /*where the src code is located*/
+ const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */
TESTING("opening external link twice");
@@ -865,14 +865,6 @@ test_4 (hid_t fapl)
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
goto error;
- pathname[0] = '\0';
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) {
- HDstrcpy(pathname, srcdir);
- HDstrcat(pathname, "/");
- }
- HDstrcat(pathname, LINKED_FILE);
-
/* Create an external link to an existing file*/
if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto error;
diff --git a/test/farray.c b/test/farray.c
index b949263..60a2200 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -13,7 +13,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
+/*
* This file is modified based on earray.c.
*/
#include "h5test.h"
@@ -37,7 +37,7 @@
#define FARRAY_FILENAME_LEN 1024
/* Fixed array creation values */
-#define ELMT_SIZE sizeof(uint64_t)
+#define ELMT_SIZE sizeof(uint64_t)
#define MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* 2^10 = 1024 elements per data block page */
/* Testing # of elements in the Fixed Array */
@@ -130,8 +130,8 @@ init_cparam(H5FA_create_t *cparam, farray_test_param_t *tparam)
cparam->cls = H5FA_CLS_TEST;
cparam->raw_elmt_size = ELMT_SIZE;
- cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS;
- cparam->nelmts = tparam->nelmts;
+ cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS;
+ cparam->nelmts = tparam->nelmts;
return(0);
} /* init_cparam() */
@@ -187,19 +187,19 @@ check_stats(const H5FA_t *fa, const farray_state_t *state)
/* Compare information */
if(farray_stats.hdr_size != state->hdr_size) {
- HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n",
+ HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n",
farray_stats.hdr_size, state->hdr_size);
TEST_ERROR
} /* end if */
if(farray_stats.dblk_size != state->dblk_size) {
- HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n",
+ HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n",
farray_stats.dblk_size, state->dblk_size);
TEST_ERROR
} /* end if */
if(farray_stats.nelmts != state->nelmts) {
- HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n",
+ HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n",
farray_stats.nelmts, state->nelmts);
TEST_ERROR
} /* end if */
@@ -242,9 +242,9 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state)
size_t dblk_page_init_size = (npages + 7) / 8;
hsize_t checksum_size = npages * 4;
- state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size +
+ state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size +
state->nelmts * cparam->raw_elmt_size;
- } else
+ } else
state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size;
return(0);
@@ -392,7 +392,7 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr)
h5_stat_size_t file_size; /* File size, after deleting array */
/* Close the fixed array */
- if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0)
+ if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Delete array */
@@ -1229,7 +1229,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam,
uint64_t welmt; /* Element to write */
uint64_t relmt; /* Element to read */
hsize_t cnt; /* Count of array indices */
- hssize_t sidx; /* Index value of next element in the fixed array */
+ hssize_t sidx; /* Index value of next element in the fixed array */
hsize_t idx; /* Index value of next element in the fixed array */
hsize_t fa_nelmts; /* # of elements in fixed array */
haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
@@ -1625,7 +1625,7 @@ main(void)
nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE, "skipping to last element");
/* Create Fixed Array of MAX_NELMTS elements */
- /*
+ /*
* MAX_NELMTS succeeds on jam and smirom.
* The value was adjusted for linew due to the following:
Linew failed with "H5FD_sec2_truncate(): unable to extend file properly"
diff --git a/test/fillval.c b/test/fillval.c
index 2f58380..81856de 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -20,6 +20,7 @@
* Purpose: Tests dataset fill values.
*/
#include "h5test.h"
+#include "H5srcdir.h"
/*
* Define NO_FILLING if you want to compare how this test works when there is
@@ -1974,19 +1975,10 @@ test_compatible(void)
hsize_t dims[2], one[2]={1,1};
hsize_t hs_offset[2]={3,4};
H5D_fill_value_t status;
- char *srcdir = getenv("srcdir"); /*where the src code is located*/
- char testfile[512]=""; /* test file name */
+ const char *testfile = H5_get_srcdir_filename(FILE_COMPATIBLE); /* Corrected test file name */
TESTING("contiguous dataset compatibility with v. 1.4");
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((strlen(srcdir) + strlen(FILE_COMPATIBLE) + 1) <
- sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, FILE_COMPATIBLE);
-
if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
printf(" Could not open file %s. Try set $srcdir to point at the "
"source directory of test\n", testfile);
diff --git a/test/gen_filespace.c b/test/gen_filespace.c
index e9dee1c..293e3df 100644
--- a/test/gen_filespace.c
+++ b/test/gen_filespace.c
@@ -24,22 +24,22 @@ const char *FILENAMES[] = {
"filespace_aggr_vfd.h5", /* H5F_FILE_SPACE_AGGR_VFD */
"filespace_vfd.h5", /* H5F_FILE_SPACE_VFD */
"filespace_threshold.h5" /* H5F_FILE_SPACE_ALL, non-default threshold */
-};
+};
#define DATASET "dset"
#define NUM_ELMTS 100
/*
- * Compile and run this program in file-space branch to generate
+ * Compile and run this program in file-space branch to generate
* HDF5 files with different kinds of file space strategies
- * Move the HDF5 files to the 1.6 and 1.8 branch for compatibility
+ * Move the HDF5 files to the 1.6 and 1.8 branch for compatibility
* testing:test_filespace_compatible() will use the files
*/
static void gen_file(void)
{
hid_t fid;
hid_t fcpl;
- hid_t dataset, space;
+ hid_t dataset, space;
hsize_t dim[1];
int data[NUM_ELMTS];
unsigned i, j; /* Local index variable */
diff --git a/test/h5test.c b/test/h5test.c
index a5b50d3..10ca47e 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -25,6 +25,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "h5test.h"
+#include "H5srcdir.h"
#ifdef _WIN32
#include <process.h>
@@ -72,7 +73,7 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
#endif
#define FILENAME_BUF_SIZE 1024
-#define READ_BUF_SIZE 4096
+#define READ_BUF_SIZE 4096
/*
* These are the letters that are appended to the file name when generating
@@ -872,10 +873,10 @@ h5_get_file_size(const char *filename, hid_t fapl)
driver == H5FD_MPIO || driver == H5FD_MPIPOSIX ||
#endif /* H5_HAVE_PARALLEL */
#ifdef H5_HAVE_WINDOWS
- driver == H5FD_WINDOWS ||
+ driver == H5FD_WINDOWS ||
#endif /* H5_HAVE_WINDOWS */
#ifdef H5_HAVE_DIRECT
- driver == H5FD_DIRECT ||
+ driver == H5FD_DIRECT ||
#endif /* H5_HAVE_DIRECT */
driver == H5FD_LOG) {
/* Get the file's statistics */
@@ -1096,9 +1097,9 @@ getenv_all(MPI_Comm comm, int root, const char* name)
*
* Purpose: Make copy of file. Some tests write to data files under that
* are under version control. Those tests should make a copy of
- * the versioned file and write to the copy. This function
+ * the versioned file and write to the copy. This function
* prepends srcdir to the name of the file to be copied and uses
- * the name of the copy as is.
+ * the name of the copy as is.
*
* Return: Success: 0
*
@@ -1114,22 +1115,14 @@ getenv_all(MPI_Comm comm, int root, const char* name)
hid_t
h5_make_local_copy(char *origfilename, char *local_copy_name)
{
- char filename[FILENAME_BUF_SIZE] = "";
+ const char *filename = H5_get_srcdir_filename(origfilename); /* Corrected test file name */
int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
ssize_t nread; /* Number of bytes read in */
char buf[READ_BUF_SIZE]; /* Buffer for copying data */
- char * srcdir = HDgetenv("srcdir"); /* The source directory */
-
- if(srcdir && ((HDstrlen(srcdir) +
- HDstrlen(origfilename) + 6) < FILENAME_BUF_SIZE)) {
- HDstrcpy(filename, srcdir);
- HDstrcat(filename, "/");
- }
- HDstrcat(filename, origfilename);
/* Copy old file into temporary file */
if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1;
- if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666))
+ if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666))
< 0) return -1;
/* Copy data */
@@ -1139,7 +1132,7 @@ h5_make_local_copy(char *origfilename, char *local_copy_name)
/* Close files */
if(HDclose(fd_old) < 0) return -1;
if(HDclose(fd_new) < 0) return -1;
-
- return 0;
+
+ return 0;
}
diff --git a/test/h5test.h b/test/h5test.h
index 315b504..f984751 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -61,11 +61,16 @@
* Verbose queries
* Only None needs an exact match. The rest are at least as much.
*/
-#define VERBOSE_NONE (GetTestVerbosity()==VERBO_NONE)
-#define VERBOSE_DEF (GetTestVerbosity()>=VERBO_DEF)
-#define VERBOSE_LO (GetTestVerbosity()>=VERBO_LO)
-#define VERBOSE_MED (GetTestVerbosity()>=VERBO_MED)
-#define VERBOSE_HI (GetTestVerbosity()>=VERBO_HI)
+
+/* A macro version of HDGetTestVerbosity(). */
+/* Should be used internally by the libtest.a only. */
+#define HDGetTestVerbosity() (TestVerbosity)
+
+#define VERBOSE_NONE (HDGetTestVerbosity()==VERBO_NONE)
+#define VERBOSE_DEF (HDGetTestVerbosity()>=VERBO_DEF)
+#define VERBOSE_LO (HDGetTestVerbosity()>=VERBO_LO)
+#define VERBOSE_MED (HDGetTestVerbosity()>=VERBO_MED)
+#define VERBOSE_HI (HDGetTestVerbosity()>=VERBO_HI)
/*
* Test controls definitions.
@@ -152,7 +157,7 @@ H5TEST_DLL void h5_reset(void);
H5TEST_DLL void h5_show_hostname(void);
H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl);
H5TEST_DLL int print_func(const char *format, ...);
-H5TEST_DLL int h5_make_local_copy(char *origfilename, char *local_copy_name);
+H5TEST_DLL int h5_make_local_copy(char *origfilename, char *local_copy_name);
/* Routines for operating on the list of tests (for the "all in one" tests) */
H5TEST_DLL void TestUsage(void);
@@ -189,6 +194,9 @@ H5TEST_DLL void h5_dump_info_object(MPI_Info info);
H5TEST_DLL char* getenv_all(MPI_Comm comm, int root, const char* name);
#endif
+/* Extern global variables */
+H5TEST_DLLVAR int TestVerbosity;
+
#ifdef __cplusplus
}
#endif
diff --git a/test/hyperslab.c b/test/hyperslab.c
index b756449..e216b95 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -48,29 +48,27 @@
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static unsigned
init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
- size_t i, j, k;
uint8_t acc = 128;
unsigned total = 0;
+ size_t i, j, k;
- for (i=0; i<nx; i++) {
- for (j=0; j<ny; j++) {
- for (k=0; k<nz; k++) {
+ for(i = 0; i < nx; i++)
+ for(j = 0; j < ny; j++)
+ for(k = 0; k < nz; k++) {
total += acc;
*array = acc;
acc++;
array++;
- }
- }
- }
+ } /* end for */
+
return total;
-}
+} /* end init_full() */
+
/*-------------------------------------------------------------------------
* Function: print_array
@@ -82,8 +80,6 @@ init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -91,25 +87,24 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
{
size_t i, j, k;
- for (i=0; i<nx; i++) {
- if (nz>1) {
+ for(i = 0; i < nx; i++) {
+ if(nz > 1)
printf("i=%lu:\n", (unsigned long)i);
- } else {
+ else
printf("%03lu:", (unsigned long)i);
- }
- for (j=0; j<ny; j++) {
- if (nz>1)
+ for(j = 0; j < ny; j++) {
+ if(nz > 1)
printf("%03lu:", (unsigned long)j);
- for (k=0; k<nz; k++) {
+ for(k = 0; k < nz; k++)
printf(" %3d", *array++);
- }
- if (nz>1)
+ if(nz > 1)
printf("\n");
- }
+ } /* end for */
printf("\n");
- }
-}
+ } /* end for */
+} /* end print_array() */
+
/*-------------------------------------------------------------------------
* Function: print_ref
@@ -123,21 +118,21 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
print_ref(size_t nx, size_t ny, size_t nz)
{
- uint8_t *array;
+ uint8_t *array;
- array = HDcalloc(nx*ny*nz,sizeof(uint8_t));
+ if(NULL != (array = HDmalloc(nx * ny * nz))) {
+ printf("Reference array:\n");
+ init_full(array, nx, ny, nz);
+ print_array(array, nx, ny, nz);
+ HDfree(array);
+ } /* end if */
+} /* end print_ref() */
- printf("Reference array:\n");
- init_full(array, nx, ny, nz);
- print_array(array, nx, ny, nz);
-}
/*-------------------------------------------------------------------------
* Function: test_fill
@@ -151,8 +146,6 @@ print_ref(size_t nx, size_t ny, size_t nz)
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -160,142 +153,134 @@ test_fill(size_t nx, size_t ny, size_t nz,
size_t di, size_t dj, size_t dk,
size_t ddx, size_t ddy, size_t ddz)
{
- uint8_t *dst = NULL; /*destination array */
- hsize_t hs_size[3]; /*hyperslab size */
- hsize_t dst_size[3]; /*destination total size */
- hsize_t dst_offset[3]; /*offset of hyperslab in dest */
- unsigned ref_value; /*reference value */
- unsigned acc; /*accumulator */
- size_t i, j, k, dx, dy, dz; /*counters */
- size_t u, v, w;
- unsigned ndims; /*hyperslab dimensionality */
- char dim[64], s[256]; /*temp string */
- unsigned fill_value; /*fill value */
+ uint8_t *dst = NULL; /*destination array */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hsize_t dst_offset[3]; /*offset of hyperslab in dest */
+ unsigned ref_value; /*reference value */
+ unsigned acc; /*accumulator */
+ size_t i, j, k, dx, dy, dz; /*counters */
+ size_t u, v, w;
+ unsigned ndims; /*hyperslab dimensionality */
+ char dim[64], s[256]; /*temp string */
+ unsigned fill_value; /*fill value */
/*
* Dimensionality.
*/
- if (0 == nz) {
- if (0 == ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dim, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
- } else {
- ndims = 3;
- sprintf(dim, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
- }
+ if(0 == nz) {
+ if(0 == ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dim, "%lu", (unsigned long) nx);
+ } /* end if */
+ else {
+ ndims = 2;
+ nz = 1;
+ sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ } /* end else */
+ } /* end if */
+ else {
+ ndims = 3;
+ sprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny,
+ (unsigned long) nz);
+ } /* end else */
sprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim);
printf("%-70s", s);
fflush(stdout);
/* Allocate array */
- dst = HDcalloc((size_t)1, nx * ny * nz);
+ if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ TEST_ERROR
+
init_full(dst, nx, ny, nz);
- for (i = 0; i < nx; i += di) {
- for (j = 0; j < ny; j += dj) {
- for (k = 0; k < nz; k += dk) {
- for (dx = 1; dx <= nx - i; dx += ddx) {
- for (dy = 1; dy <= ny - j; dy += ddy) {
- for (dz = 1; dz <= nz - k; dz += ddz) {
-
- /* Describe the hyperslab */
- dst_size[0] = nx;
- dst_size[1] = ny;
- dst_size[2] = nz;
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
- hs_size[0] = dx;
- hs_size[1] = dy;
- hs_size[2] = dz;
-
- for (fill_value=0;
- fill_value<256;
- fill_value+=64) {
- /*
- * Initialize the full array, then subtract the
- * original * fill values and add the new ones.
- */
- ref_value = init_full(dst, nx, ny, nz);
- for (u=(size_t)dst_offset[0];
- u<dst_offset[0]+dx;
- u++) {
- for (v = (size_t)dst_offset[1];
- v < dst_offset[1] + dy;
- v++) {
- for (w = (size_t)dst_offset[2];
- w < dst_offset[2] + dz;
- w++) {
- ref_value -= dst[u*ny*nz+v*nz+w];
- }
- }
- }
- ref_value += fill_value * dx * dy * dz;
-
- /* Fill the hyperslab with some value */
- H5V_hyper_fill(ndims, hs_size, dst_size,
- dst_offset, dst, fill_value);
-
- /*
- * Sum the array and compare it to the
- * reference value.
- */
- acc = 0;
- for (u = 0; u < nx; u++) {
- for (v = 0; v < ny; v++) {
- for (w = 0; w < nz; w++) {
- acc += dst[u*ny*nz + v*nz + w];
- }
- }
- }
-
- if (acc != ref_value) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- /*
- * Print debugging info unless output
- * is going directly to a terminal.
- */
- AT();
- printf(" acc != ref_value\n");
- printf(" i=%lu, j=%lu, k=%lu, "
- "dx=%lu, dy=%lu, dz=%lu, "
- "fill=%d\n",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)k,
- (unsigned long)dx,
- (unsigned long)dy,
- (unsigned long)dz,
- fill_value);
- print_ref(nx, ny, nz);
- printf("\n Result is:\n");
- print_array(dst, nx, ny, nz);
- }
- goto error;
- }
- }
- }
- }
- }
- }
- }
- }
- puts(" PASSED");
+ for(i = 0; i < nx; i += di) {
+ for(j = 0; j < ny; j += dj) {
+ for(k = 0; k < nz; k += dk) {
+ for(dx = 1; dx <= nx - i; dx += ddx) {
+ for(dy = 1; dy <= ny - j; dy += ddy) {
+ for(dz = 1; dz <= nz - k; dz += ddz) {
+
+ /* Describe the hyperslab */
+ dst_size[0] = nx;
+ dst_size[1] = ny;
+ dst_size[2] = nz;
+ dst_offset[0] = i;
+ dst_offset[1] = j;
+ dst_offset[2] = k;
+ hs_size[0] = dx;
+ hs_size[1] = dy;
+ hs_size[2] = dz;
+
+ for(fill_value = 0; fill_value < 256; fill_value += 64) {
+ /*
+ * Initialize the full array, then subtract the
+ * original * fill values and add the new ones.
+ */
+ ref_value = init_full(dst, nx, ny, nz);
+ for(u = (size_t)dst_offset[0]; u < dst_offset[0] + dx; u++)
+ for(v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++)
+ for(w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++)
+ ref_value -= dst[u * ny * nz + v * nz + w];
+ ref_value += fill_value * dx * dy * dz;
+
+ /* Fill the hyperslab with some value */
+ H5V_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value);
+
+ /*
+ * Sum the array and compare it to the
+ * reference value.
+ */
+ acc = 0;
+ for(u = 0; u < nx; u++)
+ for(v = 0; v < ny; v++)
+ for(w = 0; w < nz; w++)
+ acc += dst[u * ny * nz + v * nz + w];
+
+ if(acc != ref_value) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ /*
+ * Print debugging info unless output
+ * is going directly to a terminal.
+ */
+ AT();
+ printf(" acc != ref_value\n");
+ printf(" i=%lu, j=%lu, k=%lu, "
+ "dx=%lu, dy=%lu, dz=%lu, "
+ "fill=%d\n", (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)k,
+ (unsigned long)dx,
+ (unsigned long)dy,
+ (unsigned long)dz, fill_value);
+ print_ref(nx, ny, nz);
+ printf("\n Result is:\n");
+ print_array(dst, nx, ny, nz);
+ } /* end if */
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+
+ PASSED()
+
HDfree(dst);
+
return SUCCEED;
- error:
- HDfree(dst);
+error:
+ if(dst)
+ HDfree(dst);
return FAIL;
-}
+} /* end test_fill() */
+
/*-------------------------------------------------------------------------
* Function: test_copy
@@ -321,8 +306,6 @@ test_fill(size_t nx, size_t ny, size_t nz,
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -331,66 +314,71 @@ test_copy(int mode,
size_t di, size_t dj, size_t dk,
size_t ddx, size_t ddy, size_t ddz)
{
- uint8_t *src = NULL; /*source array */
- uint8_t *dst = NULL; /*destination array */
- hsize_t hs_size[3]; /*hyperslab size */
- hsize_t dst_size[3]; /*destination total size */
- hsize_t src_size[3]; /*source total size */
- hsize_t dst_offset[3]; /*offset of hyperslab in dest */
- hsize_t src_offset[3]; /*offset of hyperslab in source */
- unsigned ref_value; /*reference value */
- unsigned acc; /*accumulator */
- hsize_t i, j, k, dx, dy, dz; /*counters */
- hsize_t u, v, w;
- unsigned ndims; /*hyperslab dimensionality */
- char dim[64], s[256]; /*temp string */
- const char *sub;
+ uint8_t *src = NULL; /*source array */
+ uint8_t *dst = NULL; /*destination array */
+ hsize_t hs_size[3]; /*hyperslab size */
+ hsize_t dst_size[3]; /*destination total size */
+ hsize_t src_size[3]; /*source total size */
+ hsize_t dst_offset[3]; /*offset of hyperslab in dest */
+ hsize_t src_offset[3]; /*offset of hyperslab in source */
+ unsigned ref_value; /*reference value */
+ unsigned acc; /*accumulator */
+ hsize_t i, j, k, dx, dy, dz; /*counters */
+ hsize_t u, v, w;
+ unsigned ndims; /*hyperslab dimensionality */
+ char dim[64], s[256]; /*temp string */
+ const char *sub;
/*
* Dimensionality.
*/
- if (0 == nz) {
- if (0 == ny) {
- ndims = 1;
- ny = nz = 1;
- sprintf(dim, "%lu", (unsigned long) nx);
- } else {
- ndims = 2;
- nz = 1;
- sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
- }
- } else {
- ndims = 3;
- sprintf(dim, "%lux%lux%lu",
- (unsigned long) nx, (unsigned long) ny, (unsigned long) nz);
- }
-
- switch (mode) {
- case VARIABLE_SRC:
- /*
- * The hyperslab "travels" through the source array but the
- * destination hyperslab is always at the origin of the destination
- * array.
- */
- sub = "variable source";
- break;
- case VARIABLE_DST:
- /*
- * We always read a hyperslab from the origin of the source and copy it
- * to a hyperslab at various locations in the destination.
- */
- sub = "variable destination";
- break;
- case VARIABLE_BOTH:
- /*
- * We read the hyperslab from various locations in the source and copy
- * it to the same location in the destination.
- */
- sub = "sync source & dest ";
- break;
- default:
- abort();
- }
+ if(0 == nz) {
+ if(0 == ny) {
+ ndims = 1;
+ ny = nz = 1;
+ sprintf(dim, "%lu", (unsigned long) nx);
+ } /* end if */
+ else {
+ ndims = 2;
+ nz = 1;
+ sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny);
+ } /* end else */
+ } /* end if */
+ else {
+ ndims = 3;
+ sprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny,
+ (unsigned long) nz);
+ } /* end else */
+
+ switch(mode) {
+ case VARIABLE_SRC:
+ /*
+ * The hyperslab "travels" through the source array but the
+ * destination hyperslab is always at the origin of the destination
+ * array.
+ */
+ sub = "variable source";
+ break;
+
+ case VARIABLE_DST:
+ /*
+ * We always read a hyperslab from the origin of the source and copy it
+ * to a hyperslab at various locations in the destination.
+ */
+ sub = "variable destination";
+ break;
+
+ case VARIABLE_BOTH:
+ /*
+ * We read the hyperslab from various locations in the source and copy
+ * it to the same location in the destination.
+ */
+ sub = "sync source & dest ";
+ break;
+
+ default:
+ HDabort();
+ } /* end switch */
sprintf(s, "Testing hyperslab copy %-11s %s", dim, sub);
printf("%-70s", s);
@@ -399,192 +387,184 @@ test_copy(int mode,
/*
* Allocate arrays
*/
- src = HDcalloc((size_t)1, nx * ny * nz);
- dst = HDcalloc((size_t)1, nx * ny * nz);
+ if(NULL == (src = HDcalloc((size_t)1, nx * ny * nz)))
+ TEST_ERROR
+ if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz)))
+ TEST_ERROR
+
init_full(src, nx, ny, nz);
- for (i=0; i<nx; i+=di) {
- for (j=0; j<ny; j+=dj) {
- for (k=0; k<nz; k+=dk) {
- for (dx=1; dx<=nx-i; dx+=ddx) {
- for (dy=1; dy<=ny-j; dy+=ddy) {
- for (dz=1; dz<=nz-k; dz+=ddz) {
-
- /*
- * Describe the source and destination hyperslabs
- * and the arrays to which they belong.
- */
- hs_size[0] = dx;
- hs_size[1] = dy;
- hs_size[2] = dz;
- dst_size[0] = src_size[0] = nx;
- dst_size[1] = src_size[1] = ny;
- dst_size[2] = src_size[2] = nz;
- switch (mode) {
- case VARIABLE_SRC:
- dst_offset[0] = 0;
- dst_offset[1] = 0;
- dst_offset[2] = 0;
- src_offset[0] = i;
- src_offset[1] = j;
- src_offset[2] = k;
- break;
- case VARIABLE_DST:
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
- src_offset[0] = 0;
- src_offset[1] = 0;
- src_offset[2] = 0;
- break;
- case VARIABLE_BOTH:
- dst_offset[0] = i;
- dst_offset[1] = j;
- dst_offset[2] = k;
- src_offset[0] = i;
- src_offset[1] = j;
- src_offset[2] = k;
- break;
- default:
- abort();
- }
-
- /*
- * Sum the main array directly to get a reference
- * value to compare against later.
- */
- ref_value = 0;
- for (u=src_offset[0]; u<src_offset[0]+dx; u++) {
- for (v=src_offset[1];
- v<src_offset[1]+dy;
- v++) {
- for (w=src_offset[2];
- w<src_offset[2]+dz;
- w++) {
- ref_value += src[u*ny*nz + v*nz + w];
- }
- }
- }
-
- /*
- * Set all loc values to 1 so we can detect writing
- * outside the hyperslab.
- */
- for (u=0; u<nx; u++) {
- for (v=0; v<ny; v++) {
- for (w=0; w<nz; w++) {
- dst[u*ny*nz + v*nz + w] = 1;
- }
- }
- }
-
- /*
- * Copy a hyperslab from the global array to the
- * local array.
- */
- H5V_hyper_copy(ndims, hs_size,
- dst_size, dst_offset, dst,
- src_size, src_offset, src);
-
- /*
- * Sum the destination hyperslab. It should be
- * the same as the reference value.
- */
- acc = 0;
- for (u=dst_offset[0]; u<dst_offset[0]+dx; u++) {
- for (v=dst_offset[1];
- v<dst_offset[1]+dy;
- v++) {
- for (w=dst_offset[2];
- w<dst_offset[2]+dz;
- w++) {
- acc += dst[u*ny*nz + v*nz + w];
- }
- }
- }
- if (acc != ref_value) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- /*
- * Print debugging info unless output is
- * going directly to a terminal.
- */
- AT();
- printf(" acc != ref_value\n");
- printf(" i=%lu, j=%lu, k=%lu, "
- "dx=%lu, dy=%lu, dz=%lu\n",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)k,
- (unsigned long)dx,
- (unsigned long)dy,
- (unsigned long)dz);
- print_ref(nx, ny, nz);
- printf("\n Destination array is:\n");
- print_array(dst, nx, ny, nz);
- }
- goto error;
- }
- /*
- * Sum the entire array. It should be a fixed
- * amount larger than the reference value since
- * we added the border of 1's to the hyperslab.
- */
- acc = 0;
- for (u=0; u<nx; u++) {
- for (v=0; v<ny; v++) {
- for (w=0; w<nz; w++) {
- acc += dst[u*ny*nz + v*nz + w];
- }
- }
- }
-
- /*
- * The following casts are to work around an
- * optimization bug in the Mongoose 7.20 Irix64
- * compiler.
- */
- if (acc+(unsigned)dx*(unsigned)dy*(unsigned)dz !=
- ref_value + nx*ny*nz) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- /*
- * Print debugging info unless output is
- * going directly to a terminal.
- */
- AT();
- printf(" acc != ref_value + nx*ny*nz - "
- "dx*dy*dz\n");
- printf(" i=%lu, j=%lu, k=%lu, "
- "dx=%lu, dy=%lu, dz=%lu\n",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)k,
- (unsigned long)dx,
- (unsigned long)dy,
- (unsigned long)dz);
- print_ref(nx, ny, nz);
- printf("\n Destination array is:\n");
- print_array(dst, nx, ny, nz);
- }
- goto error;
- }
- }
- }
- }
- }
- }
- }
- puts(" PASSED");
+ for(i = 0; i < nx; i += di) {
+ for(j = 0; j < ny; j += dj) {
+ for(k = 0; k < nz; k += dk) {
+ for(dx = 1; dx <= nx - i; dx += ddx) {
+ for(dy = 1; dy <= ny - j; dy += ddy) {
+ for(dz = 1; dz <= nz - k; dz += ddz) {
+
+ /*
+ * Describe the source and destination hyperslabs
+ * and the arrays to which they belong.
+ */
+ hs_size[0] = dx;
+ hs_size[1] = dy;
+ hs_size[2] = dz;
+ dst_size[0] = src_size[0] = nx;
+ dst_size[1] = src_size[1] = ny;
+ dst_size[2] = src_size[2] = nz;
+ switch(mode) {
+ case VARIABLE_SRC:
+ dst_offset[0] = 0;
+ dst_offset[1] = 0;
+ dst_offset[2] = 0;
+ src_offset[0] = i;
+ src_offset[1] = j;
+ src_offset[2] = k;
+ break;
+
+ case VARIABLE_DST:
+ dst_offset[0] = i;
+ dst_offset[1] = j;
+ dst_offset[2] = k;
+ src_offset[0] = 0;
+ src_offset[1] = 0;
+ src_offset[2] = 0;
+ break;
+
+ case VARIABLE_BOTH:
+ dst_offset[0] = i;
+ dst_offset[1] = j;
+ dst_offset[2] = k;
+ src_offset[0] = i;
+ src_offset[1] = j;
+ src_offset[2] = k;
+ break;
+
+ default:
+ HDabort();
+ } /* end switch */
+
+ /*
+ * Sum the main array directly to get a reference
+ * value to compare against later.
+ */
+ ref_value = 0;
+ for(u = src_offset[0]; u < src_offset[0] + dx; u++)
+ for(v = src_offset[1]; v < src_offset[1] + dy; v++)
+ for(w = src_offset[2]; w < src_offset[2] + dz; w++)
+ ref_value += src[u * ny * nz + v * nz + w];
+
+ /*
+ * Set all loc values to 1 so we can detect writing
+ * outside the hyperslab.
+ */
+ for(u = 0; u < nx; u++)
+ for(v = 0; v < ny; v++)
+ for(w = 0; w < nz; w++)
+ dst[u * ny * nz + v * nz + w] = 1;
+
+ /*
+ * Copy a hyperslab from the global array to the
+ * local array.
+ */
+ H5V_hyper_copy(ndims, hs_size, dst_size, dst_offset, dst, src_size, src_offset, src);
+
+ /*
+ * Sum the destination hyperslab. It should be
+ * the same as the reference value.
+ */
+ acc = 0;
+ for(u = dst_offset[0]; u < dst_offset[0] + dx; u++)
+ for(v = dst_offset[1]; v < dst_offset[1] + dy; v++)
+ for(w = dst_offset[2]; w < dst_offset[2] + dz; w++)
+ acc += dst[u * ny * nz + v * nz + w];
+ if(acc != ref_value) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ /*
+ * Print debugging info unless output is
+ * going directly to a terminal.
+ */
+ AT();
+ printf(" acc != ref_value\n");
+ printf(" i=%lu, j=%lu, k=%lu, "
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)k,
+ (unsigned long)dx,
+ (unsigned long)dy,
+ (unsigned long)dz);
+ print_ref(nx, ny, nz);
+ printf("\n Destination array is:\n");
+ print_array(dst, nx, ny, nz);
+ } /* end if */
+ goto error;
+ } /* end if */
+
+ /*
+ * Sum the entire array. It should be a fixed
+ * amount larger than the reference value since
+ * we added the border of 1's to the hyperslab.
+ */
+ acc = 0;
+ for(u = 0; u < nx; u++)
+ for(v = 0; v < ny; v++)
+ for(w = 0; w < nz; w++)
+ acc += dst[u * ny * nz + v * nz + w];
+
+ /*
+ * The following casts are to work around an
+ * optimization bug in the Mongoose 7.20 Irix64
+ * compiler.
+ */
+ if(acc + (unsigned) dx * (unsigned) dy
+ * (unsigned) dz != ref_value + nx * ny * nz) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ /*
+ * Print debugging info unless output is
+ * going directly to a terminal.
+ */
+ AT();
+ printf(" acc != ref_value + nx*ny*nz - "
+ "dx*dy*dz\n");
+ printf(" i=%lu, j=%lu, k=%lu, "
+ "dx=%lu, dy=%lu, dz=%lu\n",
+ (unsigned long)i,
+ (unsigned long)j,
+ (unsigned long)k,
+ (unsigned long)dx,
+ (unsigned long)dy,
+ (unsigned long)dz);
+ print_ref(nx, ny, nz);
+ printf("\n Destination array is:\n");
+ print_array(dst, nx, ny, nz);
+ } /* end if */
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+ } /* end for */
+
+ PASSED()
+
HDfree(src);
HDfree(dst);
+
return SUCCEED;
- error:
- HDfree(src);
- HDfree(dst);
+error:
+ if(src)
+ HDfree(src);
+ if(dst)
+ HDfree(dst);
+
return FAIL;
-}
+} /* end test_copy() */
+
/*-------------------------------------------------------------------------
* Function: test_multifill
@@ -602,39 +582,39 @@ test_copy(int mode,
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_multifill(size_t nx)
{
- hsize_t i, j;
hsize_t size;
hsize_t src_stride;
hsize_t dst_stride;
char s[64];
-
struct a_struct {
- int left;
- double mid;
- int right;
- } fill , *src = NULL, *dst = NULL;
+ int left;
+ double mid;
+ int right;
+ } fill, *src = NULL, *dst = NULL;
+ hsize_t i, j;
printf("%-70s", "Testing multi-byte fill value");
fflush(stdout);
/* Initialize the source and destination */
- src = HDmalloc(nx * sizeof(*src));
- dst = HDmalloc(nx * sizeof(*dst));
- for (i = 0; i < nx; i++) {
- src[i].left = 1111111;
- src[i].mid = 12345.6789;
- src[i].right = 2222222;
- dst[i].left = 3333333;
- dst[i].mid = 98765.4321;
- dst[i].right = 4444444;
- }
+ if(NULL == (src = HDmalloc(nx * sizeof(*src))))
+ TEST_ERROR
+ if(NULL == (dst = HDmalloc(nx * sizeof(*dst))))
+ TEST_ERROR
+
+ for(i = 0; i < nx; i++) {
+ src[i].left = 1111111;
+ src[i].mid = 12345.6789;
+ src[i].right = 2222222;
+ dst[i].left = 3333333;
+ dst[i].mid = 98765.4321;
+ dst[i].right = 4444444;
+ } /* end for */
/*
* Describe the fill value. The zero stride says to read the same thing
@@ -654,56 +634,58 @@ test_multifill(size_t nx)
* Copy the fill value into each element
*/
size = nx;
- H5V_stride_copy(1, (hsize_t)sizeof(double), &size,
- &dst_stride, &(dst[0].mid), &src_stride, &(fill.mid));
+ H5V_stride_copy(1, (hsize_t)sizeof(double), &size, &dst_stride,
+ &(dst[0].mid), &src_stride, &(fill.mid));
/*
* Check
*/
s[0] = '\0';
- for (i = 0; i < nx; i++) {
- if (dst[i].left != 3333333) {
- sprintf(s, "bad dst[%lu].left", (unsigned long)i);
- } else if (!DBL_ABS_EQUAL(dst[i].mid, fill.mid)) {
+ for(i = 0; i < nx; i++) {
+ if(dst[i].left != 3333333)
+ sprintf(s, "bad dst[%lu].left", (unsigned long)i);
+ else if(!DBL_ABS_EQUAL(dst[i].mid, fill.mid))
/* Check if two DOUBLE values are equal. If their difference
* is smaller than the EPSILON value for double, they are
* considered equal. See the definition in h5test.h.
*/
- sprintf(s, "bad dst[%lu].mid", (unsigned long)i);
- } else if (dst[i].right != 4444444) {
- sprintf(s, "bad dst[%lu].right", (unsigned long)i);
- }
- if (s[0]) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- AT();
- printf(" fill={%d,%g,%d}\n ",
- fill.left, fill.mid, fill.right);
- for (j = 0; j < sizeof(fill); j++) {
- printf(" %02x", ((uint8_t *) &fill)[j]);
- }
- printf("\n dst[%lu]={%d,%g,%d}\n ",
- (unsigned long)i,
- dst[i].left, dst[i].mid, dst[i].right);
- for (j = 0; j < sizeof(dst[i]); j++) {
- printf(" %02x", ((uint8_t *) (dst + i))[j]);
- }
- printf("\n");
- }
- goto error;
- }
- }
+ sprintf(s, "bad dst[%lu].mid", (unsigned long)i);
+ else if(dst[i].right != 4444444)
+ sprintf(s, "bad dst[%lu].right", (unsigned long)i);
+ if(s[0]) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ AT();
+ printf(" fill={%d,%g,%d}\n ", fill.left, fill.mid,
+ fill.right);
+ for(j = 0; j < sizeof(fill); j++)
+ printf(" %02x", ((uint8_t *)&fill)[j]);
+ printf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i,
+ dst[i].left, dst[i].mid, dst[i].right);
+ for(j = 0; j < sizeof(dst[i]); j++)
+ printf(" %02x", ((uint8_t *)(dst + i))[j]);
+ printf("\n");
+ } /* end if */
+ goto error;
+ } /* end if */
+ } /* end for */
+
+ PASSED()
- puts(" PASSED");
HDfree(src);
HDfree(dst);
+
return SUCCEED;
- error:
- HDfree(src);
- HDfree(dst);
+error:
+ if(src)
+ HDfree(src);
+ if(dst)
+ HDfree(dst);
+
return FAIL;
-}
+} /* end test_multifill() */
+
/*-------------------------------------------------------------------------
* Function: test_endian
@@ -719,27 +701,28 @@ test_multifill(size_t nx)
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_endian(size_t nx)
{
- uint8_t *src = NULL; /*source array */
- uint8_t *dst = NULL; /*destination array */
+ uint8_t *src = NULL; /*source array */
+ uint8_t *dst = NULL; /*destination array */
hssize_t src_stride[2]; /*source strides */
hssize_t dst_stride[2]; /*destination strides */
- hsize_t size[2]; /*size vector */
- hsize_t i, j;
+ hsize_t size[2]; /*size vector */
+ hsize_t i, j;
printf("%-70s", "Testing endian conversion by stride");
fflush(stdout);
/* Initialize arrays */
- src = HDmalloc(nx * 4);
- init_full(src, nx, (size_t)4, (size_t)1);
- dst = HDcalloc(nx , (size_t)4);
+ if(NULL == (src = HDmalloc(nx * 4)))
+ TEST_ERROR
+ if(NULL == (dst = HDcalloc(nx , (size_t)4)))
+ TEST_ERROR
+
+ init_full(src, nx, (size_t)4,(size_t)1);
/* Initialize strides */
src_stride[0] = 0;
@@ -753,38 +736,43 @@ test_endian(size_t nx)
H5V_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
/* Compare */
- for (i = 0; i < nx; i++) {
- for (j = 0; j < 4; j++) {
- if (src[i * 4 + j] != dst[i * 4 + 3 - j]) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- /*
- * Print debugging info unless output is going directly
- * to a terminal.
- */
- AT();
- printf(" i=%lu, j=%lu\n",
- (unsigned long)i, (unsigned long)j);
- printf(" Source array is:\n");
- print_array(src, nx, (size_t)4, (size_t)1);
- printf("\n Result is:\n");
- print_array(dst, nx, (size_t)4, (size_t)1);
- }
- goto error;
- }
- }
- }
-
- puts(" PASSED");
+ for(i = 0; i < nx; i++) {
+ for(j = 0; j < 4; j++) {
+ if(src[i * 4 + j] != dst[i * 4 + 3 - j]) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ /*
+ * Print debugging info unless output is going directly
+ * to a terminal.
+ */
+ AT();
+ printf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j);
+ printf(" Source array is:\n");
+ print_array(src, nx, (size_t)4, (size_t)1);
+ printf("\n Result is:\n");
+ print_array(dst, nx, (size_t)4, (size_t)1);
+ } /* end if */
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ PASSED()
+
HDfree(src);
HDfree(dst);
+
return SUCCEED;
- error:
- HDfree(src);
- HDfree(dst);
+error:
+ if(src)
+ HDfree(src);
+ if(dst)
+ HDfree(dst);
+
return FAIL;
-}
+} /* end test_endian() */
+
/*-------------------------------------------------------------------------
* Function: test_transpose
@@ -799,33 +787,32 @@ test_endian(size_t nx)
* Programmer: Robb Matzke
* Saturday, October 11, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_transpose(size_t nx, size_t ny)
{
- int *src = NULL;
- int *dst = NULL;
- hsize_t i, j;
+ int *src = NULL;
+ int *dst = NULL;
hsize_t src_stride[2], dst_stride[2];
hsize_t size[2];
char s[256];
+ hsize_t i, j;
- sprintf(s, "Testing 2d transpose by stride %4lux%-lud",
- (unsigned long) nx, (unsigned long) ny);
+ sprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx,
+ (unsigned long)ny);
printf("%-70s", s);
fflush(stdout);
/* Initialize */
- src = HDmalloc(nx * ny * sizeof(*src));
- for (i = 0; i < nx; i++) {
- for (j = 0; j < ny; j++) {
- src[i * ny + j] = (int)(i * ny + j);
- }
- }
- dst = HDcalloc(nx*ny,sizeof(*dst));
+ if(NULL == (src = HDmalloc(nx * ny * sizeof(*src))))
+ TEST_ERROR
+ if(NULL == (dst = HDcalloc(nx * ny, sizeof(*dst))))
+ TEST_ERROR
+
+ for(i = 0; i < nx; i++)
+ for(j = 0; j < ny; j++)
+ src[i * ny + j] = (int)(i * ny + j);
/* Build stride info */
size[0] = nx;
@@ -836,57 +823,57 @@ test_transpose(size_t nx, size_t ny)
dst_stride[1] = (ssize_t)(nx * sizeof(*src));
/* Copy and transpose */
- if (nx == ny) {
- H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
- dst_stride, dst,
- src_stride, src);
- } else {
- H5V_stride_copy(2, (hsize_t)sizeof(*src), size,
- dst_stride, dst,
- src_stride, src);
- }
+ if(nx == ny)
+ H5V_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst,
+ src_stride, src);
+ else
+ H5V_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst,
+ src_stride, src);
/* Check */
- for (i = 0; i < nx; i++) {
- for (j = 0; j < ny; j++) {
- if (src[i * ny + j] != dst[j * nx + i]) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- AT();
- printf(" diff at i=%lu, j=%lu\n",
- (unsigned long)i, (unsigned long)j);
- printf(" Source is:\n");
- for (i = 0; i < nx; i++) {
- printf("%3lu:", (unsigned long)i);
- for (j = 0; j < ny; j++) {
- printf(" %6d", src[i * ny + j]);
- }
- printf("\n");
- }
- printf("\n Destination is:\n");
- for (i = 0; i < ny; i++) {
- printf("%3lu:", (unsigned long)i);
- for (j = 0; j < nx; j++) {
- printf(" %6d", dst[i * nx + j]);
- }
- printf("\n");
- }
- }
- goto error;
- }
- }
- }
-
- puts(" PASSED");
+ for(i = 0; i < nx; i++) {
+ for(j = 0; j < ny; j++) {
+ if(src[i * ny + j] != dst[j * nx + i]) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ AT();
+ printf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j);
+ printf(" Source is:\n");
+ for(i = 0; i < nx; i++) {
+ printf("%3lu:", (unsigned long)i);
+ for(j = 0; j < ny; j++)
+ printf(" %6d", src[i * ny + j]);
+ printf("\n");
+ } /* end for */
+ printf("\n Destination is:\n");
+ for (i = 0; i < ny; i++) {
+ printf("%3lu:", (unsigned long)i);
+ for(j = 0; j < nx; j++)
+ printf(" %6d", dst[i * nx + j]);
+ printf("\n");
+ } /* end for */
+ } /* end if */
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ PASSED()
+
HDfree(src);
HDfree(dst);
+
return SUCCEED;
- error:
- HDfree(src);
- HDfree(dst);
+error:
+ if(src)
+ HDfree(src);
+ if(dst)
+ HDfree(dst);
+
return FAIL;
-}
+} /* end test_transpose() */
+
/*-------------------------------------------------------------------------
* Function: test_sub_super
@@ -903,33 +890,35 @@ test_transpose(size_t nx, size_t ny)
* Programmer: Robb Matzke
* Monday, October 13, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_sub_super(size_t nx, size_t ny)
{
- uint8_t *full = NULL; /*original image */
- uint8_t *half = NULL; /*image at 1/2 resolution */
- uint8_t *twice = NULL; /*2x2 pixels */
- hsize_t src_stride[4]; /*source stride info */
- hsize_t dst_stride[4]; /*destination stride info */
- hsize_t size[4]; /*number of sample points */
- hsize_t i, j;
- char s[256];
+ uint8_t *full = NULL; /*original image */
+ uint8_t *half = NULL; /*image at 1/2 resolution */
+ uint8_t *twice = NULL; /*2x2 pixels */
+ hsize_t src_stride[4]; /*source stride info */
+ hsize_t dst_stride[4]; /*destination stride info */
+ hsize_t size[4]; /*number of sample points */
+ hsize_t i, j;
+ char s[256];
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
- (unsigned long) (2 * nx), (unsigned long) (2 * ny),
- (unsigned long) nx, (unsigned long) ny);
+ (unsigned long)(2 * nx), (unsigned long)(2 * ny),
+ (unsigned long)nx, (unsigned long)ny);
printf("%-70s", s);
fflush(stdout);
/* Initialize */
- full = HDmalloc(4 * nx * ny);
+ if(NULL == (full = HDmalloc(4 * nx * ny)))
+ TEST_ERROR
+ if(NULL == (half = HDcalloc((size_t)1, nx * ny)))
+ TEST_ERROR
+ if(NULL == (twice = HDcalloc((size_t)4, nx * ny)))
+ TEST_ERROR
+
init_full(full, 2 * nx, 2 * ny, (size_t)1);
- half = HDcalloc((size_t)1, nx * ny);
- twice = HDcalloc((size_t)4, nx * ny);
/* Setup */
size[0] = nx;
@@ -940,39 +929,37 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[1] = 1;
/* Copy */
- H5V_stride_copy(2, (hsize_t)sizeof(uint8_t), size,
- dst_stride, half, src_stride, full);
+ H5V_stride_copy(2, (hsize_t)sizeof(uint8_t), size, dst_stride, half,
+ src_stride, full);
/* Check */
- for (i = 0; i < nx; i++) {
- for (j = 0; j < ny; j++) {
- if (full[4 * i * ny + 2 * j] != half[i * ny + j]) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- AT();
- printf(" full[%lu][%lu] != half[%lu][%lu]\n",
- (unsigned long)i*2,
- (unsigned long)j*2,
- (unsigned long)i,
- (unsigned long)j);
- printf(" full is:\n");
- print_array(full, 2 * nx, 2 * ny, (size_t)1);
- printf("\n half is:\n");
- print_array(half, nx, ny, (size_t)1);
- }
- goto error;
- }
- }
- }
- puts(" PASSED");
+ for(i = 0; i < nx; i++) {
+ for(j = 0; j < ny; j++) {
+ if(full[4 * i * ny + 2 * j] != half[i * ny + j]) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ AT();
+ printf(" full[%lu][%lu] != half[%lu][%lu]\n",
+ (unsigned long)i * 2, (unsigned long)j * 2,
+ (unsigned long)i, (unsigned long)j);
+ printf(" full is:\n");
+ print_array(full, 2 * nx, 2 * ny, (size_t)1);
+ printf("\n half is:\n");
+ print_array(half, nx, ny, (size_t)1);
+ } /* end if */
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+ PASSED()
/*
* Test replicating pixels to produce an image twice as large in each
* dimension.
*/
sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ",
- (unsigned long) nx, (unsigned long) ny,
- (unsigned long) (2 * nx), (unsigned long) (2 * ny));
+ (unsigned long)nx, (unsigned long)ny, (unsigned long)(2 * nx),
+ (unsigned long)(2 * ny));
printf("%-70s", s);
fflush(stdout);
@@ -991,64 +978,62 @@ test_sub_super(size_t nx, size_t ny)
dst_stride[3] = sizeof(uint8_t);
/* Copy */
- H5V_stride_copy(4, (hsize_t)sizeof(uint8_t), size,
- dst_stride, twice, src_stride, half);
+ H5V_stride_copy(4, (hsize_t)sizeof(uint8_t), size, dst_stride, twice,
+ src_stride, half);
/* Check */
s[0] = '\0';
- for (i = 0; i < nx; i++) {
- for (j = 0; j < ny; j++) {
- if (half[i*ny+j] != twice[4*i*ny + 2*j]) {
- sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)i*2,
- (unsigned long)j*2);
- } else if (half[i*ny + j] != twice[4*i*ny + 2*j + 1]) {
- sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)i*2,
- (unsigned long)j*2+1);
- } else if (half[i*ny + j] != twice[(2*i +1)*2*ny + 2*j]) {
- sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)i*2+1,
- (unsigned long)j*2);
- } else if (half[i*ny + j] != twice[(2*i+1)*2*ny + 2*j+1]) {
- sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
- (unsigned long)i,
- (unsigned long)j,
- (unsigned long)i*2+1,
- (unsigned long)j*2+1);
- }
- if (s[0]) {
- puts("*FAILED*");
- if (!HDisatty(1)) {
- AT();
- printf(" %s\n Half is:\n", s);
- print_array(half, nx, ny, (size_t)1);
- printf("\n Twice is:\n");
- print_array(twice, 2 * nx, 2 * ny, (size_t)1);
- }
- goto error;
- }
- }
- }
- puts(" PASSED");
+ for(i = 0; i < nx; i++) {
+ for(j = 0; j < ny; j++) {
+ if(half[i * ny + j] != twice[4 * i * ny + 2 * j])
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2, (unsigned long)j * 2);
+ else if(half[i * ny + j] != twice[4 * i * ny + 2 * j + 1])
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2, (unsigned long)j * 2 + 1);
+ else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j])
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2 + 1, (unsigned long)j * 2);
+ else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j + 1])
+ sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]",
+ (unsigned long)i, (unsigned long)j,
+ (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1);
+ if(s[0]) {
+ H5_FAILED()
+ if(!HDisatty(1)) {
+ AT();
+ printf(" %s\n Half is:\n", s);
+ print_array(half, nx, ny, (size_t)1);
+ printf("\n Twice is:\n");
+ print_array(twice, 2 * nx, 2 * ny, (size_t)1);
+ } /* end if */
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ PASSED()
HDfree(full);
HDfree(half);
HDfree(twice);
+
return SUCCEED;
- error:
- HDfree(full);
- HDfree(half);
- HDfree(twice);
+error:
+ if(full)
+ HDfree(full);
+ if(half)
+ HDfree(half);
+ if(twice)
+ HDfree(twice);
+
return FAIL;
-}
+} /* test_sub_super() */
+
/*-------------------------------------------------------------------------
* Function: test_array_fill
@@ -1064,15 +1049,13 @@ test_sub_super(size_t nx, size_t ny)
* Programmer: Quincey Koziol
* Monday, April 21, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_array_fill(size_t lo, size_t hi)
{
- int *dst; /* Destination */
- int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
+ int *dst = NULL; /* Destination */
+ int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
size_t u, v, w; /* Local index variables */
char s[256];
@@ -1080,32 +1063,38 @@ test_array_fill(size_t lo, size_t hi)
TESTING(s);
/* Initialize */
- dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi);
+ if(NULL == (dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi)))
+ TEST_ERROR
/* Setup */
- for(u=0; u<ARRAY_FILL_SIZE; u++)
- src[u]=(char)u;
+ for(u = 0; u < ARRAY_FILL_SIZE; u++)
+ src[u] = (char)u;
/* Fill */
- for(w=lo; w<=hi; w++) {
- H5V_array_fill(dst,src,sizeof(src),w);
+ for(w = lo; w <= hi; w++) {
+ H5V_array_fill(dst, src, sizeof(src), w);
/* Check */
- for(u=0; u<w; u++)
- for(v=0; v<ARRAY_FILL_SIZE; v++)
- if(dst[(u*ARRAY_FILL_SIZE)+v]!=src[v]) TEST_ERROR;
+ for(u = 0; u < w; u++)
+ for(v = 0; v < ARRAY_FILL_SIZE; v++)
+ if(dst[(u * ARRAY_FILL_SIZE) + v] != src[v])
+ TEST_ERROR
- HDmemset(dst,0,sizeof(int)*ARRAY_FILL_SIZE*w);
+ HDmemset(dst, 0, sizeof(int) * ARRAY_FILL_SIZE * w);
} /* end for */
+
PASSED();
HDfree(dst);
+
return SUCCEED;
- error:
- HDfree(dst);
+error:
+ if(dst)
+ HDfree(dst);
return FAIL;
-}
+} /* end test_array_fill() */
+
/*-------------------------------------------------------------------------
* Function: test_array_offset_n_calc
@@ -1121,14 +1110,13 @@ test_array_fill(size_t lo, size_t hi)
* Programmer: Quincey Koziol
* Monday, April 21, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
{
- hsize_t *a, *temp_a; /* Array for stored calculated offsets */
+ hsize_t *a = NULL;
+ hsize_t *temp_a; /* Array for stored calculated offsets */
hsize_t off; /* Offset in array */
size_t u, v, w; /* Local index variables */
hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */
@@ -1140,50 +1128,58 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
TESTING(s);
/* Initialize */
- a = HDmalloc(sizeof(hsize_t) * x * y *z);
- dims[0]=z;
- dims[1]=y;
- dims[2]=x;
+ if(NULL == (a = HDmalloc(sizeof(hsize_t) * x * y *z)))
+ TEST_ERROR
+
+ dims[0] = z;
+ dims[1] = y;
+ dims[2] = x;
/* Setup */
- for(u=0, temp_a=a, off=0; u<z; u++)
- for(v=0; v<y; v++)
- for(w=0; w<x; w++)
+ for(u = 0, temp_a = a, off = 0; u < z; u++)
+ for(v = 0; v < y; v++)
+ for(w = 0; w < x; w++)
*temp_a++ = off++;
/* Check offsets */
- for(u=0; u<n; u++) {
+ for(u = 0; u < n; u++) {
/* Get random coordinate */
coords[0] = (hssize_t)(HDrandom() % z);
coords[1] = (hssize_t)(HDrandom() % y);
coords[2] = (hssize_t)(HDrandom() % x);
/* Get offset of coordinate */
- off=H5V_array_offset(ARRAY_OFFSET_NDIMS,dims,coords);
+ off = H5V_array_offset(ARRAY_OFFSET_NDIMS, dims, coords);
/* Check offset of coordinate */
- if(a[off]!=off) TEST_ERROR;
+ if(a[off] != off)
+ TEST_ERROR
/* Get coordinates of offset */
- if(H5V_array_calc(off,ARRAY_OFFSET_NDIMS,dims,new_coords)<0) TEST_ERROR;
+ if(H5V_array_calc(off, ARRAY_OFFSET_NDIMS, dims, new_coords) < 0)
+ TEST_ERROR
/* Check computed coordinates */
- for(v=0; v<ARRAY_OFFSET_NDIMS; v++)
- if(coords[v]!=new_coords[v]) {
- HDfprintf(stderr,"coords[%u]=%Hu, new_coords[%u]=%Hu\n",(unsigned)v,coords[v],(unsigned)v,new_coords[v]);
+ for(v = 0; v < ARRAY_OFFSET_NDIMS; v++)
+ if(coords[v] != new_coords[v]) {
+ HDfprintf(stderr,"coords[%u]=%Hu, new_coords[%u]=%Hu\n", (unsigned)v, coords[v], (unsigned)v, new_coords[v]);
TEST_ERROR;
- }
+ } /* end if */
} /* end for */
PASSED();
HDfree(a);
+
return SUCCEED;
- error:
- HDfree(a);
+error:
+ if(a)
+ HDfree(a);
+
return FAIL;
-}
+} /* end test_array_offset_n_calc() */
+
/*-------------------------------------------------------------------------
* Function: main
@@ -1199,8 +1195,6 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
* Programmer: Robb Matzke
* Friday, October 10, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -1208,29 +1202,31 @@ main(int argc, char *argv[])
{
herr_t status;
int nerrors = 0;
- unsigned size_of_test;
+ unsigned size_of_test;
/* Parse arguments or assume `small' & `medium' */
- if (1 == argc) {
- size_of_test = TEST_SMALL | TEST_MEDIUM;
- } else {
- int i;
- for (i = 1, size_of_test = 0; i < argc; i++) {
- if (!strcmp(argv[i], "small")) {
- size_of_test |= TEST_SMALL;
- } else if (!strcmp(argv[i], "medium")) {
- size_of_test |= TEST_MEDIUM;
- } else {
- printf("unrecognized argument: %s\n", argv[i]);
- exit(1);
- }
- }
- }
+ if(1 == argc)
+ size_of_test = TEST_SMALL | TEST_MEDIUM;
+ else {
+ int i;
+
+ for(i = 1, size_of_test = 0; i < argc; i++) {
+ if(!HDstrcmp(argv[i], "small"))
+ size_of_test |= TEST_SMALL;
+ else if(!HDstrcmp(argv[i], "medium"))
+ size_of_test |= TEST_MEDIUM;
+ else {
+ printf("unrecognized argument: %s\n", argv[i]);
+ HDexit(1);
+ } /* end else */
+ } /* end for */
+ } /* end else */
+
printf("Test sizes: ");
- if (size_of_test & TEST_SMALL)
- printf(" SMALL");
- if (size_of_test & TEST_MEDIUM)
- printf(" MEDIUM");
+ if(size_of_test & TEST_SMALL)
+ printf(" SMALL");
+ if(size_of_test & TEST_MEDIUM)
+ printf(" MEDIUM");
printf("\n");
/* Set the random # seed */
@@ -1249,176 +1245,207 @@ main(int argc, char *argv[])
* TEST HYPERSLAB FILL OPERATION
*------------------------------
*/
- if (size_of_test & TEST_SMALL) {
- status = test_fill((size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_fill((size_t)113, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)15, (size_t)11, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_fill((size_t)5, (size_t)7, (size_t)7, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
- /*------------------------------
- * TEST HYPERSLAB COPY OPERATION
- *------------------------------
- */
+ if(size_of_test & TEST_SMALL) {
+ status = test_fill((size_t)11, (size_t)0, (size_t)0, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_fill((size_t)11, (size_t)10, (size_t)0, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_fill((size_t)3, (size_t)5, (size_t)5, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_fill((size_t)113, (size_t)0, (size_t)0, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_fill((size_t)15, (size_t)11, (size_t)0, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_fill((size_t)5, (size_t)7, (size_t)7, (size_t)1,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+
+ /*------------------------------
+ * TEST HYPERSLAB COPY OPERATION
+ *------------------------------
+ */
/* exhaustive, one-dimensional test */
- if (size_of_test & TEST_SMALL) {
- status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
+ if(size_of_test & TEST_SMALL) {
+ status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)0, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_DST, (size_t)11, (size_t)0, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)0, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)179, (size_t)0, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_DST, (size_t)179, (size_t)0, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_BOTH, (size_t)179, (size_t)0, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
/* exhaustive, two-dimensional test */
- if (size_of_test & TEST_SMALL) {
- status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
+ if(size_of_test & TEST_SMALL) {
+ status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)10, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_DST, (size_t)11, (size_t)10, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)10, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)13, (size_t)19, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_DST, (size_t)13, (size_t)19, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_BOTH, (size_t)13, (size_t)19, (size_t)0,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
/* sparse, two-dimensional test */
- if (size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)73, (size_t)67, (size_t)0,
+ (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_DST, (size_t)73, (size_t)67, (size_t)0,
+ (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_BOTH, (size_t)73, (size_t)67, (size_t)0,
+ (size_t)7, (size_t)11, (size_t)1, (size_t)13, (size_t)11, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
/* exhaustive, three-dimensional test */
- if (size_of_test & TEST_SMALL) {
- status = test_copy(VARIABLE_SRC, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_copy(VARIABLE_SRC, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_DST, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- status = test_copy(VARIABLE_BOTH, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
- nerrors += status < 0 ? 1 : 0;
- }
- /*---------------------
- * TEST MULTI-BYTE FILL
- *---------------------
- */
-
- if (size_of_test & TEST_SMALL) {
- status = test_multifill((size_t)10);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_multifill((size_t)500000);
- nerrors += status < 0 ? 1 : 0;
- }
- /*---------------------------
- * TEST TRANSLATION OPERATORS
- *---------------------------
- */
-
- if (size_of_test & TEST_SMALL) {
- status = test_endian((size_t)10);
- nerrors += status < 0 ? 1 : 0;
- status = test_transpose((size_t)9, (size_t)9);
- nerrors += status < 0 ? 1 : 0;
- status = test_transpose((size_t)3, (size_t)11);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_endian((size_t)800000);
- nerrors += status < 0 ? 1 : 0;
- status = test_transpose((size_t)1200, (size_t)1200);
- nerrors += status < 0 ? 1 : 0;
- status = test_transpose((size_t)800, (size_t)1800);
- nerrors += status < 0 ? 1 : 0;
- }
- /*-------------------------
- * TEST SAMPLING OPERATIONS
- *-------------------------
- */
-
- if (size_of_test & TEST_SMALL) {
- status = test_sub_super((size_t)5, (size_t)10);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_sub_super((size_t)480, (size_t)640);
- nerrors += status < 0 ? 1 : 0;
- }
- /*-------------------------
- * TEST ARRAY FILL OPERATIONS
- *-------------------------
- */
-
- if (size_of_test & TEST_SMALL) {
- status = test_array_fill((size_t)1, (size_t)9);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_array_fill((size_t)9, (size_t)257);
- nerrors += status < 0 ? 1 : 0;
- }
- /*-------------------------
- * TEST ARRAY OFFSET OPERATIONS
- *-------------------------
- */
-
- if (size_of_test & TEST_SMALL) {
- status = test_array_offset_n_calc((size_t)20, (size_t)7, (size_t)11, (size_t)13);
- nerrors += status < 0 ? 1 : 0;
- }
- if (size_of_test & TEST_MEDIUM) {
- status = test_array_offset_n_calc((size_t)500, (size_t)71, (size_t)193, (size_t)347);
- nerrors += status < 0 ? 1 : 0;
- }
+ if(size_of_test & TEST_SMALL) {
+ status = test_copy(VARIABLE_SRC, (size_t)3, (size_t)5, (size_t)5,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_DST, (size_t)3, (size_t)5, (size_t)5,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_BOTH, (size_t)3, (size_t)5, (size_t)5,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_copy(VARIABLE_SRC, (size_t)7, (size_t)9, (size_t)5,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_DST, (size_t)7, (size_t)9, (size_t)5,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_copy(VARIABLE_BOTH, (size_t)7, (size_t)9, (size_t)5,
+ (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1, (size_t)1);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+
+ /*---------------------
+ * TEST MULTI-BYTE FILL
+ *---------------------
+ */
+ if(size_of_test & TEST_SMALL) {
+ status = test_multifill((size_t)10);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_multifill((size_t)500000);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+
+ /*---------------------------
+ * TEST TRANSLATION OPERATORS
+ *---------------------------
+ */
+ if(size_of_test & TEST_SMALL) {
+ status = test_endian((size_t)10);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_transpose((size_t)9, (size_t)9);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_transpose((size_t)3, (size_t)11);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_endian((size_t)800000);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_transpose((size_t)1200, (size_t)1200);
+ nerrors += status < 0 ? 1 : 0;
+ status = test_transpose((size_t)800, (size_t)1800);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+
+ /*-------------------------
+ * TEST SAMPLING OPERATIONS
+ *-------------------------
+ */
+ if(size_of_test & TEST_SMALL) {
+ status = test_sub_super((size_t)5, (size_t)10);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_sub_super((size_t)480, (size_t)640);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+
+ /*-------------------------
+ * TEST ARRAY FILL OPERATIONS
+ *-------------------------
+ */
+ if(size_of_test & TEST_SMALL) {
+ status = test_array_fill((size_t)1, (size_t)9);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_array_fill((size_t)9, (size_t)257);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+
+ /*-------------------------
+ * TEST ARRAY OFFSET OPERATIONS
+ *-------------------------
+ */
+ if(size_of_test & TEST_SMALL) {
+ status = test_array_offset_n_calc((size_t)20, (size_t)7, (size_t)11,
+ (size_t)13);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
+ if(size_of_test & TEST_MEDIUM) {
+ status = test_array_offset_n_calc((size_t)500, (size_t)71,
+ (size_t)193, (size_t)347);
+ nerrors += status < 0 ? 1 : 0;
+ } /* end if */
/*--- END OF TESTS ---*/
- if (nerrors) {
- printf("***** %d HYPERSLAB TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
- if (HDisatty(1)) {
- printf("(Redirect output to a pager or a file to see "
- "debug output)\n");
- }
- exit(1);
- }
+ if(nerrors) {
+ printf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1
+ == nerrors ? "" : "S");
+ if(HDisatty(1))
+ printf("(Redirect output to a pager or a file to see debug output)\n");
+ HDexit(1);
+ } /* end if */
+
printf("All hyperslab tests passed.\n");
#ifdef H5_HAVE_THREADSAFE
H5close();
#endif /* H5_HAVE_THREADSAFE */
+
return 0;
}
+
diff --git a/test/links.c b/test/links.c
index deae5ef..afd5872 100644
--- a/test/links.c
+++ b/test/links.c
@@ -28,6 +28,7 @@
#define H5G_TESTING
#include "h5test.h"
+#include "H5srcdir.h"
#include "H5Gpkg.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
@@ -327,7 +328,7 @@ typedef struct {
* 14 Jan. 2009
*-------------------------------------------------------------------------
*/
-static void
+static void
fix_ext_filename(char *path_name, char *cwd, const char *file_name)
{
HDstrcpy(path_name, cwd);
@@ -638,7 +639,7 @@ cklinks(hid_t fapl, hbool_t new_format)
TEST_ERROR
} /* end if */
- /* Non-existant link */
+ /* Non-existent link */
if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR
/* Cleanup */
@@ -2190,7 +2191,7 @@ external_link_mult(hid_t fapl, hbool_t new_format)
*-------------------------------------------------------------------------
*/
static int
-external_link_self(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
+external_link_self(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -2205,125 +2206,116 @@ external_link_self(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
else
TESTING("external link to self")
- /* Skip test when using core VFD, since it doesn't re-open file when linking
- * to same file.
- */
- if(HDstrcmp(env_h5_drvr, "core")) {
- /* Set up filename */
- h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1);
- h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1);
+ /* Set up filename */
+ h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1);
+ h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1);
- /* Create file */
- if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create file */
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create an lcpl with intermediate group creation set */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
+ /* Create an lcpl with intermediate group creation set */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
- /* Create a series of groups within the file: /A/B and /X/Y/Z */
- if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Create a series of groups within the file: /A/B and /X/Y/Z */
+ if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Pclose (lcpl_id) < 0) TEST_ERROR
+ if(H5Pclose (lcpl_id) < 0) TEST_ERROR
- /* Create external link to own root group*/
- if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create external link to own root group*/
+ if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Open object through external link */
- if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Open object through external link */
+ if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/X")) TEST_ERROR
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/X")) TEST_ERROR
- /* Create object through external link */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create object through external link */
+ if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close created group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ /* Close created group */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
- /* Close object opened through external link */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Close object opened through external link */
+ if(H5Gclose(gid) < 0) TEST_ERROR
- /* Check on object created */
- if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Check on object created */
+ if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR
- /* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Close opened object */
+ if(H5Gclose(gid) < 0) TEST_ERROR
- /* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Close first file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Complicate things. Use this file as an intermediate file in a chain
- * of external links that will go: file2 -> file1 -> file1 -> file3
- */
+ /* Complicate things. Use this file as an intermediate file in a chain
+ * of external links that will go: file2 -> file1 -> file1 -> file3
+ */
- /* Create file2 with an external link to file1 */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create file2 with an external link to file1 */
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Close file2 */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Close file2 */
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Create file3 as a target */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Create file3 as a target */
+ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Open file1 and create an extlink pointing to file3 */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Open file1 and create an extlink pointing to file3 */
+ if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Close file1 */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Close file1 */
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */
- if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */
+ if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Create object through external link */
- if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create object through external link */
+ if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Cleanup */
- if(H5Gclose(gid2) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Cleanup */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Open up file3 and make sure the object was created successfully */
- if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ /* Open up file3 and make sure the object was created successfully */
+ if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Cleanup */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Cleanup */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
- PASSED();
- } /* end if */
- else {
- SKIPPED();
- puts(" Current VFD can't reopen same file through external link");
- } /* end else */
+ PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Fclose(gid2);
- H5Fclose(gid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
H5Pclose(lcpl_id);
H5Fclose(fid);
} H5E_END_TRY;
@@ -2356,7 +2348,7 @@ external_link_self(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
*-------------------------------------------------------------------------
*/
static int
-external_link_pingpong(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
+external_link_pingpong(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
@@ -2369,86 +2361,77 @@ external_link_pingpong(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
else
TESTING("external links back and forth")
- /* Skip test when using core VFD, since it doesn't re-open file when linking
- * to same file.
- */
- if(HDstrcmp(env_h5_drvr, "core")) {
- /* Set up filenames */
- h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
+ /* Set up filenames */
+ h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
- /* Create first file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create first file */
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create external links for chain */
- if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create external links for chain */
+ if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Create final object */
- if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Create final object */
+ if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
- /* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Create second file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create second file */
+ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create external links for chain */
- if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create external links for chain */
+ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Close file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Open first file */
- if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Open first file */
+ if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- /* Open object through external link */
- if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Open object through external link */
+ if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/final")) TEST_ERROR
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/final")) TEST_ERROR
- /* Create object in external file */
- if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create object in external file */
+ if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close group in external file */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ /* Close group in external file */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
- /* Close external object (lets first file close) */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Close external object (lets first file close) */
+ if(H5Gclose(gid) < 0) TEST_ERROR
- /* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Close first file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
- /* Open first file again and check on object created */
- if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ /* Open first file again and check on object created */
+ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
- /* Open object created through external link */
- if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Open object created through external link */
+ if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Check name */
- if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
- if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR
- /* Close opened object */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Close opened object */
+ if(H5Gclose(gid) < 0) TEST_ERROR
- /* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
+ /* Close first file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
- PASSED();
- } /* end if */
- else {
- SKIPPED();
- puts(" Current VFD can't reopen same file through external link");
- } /* end else */
+ PASSED();
return 0;
@@ -5993,7 +5976,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-external_link_closing(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
+external_link_closing(hid_t fapl, hbool_t new_format)
{
hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1);
hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1);
@@ -6013,194 +5996,185 @@ external_link_closing(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
else
TESTING("that external files are closed during traversal")
- /* Skip test when using core VFD, since it doesn't re-open file when linking
- * to same file.
+ /* In this test, external links will go from file1 to file2 and from
+ * file2 to file3.
+ * Test that all functions that can traverse external files close
+ * the files they open.
+ * Test that providing unusual paths containing external links can't
+ * make HDF5 forget to close a file it opened.
*/
- if(HDstrcmp(env_h5_drvr, "core")) {
- /* In this test, external links will go from file1 to file2 and from
- * file2 to file3.
- * Test that all functions that can traverse external files close
- * the files they open.
- * Test that providing unusual paths containing external links can't
- * make HDF5 forget to close a file it opened.
- */
- /* Set up filenames */
- h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
- h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3);
- h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4);
-
- /* Create four files */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */
- dims[0] = 2;
- dims[1] = 2;
- if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
- if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
-
- /* Create external links from each file to the next */
- if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Close all files but the first */
- if(H5Fclose(fid4) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
-
- /* Test creating each kind of object */
- if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* Close objects */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Tclose(tid) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
-
- /* Test that getting info works */
- if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name(fid1, "elink/elink/elink", &oi, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Test move */
- if(H5Lmove(fid1, "elink/elink/elink/group1", fid1,
- "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open file 4 so we can do some fancy things */
- if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
- if(H5Lmove(fid1, "elink/elink/elink/type1", fid4,
- "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lmove(fid4, "dataset1", fid1,
- "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
-
- /* Close file 4 again */
- if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR
-
- /* Test copy (as of this test, it uses the same code as move) */
- if(H5Lcopy(fid1, "elink/elink/elink", fid1,
- "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Lcopy(fid1, "elink/elink/elink", fid1,
- "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
-
- /* Test H5Gset and get comment */
- if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(HDstrcmp(buf, "comment")) TEST_ERROR
-
- /* Test H5*open */
- if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Close objects */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
-
- /* Test H5*open2 */
- if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Close objects */
- if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
-
- /* Test H5Oopen */
- if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(did) < 0) TEST_ERROR
-
- /* Test H5Fmount */
- if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- H5E_BEGIN_TRY {
- if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR
- if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR
- } H5E_END_TRY
-
- /* Test H5Rcreate */
- if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (-1)) < 0) TEST_ERROR
-
- /* Test unlink */
- if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR
-
- /* We've tested that the various functions above don't leave files open.
- * Now test that we can't confuse HDF5 by giving unusual paths with external links
- */
- /* Create an external link that points to another external link */
- if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- if(H5Lcreate_external(filename3, "/elink", fid2, "elink2",
- H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
-
- /* Do an external link traversal that recursively calls another external link. */
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
-
- /* Create two more groups so that the last three elements in the path are
- * all within the same external file
- */
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Oget_info_by_name(fid1, "elink/elink2/group2/group3/group4", &oi, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Add a few regular groups and a soft link in file2 using intermediate group creation */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
- if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink",
- lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Try to traverse this path. There are three soft traversals in a row;
- * slink points to (file2)/elink2, which points to (file3)/elink, which
- * points to file 4.
- */
- if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Some simpler tests */
- if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
-
-
- /* Close file1, the only file that should still be open */
- if(H5Fclose(fid1) < 0) TEST_ERROR
-
- /* Re-create each file. If they are hanging open, these creates will fail */
- if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Cleanup */
- if(H5Sclose(sid) < 0) TEST_ERROR
- if(H5Tclose(tid2) < 0) TEST_ERROR
- if(H5Fclose(fid4) < 0) TEST_ERROR
- if(H5Fclose(fid3) < 0) TEST_ERROR
- if(H5Fclose(fid2) < 0) TEST_ERROR
- if(H5Fclose(fid1) < 0) TEST_ERROR
+ /* Set up filenames */
+ h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3);
+ h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4);
- PASSED();
- } /* end if */
- else {
- SKIPPED();
- puts(" Current VFD can't reopen same file through external link");
- } /* end else */
+ /* Create four files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */
+ dims[0] = 2;
+ dims[1] = 2;
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+
+ /* Create external links from each file to the next */
+ if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close all files but the first */
+ if(H5Fclose(fid4) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+
+ /* Test creating each kind of object */
+ if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close objects */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Test that getting info works */
+ if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name(fid1, "elink/elink/elink", &oi, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Test move */
+ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1,
+ "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Open file 4 so we can do some fancy things */
+ if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if(H5Lmove(fid1, "elink/elink/elink/type1", fid4,
+ "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lmove(fid4, "dataset1", fid1,
+ "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Close file 4 again */
+ if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR
+
+ /* Test copy (as of this test, it uses the same code as move) */
+ if(H5Lcopy(fid1, "elink/elink/elink", fid1,
+ "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcopy(fid1, "elink/elink/elink", fid1,
+ "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Test H5Gset and get comment */
+ if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(HDstrcmp(buf, "comment")) TEST_ERROR
+
+ /* Test H5*open */
+ if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Close objects */
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+
+ /* Test H5*open2 */
+ if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Close objects */
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+
+ /* Test H5Oopen */
+ if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Test H5Fmount */
+ if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR
+ if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR
+ } H5E_END_TRY
+
+ /* Test H5Rcreate */
+ if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (-1)) < 0) TEST_ERROR
+
+ /* Test unlink */
+ if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* We've tested that the various functions above don't leave files open.
+ * Now test that we can't confuse HDF5 by giving unusual paths with external links
+ */
+ /* Create an external link that points to another external link */
+ if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/elink", fid2, "elink2",
+ H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+
+ /* Do an external link traversal that recursively calls another external link. */
+ if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create two more groups so that the last three elements in the path are
+ * all within the same external file
+ */
+ if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Oget_info_by_name(fid1, "elink/elink2/group2/group3/group4", &oi, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Add a few regular groups and a soft link in file2 using intermediate group creation */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink",
+ lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Try to traverse this path. There are three soft traversals in a row;
+ * slink points to (file2)/elink2, which points to (file3)/elink, which
+ * points to file 4.
+ */
+ if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Some simpler tests */
+ if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+
+
+ /* Close file1, the only file that should still be open */
+ if(H5Fclose(fid1) < 0) TEST_ERROR
+
+ /* Re-create each file. If they are hanging open, these creates will fail */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Cleanup */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Fclose(fid4) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
+
+ PASSED();
return 0;
@@ -6241,34 +6215,19 @@ external_link_endian(hbool_t new_format)
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
hid_t lapl_id = (-1); /* Prop List ID */
- char * srcdir = getenv("srcdir"); /* The source directory */
- char pathbuf[NAME_BUF_SIZE]; /* Path to the files */
- char namebuf[NAME_BUF_SIZE];
+ const char *pathbuf = H5_get_srcdir(); /* Path to the files */
+ const char *namebuf;
if(new_format)
TESTING("endianness of external links (w/new group format)")
else
TESTING("endianness of external links")
- /*
- * Create the name of the file to open (in case we are using the --srcdir
- * option and the file is in a different directory from this test).
- */
- if (srcdir && ((HDstrlen(srcdir) + 2) < sizeof(pathbuf)) )
- {
- HDstrcpy(pathbuf, srcdir);
- HDstrcat(pathbuf, "/");
- }
- else
- HDstrcpy(pathbuf, "");
-
/* Create a link access property list with the path to the srcdir */
if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR
- if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR
- HDstrcpy(namebuf, pathbuf);
- HDstrcat(namebuf, LE_FILENAME);
+ namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */
/* Test LE file; try to open a group through the external link */
if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -6282,9 +6241,7 @@ external_link_endian(hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
- if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR
- HDstrcpy(namebuf, pathbuf);
- HDstrcat(namebuf, BE_FILENAME);
+ namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */
/* Test BE file; try to open a group through the external link */
if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -6611,6 +6568,143 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/*-------------------------------------------------------------------------
+ * Function: external_copy_invalid_object
+ *
+ * Purpose: Check that attempting to copy an object through an
+ * external link to the source file but with an invalid
+ * object name fails gracefully, and does not leave lingering
+ * file ids.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Wednesday, March 3, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_copy_invalid_object(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t ocpyplid = (-1); /* Object copy plist ID */
+ char filename[NAME_BUF_SIZE];
+
+ if(new_format)
+ TESTING("copying invalid external links to the source file (w/new group format)")
+ else
+ TESTING("copying invalid external links to the source file")
+
+ /* Set up filename */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Create object copy plist, set expand external flag */
+ if((ocpyplid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+ if(H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) TEST_ERROR
+
+ /* Create file and group */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create an external link in the group to the source file with an invalid
+ * object name */
+ if(H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Copy the group containing the external link */
+ if(H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Attempt to truncate the file again. If there is a lingering id for this
+ * file this will fail */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Close */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if(H5Pclose(ocpyplid) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ H5Pclose(ocpyplid);
+ } H5E_END_TRY
+
+ return -1;
+} /* end external_copy_invalid_object */
+
+
+/*-------------------------------------------------------------------------
+ * Function: external_dont_fail_to_source
+ *
+ * Purpose: Check that external links with invalid target file names
+ * work properly and do not attempt to (re)open the source
+ * file.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Wednesday, March 3, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_dont_fail_to_source(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t oid = (-1); /* Object ID */
+ char filename[NAME_BUF_SIZE];
+
+ if(new_format)
+ TESTING("that invalid external links don't open the source file (w/new group format)")
+ else
+ TESTING("that invalid external links don't open the source file")
+
+ /* Set up filename */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Create file and group */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create an external link with an invalid file name, but the same object
+ * name as the group. This way, if the external link is interpreted to
+ * refer to the source file, it will link to the group */
+ if(H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Attempt to open the object the link points to. This should fail */
+ H5E_BEGIN_TRY {
+ oid = H5Oopen(fid, "link", H5P_DEFAULT);
+ } H5E_END_TRY
+ if(oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link")
+
+ /* Close */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Oclose(oid);
+ H5Fclose(fid);
+ } H5E_END_TRY
+
+ return -1;
+} /* end external_dont_fail_to_source */
+
+
+/*-------------------------------------------------------------------------
* Function: ud_hard_links
*
* Purpose: Check that the functionality of hard links can be duplicated
@@ -8190,8 +8284,7 @@ build_visit_file(hid_t fapl)
hid_t did = (-1); /* Dataset ID */
hid_t tid = (-1); /* Datatype ID */
char filename[NAME_BUF_SIZE];
- char pathname[1024]; /* Path of external link file */
- char *srcdir = getenv("srcdir"); /* where the src code is located */
+ const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */
h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
@@ -8227,17 +8320,9 @@ build_visit_file(hid_t fapl)
if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create external link to existing file */
- pathname[0] = '\0';
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) {
- HDstrcpy(pathname, srcdir);
- HDstrcat(pathname, "/");
- }
- HDstrcat(pathname, LINKED_FILE);
-
if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Create dangling external link to non-existant file */
+ /* Create dangling external link to non-existent file */
if(H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create dataset in each group */
@@ -8370,7 +8455,7 @@ link_visit(hid_t fapl, hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Fclose(gid);
+ H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
return -1;
@@ -8448,7 +8533,7 @@ link_visit_by_name(hid_t fapl, hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Fclose(gid);
+ H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
return -1;
@@ -8548,7 +8633,7 @@ obj_visit(hid_t fapl, hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Fclose(gid);
+ H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
return -1;
@@ -8627,7 +8712,7 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Fclose(gid);
+ H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
return -1;
@@ -9099,6 +9184,294 @@ error:
/*-------------------------------------------------------------------------
+ * Function: obj_exists
+ *
+ * Purpose: Test the 'object exists' routine
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, February 2, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+obj_exists(hid_t fapl, hbool_t new_format)
+{
+ char filename[NAME_BUF_SIZE]; /* Buffer for file name */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ herr_t status; /* Generic return value */
+
+ if(new_format)
+ TESTING("object exists (w/new group format)")
+ else
+ TESTING("object exists")
+
+ /* Set up filename and create file*/
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+/* Hard links */
+ /* Verify that H5Oexists_by_name() fails for non-existent link in root group */
+ H5E_BEGIN_TRY {
+ status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT);
+ } H5E_END_TRY
+ if(status >= 0) TEST_ERROR
+
+ /* Create a group, as a destination for testing */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() succeeds for hard linked object */
+ if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */
+ H5E_BEGIN_TRY {
+ status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT);
+ } H5E_END_TRY
+ if(status >= 0) TEST_ERROR
+
+
+/* Soft links */
+ /* Create dangling soft-link in root group */
+ if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */
+ if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in root group that points to object */
+ if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */
+ if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create dangling soft-link in non-root group */
+ if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */
+ if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in non-root group that points to object */
+ if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */
+ if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT))
+ TEST_ERROR
+
+
+/* External links */
+ /* Create dangling (file doesn't exist) external link in root group */
+ if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */
+ if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create dangling (object doesn't exist) external link in root group */
+ if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */
+ if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in root group that points to object */
+ if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */
+ if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create dangling (file doesn't exist) external link in non-root group */
+ if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */
+ if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create dangling (object doesn't exist) external link in non-root group */
+ if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */
+ if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in non-root group that points to object */
+ if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */
+ if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT))
+ TEST_ERROR
+
+
+/* Soft->External links */
+ /* Create soft-link in root group that points to dangling (file doesn't exist) external link */
+ if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in root group that points to dangling (object doesn't exist) external link */
+ if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in root group that points to external link that points to object */
+ if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */
+ if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */
+ if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in root group that points to external link in non-root group that points to object */
+ if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */
+ if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */
+ if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in non-root group that points to external link that points to object */
+ if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */
+ if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */
+ if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create soft-link in non-root group that points to external link in non-root group that points to object */
+ if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT))
+ TEST_ERROR
+
+
+/* External->Soft links */
+ /* Create external link in root group that points to dangling soft link in root group */
+ if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in root group that points to soft link in root group that points to object */
+ if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in root group that points to dangling soft link in non-root group */
+ if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in root group that points to soft link in root group that points to object */
+ if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in non-root group that points to dangling soft link in root group */
+ if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in non-root group that points to soft link in root group that points to object */
+ if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in non-root group that points to dangling soft link in non-root group */
+ if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns FALSE */
+ if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT))
+ TEST_ERROR
+
+ /* Create external link in non-root group that points to soft link in non-root group that points to object */
+ if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify that H5Oexists_by_name() returns TRUE */
+ if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT))
+ TEST_ERROR
+
+
+ /* Close file created */
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return -1;
+} /* end obj_exists() */
+
+
+/*-------------------------------------------------------------------------
* Function: corder_create_empty
*
* Purpose: Create an empty group with creation order indices
@@ -10887,13 +11260,6 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
char objname[NAME_BUF_SIZE]; /* Object name */
H5L_info_t my_info; /* Local link info */
-#ifdef QAK
-HDfprintf(stderr, "link_name = '%s'\n", link_name);
-if(info)
- HDfprintf(stderr, "info->corder = %Hd\n", info->corder);
-HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr);
-#endif /* QAK */
-
/* Increment # of times the callback was called */
op_data->ncalled++;
@@ -11372,13 +11738,6 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf
char objname[NAME_BUF_SIZE]; /* Object name */
H5L_info_t my_info; /* Local link info */
-#ifdef QAK
-HDfprintf(stderr, "link_name = '%s'\n", link_name);
-if(info)
- HDfprintf(stderr, "info->corder = %Hd\n", info->corder);
-HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr);
-#endif /* QAK */
-
/* Increment # of times the callback was called */
op_data->ncalled++;
@@ -13571,8 +13930,8 @@ main(void)
nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
#ifndef H5_CANNOT_OPEN_TWICE
- nerrors += external_link_self(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_pingpong(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0;
#endif /* H5_CANNOT_OPEN_TWICE */
nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0;
@@ -13583,7 +13942,7 @@ main(void)
nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0;
#ifndef H5_CANNOT_OPEN_TWICE
- nerrors += external_link_closing(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0;
#endif /* H5_CANNOT_OPEN_TWICE */
nerrors += external_link_endian(new_format) < 0 ? 1 : 0;
nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
@@ -13615,6 +13974,8 @@ main(void)
nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0;
#endif
nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0;
/* These tests assume that external links are a form of UD links,
* so assume that everything that passed for external links
@@ -13637,6 +13998,9 @@ main(void)
nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_CANNOT_OPEN_TWICE
+ nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_CANNOT_OPEN_TWICE */
/* Keep this test last, it's testing files that are used above */
/* do not do this for files used by external link tests */
diff --git a/test/mf.c b/test/mf.c
index ca89b79..6bfa44e 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -19,7 +19,7 @@
* test_mf_fs_*() tests for file memory that interact with the free-space manager
* test_mf_aggr_*() tests for file memory that interact with the aggregators
* test_mf_align_*() tests for file memory with alignment setting
- * test_filespace_*() tests for file space management
+ * test_filespace_*() tests for file space management
*/
#include "h5test.h"
@@ -3688,7 +3688,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
@@ -4127,7 +4127,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
if((file_size = h5_get_file_size(filename, new_fapl)) < 0)
@@ -4335,7 +4335,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
@@ -4592,7 +4592,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
@@ -4921,7 +4921,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
@@ -5217,7 +5217,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
@@ -5424,7 +5424,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
@@ -5693,7 +5693,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
/* Skip test when using VFDs that have their own 'alloc' callback, which
* don't push mis-aligned space fragments on the file free space list
*/
- have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
+ have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio")
&& HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi"));
if(have_alloc_vfd) {
/* Set the filename to use for this test (dependent on fapl) */
@@ -5993,7 +5993,7 @@ error:
} /* test_mf_fs_persist() */
/*
- * Verify that the free-space manager goes away
+ * Verify that the free-space manager goes away
*/
static unsigned
test_mf_fs_gone(hid_t fapl_new, hid_t fcpl)
@@ -6365,7 +6365,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
hid_t file = -1; /* File ID */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
- H5FD_mem_t type, stype, btype, gtype; /* File allocation type */
+ H5FD_mem_t type, stype, btype, gtype; /* File allocation type */
H5FS_stat_t fs_stat; /* Information for free-space manager */
haddr_t addr1, addr2, addr3, addr4; /* File allocation type */
haddr_t saddr1, saddr2, saddr3, saddr4; /* File address for H5FD_MEM_SUPER */
@@ -6591,7 +6591,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl)
(hsize_t)TEST_BLOCK_SIZE1, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
if(node_found) TEST_ERROR
-
+
if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type],
(hsize_t)TEST_BLOCK_SIZE3, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -6691,7 +6691,7 @@ test_mf_fs_drivers(hid_t fapl)
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Test with old and new format */
@@ -6713,7 +6713,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_gone(fapl_new, fcpl);
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_cleanup(FILENAME, fapl_new);
/* STDIO */
@@ -6727,13 +6727,13 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_gone(fapl_new, fcpl);
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_cleanup(FILENAME, fapl_new);
/* CORE */
HDputs("Testing free-space managers with core driver");
/* create fapl to be a "core" file */
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
FAIL_STACK_ERROR
if(H5Pset_fapl_core(fapl_new, (size_t)CORE_INCREMENT, TRUE) < 0)
FAIL_STACK_ERROR
@@ -6741,7 +6741,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_gone(fapl_new, fcpl);
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_cleanup(FILENAME, fapl_new);
/* FAMILY */
HDputs("Testing free-space managers with family driver");
@@ -6753,7 +6753,7 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_persist(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_cleanup(FILENAME, fapl_new);
/* SPLIT */
HDputs("Testing free-space managers with split driver");
@@ -6766,27 +6766,27 @@ test_mf_fs_drivers(hid_t fapl)
ret += test_mf_fs_persist(fapl_new, fcpl);
ret += test_mf_fs_split(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_cleanup(FILENAME, fapl_new);
/* MULTI */
HDputs("Testing free-space managers with multi driver");
MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
FAIL_STACK_ERROR
if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
ret += test_mf_fs_multi(fapl_new, fcpl);
- h5_cleanup(FILENAME, fapl_new);
+ h5_cleanup(FILENAME, fapl_new);
} /* end for new_format */
- if (H5Pclose(fcpl) < 0)
+ if (H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
- if (H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
FAIL_STACK_ERROR
return(ret);
@@ -6827,7 +6827,7 @@ test_filespace_strategy_threshold(hid_t fapl_new)
/* Create file-creation template */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
FAIL_STACK_ERROR
-
+
/* Set default file space information */
if(H5Pset_file_space(fcpl, fs_type, fs_threshold) < 0)
FAIL_STACK_ERROR
@@ -6864,14 +6864,14 @@ test_filespace_strategy_threshold(hid_t fapl_new)
FAIL_STACK_ERROR
/* Retrieve the total amount of free space and # of free-space sections */
- if(f->shared->fs_man[type] &&
+ if(f->shared->fs_man[type] &&
H5FS_sect_stats(f->shared->fs_man[type], &saved_tot_space, &saved_tot_sect_count) < 0)
FAIL_STACK_ERROR
/* H5F_FILE_SPACE_AGGR_VFD and H5F_FILE_SPACE_VFD: should not have free-space manager */
if(fs_type > H5F_FILE_SPACE_ALL && f->shared->fs_man[type])
TEST_ERROR
-
+
/* Close the file */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -6904,7 +6904,7 @@ test_filespace_strategy_threshold(hid_t fapl_new)
TEST_ERROR
/* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */
- if(HADDR_UNDEF ==
+ if(HADDR_UNDEF ==
(tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5)))
FAIL_STACK_ERROR
@@ -6929,7 +6929,7 @@ test_filespace_strategy_threshold(hid_t fapl_new)
/* Closing */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if(H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
} /* end for fs_type */
@@ -6947,7 +6947,7 @@ error:
} /* test_filespace_strategy_threshold() */
/*
- * Verify section is merged/shrunk away for
+ * Verify section is merged/shrunk away for
* H5F_FILE_SPACE_ALL_PERSIST and H5F_FILE_SPACE_ALL strategy.
*/
static unsigned
@@ -7063,7 +7063,7 @@ test_filespace_gone(hid_t fapl_new)
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fcpl) < 0)
+ if(H5Pclose(fcpl) < 0)
FAIL_STACK_ERROR
} /* end for fs_type */
@@ -7100,7 +7100,7 @@ test_filespace_drivers(hid_t fapl)
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
TEST_ERROR
/* Test with old and new format */
@@ -7141,7 +7141,7 @@ test_filespace_drivers(hid_t fapl)
HDputs("Testing file space management with core driver");
/* create fapl to be a "core" file */
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
FAIL_STACK_ERROR
if(H5Pset_fapl_core(fapl_new, (size_t)CORE_INCREMENT, TRUE) < 0)
FAIL_STACK_ERROR
@@ -7183,7 +7183,7 @@ test_filespace_drivers(hid_t fapl)
MULTI_SETUP(memb_map, memb_fapl, memb_name, memb_addr, sv)
- if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
+ if((fapl_new = H5Pcopy(new_format?fapl2:fapl)) < 0)
TEST_ERROR
if(H5Pset_fapl_multi(fapl_new, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
@@ -7195,7 +7195,7 @@ test_filespace_drivers(hid_t fapl)
} /* end for new_format */
- if (H5Pclose(fapl2) < 0)
+ if (H5Pclose(fapl2) < 0)
FAIL_STACK_ERROR
return(ret);
@@ -7294,7 +7294,7 @@ main(void)
/* tests for file space management */
nerrors += test_filespace_drivers(fapl);
- if (H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
h5_cleanup(FILENAME, fapl);
diff --git a/test/mtime.c b/test/mtime.c
index 741f09a..cc04e42 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -23,6 +23,7 @@
* working properly.
*/
#include "h5test.h"
+#include "H5srcdir.h"
const char *FILENAME[] = {
"mtime",
@@ -131,14 +132,8 @@ main(void)
TESTING("accessing old modification time messages");
{
- char testfile[512]="";
- char *srcdir = HDgetenv("srcdir");
+ const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */
- if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE1) + 1) < sizeof(testfile))){
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, TESTFILE1);
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0)
@@ -167,14 +162,8 @@ main(void)
TESTING("accessing new modification time messages");
{
- char testfile[512]="";
- char *srcdir = HDgetenv("srcdir");
+ const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */
- if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE2) + 1) < sizeof(testfile))){
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, TESTFILE2);
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0)
diff --git a/test/ntypes.c b/test/ntypes.c
index 6efabc6..781dfef 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -2401,7 +2401,7 @@ test_refer_dtype2(hid_t file)
PASSED();
return 0;
-error:
+error:
/* Free memory buffers */
if(dwbuf)
HDfree(dwbuf);
@@ -2546,7 +2546,7 @@ test_bitfield_dtype(hid_t file)
if((space = H5Screate_simple(1, &nelmts, NULL)) < 0) TEST_ERROR;
/* Create and write to dataset1 with a unsigned char buffer */
- if((dset1 = H5Dcreate2(file, DSET1_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ if((dset1 = H5Dcreate2(file, DSET1_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT)) < 0) TEST_ERROR;
for(i = 0; i < BITFIELD_ENUMB*sizeof(int); i++)
@@ -2556,7 +2556,7 @@ test_bitfield_dtype(hid_t file)
if(H5Dclose(dset1) < 0) TEST_ERROR;
/* Create and write to dataset2 with a unsigned int buffer */
- if((dset2 = H5Dcreate2(file, DSET2_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
+ if((dset2 = H5Dcreate2(file, DSET2_BITFIELD_NAME, type, space, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT)) < 0) TEST_ERROR;
for(i = 0; i < BITFIELD_ENUMB; i++)
@@ -2587,7 +2587,7 @@ test_bitfield_dtype(hid_t file)
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %d\n", i);
- TEST_ERROR;
+ TEST_ERROR;
}
p++;
}
@@ -2612,14 +2612,14 @@ test_bitfield_dtype(hid_t file)
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %d\n", i);
- TEST_ERROR;
+ TEST_ERROR;
}
}
if(H5Tclose(dtype) < 0) TEST_ERROR;
if(H5Tclose(native_type) < 0) TEST_ERROR;
if(H5Dclose(dataset2) < 0) TEST_ERROR;
-
+
PASSED();
return 0;
diff --git a/test/objcopy.c b/test/objcopy.c
index 493274a..b8579a8 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -22,6 +22,7 @@
#include <time.h>
#include "h5test.h"
+#include "H5srcdir.h"
/*
* This file needs to access private information from the H5S package.
@@ -109,8 +110,11 @@ const char *FILENAME[] = {
#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
#define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple"
#define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple"
+#define NAME_LINK_EXTERN2 "/g_links2/external_link_to_dataset_simple"
#define NAME_LINK_SOFT_DANGLE "/g_links/soft_link_to_nowhere"
#define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
#define NAME_OLD_FORMAT "/dset1"
#define NAME_BUF_SIZE 1024
@@ -5297,21 +5301,32 @@ error:
* Friday, September 30, 2005
*
* Modifications:
+ * Neil Fortner
+ * Tuesday, February 16, 2010
+ * Modified test to test flags for expanding soft and external
+ * links.
*
*-------------------------------------------------------------------------
*/
static int
test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
+ hid_t did = -1, did2 = -1; /* Dataset ID */
hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plid = -1; /* Object copy plist ID */
hsize_t dim2d[2];
+ hsize_t dim1d[1];
+ H5L_info_t linfo;
int buf[DIM_SIZE_1][DIM_SIZE_2];
int i, j;
+ unsigned expand_soft;
+ unsigned expand_ext;
+ unsigned copy_options;
char src_filename[NAME_BUF_SIZE];
char dst_filename[NAME_BUF_SIZE];
+ char ext_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): group with links");
@@ -5323,6 +5338,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
+ h5_fixname(FILENAME[2], fapl, ext_filename, sizeof ext_filename);
/* Reset file address checking info */
addr_reset();
@@ -5330,11 +5346,16 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
- /* create group at the SRC file */
+ /* create file to hold external dataset */
+ if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
+
+ /* create groups at the SRC file. Group 2 will hold dangling links. */
if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((gid2 = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* attach attributes to the group */
+ /* attach attributes to the groups */
if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+ if(test_copy_attach_attributes(gid2, H5T_NATIVE_INT) < 0) TEST_ERROR
/* Set dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
@@ -5353,57 +5374,162 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
/* close the dataset */
if(H5Dclose(did) < 0) TEST_ERROR
+ /* Now create a 1-D dataset in an external file */
+ /* Set dataspace dimensions */
+ dim1d[0]=DIM_SIZE_2;
+
+ /* create dataspace */
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR
+
+ /* add a dataset to the external file */
+ if((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ /* close the dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
/* make a hard link to the dataset */
if(H5Lcreate_hard(fid_src, NAME_LINK_DATASET, H5L_SAME_LOC, NAME_LINK_HARD, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* make a soft link to the dataset */
if(H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- /* make a soft link to nowhere */
- if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* make an external link to the external dataset */
+ if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* make a dangling soft link */
+ if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* make a dangling external link */
- if(H5Lcreate_external("filename", "obj_name", fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- /* close the group */
+ /* close the groups */
if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
- /* close the SRC file */
+ /* close the SRC and EXT files */
if(H5Fclose(fid_src) < 0) TEST_ERROR
+ if(H5Fclose(fid_ext) < 0) TEST_ERROR
- /* open the source file with read-only */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ /* Create the object copy plist */
+ if((plid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
- /* create destination file */
- if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
+ /* Loop over all configurations (expand soft/external links) */
+ for(expand_soft=0; expand_soft<=1; expand_soft++) {
+ for(expand_ext=0; expand_ext<=1; expand_ext++) {
+ /* Set the correct copy options on the obj copy plist */
+ copy_options = 0;
+ if(expand_soft)
+ copy_options |= H5O_COPY_EXPAND_SOFT_LINK_FLAG;
+ if(expand_ext)
+ copy_options |= H5O_COPY_EXPAND_EXT_LINK_FLAG;
+ if(H5Pset_copy_object(plid, copy_options) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
- if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* open the source file with read-only */
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
- /* copy the group from SRC to DST */
- if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
- /* open the group for copy */
- if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* open the destination group */
- if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* copy the group from SRC to DST */
+ if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, plid, H5P_DEFAULT) < 0) TEST_ERROR
- /* Check if the groups are equal */
- if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+ /* open the group for copy */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* close the destination group */
- if(H5Gclose(gid2) < 0) TEST_ERROR
+ /* open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* close the source group */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* If expand_soft is set to true, verify that the soft link is now a
+ * hard link, and compare the expanded dataset, then delete it and
+ * re-add it as a soft link so compare_groups() works */
+ if(expand_soft) {
+ /* Check link type */
+ if(H5Lget_info(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.type != H5L_TYPE_HARD)
+ FAIL_PUTS_ERROR("Soft link was not expanded to a hard link")
- /* close the SRC file */
- if(H5Fclose(fid_src) < 0) TEST_ERROR
+ /* Compare datasets */
+ if((did = H5Dopen2(fid_src, NAME_LINK_DATASET, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did2 = H5Dopen2(fid_dst, NAME_LINK_SOFT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
- /* close the DST file */
- if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ /* Delete expanded dataset, add soft link */
+ if(H5Ldelete(fid_dst, NAME_LINK_SOFT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_soft(NAME_LINK_DATASET, fid_dst, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close datasets */
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
+ } /* end if */
+
+ /* If expand_ext is set to true, verify that the external link is
+ * now a hard link, and compare the expanded dataset, then delete it
+ * and re-add it as an external link so compare_groups() works */
+ if(expand_ext) {
+ /* Check link type */
+ if(H5Lget_info(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.type != H5L_TYPE_HARD)
+ FAIL_PUTS_ERROR("External link was not expanded to a hard link")
+
+ /* Compare datasets */
+ if((fid_ext = H5Fopen(ext_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((did = H5Dopen2(fid_ext, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did2 = H5Dopen2(fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(compare_datasets(did, did2, H5P_DEFAULT, NULL) != TRUE) TEST_ERROR
+
+ /* Delete expanded dataset, add external link */
+ if(H5Ldelete(fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_dst, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close datasets and external file */
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Fclose(fid_ext) < 0) TEST_ERROR
+ } /* end if */
+
+ /* Check if the groups are equal */
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+
+ /* close the destination group */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+
+ /* close the source group */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Now try to copy the group containing the dangling link. They
+ * should always be copied as the same type of link, never expanded
+ * to hard links. */
+ if(H5Ocopy(fid_src, NAME_GROUP_LINK2, fid_dst, NAME_GROUP_LINK2, plid, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Open the original and copied groups */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Compare the groups */
+ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR
+
+ /* Close groups */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ } /* end for */
+ } /* end for */
+
+ /* Close the object copy plist */
+ if(H5Pclose(plid) < 0) TEST_ERROR
PASSED();
return 0;
@@ -5411,11 +5537,14 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
error:
H5E_BEGIN_TRY {
H5Sclose(sid);
+ H5Dclose(did2);
H5Dclose(did);
H5Gclose(gid2);
H5Gclose(gid);
+ H5Fclose(fid_ext);
H5Fclose(fid_dst);
H5Fclose(fid_src);
+ H5Pclose(plid);
} H5E_END_TRY;
return 1;
} /* end test_copy_group_links */
@@ -5584,7 +5713,7 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
- h5_fixname(FILENAME[2], fapl, ext_filename, sizeof dst_filename);
+ h5_fixname(FILENAME[2], fapl, ext_filename, sizeof ext_filename);
/* Reset file address checking info */
addr_reset();
@@ -6016,19 +6145,11 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl)
{
hid_t fid_src = -1, fid_dst = -1; /* File IDs */
hid_t did = -1, did2 = -1; /* Dataset IDs */
- char *srcdir = HDgetenv("srcdir"); /* Where the src code is located */
- char src_filename[NAME_BUF_SIZE] = "";
+ const char *src_filename = H5_get_srcdir_filename(FILE_OLD_LAYOUT); /* Corrected test file name */
char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): dataset with old layout format");
- /* Generate correct name for source file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_OLD_LAYOUT) + 1) < sizeof(src_filename))) {
- HDstrcpy(src_filename, srcdir);
- HDstrcat(src_filename, "/");
- } /* end if */
- HDstrcat(src_filename, FILE_OLD_LAYOUT);
-
/* Initialize the destination filename */
h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
@@ -7317,7 +7438,7 @@ static int
test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl)
{
hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1; /* Datatype ID */
+ hid_t tid = -1; /* Datatype ID */
hid_t tid2 = -1; /* Datatype ID */
hid_t sid = -1; /* Dataspace ID */
hid_t did = -1; /* Dataset ID */
@@ -7747,7 +7868,7 @@ error:
static int
test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hbool_t crt_intermediate_grp, const char* test_desciption)
{
- hid_t fid_src = -1, fid_dst = -1; /* File IDs */
+ hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
hid_t sid = -1; /* Dataspace ID */
hid_t did = -1; /* Dataset ID */
hid_t gid=-1, gid2=-1, gid_ref=-1; /* Group IDs */
@@ -7838,6 +7959,45 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
} /* end if */
+ if((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) {
+ char ext_filename[NAME_BUF_SIZE];
+
+ h5_fixname(FILENAME[2], fapl, ext_filename, sizeof ext_filename);
+
+ /* Create the external file and dataset */
+ if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Fclose(fid_ext) < 0) TEST_ERROR
+
+ /* Create group to copy */
+ if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ } /* end if */
+ else
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create group to compare with */
+ if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ } /* end if */
+ else
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+ } /* end if */
+
if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
if((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -7898,12 +8058,14 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo
/* open the destination group */
if((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- } else if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ } else if(((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
+ || ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) {
if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) TEST_ERROR
- /* Unlink dataset to copy from original location */
- /* (So group comparison works properly) */
- if(H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
+ /* Unlink dataset to copy from original location */
+ /* (So group comparison works properly) */
+ if(H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* open the group for copy */
if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@@ -7972,6 +8134,7 @@ error:
H5Gclose(gid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
+ H5Fclose(fid_ext);
} H5E_END_TRY;
return 1;
} /* end test_copy_option */
@@ -8111,6 +8274,11 @@ main(void)
"H5Ocopy(): with missing groups");
nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG,
FALSE, "H5Ocopy(): expand soft link");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG,
+ FALSE, "H5Ocopy: expand external link");
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl,
+ H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG,
+ FALSE, "H5Ocopy: expand soft and external links");
nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG,
FALSE, "H5Ocopy(): shallow group copy");
nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG,
@@ -8154,7 +8322,6 @@ main(void)
}
/* TODO: not implemented
- nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Ocopy: expand external link");
nerrors += test_copy_mount(my_fapl);
*/
} /* end for */
diff --git a/test/ohdr.c b/test/ohdr.c
index f59dace..5bccf6e 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -17,7 +17,9 @@
* Tuesday, November 24, 1998
*/
#include "h5test.h"
+#include "H5srcdir.h"
#include "H5Iprivate.h"
+
/*
* This file needs to access private datatypes from the H5O package.
* This file also needs to access the object header testing code.
@@ -48,7 +50,7 @@ const char *FILENAME[] = {
* Create an object header with several continuation chunks
* Remove a message in the last chunk
* The remaining message(s) in the last chunk should be moved forward into the continuation message
- * The process will repeat when the continuation message is big enough to hold all the
+ * The process will repeat when the continuation message is big enough to hold all the
* messages in the last chunk.
* Result: the number of chunks should be reduced
*/
@@ -57,7 +59,7 @@ test_cont(char *filename, hid_t fapl)
{
hid_t file=-1;
H5F_t *f = NULL;
- H5O_hdr_info_t hdr_info;
+ H5O_hdr_info_t hdr_info;
H5O_loc_t oh_locA, oh_locB;
time_t time_new;
const char *short_name = "T";
@@ -181,7 +183,7 @@ main(void)
/* Display info about testing */
if(b)
HDputs("Using new file format:");
- else
+ else
HDputs("Using default file format:");
/* Set the format to use for the file */
@@ -362,20 +364,7 @@ main(void)
HDputs("Accessing objects with unknown header messages:");
{
hid_t file2; /* File ID for 'bogus' object file */
- char testpath[512] = "";
- char testfile[512] = "";
- char *srcdir = HDgetenv("srcdir");
-
- /* Build path to all test files */
- if(srcdir && ((HDstrlen(srcdir) + 2) < sizeof(testpath))) {
- HDstrcpy(testpath, srcdir);
- HDstrcat(testpath, "/");
- } /* end if */
-
- /* Build path to test file */
- if(srcdir && ((HDstrlen(testpath) + HDstrlen(FILE_BOGUS) + 1) < sizeof(testfile)))
- HDstrcpy(testfile, testpath);
- HDstrcat(testfile, FILE_BOGUS);
+ const char *testfile = H5_get_srcdir_filename(FILE_BOGUS);
TESTING("object with unknown header message and no flags set");
diff --git a/test/set_extent.c b/test/set_extent.c
index b4e61b4..9d669a2 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -20,6 +20,8 @@
* Purpose: Tests the H5Dset_extent call
*/
+#include <time.h>
+#include <stdlib.h>
#include "hdf5.h"
#include "h5test.h"
@@ -36,6 +38,7 @@ const char *FILENAME[] = {
"set_extent3",
"set_extent4",
"set_extent5",
+ "set_extent6",
NULL
};
@@ -43,6 +46,22 @@ const char *FILENAME[] = {
#define EXT_FILE_NAME1 "ext1.bin"
#define EXT_FILE_NAME2 "ext2.bin"
+#define CONFIG_COMPRESS 0x01u
+#define CONFIG_FILL 0x02u
+#define CONFIG_EARLY_ALLOC 0x04u
+#define CONFIG_ALL (CONFIG_COMPRESS + CONFIG_FILL \
+ + CONFIG_EARLY_ALLOC)
+#define FILL_VALUE -1
+#define DO_RANKS_PRINT_CONFIG(TEST) { \
+ printf(" Config:\n"); \
+ printf(" Test: %s\n", TEST); \
+ printf(" Compression: %s\n", (config & CONFIG_COMPRESS ? "yes" \
+ : "no")); \
+ printf(" Fill value: %s\n", (do_fillvalue ? "yes" : "no")); \
+ printf(" Early allocation: %s\n", (config & CONFIG_EARLY_ALLOC \
+ ? "yes" : "no")); \
+} /* end DO_RANKS_PRINT_CONFIG */
+
#define RANK1 1
#define RANK2 2
#define RANK3 3
@@ -56,28 +75,36 @@ const char *FILENAME[] = {
#define DIME1 7
#define DIME2 7
#define ISTORE_IK 64
+#define RAND4_NITER 100
+#define RAND4_FAIL_DUMP(NDIM_SETS, J, K, L, M) { \
+ H5_FAILED(); AT(); \
+ test_random_rank4_dump(NDIM_SETS, dim_log, cdims, J, K, L, M); \
+ goto error; \
+} /* end RAND4_FAIL_DUMP */
static int do_ranks( hid_t fapl );
static int do_layouts( hid_t fapl );
-static int test_rank1( hbool_t do_compress,
- hbool_t do_fill_value,
- hbool_t set_istore_k,
- H5D_fill_time_t fill_time,
- hid_t fapl);
-static int test_rank2( hbool_t do_compress,
- hbool_t do_fill_value,
- hbool_t set_istore_k,
- H5D_fill_time_t fill_time,
- hid_t fapl);
-static int test_rank3( hbool_t do_compress,
- hbool_t do_fill_value,
- hbool_t set_istore_k,
- H5D_fill_time_t fill_time,
- hid_t fapl);
+static int test_rank1( hid_t fapl,
+ hid_t dcpl,
+ hbool_t do_fill_value,
+ hbool_t set_istore_k);
+static int test_rank2( hid_t fapl,
+ hid_t dcpl,
+ hbool_t do_fill_value,
+ hbool_t set_istore_k);
+static int test_rank3( hid_t fapl,
+ hid_t dcpl,
+ hbool_t do_fill_value,
+ hbool_t set_istore_k);
+static int test_random_rank4( hid_t fapl,
+ hid_t dcpl,
+ hbool_t do_fillvalue);
static int test_external( hid_t fapl );
static int test_layouts( H5D_layout_t layout, hid_t fapl );
+static void test_random_rank4_dump( unsigned ndim_sets, hsize_t dim_log[][4],
+ hsize_t cdims[4], int j, int k, int l, int m );
/*-------------------------------------------------------------------------
* main
@@ -92,6 +119,9 @@ int main( void )
hbool_t chunk_cache; /* Whether to enable chunk caching */
int nerrors = 0;
+ /* Initialize random number seed */
+ HDsrandom((unsigned)HDtime(NULL));
+
h5_reset();
fapl = h5_fileaccess();
@@ -152,7 +182,7 @@ int main( void )
if(H5Pclose(fapl2) < 0) TEST_ERROR
h5_cleanup(FILENAME, fapl);
-
+
HDremove(EXT_FILE_NAME1);
HDremove(EXT_FILE_NAME2);
@@ -177,148 +207,140 @@ error:
static int do_ranks( hid_t fapl )
{
- hbool_t do_compress = 0;
- hbool_t do_fillvalue = 0;
- hbool_t set_istore_k = 0;
-
-
- TESTING_2("with fill value, no compression");
-
- do_fillvalue = 1;
+ hbool_t do_fillvalue = 0;
+ hid_t dcpl = -1;
+ int fillvalue = FILL_VALUE;
+ unsigned config;
- if (test_rank1( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ALLOC, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank1( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_IFSET, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank2( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ALLOC, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank2( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_IFSET, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank3( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ALLOC, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank3( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_IFSET, fapl ) < 0)
- {
- goto error;
- }
-
-
-
- PASSED();
-
-
- TESTING_2("no fill value, no compression");
-
- do_fillvalue = 0;
-
- if (test_rank1( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ERROR, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank2( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ERROR, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank3( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ERROR, fapl ) < 0)
- {
- goto error;
- }
-
-
+ TESTING_2("datasets with ranks 1 to 4 (all configurations)");
- PASSED();
-
- TESTING_2("with fill value, with compression");
+ /* Loop over different configurations for tests */
+ for(config=0; config<=CONFIG_ALL; config++) {
+ /* Create DCPL and add appropriate settings */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(config & CONFIG_COMPRESS) {
#ifdef H5_HAVE_FILTER_DEFLATE
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ TEST_ERROR
+#else /* H5_HAVE_FILTER_DEFLATE */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ continue;
+#endif /* H5_HAVE_FILTER_DEFLATE */
+ } /* end if */
- do_compress = 1;
- do_fillvalue = 1;
-
- if (test_rank1( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ALLOC, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank1( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_IFSET, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank2( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ALLOC, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank2( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_IFSET, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank3( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ALLOC, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank3( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_IFSET, fapl ) < 0)
- {
- goto error;
- }
-
-
- PASSED();
-#else
- SKIPPED();
-#endif
-
- TESTING_2("no fill value, with compression");
+ if(config & CONFIG_FILL) {
+ do_fillvalue = TRUE;
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
+ TEST_ERROR
+ } /* end if */
+ else
+ do_fillvalue = FALSE;
-#ifdef H5_HAVE_FILTER_DEFLATE
+ if(config & CONFIG_EARLY_ALLOC)
+ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
- do_fillvalue = 0;
+ /* Run tests */
+ if(do_fillvalue) {
+ unsigned ifset;
+
+ /* Iterate over different fill times */
+ for(ifset=0; ifset<=1; ifset++) {
+ if(ifset) {
+ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ TEST_ERROR
+
+ if(test_rank1(fapl, dcpl, do_fillvalue, FALSE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 1")
+ printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
+ : "H5D_FILL_TIME_ALLOC"));
+ goto error;
+ } /* end if */
+ if(test_rank2(fapl, dcpl, do_fillvalue, FALSE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 2")
+ printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
+ : "H5D_FILL_TIME_ALLOC"));
+ goto error;
+ } /* end if */
+ if(test_rank3(fapl, dcpl, do_fillvalue, FALSE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 3")
+ printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
+ : "H5D_FILL_TIME_ALLOC"));
+ goto error;
+ } /* end if */
+ if(test_rank2(fapl, dcpl, do_fillvalue, TRUE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree")
+ printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET"
+ : "H5D_FILL_TIME_ALLOC"));
+ goto error;
+ } /* end if */
+ } /* end for */
+ } /* end if */
+ else {
+ /* These tests expect fill values to be written even if there is no
+ * fill value defined */
+ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
+ TEST_ERROR
- if (test_rank1( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ERROR, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank2( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ERROR, fapl ) < 0)
- {
- goto error;
- }
- if (test_rank3( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ERROR, fapl ) < 0)
- {
- goto error;
- }
-
- PASSED();
-#else
- SKIPPED();
-#endif
+ if(test_rank1(fapl, dcpl, do_fillvalue, FALSE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 1")
+ goto error;
+ } /* end if */
+ if(test_rank2(fapl, dcpl, do_fillvalue, FALSE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 2")
+ goto error;
+ } /* end if */
+ if(test_rank3(fapl, dcpl, do_fillvalue, FALSE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 3")
+ goto error;
+ } /* end if */
+ if(test_rank2(fapl, dcpl, do_fillvalue, TRUE) < 0)
+ {
+ DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree")
+ goto error;
+ } /* end if */
+ } /* end else */
- TESTING_2("with non-default indexed storage B-tree");
+ /* The rank 4 test expects the fill value to be written only if
+ * defined */
+ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
+ TEST_ERROR
- do_fillvalue = 1;
- set_istore_k = 1;
+ if(test_random_rank4(fapl, dcpl, do_fillvalue) < 0) {
+ DO_RANKS_PRINT_CONFIG("Randomized rank 4")
+ goto error;
+ } /* end if */
- if (test_rank2( do_compress, do_fillvalue, set_istore_k, H5D_FILL_TIME_ALLOC, fapl ) < 0)
- {
- goto error;
- }
-
+ /* Close dcpl */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ } /* end for */
PASSED();
-
-
+
return 0;
-
-
+
error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ } H5E_END_TRY
+
return -1;
-}
+} /* end do_ranks */
/*-------------------------------------------------------------------------
@@ -327,23 +349,23 @@ error:
*/
static int do_layouts( hid_t fapl )
{
-
- TESTING_2("storage layout use");
-
+
+ TESTING("storage layout use");
+
if (test_layouts( H5D_COMPACT, fapl ) < 0)
{
goto error;
- }
-
+ }
+
if (test_layouts( H5D_CONTIGUOUS, fapl ) < 0)
{
goto error;
- }
-
+ }
+
PASSED();
-
+
return 0;
-
+
error:
return -1;
}
@@ -353,270 +375,240 @@ error:
*-------------------------------------------------------------------------
*/
-static int test_rank1( hbool_t do_compress,
- hbool_t do_fill_value,
- hbool_t set_istore_k,
- H5D_fill_time_t fill_time,
- hid_t fapl)
+static int test_rank1( hid_t fapl,
+ hid_t dcpl,
+ hbool_t do_fill_value,
+ hbool_t set_istore_k)
{
- hid_t fid=-1;
+ hid_t fid=-1;
hid_t did=-1;
hid_t sid=-1;
- hid_t dcpl=-1;
+ hid_t my_dcpl=-1;
hid_t fcpl;
- hsize_t dims_o[RANK1] = {DIM0}; /* original dimensions */
- hsize_t dims_s[RANK1] = {DIMS0}; /* shrinking dimensions */
- hsize_t dims_e[RANK1] = {DIME0}; /* extended dimensions */
- hsize_t dims_c[RANK1] = {2}; /* chunk dimensions */
- hsize_t dims_r[RANK1]; /* read dimensions */
+ hsize_t dims_o[RANK1] = {DIM0}; /* original dimensions */
+ hsize_t dims_s[RANK1] = {DIMS0}; /* shrinking dimensions */
+ hsize_t dims_e[RANK1] = {DIME0}; /* extended dimensions */
+ hsize_t dims_c[RANK1] = {2}; /* chunk dimensions */
+ hsize_t dims_r[RANK1]; /* read dimensions */
hsize_t maxdims[RANK1] = {H5S_UNLIMITED};
int buf_o[DIM0];
int buf_s[DIMS0];
int buf_e[DIME0];
int buf_r[DIM0];
int i;
- int fillvalue = 1;
- int comp_value;
+ int comp_value;
char filename[NAME_BUF_SIZE];
-
+
if ( do_fill_value )
{
- comp_value = fillvalue;
+ comp_value = FILL_VALUE;
}
else
{
comp_value = 0;
}
-
+
for( i = 0; i < DIM0; i++ )
{
-
+
buf_o[i] = 2;
}
/* create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if ( set_istore_k )
{
/* set non-default indexed storage B-tree internal 'K' value */
- if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
+ if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
}
/* create a new file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
- goto error;
+ TEST_ERROR
}
/* close property list */
- if(H5Pclose(fcpl) < 0)
+ if(H5Pclose(fcpl) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* create the data space with unlimited dimensions. */
- if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
+ if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* modify dataset creation properties, i.e. enable chunking. */
- if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ if ((my_dcpl = H5Pcopy (dcpl)) < 0)
{
- goto error;
+ TEST_ERROR
}
- if (H5Pset_chunk(dcpl, RANK1, dims_c) < 0)
+ if (H5Pset_chunk(my_dcpl, RANK1, dims_c) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ( do_fill_value )
- {
- if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
- {
- goto error;
- }
- if(H5Pset_fill_time(dcpl, fill_time) < 0)
- {
- goto error;
- }
- }
- else
- {
-
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
- {
- goto error;
- }
-
- }
- if (do_compress)
- {
- if(H5Pset_deflate(dcpl, 9) < 0)
- {
- goto error;
- }
- }
-
/*-------------------------------------------------------------------------
* create, write dataset
*-------------------------------------------------------------------------
*/
-
+
/* create a dataset */
- if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* write */
- if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
+ if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
#if defined (H5_SET_EXTENT_DEBUG)
printf("\n");
for (i = 0; i < (int)dims_o[0]; i++ )
{
-
+
printf("%d ", buf_o[i]);
-
+
}
printf("\n");
-#endif
+#endif
+
-
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/*-------------------------------------------------------------------------
* set new dimensions for the array; expand it
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_e) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
/* check dimensions */
for( i = 0; i < RANK1; i++ )
{
- if (dims_r[i] != dims_e[i])
- goto error;
+ if (dims_r[i] != dims_e[i])
+ TEST_ERROR
}
-
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
- goto error;
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
+ TEST_ERROR
+
+
-
-
#if defined (H5_SET_EXTENT_DEBUG)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
{
-
+
printf("%d ", buf_e[i]);
-
+
}
printf("\n");
-#endif
+#endif
+
+
+
-
-
-
/* compare the read array with the expanded array */
for (i = 0; i < (int)dims_r[0]; i++ )
{
-
- if ( i >= DIM0 )
+
+ if ( i >= DIM0 )
{
- if(buf_e[i] != comp_value)
+ if(buf_e[i] != comp_value)
{
printf("buf_e[%d] = %d\n", i, buf_e[i]);
printf("value = %d\n", comp_value);
- goto error;
- }
- }
- else
+ TEST_ERROR
+ }
+ }
+ else
{
- if(buf_e[i] != buf_o[i])
- goto error;
+ if(buf_e[i] != buf_o[i])
+ TEST_ERROR
}
}
-
-
-
-
+
+
+
+
/*-------------------------------------------------------------------------
- * shrink
+ * shrink
*
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_s) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK1; i++ )
{
- if (dims_r[i] != dims_s[i])
- goto error;
+ if (dims_r[i] != dims_s[i])
+ TEST_ERROR
}
@@ -624,143 +616,143 @@ static int test_rank1( hbool_t do_compress,
/* for this case we close and reopen file */
if ( set_istore_k )
{
-
- if (H5Dclose(did) < 0)
+
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Fclose(fid) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
+ if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
{
- goto error;
+ TEST_ERROR
}
-
- if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
+
+ if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
{
- goto error;
+ TEST_ERROR
}
-
-
-
+
+
+
}
-
-
+
+
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
*/
-
+
/* read */
- if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
+ if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
#if defined (H5_SET_EXTENT_DEBUG)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
{
-
+
printf("%d ", buf_s[i]);
}
printf("\n");
-#endif
+#endif
+
+
-
-
/* compare the read array with the shrinked array */
for( i = 0; i < (int)dims_r[0]; i++ )
{
-
- if ( buf_s[i] != buf_o[i] )
+
+ if ( buf_s[i] != buf_o[i] )
{
printf("buf_s[%d] = %d\n", i, buf_s[i]);
printf("buf_o[%d] = %d\n", i, buf_o[i]);
- goto error;
- }
+ TEST_ERROR
+ }
}
-
-
+
+
/*-------------------------------------------------------------------------
* expand it back to original size
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array */
if (H5Dset_extent(did, dims_o) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
- if ((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions. */
if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
/* check dimensions */
for( i = 0; i < RANK1; i++ )
{
- if (dims_r[i] != dims_o[i])
- goto error;
+ if (dims_r[i] != dims_o[i])
+ TEST_ERROR
}
-
-
+
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
- goto error;
-
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
+ TEST_ERROR
+
#if defined (H5_SET_EXTENT_DEBUG)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
{
-
+
printf("%d ", buf_r[i]);
-
+
}
printf("\n");
-#endif
+#endif
+
-
/* compare the read array with the original array */
for (i = 0; i < (int)dims_r[0]; i++ )
{
-
- if (i >= DIMS0 )
+
+ if (i >= DIMS0 )
{
- if(buf_r[i] != comp_value)
+ if(buf_r[i] != comp_value)
{
printf("buf_r[%d] = %d\n", i, buf_r[i] );
printf("value = %d\n", comp_value);
- goto error;
- }
- }
- else
+ TEST_ERROR
+ }
+ }
+ else
{
- if(buf_r[i] != buf_o[i])
- goto error;
+ if(buf_r[i] != buf_o[i])
+ TEST_ERROR
}
}
-
+
/*-------------------------------------------------------------------------
* shrink to 0
@@ -769,119 +761,119 @@ static int test_rank1( hbool_t do_compress,
*/
dims_s[0] = 0;
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_s) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK1; i++ )
{
- if (dims_r[i] != dims_s[i])
- goto error;
- }
-
+ if (dims_r[i] != dims_s[i])
+ TEST_ERROR
+ }
+
/*-------------------------------------------------------------------------
* close dataset
*-------------------------------------------------------------------------
*/
-
- if (H5Dclose(did) < 0)
+
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
-
-
-
+
+
+
+
+
/*-------------------------------------------------------------------------
* test a dataset with non initialized chunks
*-------------------------------------------------------------------------
*/
-
-
- if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
+
+
+ if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
{
- goto error;
+ TEST_ERROR
}
/* set new dimensions for the array */
dims_o[ 0 ] = 0;
- if (H5Dset_extent( did , dims_o ) < 0)
+ if (H5Dset_extent( did , dims_o ) < 0)
{
- goto error;
+ TEST_ERROR
}
- if (H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
-
+
+
+
/*-------------------------------------------------------------------------
* close property list
*-------------------------------------------------------------------------
*/
-
-
- if (H5Pclose(dcpl) < 0)
+
+
+ if (H5Pclose(my_dcpl) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Fclose( fid ) < 0)
{
- goto error;
+ TEST_ERROR
}
return 0;
-
-
-
+
+
+
error:
-
- H5E_BEGIN_TRY
+
+ H5E_BEGIN_TRY
{
H5Dclose( did );
H5Sclose( sid );
- H5Pclose( dcpl );
+ H5Pclose( my_dcpl );
H5Pclose( fcpl );
H5Fclose( fid );
} H5E_END_TRY;
return -1;
-
+
}
/*-------------------------------------------------------------------------
@@ -889,43 +881,41 @@ error:
*-------------------------------------------------------------------------
*/
-static int test_rank2( hbool_t do_compress,
- hbool_t do_fill_value,
- hbool_t set_istore_k,
- H5D_fill_time_t fill_time,
- hid_t fapl)
+static int test_rank2( hid_t fapl,
+ hid_t dcpl,
+ hbool_t do_fill_value,
+ hbool_t set_istore_k)
{
- hid_t fid=-1;
+ hid_t fid=-1;
hid_t did=-1;
hid_t sid=-1;
- hid_t dcpl=-1;
+ hid_t my_dcpl=-1;
hid_t fcpl;
- hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */
- hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */
- hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */
- hsize_t dims_c[RANK2] = {2,2}; /* chunk dimensions */
- hsize_t dims_r[RANK2]; /* read dimensions */
+ hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */
+ hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */
+ hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */
+ hsize_t dims_c[RANK2] = {2,2}; /* chunk dimensions */
+ hsize_t dims_r[RANK2]; /* read dimensions */
hsize_t maxdims[RANK2] = {H5S_UNLIMITED,H5S_UNLIMITED};
int buf_o[DIM0][DIM1];
int buf_s[DIMS0][DIMS1];
int buf_e[DIME0][DIME1];
int buf_r[DIM0][DIM1];
int i, j;
- int fillvalue = 1;
- int comp_value;
+ int comp_value;
char filename[NAME_BUF_SIZE];
-
+
if ( do_fill_value )
{
- comp_value = fillvalue;
+ comp_value = FILL_VALUE;
}
else
{
comp_value = 0;
}
-
+
for( i = 0; i < DIM0; i++ )
{
for( j = 0; j < DIM1; j++ )
@@ -935,79 +925,51 @@ static int test_rank2( hbool_t do_compress,
}
/* create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if ( set_istore_k )
{
/* set non-default indexed storage B-tree internal 'K' value */
- if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
+ if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
}
-
+
/* create a new file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
/* create the data space with unlimited dimensions. */
- if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
+ if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* modify dataset creation properties, i.e. enable chunking. */
- if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ if ((my_dcpl = H5Pcopy (dcpl)) < 0)
{
- goto error;
+ TEST_ERROR
}
- if (H5Pset_chunk(dcpl, RANK2, dims_c) < 0)
+ if (H5Pset_chunk(my_dcpl, RANK2, dims_c) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ( do_fill_value )
- {
- if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
- {
- goto error;
- }
- if(H5Pset_fill_time(dcpl, fill_time) < 0)
- {
- goto error;
- }
- }
- else
- {
-
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
- {
- goto error;
- }
-
- }
- if (do_compress)
- {
- if(H5Pset_deflate(dcpl, 9) < 0)
- {
- goto error;
- }
- }
-
/*-------------------------------------------------------------------------
* Procedure 1
* a. Write an array AxB. These are the dimensions for creating the dataset
* b. Define a greater array CxD where C > A and D > B
- * c. Read data back
+ * c. Read data back
* d. Verify if new dimensions are C and D
* e. Verify if data from A to C and B to D is what it is to be expected
*
@@ -1020,20 +982,20 @@ static int test_rank2( hbool_t do_compress,
*
*-------------------------------------------------------------------------
*/
-
+
/* create a dataset */
- if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* write */
- if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
+ if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
#if defined (H5_SET_EXTENT_DEBUG2)
printf("\n");
for (i = 0; i < (int)dims_o[0]; i++ )
@@ -1044,15 +1006,15 @@ static int test_rank2( hbool_t do_compress,
}
printf("\n");
}
-#endif
+#endif
+
-
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/*-------------------------------------------------------------------------
* set new dimensions for the array; expand it
* data is now, extended space was initialized with fill value or default value
@@ -1067,44 +1029,44 @@ static int test_rank2( hbool_t do_compress,
*
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_e) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_e[i])
- goto error;
+ if (dims_r[i] != dims_e[i])
+ TEST_ERROR
}
-
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
- goto error;
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
+ TEST_ERROR
+
+
-
-
#if defined (H5_SET_EXTENT_DEBUG2)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -1115,41 +1077,41 @@ static int test_rank2( hbool_t do_compress,
}
printf("\n");
}
-#endif
+#endif
+
+
+
-
-
-
/* compare the read array with the expanded array */
for (i = 0; i < (int)dims_r[0]; i++ )
{
for (j = 0; j < (int)dims_r[1]; j++ )
{
- if ( i >= DIM0 || j >= DIM1 )
+ if ( i >= DIM0 || j >= DIM1 )
{
- if(buf_e[i][j] != comp_value)
+ if(buf_e[i][j] != comp_value)
{
printf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]);
printf("value = %d\n", comp_value);
- goto error;
- }
- }
- else
+ TEST_ERROR
+ }
+ }
+ else
{
- if(buf_e[i][j] != buf_o[i][j])
- goto error;
+ if(buf_e[i][j] != buf_o[i][j])
+ TEST_ERROR
}
}
}
-
-
-
-
+
+
+
+
/*-------------------------------------------------------------------------
*
* Procedure 2
* a. Define a smaller array ExF where E < A and F < B
- * b. Read data back
+ * b. Read data back
* c. Verify if new dimensions are E and F
* d. Verify if data up until E and F is what to be expected
*
@@ -1160,35 +1122,35 @@ static int test_rank2( hbool_t do_compress,
*
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_s) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_s[i])
- goto error;
+ if (dims_r[i] != dims_s[i])
+ TEST_ERROR
}
@@ -1196,42 +1158,42 @@ static int test_rank2( hbool_t do_compress,
/* for this case we close and reopen file */
if ( set_istore_k )
{
-
- if (H5Dclose(did) < 0)
+
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Fclose(fid) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
+ if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
{
- goto error;
+ TEST_ERROR
}
-
- if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
+
+ if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
{
- goto error;
+ TEST_ERROR
}
-
-
-
+
+
+
}
-
-
+
+
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
*/
-
+
/* read */
- if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
+ if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
#if defined (H5_SET_EXTENT_DEBUG2)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -1242,26 +1204,26 @@ static int test_rank2( hbool_t do_compress,
}
printf("\n");
}
-#endif
+#endif
+
+
-
-
/* compare the read array with the shrinked array */
for( i = 0; i < (int)dims_r[0]; i++ )
{
for( j = 0; j < (int)dims_r[1]; j++ )
{
- if ( buf_s[i][j] != buf_o[i][j] )
+ if ( buf_s[i][j] != buf_o[i][j] )
{
printf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]);
printf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]);
- goto error;
- }
+ TEST_ERROR
+ }
}
}
-
-
+
+
/*-------------------------------------------------------------------------
* set new dimensions for the array; expand it back to original size
* data is now, extended space was initialized with fill value or default value
@@ -1273,47 +1235,47 @@ static int test_rank2( hbool_t do_compress,
*
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array */
if (H5Dset_extent(did, dims_o) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
- if ((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions. */
if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_o[i])
- goto error;
+ if (dims_r[i] != dims_o[i])
+ TEST_ERROR
}
-
-
+
+
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
*/
-
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
- goto error;
-
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
+ TEST_ERROR
+
#if defined (H5_SET_EXTENT_DEBUG2)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -1324,28 +1286,28 @@ static int test_rank2( hbool_t do_compress,
}
printf("\n");
}
-#endif
+#endif
+
-
/* compare the read array with the original array */
for (i = 0; i < (int)dims_r[0]; i++ )
{
for (j = 0; j < (int)dims_r[1]; j++ )
{
- if (i >= DIMS0 || j >= DIMS1)
+ if (i >= DIMS0 || j >= DIMS1)
{
- if(buf_r[i][j] != comp_value)
+ if(buf_r[i][j] != comp_value)
{
printf("buf_r[%d][%d] = %d\n", i, j, buf_r[i][j]);
printf("value = %d\n", comp_value);
- goto error;
- }
- }
- else
+ TEST_ERROR
+ }
+ }
+ else
{
- if(buf_r[i][j] != buf_o[i][j])
- goto error;
+ if(buf_r[i][j] != buf_o[i][j])
+ TEST_ERROR
}
}
}
@@ -1358,124 +1320,172 @@ static int test_rank2( hbool_t do_compress,
dims_s[0] = 0;
dims_s[1] = 0;
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_s) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_s[i])
- goto error;
- }
-
-
+ if (dims_r[i] != dims_s[i])
+ TEST_ERROR
+ }
+
+
/*-------------------------------------------------------------------------
- * close dataset
+ * expand then shrink to 0 in dimension 1 while expanding again in
+ * dimension 0
+ *
*-------------------------------------------------------------------------
*/
-
- if (H5Dclose(did) < 0)
+
+
+ /* expand to original dimensions for the array. */
+ if (H5Dset_extent(did , dims_o) < 0)
{
- goto error;
+ TEST_ERROR
+ }
+
+ dims_s[0] = dims_e[0];
+ dims_s[1] = 0;
+
+ /* set new dimensions for the array. */
+ if (H5Dset_extent(did , dims_s) < 0)
+ {
+ TEST_ERROR
+ }
+
+ /* get the space */
+ if ((sid = H5Dget_space(did)) < 0)
+ {
+ TEST_ERROR
+ }
+
+ /* get dimensions */
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ {
+ TEST_ERROR
+ }
+
+ if (H5Sclose(sid) < 0)
+ {
+ TEST_ERROR
}
-
-
+
+ /* check dimensions */
+ for( i = 0; i < RANK2; i++ )
+ {
+ if (dims_r[i] != dims_s[i])
+ TEST_ERROR
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * close dataset
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Dclose(did) < 0)
+ {
+ TEST_ERROR
+ }
+
+
/*-------------------------------------------------------------------------
* test a dataset with non initialized chunks
*-------------------------------------------------------------------------
*/
-
-
- if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
+
+
+ if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
{
- goto error;
+ TEST_ERROR
}
/* set new dimensions for the array */
dims_o[ 0 ] = 0;
dims_o[ 1 ] = 0;
- if (H5Dset_extent( did , dims_o ) < 0)
+ if (H5Dset_extent( did , dims_o ) < 0)
{
- goto error;
+ TEST_ERROR
}
- if (H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
-
+
+
+
/*-------------------------------------------------------------------------
* close property list
*-------------------------------------------------------------------------
*/
-
-
- if (H5Pclose(dcpl) < 0)
+
+
+ if (H5Pclose(my_dcpl) < 0)
{
- goto error;
+ TEST_ERROR
}
/* close file creation property list */
- if(H5Pclose(fcpl) < 0)
+ if(H5Pclose(fcpl) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Fclose( fid ) < 0)
{
- goto error;
+ TEST_ERROR
}
return 0;
-
-
-
+
+
+
error:
-
- H5E_BEGIN_TRY
+
+ H5E_BEGIN_TRY
{
H5Dclose( did );
H5Sclose( sid );
- H5Pclose( dcpl );
+ H5Pclose( my_dcpl );
H5Pclose( fcpl );
H5Fclose( fid );
} H5E_END_TRY;
return -1;
-
+
}
@@ -1486,43 +1496,41 @@ error:
*-------------------------------------------------------------------------
*/
-static int test_rank3( hbool_t do_compress,
- hbool_t do_fill_value,
- hbool_t set_istore_k,
- H5D_fill_time_t fill_time,
- hid_t fapl)
+static int test_rank3( hid_t fapl,
+ hid_t dcpl,
+ hbool_t do_fill_value,
+ hbool_t set_istore_k)
{
- hid_t fid=-1;
+ hid_t fid=-1;
hid_t did=-1;
hid_t sid=-1;
- hid_t dcpl=-1;
+ hid_t my_dcpl=-1;
hid_t fcpl;
- hsize_t dims_o[RANK3] = {DIM0,DIM1,DIM2}; /* original dimensions */
- hsize_t dims_s[RANK3] = {DIMS0,DIMS1,DIMS2}; /* shrinking dimensions */
- hsize_t dims_e[RANK3] = {DIME0,DIME1,DIME2}; /* extended dimensions */
- hsize_t dims_c[RANK3] = {2,2,2}; /* chunk dimensions */
- hsize_t dims_r[RANK3]; /* read dimensions */
+ hsize_t dims_o[RANK3] = {DIM0,DIM1,DIM2}; /* original dimensions */
+ hsize_t dims_s[RANK3] = {DIMS0,DIMS1,DIMS2}; /* shrinking dimensions */
+ hsize_t dims_e[RANK3] = {DIME0,DIME1,DIME2}; /* extended dimensions */
+ hsize_t dims_c[RANK3] = {2,2,2}; /* chunk dimensions */
+ hsize_t dims_r[RANK3]; /* read dimensions */
hsize_t maxdims[RANK3] = {H5S_UNLIMITED,H5S_UNLIMITED,H5S_UNLIMITED};
int buf_o[DIM0][DIM1][DIM2];
int buf_s[DIMS0][DIMS1][DIMS2];
int buf_e[DIME0][DIME1][DIME2];
int buf_r[DIM0][DIM1][DIM2];
int i, j, k;
- int fillvalue = 1;
- int comp_value;
+ int comp_value;
char filename[NAME_BUF_SIZE];
-
+
if ( do_fill_value )
{
- comp_value = fillvalue;
+ comp_value = FILL_VALUE;
}
else
{
comp_value = 0;
}
-
+
for( i = 0; i < DIM0; i++ )
{
for( j = 0; j < DIM1; j++ )
@@ -1535,95 +1543,67 @@ static int test_rank3( hbool_t do_compress,
}
/* create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if ( set_istore_k )
{
/* set non-default indexed storage B-tree internal 'K' value */
- if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
+ if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
}
/* create a new file */
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
- if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
- goto error;
+ TEST_ERROR
}
/* close property list */
- if(H5Pclose(fcpl) < 0)
+ if(H5Pclose(fcpl) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* create the data space with unlimited dimensions. */
- if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0)
+ if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* modify dataset creation properties, i.e. enable chunking. */
- if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ if ((my_dcpl = H5Pcopy (dcpl)) < 0)
{
- goto error;
+ TEST_ERROR
}
- if (H5Pset_chunk(dcpl, RANK3, dims_c) < 0)
+ if (H5Pset_chunk(my_dcpl, RANK3, dims_c) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ( do_fill_value )
- {
- if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
- {
- goto error;
- }
- if(H5Pset_fill_time(dcpl, fill_time) < 0)
- {
- goto error;
- }
- }
- else
- {
-
- if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
- {
- goto error;
- }
-
- }
- if (do_compress)
- {
- if(H5Pset_deflate(dcpl, 9) < 0)
- {
- goto error;
- }
- }
-
/*-------------------------------------------------------------------------
* create, write array
*-------------------------------------------------------------------------
*/
-
+
/* create a dataset */
- if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* write */
- if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
+ if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
#if defined (H5_SET_EXTENT_DEBUG3)
printf("\n");
for (i = 0; i < (int)dims_o[0]; i++ )
@@ -1637,61 +1617,61 @@ static int test_rank3( hbool_t do_compress,
printf("[%d] ", j);
}
printf("\n");
-
+
}
printf("\n");
-#endif
+#endif
+
-
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/*-------------------------------------------------------------------------
* set new dimensions for the array; expand it
*
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_e) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
/* check dimensions */
for( i = 0; i < RANK3; i++ )
{
- if (dims_r[i] != dims_e[i])
- goto error;
+ if (dims_r[i] != dims_e[i])
+ TEST_ERROR
}
-
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
- goto error;
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
+ TEST_ERROR
+
+
-
-
#if defined (H5_SET_EXTENT_DEBUG3)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -1705,14 +1685,14 @@ static int test_rank3( hbool_t do_compress,
printf("[%d] ", j);
}
printf("\n");
-
+
}
printf("\n");
-#endif
+#endif
+
+
+
-
-
-
/* compare the read array with the expanded array */
for (i = 0; i < (int)dims_r[0]; i++ )
{
@@ -1720,60 +1700,60 @@ static int test_rank3( hbool_t do_compress,
{
for( k = 0; k < (int)dims_r[2]; k++ )
{
- if ( i >= DIM0 || j >= DIM1 || k >= DIM2 )
+ if ( i >= DIM0 || j >= DIM1 || k >= DIM2 )
{
- if(buf_e[i][j][k] != comp_value)
+ if(buf_e[i][j][k] != comp_value)
{
printf("buf_e[%d][%d][%d] = %d\n", i, j, k, buf_e[i][j][k] );
printf("value = %d\n", comp_value);
- goto error;
- }
- }
- else
+ TEST_ERROR
+ }
+ }
+ else
{
- if(buf_e[i][j][k] != buf_o[i][j][k] )
- goto error;
+ if(buf_e[i][j][k] != buf_o[i][j][k] )
+ TEST_ERROR
}
}
}
}
-
-
-
-
+
+
+
+
/*-------------------------------------------------------------------------
* shrink
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_s) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK3; i++ )
{
- if (dims_r[i] != dims_s[i])
- goto error;
+ if (dims_r[i] != dims_s[i])
+ TEST_ERROR
}
@@ -1781,42 +1761,42 @@ static int test_rank3( hbool_t do_compress,
/* for this case we close and reopen file */
if ( set_istore_k )
{
-
- if (H5Dclose(did) < 0)
+
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Fclose(fid) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
+ if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
{
- goto error;
+ TEST_ERROR
}
-
- if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
+
+ if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0)
{
- goto error;
+ TEST_ERROR
}
-
-
-
+
+
+
}
-
-
+
+
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
*/
-
+
/* read */
- if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
+ if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
#if defined (H5_SET_EXTENT_DEBUG3)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -1830,14 +1810,14 @@ static int test_rank3( hbool_t do_compress,
printf("[%d] ", j);
}
printf("\n");
-
+
}
printf("\n");
-#endif
+#endif
+
+
-
-
/* compare the read array with the shrinked array */
for( i = 0; i < (int)dims_r[0]; i++ )
{
@@ -1845,56 +1825,56 @@ static int test_rank3( hbool_t do_compress,
{
for( k = 0; k < (int)dims_r[2]; k++ )
{
- if ( buf_s[i][j][k] != buf_o[i][j][k] )
+ if ( buf_s[i][j][k] != buf_o[i][j][k] )
{
printf("buf_s[%d][%d][%d] = %d\n", i, j, k, buf_s[i][j][k] );
printf("buf_o[%d][%d][%d] = %d\n", i, j, k, buf_o[i][j][k] );
- goto error;
- }
+ TEST_ERROR
+ }
}
}
}
-
-
+
+
/*-------------------------------------------------------------------------
* set new dimensions for the array; expand it back to original size
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array */
if (H5Dset_extent(did, dims_o) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
- if ((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions. */
if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK3; i++ )
{
- if (dims_r[i] != dims_o[i])
- goto error;
+ if (dims_r[i] != dims_o[i])
+ TEST_ERROR
}
-
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
- goto error;
-
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
+ TEST_ERROR
+
#if defined (H5_SET_EXTENT_DEBUG3)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -1903,19 +1883,19 @@ static int test_rank3( hbool_t do_compress,
{
for( k = 0; k < (int)dims_r[2]; k++ )
{
-
+
printf("%d ", buf_r[i][j][k]);
}
printf("[%d] ", j);
}
printf("\n");
-
+
}
printf("\n");
-#endif
+#endif
+
-
/* compare the read array with the original array */
for (i = 0; i < (int)dims_r[0]; i++ )
{
@@ -1923,24 +1903,24 @@ static int test_rank3( hbool_t do_compress,
{
for( k = 0; k < (int)dims_r[2]; k++ )
{
- if (i >= DIMS0 || j >= DIMS1 || k >= DIMS2 )
+ if (i >= DIMS0 || j >= DIMS1 || k >= DIMS2 )
{
- if( buf_r[i][j][k] != comp_value )
+ if( buf_r[i][j][k] != comp_value )
{
printf("buf_r[%d][%d][%d] = %d\n", i, j, k, buf_r[i][j][k] );
printf("value = %d\n", comp_value);
- goto error;
- }
- }
- else
+ TEST_ERROR
+ }
+ }
+ else
{
- if(buf_r[i][j][k] != buf_o[i][j][k])
- goto error;
+ if(buf_r[i][j][k] != buf_o[i][j][k])
+ TEST_ERROR
}
}
}
}
-
+
/*-------------------------------------------------------------------------
* shrink to 0
@@ -1951,120 +1931,120 @@ static int test_rank3( hbool_t do_compress,
dims_s[0] = 0;
dims_s[1] = 0;
dims_s[2] = 0;
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_s) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK3; i++ )
{
- if (dims_r[i] != dims_s[i])
- goto error;
- }
-
-
-
+ if (dims_r[i] != dims_s[i])
+ TEST_ERROR
+ }
+
+
+
/*-------------------------------------------------------------------------
- * close dataset
+ * close dataset
*-------------------------------------------------------------------------
*/
-
- if (H5Dclose(did) < 0)
+
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
/*-------------------------------------------------------------------------
* test a dataset with non initialized chunks
*-------------------------------------------------------------------------
*/
-
-
- if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0)
+
+
+ if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0)
{
- goto error;
+ TEST_ERROR
}
- if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0)
{
- goto error;
+ TEST_ERROR
}
/* set new dimensions for the array */
dims_o[ 0 ] = 0;
dims_o[ 1 ] = 0;
dims_o[ 2 ] = 0;
- if (H5Dset_extent( did , dims_o ) < 0)
+ if (H5Dset_extent( did , dims_o ) < 0)
{
- goto error;
+ TEST_ERROR
}
- if (H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
-
+
+
+
/*-------------------------------------------------------------------------
* close property list
*-------------------------------------------------------------------------
*/
-
-
- if (H5Pclose(dcpl) < 0)
+
+
+ if (H5Pclose(my_dcpl) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Fclose( fid ) < 0)
{
- goto error;
+ TEST_ERROR
}
return 0;
-
-
-
+
+
+
error:
-
- H5E_BEGIN_TRY
+
+ H5E_BEGIN_TRY
{
H5Dclose( did );
H5Sclose( sid );
- H5Pclose( dcpl );
+ H5Pclose( my_dcpl );
H5Pclose( fcpl );
H5Fclose( fid );
} H5E_END_TRY;
return -1;
-
+
}
@@ -2075,32 +2055,32 @@ error:
static int test_external( hid_t fapl )
{
- hid_t fid=-1;
+ hid_t fid=-1;
hid_t did=-1;
hid_t sid=-1;
hid_t dcpl=-1;
- hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */
- hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */
- hsize_t dims_e[RANK2] = {DIME0,DIM1}; /* extended dimensions, dimension 1 is the original */
- hsize_t dims_r[RANK2]; /* read dimensions */
+ hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */
+ hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */
+ hsize_t dims_e[RANK2] = {DIME0,DIM1}; /* extended dimensions, dimension 1 is the original */
+ hsize_t dims_r[RANK2]; /* read dimensions */
hsize_t maxdims[RANK2] = {DIME0,DIM1}; /* only the first dimension can be extendible */
- int buf_o[DIM0][DIM1]; /* original buffer, for writing */
- int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */
- int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */
- int buf_ro[DIM0][DIM1]; /* original buffer for reading */
+ int buf_o[DIM0][DIM1]; /* original buffer, for writing */
+ int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */
+ int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */
+ int buf_ro[DIM0][DIM1]; /* original buffer for reading */
int i, j;
int comp_value = 0;
char filename[NAME_BUF_SIZE];
-
+
hsize_t size; /* number of bytes reserved in the file for the data */
- hsize_t max_size[2];
-
+ hsize_t max_size[2];
+
max_size[0] = dims_e[0];
max_size[1] = dims_e[1];
size = max_size[0] * max_size[1] * sizeof(int) / 2;
-
-
+
+
for( i = 0; i < DIM0; i++ )
{
for( j = 0; j < DIM1; j++ )
@@ -2109,33 +2089,33 @@ static int test_external( hid_t fapl )
}
}
- TESTING_2("external file use");
-
+ TESTING("external file use");
+
/* create a new file */
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
- if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
-
+
/* modify dataset creation properties */
if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
-
+
if(H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t)0, size) < 0)
FAIL_STACK_ERROR
if(H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t)0, size) < 0)
FAIL_STACK_ERROR
-
+
{
-
+
char name[256]; /*external file name */
off_t file_offset; /*external file offset */
hsize_t file_size; /*sizeof external file segment */
-
+
if(H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset,
&file_size) < 0)
FAIL_STACK_ERROR
-
+
}
@@ -2155,11 +2135,11 @@ static int test_external( hid_t fapl )
/* create the data space with unlimited dimensions. */
- if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
+ if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
FAIL_STACK_ERROR
- if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
+ if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
FAIL_STACK_ERROR
if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
@@ -2171,9 +2151,9 @@ static int test_external( hid_t fapl )
*/
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ro) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ro) < 0)
FAIL_STACK_ERROR
-
+
#if defined (H5_SET_EXTENT_DEBUG)
printf("\n");
for (i = 0; i < (int)dims_o[0]; i++ )
@@ -2184,10 +2164,10 @@ static int test_external( hid_t fapl )
}
printf("\n");
}
-#endif
+#endif
+
-
/*-------------------------------------------------------------------------
* expand
*-------------------------------------------------------------------------
@@ -2197,13 +2177,13 @@ static int test_external( hid_t fapl )
* set new dimensions for the array; expand it
* data is now, extended space was initialized with default value
*
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- * 2 2 2 2
- * 0 0 0 0
- * 0 0 0 0
- * 0 0 0 0
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ * 2 2 2 2
+ * 0 0 0 0
+ * 0 0 0 0
+ * 0 0 0 0
*
*-------------------------------------------------------------------------
*/
@@ -2215,28 +2195,28 @@ static int test_external( hid_t fapl )
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
FAIL_STACK_ERROR
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
FAIL_STACK_ERROR
-
+
if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
-
-
+
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_e[i])
+ if (dims_r[i] != dims_e[i])
TEST_ERROR
}
-
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0)
FAIL_STACK_ERROR
-
-
+
+
#if defined (H5_SET_EXTENT_DEBUG)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -2247,33 +2227,33 @@ static int test_external( hid_t fapl )
}
printf("\n");
}
-#endif
+#endif
+
+
+
-
-
-
/* compare the read array with the expanded array */
for (i = 0; i < (int)dims_r[0]; i++ )
{
for (j = 0; j < (int)dims_r[1]; j++ )
{
- if ( i >= DIM0 || j >= DIM1 )
+ if ( i >= DIM0 || j >= DIM1 )
{
- if(buf_e[i][j] != comp_value)
+ if(buf_e[i][j] != comp_value)
{
printf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]);
printf("value = %d\n", comp_value);
TEST_ERROR
- }
- }
- else
+ }
+ }
+ else
{
- if(buf_e[i][j] != buf_o[i][j])
+ if(buf_e[i][j] != buf_o[i][j])
TEST_ERROR
}
}
}
-
+
/*-------------------------------------------------------------------------
@@ -2286,41 +2266,41 @@ static int test_external( hid_t fapl )
*
*-------------------------------------------------------------------------
*/
-
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_s) < 0)
FAIL_STACK_ERROR
-
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
FAIL_STACK_ERROR
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
FAIL_STACK_ERROR
-
+
if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
-
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_s[i])
+ if (dims_r[i] != dims_s[i])
TEST_ERROR
}
-
-
+
+
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
*/
-
+
/* read */
- if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
+ if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0)
FAIL_STACK_ERROR
-
+
#if defined (H5_SET_EXTENT_DEBUG)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -2331,22 +2311,22 @@ static int test_external( hid_t fapl )
}
printf("\n");
}
-#endif
+#endif
+
+
-
-
/* compare the read array with the shrinked array */
for( i = 0; i < (int)dims_r[0]; i++ )
{
for( j = 0; j < (int)dims_r[1]; j++ )
{
- if ( buf_s[i][j] != buf_o[i][j] )
+ if ( buf_s[i][j] != buf_o[i][j] )
{
printf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]);
printf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]);
TEST_ERROR
- }
+ }
}
}
@@ -2361,16 +2341,16 @@ static int test_external( hid_t fapl )
dims_e[1] = DIME1;
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
-
-
+
+
/* set new dimensions for the array. */
if (H5Dset_extent(did , dims_e) == SUCCEED)
{
TEST_ERROR
}
-
+
} H5E_END_TRY;
@@ -2379,9 +2359,9 @@ static int test_external( hid_t fapl )
* close property list
*-------------------------------------------------------------------------
*/
-
-
- if (H5Pclose(dcpl) < 0)
+
+
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
if (H5Dclose( did ) < 0)
@@ -2393,10 +2373,10 @@ static int test_external( hid_t fapl )
PASSED();
return 0;
-
+
error:
-
- H5E_BEGIN_TRY
+
+ H5E_BEGIN_TRY
{
H5Dclose( did );
H5Sclose( sid );
@@ -2414,19 +2394,20 @@ error:
static int test_layouts( H5D_layout_t layout, hid_t fapl )
{
- hid_t fid=-1;
+ hid_t fid=-1;
hid_t did=-1;
hid_t sid=-1;
hid_t dcpl=-1;
- hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */
- hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */
- hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */
- hsize_t dims_r[RANK2]; /* read dimensions */
+ herr_t ret;
+ hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */
+ hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */
+ hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */
+ hsize_t dims_r[RANK2]; /* read dimensions */
int buf_o[DIM0][DIM1];
int buf_r[DIM0][DIM1];
- int i, j;
+ int i, j;
char filename[NAME_BUF_SIZE];
-
+
for( i = 0; i < DIM0; i++ )
{
for( j = 0; j < DIM1; j++ )
@@ -2435,44 +2416,44 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl )
}
}
-
+
/* create a new file */
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
- if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
{
- goto error;
+ TEST_ERROR
}
/* create the data space with unlimited dimensions. */
- if ((sid = H5Screate_simple(RANK2, dims_o, NULL)) < 0)
+ if ((sid = H5Screate_simple(RANK2, dims_o, NULL)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* modify dataset creation properties */
if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Pset_layout (dcpl, layout) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* create a dataset */
- if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* write */
- if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
+ if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
#if defined (H5_SET_EXTENT_DEBUG4)
printf("\n");
for (i = 0; i < (int)dims_o[0]; i++ )
@@ -2483,65 +2464,65 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl )
}
printf("\n");
}
-#endif
+#endif
+
-
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/*-------------------------------------------------------------------------
* negative test
- * try to extend dimension
+ * try to extend dimension
*-------------------------------------------------------------------------
*/
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
-
- if (H5Dset_extent(did , dims_e) == SUCCEED)
- {
- goto error;
- }
-
+
+ ret = H5Dset_extent(did , dims_e);
+
} H5E_END_TRY;
-
-
-
+ if(ret >= 0)
+ TEST_ERROR
+
+
+
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
-
+
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_o[i])
- goto error;
+ if (dims_r[i] != dims_o[i])
+ TEST_ERROR
}
-
+
/* read */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
- goto error;
+ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0)
+ TEST_ERROR
+
+
-
-
#if defined (H5_SET_EXTENT_DEBUG4)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -2552,63 +2533,63 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl )
}
printf("\n");
}
-#endif
+#endif
+
+
-
-
/*-------------------------------------------------------------------------
* negative test
- * try to shrink dimension
+ * try to shrink dimension
*-------------------------------------------------------------------------
*/
- H5E_BEGIN_TRY
+ H5E_BEGIN_TRY
{
-
- if (H5Dset_extent(did , dims_s) == SUCCEED)
- {
- goto error;
- }
-
+
+ ret = H5Dset_extent(did , dims_s);
+
} H5E_END_TRY;
-
+ if(ret >= 0)
+ TEST_ERROR
+
+
/* get the space */
if ((sid = H5Dget_space(did)) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* get dimensions */
- if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
+ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
if (H5Sclose(sid) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
/* check dimensions */
for( i = 0; i < RANK2; i++ )
{
- if (dims_r[i] != dims_o[i])
- goto error;
+ if (dims_r[i] != dims_o[i])
+ TEST_ERROR
}
-
+
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
*/
-
+
/* read */
- if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r ) < 0)
+ if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r ) < 0)
{
- goto error;
+ TEST_ERROR
}
-
+
#if defined (H5_SET_EXTENT_DEBUG4)
printf("\n");
for (i = 0; i < (int)dims_r[0]; i++ )
@@ -2619,38 +2600,38 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl )
}
printf("\n");
}
-#endif
+#endif
+
-
/*-------------------------------------------------------------------------
- * close
+ * close
*-------------------------------------------------------------------------
*/
-
- if (H5Dclose(did) < 0)
+
+ if (H5Dclose(did) < 0)
{
- goto error;
+ TEST_ERROR
}
-
- if (H5Pclose(dcpl) < 0)
+
+ if (H5Pclose(dcpl) < 0)
{
- goto error;
+ TEST_ERROR
}
if (H5Fclose( fid ) < 0)
{
- goto error;
+ TEST_ERROR
}
return 0;
-
-
-
+
+
+
error:
-
- H5E_BEGIN_TRY
+
+ H5E_BEGIN_TRY
{
H5Dclose( did );
H5Sclose( sid );
@@ -2658,6 +2639,179 @@ error:
H5Fclose( fid );
} H5E_END_TRY;
return -1;
-
+
}
+
+/*-------------------------------------------------------------------------
+ * Function: test_random_rank4
+ *
+ * Purpose: Test expanding and shrinking a rank 4 dataset in a
+ * randomized fashion. Verifies that data is preserved (and
+ * filled, if do_fillvalue is true) as expected.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Monday, January 11, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static int test_random_rank4( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue )
+{
+ hid_t file = -1;
+ hid_t dset = -1;
+ hid_t fspace = -1;
+ hid_t mspace = -1;
+ hid_t my_dcpl = -1;
+ hsize_t dims[4]; /* Dataset's dimensions */
+ hsize_t old_dims[4]; /* Old dataset dimensions */
+ hsize_t cdims[4]; /* Chunk dimensions */
+ const hsize_t mdims[4] = {10, 10, 10, 10}; /* Memory buffer dimensions */
+ const hsize_t start[4] = {0, 0, 0, 0}; /* Start for hyperslabe operations on memory */
+ static int rbuf[10][10][10][10]; /* Read buffer */
+ static int wbuf[10][10][10][10]; /* Write buffer */
+ static hsize_t dim_log[RAND4_NITER+1][4]; /* Log of dataset dimensions */
+ volatile unsigned i, j, k, l, m; /* Local indices */
+ char filename[NAME_BUF_SIZE];
+
+ /* create a new file */
+ h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Generate random chunk dimensions, 2-6 */
+ for(i=0; i<4; i++)
+ cdims[i] = (hsize_t)((HDrandom() % 5) + 2);
+
+ /* Generate initial dataset size, 1-10 */
+ for(i=0; i<4; i++) {
+ dims[i] = (hsize_t)((HDrandom() % 10) + 1);
+ dim_log[0][i] = dims[i];
+ } /* end for */
+
+ /* Create dataset */
+ if((fspace = H5Screate_simple(4, dims, mdims)) < 0)
+ TEST_ERROR
+ if((my_dcpl = H5Pcopy(dcpl)) < 0)
+ TEST_ERROR
+ if(H5Pset_chunk(my_dcpl, 4, cdims) < 0)
+ TEST_ERROR
+ if((dset = H5Dcreate2(file, "dset", H5T_NATIVE_INT, fspace, H5P_DEFAULT,
+ my_dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Sclose(fspace) < 0)
+ TEST_ERROR
+
+ /* Create memory space, and set initial selection */
+ if((mspace = H5Screate_simple(4, mdims, NULL)) < 0)
+ TEST_ERROR
+ if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL)
+ < 0)
+ TEST_ERROR
+
+ /* Main loop */
+ for(i=0; i<RAND4_NITER; i++) {
+ /* Generate random write buffer */
+ for(j=0; j<dims[0]; j++)
+ for(k=0; k<dims[1]; k++)
+ for(l=0; l<dims[2]; l++)
+ for(m=0; m<dims[3]; m++)
+ wbuf[j][k][l][m] = HDrandom();
+
+ /* Write data */
+ if(H5Dwrite(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT, wbuf)
+ < 0)
+ RAND4_FAIL_DUMP(i+1, -1, -1, -1, -1)
+
+ /* Generate new dataset size, 1-10 */
+ for(j=0; j<4; j++) {
+ old_dims[j] = dims[j];
+ dims[j] = (hsize_t)((HDrandom() % 10) + 1);
+ dim_log[i+1][j] = dims[j];
+ } /* end for */
+
+ /* Resize dataset */
+ if(H5Dset_extent(dset, dims) < 0)
+ RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
+
+ /* Read data from resized dataset */
+ if(H5Sselect_hyperslab(mspace, H5S_SELECT_SET, start, NULL, dims, NULL)
+ < 0)
+ RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
+ if(H5Dread(dset, H5T_NATIVE_INT, mspace, H5S_ALL, H5P_DEFAULT, rbuf)
+ < 0)
+ RAND4_FAIL_DUMP(i+2, -1, -1, -1, -1)
+
+ /* Verify correctness of read data */
+ if(do_fillvalue) {
+ for(j=0; j<dims[0]; j++)
+ for(k=0; k<dims[1]; k++)
+ for(l=0; l<dims[2]; l++)
+ for(m=0; m<dims[3]; m++)
+ if(j >= old_dims[0] || k >= old_dims[1]
+ || l >= old_dims[2] || m >= old_dims[3]) {
+ if(FILL_VALUE != rbuf[j][k][l][m])
+ RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ } /* end if */
+ else
+ if(wbuf[j][k][l][m] != rbuf[j][k][l][m])
+ RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ } /* end if */
+ else {
+ for(j=0; j<MIN(dims[0],old_dims[0]); j++)
+ for(k=0; k<MIN(dims[1],old_dims[1]); k++)
+ for(l=0; l<MIN(dims[2],old_dims[2]); l++)
+ for(m=0; m<MIN(dims[3],old_dims[3]); m++)
+ if(wbuf[j][k][l][m] != rbuf[j][k][l][m])
+ RAND4_FAIL_DUMP(i+2, (int)j, (int)k, (int)l, (int)m)
+ } /* end else */
+ } /* end for */
+
+ /* Close */
+ if(H5Sclose(mspace) < 0)
+ TEST_ERROR
+ if(H5Pclose(my_dcpl) < 0)
+ TEST_ERROR
+ if(H5Dclose(dset) < 0)
+ TEST_ERROR
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(fspace);
+ H5Sclose(mspace);
+ H5Pclose(dcpl);
+ H5Dclose(dset);
+ H5Fclose(file);
+ } H5E_END_TRY
+ return -1;
+} /* end test_random_rank4 */
+
+/*
+ * test_random_rank4_dump: Dump debugging info from test_random_rank4 to screen
+ * after failure.
+ */
+static void test_random_rank4_dump( unsigned ndim_sets, hsize_t dim_log[][4],
+ hsize_t cdims[4], int j, int k, int l, int m )
+{
+ unsigned i;
+
+ printf(" Chunk dimensions: ( %u, %u, %u, %u )\n", (unsigned)cdims[0],
+ (unsigned)cdims[1], (unsigned)cdims[2], (unsigned)cdims[3]);
+ printf(" Log of dataset dimensions (oldest first):\n");
+ for(i=0; i<ndim_sets; i++)
+ printf(" Iteration %-3u: ( %2u, %2u, %2u, %2u )\n", i,
+ (unsigned)dim_log[i][0], (unsigned)dim_log[i][1],
+ (unsigned)dim_log[i][2], (unsigned)dim_log[i][3]);
+ if(j>=0)
+ printf(" First incorrect value read: ( %d, %d, %d, %d )\n", j, k, l,
+ m);
+
+ return;
+} /* end test_random_rank4_dump */
+
diff --git a/test/tarray.c b/test/tarray.c
index 590d48c..f191c95 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -22,6 +22,7 @@
*************************************************************/
#include "testhdf5.h"
+#include "H5srcdir.h"
#include "hdf5.h"
@@ -1802,8 +1803,7 @@ test_compat(void)
long l[ARRAY1_DIM1];
double d;
} s3_t;
- char testfile[512]=""; /* Character buffer for corrected test file name */
- char *srcdir = getenv("srcdir"); /* Pointer to the directory the source code is located within */
+ const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
hid_t tid1; /* Array Datatype ID */
@@ -1831,12 +1831,6 @@ test_compat(void)
* changed, follow the instructions in gen_old_array.c for regenerating
* the tarrold.h5 file.
*/
- /* Generate the correct name for the test file, by prepending the source path */
- if (srcdir && ((strlen(srcdir) + strlen(TESTFILE) + 1) < sizeof(testfile))) {
- strcpy(testfile, srcdir);
- strcat(testfile, "/");
- }
- strcat(testfile, TESTFILE);
/* Open the testfile */
fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
diff --git a/test/tattr.c b/test/tattr.c
index dcf13bc..828b8a8 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -274,60 +274,68 @@ test_attr_basic_write(hid_t fapl)
attr_name_size = H5Aget_name(attr, (size_t)0, NULL);
CHECK(attr_name_size, FAIL, "H5Aget_name");
- if(attr_name_size > 0)
+ if(attr_name_size > 0) {
attr_name = (char*)HDcalloc((size_t)(attr_name_size + 1), sizeof(char));
-
- ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name);
- CHECK(ret, FAIL, "H5Aget_name");
- ret = HDstrcmp(attr_name, ATTR_TMP_NAME);
- VERIFY(ret, 0, "HDstrcmp");
-
- if(attr_name)
- HDfree(attr_name);
+ CHECK(attr_name, NULL, "HDcalloc");
+
+ if(attr_name) {
+ ret = (herr_t)H5Aget_name(attr, (size_t)(attr_name_size + 1), attr_name);
+ CHECK(ret, FAIL, "H5Aget_name");
+ ret = HDstrcmp(attr_name, ATTR_TMP_NAME);
+ VERIFY(ret, 0, "HDstrcmp");
+
+ HDfree(attr_name);
+ attr_name = NULL;
+ } /* end if */
+ } /* end if */
/* Read attribute information immediately, without closing attribute */
ret = H5Aread(attr, H5T_NATIVE_INT, read_data1);
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ for(i = 0; i < ATTR1_DIM1; i++)
+ if(attr_data1[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1[i], i, read_data1[i]);
/* Close attribute */
- ret=H5Aclose(attr);
+ ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Open the second attribute again */
- attr2=H5Aopen(dataset, ATTR1A_NAME, H5P_DEFAULT);
+ attr2 = H5Aopen(dataset, ATTR1A_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Verify new attribute name */
attr_name_size = H5Aget_name(attr2, (size_t)0, NULL);
CHECK(attr_name_size, FAIL, "H5Aget_name");
- if(attr_name_size>0)
+ if(attr_name_size > 0) {
attr_name = (char*)HDcalloc((size_t)(attr_name_size+1), sizeof(char));
-
- ret=(herr_t)H5Aget_name(attr2, (size_t)(attr_name_size+1), attr_name);
- CHECK(ret, FAIL, "H5Aget_name");
- ret=HDstrcmp(attr_name, ATTR1A_NAME);
- VERIFY(ret, 0, "HDstrcmp");
-
- if(attr_name)
- HDfree(attr_name);
+ CHECK(attr_name, NULL, "HDcalloc");
+
+ if(attr_name) {
+ ret = (herr_t)H5Aget_name(attr2, (size_t)(attr_name_size + 1), attr_name);
+ CHECK(ret, FAIL, "H5Aget_name");
+ ret = HDstrcmp(attr_name, ATTR1A_NAME);
+ VERIFY(ret, 0, "HDstrcmp");
+
+ HDfree(attr_name);
+ attr_name = NULL;
+ } /* end if */
+ } /* end if */
/* Read attribute information immediately, without closing attribute */
- ret=H5Aread(attr2,H5T_NATIVE_INT,read_data1);
+ ret = H5Aread(attr2, H5T_NATIVE_INT, read_data1);
CHECK(ret, FAIL, "H5Aread");
/* Verify values read in */
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1a[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
+ for(i = 0; i < ATTR1_DIM1; i++)
+ if(attr_data1a[i] != read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d, read_data1[%d]=%d\n", __LINE__, i, attr_data1a[i], i, read_data1[i]);
/* Close attribute */
- ret=H5Aclose(attr2);
+ ret = H5Aclose(attr2);
CHECK(ret, FAIL, "H5Aclose");
ret = H5Sclose(sid1);
@@ -1539,7 +1547,7 @@ test_attr_delete(hid_t fapl)
CHECK(attr, FAIL, "H5Aopen_by_idx");
/* Verify Name */
- name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN,attr_name);
+ name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name");
if(HDstrcmp(attr_name, ATTR1_NAME))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME);
@@ -1555,7 +1563,7 @@ test_attr_delete(hid_t fapl)
/* Verify Name */
name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name);
VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name");
- if(HDstrcmp(attr_name,ATTR3_NAME))
+ if(HDstrcmp(attr_name, ATTR3_NAME))
TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME);
/* Close attribute */
@@ -10347,7 +10355,7 @@ test_attr(void)
test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */
test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */
test_attr_bug5(my_fcpl, my_fapl); /* Test opening/closing attributes through different file handles */
- test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */
+ test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */
} /* end for */
} /* end if */
else {
@@ -10371,7 +10379,7 @@ test_attr(void)
test_attr_bug3(fcpl, my_fapl); /* Test "self referential" attributes */
test_attr_bug4(fcpl, my_fapl); /* Test attributes on named datatypes */
test_attr_bug5(fcpl, my_fapl); /* Test opening/closing attributes through different file handles */
- test_attr_bug6(fcpl, my_fapl); /* Test reading empty attribute */
+ test_attr_bug6(fcpl, my_fapl); /* Test reading empty attribute */
} /* end else */
} /* end for */
diff --git a/test/tconfig.c b/test/tconfig.c
index 6b8fd84..f3ac242 100644
--- a/test/tconfig.c
+++ b/test/tconfig.c
@@ -65,7 +65,7 @@ void test_exit_definitions(void);
* 16 Dec 2009
* On Boeing's OpenVMS, the value of EXIT_FAILURE is 268435458.
* (The test is in test_exit_definitions.) Their document says
- * it's supposed to be 2. I commented it out for OpenVMS for
+ * it's supposed to be 2. I commented it out for OpenVMS for
* further consideration.
*-------------------------------------------------------------------------
*/
diff --git a/test/testhdf5.h b/test/testhdf5.h
index adac3fe..149b4c8 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -25,18 +25,15 @@
* so we include the private headers here.
*/
#include "H5private.h"
+#include "H5Eprivate.h"
/* Include generic testing header also */
#include "h5test.h"
-/* A macro version of HDGetTestVerbosity(). */
-/* Should be used internally by the libtest.a only. */
-#define HDGetTestVerbosity() (TestVerbosity)
-
/* Use %ld to print the value because long should cover most cases. */
/* Used to make certain a return value _is_not_ a value */
#define CHECK(ret, val, where) do { \
- if (HDGetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \
+ if (VERBOSE_HI) print_func(" Call to routine: %15s at line %4d " \
"in %s returned %ld \n", \
where, (int)__LINE__, __FILE__, \
(long)(ret)); \
@@ -48,7 +45,7 @@
} while(0)
#define CHECK_I(ret,where) { \
- if (HDGetTestVerbosity()>=VERBO_HI) { \
+ if (VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \
(where), (int)__LINE__, __FILE__, (long)(ret)); \
} \
@@ -60,7 +57,7 @@
}
#define CHECK_PTR(ret,where) { \
- if (HDGetTestVerbosity()>=VERBO_HI) { \
+ if (VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \
(where), (int)__LINE__, __FILE__, (ret)); \
} \
@@ -74,7 +71,7 @@
/* Used to make certain a return value _is_ a value */
#define VERIFY(_x, _val, where) do { \
long __x = (long)_x, __val = (long)_val; \
- if(HDGetTestVerbosity() >= VERBO_HI) { \
+ if(VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
"%ld \n", (where), (int)__LINE__, __FILE__, __x); \
} \
@@ -88,7 +85,7 @@
/* Used to make certain a (non-'long' type's) return value _is_ a value */
#define VERIFY_TYPE(_x, _val, _type, _format, where) do { \
_type __x = (_type)_x, __val = (_type)_val; \
- if(HDGetTestVerbosity() >= VERBO_HI) { \
+ if(VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
_format " \n", (where), (int)__LINE__, __FILE__, __x); \
} \
@@ -101,7 +98,7 @@
/* Used to make certain a string return value _is_ a value */
#define VERIFY_STR(x, val, where) do { \
- if (HDGetTestVerbosity()>=VERBO_HI) { \
+ if (VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s had value " \
"%s \n", (where), (int)__LINE__, __FILE__, x); \
} \
@@ -114,11 +111,11 @@
/* Used to document process through a test and to check for errors */
#define RESULT(ret,func) do { \
- if (HDGetTestVerbosity()>VERBO_MED) { \
+ if (VERBOSE_MED) { \
print_func(" Call to routine: %15s at line %4d in %s returned " \
"%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
} \
- if (HDGetTestVerbosity()>=VERBO_HI) \
+ if (VERBOSE_HI) \
H5Eprint2(H5E_DEFAULT, stdout); \
if ((ret) == FAIL) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
@@ -130,6 +127,15 @@
/* Used to document process through a test */
#define MESSAGE(V,A) {if (HDGetTestVerbosity()>(V)) print_func A;}
+/* Used to indicate an error that is complex to check for */
+#define ERROR(where) do { \
+ if(VERBOSE_HI) \
+ print_func(" Call to routine: %15s at line %4d in %s returned " \
+ "invalid result\n", where, (int)__LINE__, __FILE__); \
+ TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n" \
+ where, (int)__LINE__, __FILE__); \
+} while(0)
+
/* definitions for command strings */
#define VERBOSITY_STR "Verbosity"
#define SKIP_STR "Skip"
@@ -189,9 +195,6 @@ void cleanup_sohm(void);
void cleanup_misc(void);
void cleanup_unicode(void);
-/* Extern global variables */
-extern int TestVerbosity;
-
#ifdef __cplusplus
}
#endif
diff --git a/test/tfile.c b/test/tfile.c
index d1cb25d..3b717eb 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -23,6 +23,7 @@
#include "hdf5.h"
#include "testhdf5.h"
+#include "H5srcdir.h"
#include "H5Bprivate.h"
#include "H5Pprivate.h"
@@ -1148,46 +1149,46 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1,
oid_count = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_ALL);
CHECK(oid_count, FAIL, "H5Fget_obj_count");
VERIFY(oid_count, OBJ_ID_COUNT_8, "H5Fget_obj_count");
+
+ if(oid_count > 0) {
+ hid_t *oid_list;
- {
- hid_t *oid_list;
- int i;
- H5I_type_t id_type;
-
- oid_list = (hid_t*)calloc((size_t)oid_count, sizeof(hid_t));
+ oid_list = (hid_t *)HDcalloc((size_t)oid_count, sizeof(hid_t));
if(oid_list != NULL) {
+ int i;
+
ret_count = H5Fget_obj_ids(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++) {
- id_type = H5Iget_type(oid_list[i]);
- switch(id_type) {
- case H5I_FILE:
- if(oid_list[i]!=fid1 && oid_list[i]!=fid2 &&
- oid_list[i]!=fid3 && oid_list[i]!=fid4) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5Fget_obj_ids");
- }
- break;
- case H5I_GROUP:
- if(oid_list[i]!=gid1 && oid_list[i]!=gid2 &&
- oid_list[i]!=gid3) {
- ret = FAIL;
- CHECK(ret, FAIL, "H5Fget_obj_ids");
- }
- break;
- case H5I_DATASET:
- VERIFY(oid_list[i], did, "H5Fget_obj_ids");
- break;
- default:
- ret = FAIL;
- CHECK(ret, FAIL, "H5Fget_obj_ids");
- }
- }
-
- free(oid_list);
- }
+
+ for(i = 0; i < oid_count; i++) {
+ H5I_type_t id_type;
+
+ id_type = H5Iget_type(oid_list[i]);
+ switch(id_type) {
+ case H5I_FILE:
+ if(oid_list[i] != fid1 && oid_list[i] != fid2
+ && oid_list[i] != fid3 && oid_list[i] != fid4)
+ ERROR("H5Fget_obj_ids");
+ break;
+
+ case H5I_GROUP:
+ if(oid_list[i] != gid1 && oid_list[i] != gid2
+ && oid_list[i] != gid3)
+ ERROR("H5Fget_obj_ids");
+ break;
+
+ case H5I_DATASET:
+ VERIFY(oid_list[i], did, "H5Fget_obj_ids");
+ break;
+
+ default:
+ ERROR("H5Fget_obj_ids");
+ } /* end switch */
+ } /* end for */
+
+ HDfree(oid_list);
+ } /* end if */
+ } /* end if */
/* close the two new files */
ret = H5Fclose(fid3);
@@ -2095,8 +2096,8 @@ test_cached_stab_info(void)
/****************************************************************
**
** test_rw_noupdate(): low-level file test routine.
-** This test checks to ensure that opening and closing a file
-** with read/write permissions does not write anything to the
+** This test checks to ensure that opening and closing a file
+** with read/write permissions does not write anything to the
** file if the file does not change.
**
** Programmer: Mike McGreevy
@@ -2533,8 +2534,8 @@ test_userblock_alignment(void)
/****************************************************************
**
-** test_free_sections():
-** This routine does the actual work of checking information for
+** test_free_sections():
+** This routine does the actual work of checking information for
** free space sections available in a file in various situations.
**
*****************************************************************/
@@ -2636,7 +2637,7 @@ test_free_sections(hid_t fapl, char *fname)
/* Verify the correct # of free-space sections */
nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)saved_nsects, saved_sect_info);
VERIFY(nsects, saved_nsects, "H5Fget_free_sections");
-
+
/* Verify the amount of free-space is correct */
total = 0;
for(i = 0; i < nsects; i++)
@@ -2703,7 +2704,7 @@ test_free_sections(hid_t fapl, char *fname)
/****************************************************************
**
-** test_filespace_sects():
+** test_filespace_sects():
** This test checks free space section info for
** files created with sec2 and split drivers.
**
@@ -2815,8 +2816,8 @@ test_filespace_sects(void)
/****************************************************************
**
-** test_filespace_info():
-** Verify that the public routines H5Pget/set_file_space()
+** test_filespace_info():
+** Verify that the public routines H5Pget/set_file_space()
** retrieve and set the file space strategy and free space
** section threshold as specified.
**
@@ -2939,7 +2940,7 @@ test_filespace_info(void)
/****************************************************************
**
-** test_filespace_compatible():
+** test_filespace_compatible():
** Verify that the branch with file space management enhancement
** can open, read and modify 1.6 HDF5 file and 1.8 HDF5 file.
** Also verify the correct file space strategy/threshold in use
@@ -2957,7 +2958,6 @@ test_filespace_compatible(void)
int rdbuf[100]; /* Temporary buffer for reading in dataset data */
uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */
ssize_t nread; /* Number of bytes read in */
- char *srcdir = HDgetenv("srcdir"); /* where the src code is located */
unsigned i, j; /* Local index variable */
hssize_t free_space; /* Amount of free space in the file */
hsize_t threshold; /* Free space section threshold */
@@ -2968,14 +2968,7 @@ test_filespace_compatible(void)
MESSAGE(5, ("Testing File space compatibility for 1.6 and 1.8 files\n"));
for(j = 0; j < NELMTS(OLD_FILENAME); j++) {
- char filename[FILENAME_LEN] = ""; /* old test file name */
-
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(OLD_FILENAME[j]) + 1) < sizeof(filename))) {
- HDstrcpy(filename, srcdir);
- HDstrcat(filename, "/");
- }
- HDstrcat(filename, OLD_FILENAME[j]);
+ const char *filename = H5_get_srcdir_filename(OLD_FILENAME[j]); /* Corrected test file name */
/* Copy old file into test file */
fd_old = HDopen(filename, O_RDONLY, 0666);
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 8fb2e23..5f9a69b 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -289,10 +289,10 @@ test_genprop_iter1(hid_t id, const char *name, void *iter_data)
struct { /* Struct for iterations */
int iter_count;
const char **names;
- } *iter_struct=iter_data;
+ } *iter_struct = iter_data;
/* Shut compiler up */
- id=id;
+ id = id;
return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++]));
}
@@ -1473,18 +1473,26 @@ test_genprop_class_addprop(void)
sid = H5Screate(H5S_SCALAR);
CHECK(sid, FAIL, "H5Screate");
- /* Create a new class, dervied from the dataset creation property list class */
- cid = H5Pcreate_class(H5P_DATASET_CREATE,CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
+ /* Create a new class, derived from the dataset creation property list class */
+ cid = H5Pcreate_class(H5P_DATASET_CREATE, CLASS1_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(cid, "H5Pcreate_class");
/* Check existence of an original property */
- ret = H5Pexist(cid,H5O_CRT_PIPELINE_NAME);
- VERIFY(ret, 0, "H5Pexist");
+ ret = H5Pexist(cid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
/* Insert first property into class (with no callbacks) */
ret = H5Pregister2(cid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
CHECK_I(ret, "H5Pregister2");
+ /* Check existence of an original property */
+ ret = H5Pexist(cid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of added property */
+ ret = H5Pexist(cid, PROP1_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
/* Create a derived dataset creation property list */
pid = H5Pcreate(cid);
CHECK(pid, FAIL, "H5Pcreate");
@@ -1502,6 +1510,34 @@ test_genprop_class_addprop(void)
CHECK_I(ret, "H5Pget");
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
+ /* Insert second property into class (with no callbacks) */
+ ret = H5Pregister2(cid, PROP2_NAME, PROP2_SIZE, PROP2_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pregister2");
+
+ /* Check existence of an original property (in class) */
+ ret = H5Pexist(cid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of first added property (in class) */
+ ret = H5Pexist(cid, PROP1_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of second added property (in class) */
+ ret = H5Pexist(cid, PROP2_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of an original property (in property list) */
+ ret = H5Pexist(pid, H5O_CRT_PIPELINE_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of first added property (in property list) */
+ ret = H5Pexist(pid, PROP1_NAME);
+ VERIFY(ret, 1, "H5Pexist");
+
+ /* Check existence of second added property (in property list) (should not exist) */
+ ret = H5Pexist(pid, PROP2_NAME);
+ VERIFY(ret, 0, "H5Pexist");
+
/* Create a dataset */
did = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
diff --git a/test/th5s.c b/test/th5s.c
index a38e384..2de867b 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -22,6 +22,7 @@
*************************************************************/
#include "testhdf5.h"
+#include "H5srcdir.h"
#include "H5private.h"
#include "H5Bprivate.h"
@@ -173,13 +174,8 @@ test_h5s_basic(void)
* the instructions in space_overflow.c for regenerating the th5s.h5 file.
*/
{
- char testfile[512]="";
- char *srcdir = HDgetenv("srcdir");
- if (srcdir && ((HDstrlen(srcdir) + HDstrlen(TESTFILE) + 1) < sizeof(testfile))){
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, TESTFILE);
+ const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
+
fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK_I(fid1, "H5Fopen");
if (fid1 >= 0){
diff --git a/test/tmisc.c b/test/tmisc.c
index 450743c..b7ed202 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -30,6 +30,7 @@
#include "hdf5.h"
#include "testhdf5.h"
+#include "H5srcdir.h"
#include "H5Dpkg.h" /* Datasets */
/* Definitions for misc. test #1 */
@@ -1723,20 +1724,12 @@ test_misc10(void)
hid_t dataset, dataset_new; /* Dataset IDs for old & new datasets */
hid_t dcpl; /* Dataset creation property list */
hid_t space, type; /* Old dataset's dataspace & datatype */
- char testfile[512]=""; /* Character buffer for corrected test file name */
- char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */
+ const char *testfile = H5_get_srcdir_filename(MISC10_FILE_OLD); /* Corrected test file name */
herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing using old dataset creation property list\n"));
- /* Generate the correct name for the test file, by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC10_FILE_OLD) + 1) < sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, MISC10_FILE_OLD);
-
/*
* Open the old file and the dataset and get old settings.
*/
@@ -3387,8 +3380,7 @@ test_misc20(void)
hsize_t small_dims[MISC20_SPACE_RANK]={MISC20_SPACE2_DIM0,MISC20_SPACE2_DIM1}; /* Small dimensions */
unsigned version; /* Version of storage layout info */
hsize_t contig_size; /* Size of contiguous storage size from layout into */
- char testfile[512]=""; /* Character buffer for corrected test file name */
- char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */
+ const char *testfile = H5_get_srcdir_filename(MISC20_FILE_OLD); /* Corrected test file name */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -3502,13 +3494,6 @@ test_misc20(void)
/* Verify that the storage size is computed correctly for older versions of layout info */
- /* Generate the correct name for the test file, by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC20_FILE_OLD) + 1) < sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, MISC20_FILE_OLD);
-
/*
* Open the old file and the dataset and get old settings.
*/
@@ -4630,20 +4615,12 @@ test_misc25b(void)
{
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
- char testfile[512]="";
- char *srcdir = HDgetenv("srcdir");
+ const char *testfile = H5_get_srcdir_filename(MISC25B_FILE); /* Corrected test file name */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Exercise null object header message bug\n"));
- /* Build the name of the file, with the source directory */
- if (srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC25B_FILE) + 1) < sizeof(testfile))){
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, MISC25B_FILE);
-
/* Open file */
fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -4895,20 +4872,12 @@ test_misc27(void)
{
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
- char testfile[512]=""; /* Character buffer for corrected test file name */
- char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */
+ const char *testfile = H5_get_srcdir_filename(MISC27_FILE); /* Corrected test file name */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Corrupt object header handling\n"));
- /* Generate the correct name for the test file, by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC27_FILE) + 1) < sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, MISC27_FILE);
-
/* Open the file */
fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -5132,7 +5101,7 @@ test_misc29(void)
CHECK(ret, -1, "h5_make_local_copy");
/* Open the copied file */
- fid = H5Fopen(MISC29_COPY_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid = H5Fopen(MISC29_COPY_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
/* Delete the last dataset */
diff --git a/test/trefstr.c b/test/trefstr.c
index c39a6eb..dd76cc1 100644
--- a/test/trefstr.c
+++ b/test/trefstr.c
@@ -301,6 +301,7 @@ test_refstr_own(void)
/* Initialize buffer */
s = (char *)H5FL_BLK_MALLOC(str_buf,HDstrlen("foo") + 1);
+ CHECK(s, NULL, "H5FL_BLK_MALLOC");
HDstrcpy(s, "foo");
/* Transfer ownership of dynamically allocated string to ref-counted string */
diff --git a/test/tselect.c b/test/tselect.c
index 5845a9b..b8c59d8 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -76,7 +76,6 @@
#define SPACE5_DIM5 10
/* 1-D dataset with same size as 5-D dataset */
-#define SPACE6_NAME "Space6"
#define SPACE6_RANK 1
#define SPACE6_DIM1 (SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5)
@@ -99,7 +98,6 @@
#define SPACE8_DIM4 19
/* Another 2-D dataset with easy dimension sizes */
-#define SPACE9_NAME "Space9"
#define SPACE9_RANK 2
#define SPACE9_DIM1 12
#define SPACE9_DIM2 12
@@ -222,8 +220,10 @@ test_select_hyper(hid_t xfer_plist)
MESSAGE(5, ("Testing Hyperslab Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -283,7 +283,7 @@ test_select_hyper(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset=H5Dcreate2(fid1,SPACE2_NAME,H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write selection to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,wbuf);
@@ -416,8 +416,10 @@ test_select_point(hid_t xfer_plist)
MESSAGE(5, ("Testing Element Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -540,13 +542,14 @@ test_select_point(hid_t xfer_plist)
VERIFY(ret, 20, "H5Sget_select_npoints");
/* Save points for later iteration */
- HDmemcpy(pi.coord,coord2,sizeof(coord2));
+ HDmemcpy(pi.coord, coord2, sizeof(coord2));
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -691,14 +694,16 @@ test_select_all(hid_t xfer_plist)
MESSAGE(5, ("Testing 'All' Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
for(j=0; j<SPACE4_DIM2; j++)
for(k=0; k<SPACE4_DIM3; k++)
- *tbuf++=(uint8_t)(((i*SPACE4_DIM2)+j)*SPACE4_DIM3)+k;
+ *tbuf++ = (uint8_t)(((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k;
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -713,19 +718,20 @@ test_select_all(hid_t xfer_plist)
VERIFY(ext_type, H5S_SIMPLE, "H5Sget_simple_extent_type");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_INT,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE4_NAME, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Check that the values match with a dataset iterator */
- tbuf=wbuf;
- ret = H5Diterate(rbuf,H5T_NATIVE_UCHAR,sid1,test_select_all_iter1,&tbuf);
+ tbuf = wbuf;
+ ret = H5Diterate(rbuf, H5T_NATIVE_UCHAR, sid1, test_select_all_iter1, &tbuf);
CHECK(ret, FAIL, "H5Diterate");
/* Close disk dataspace */
@@ -775,8 +781,10 @@ test_select_all_hyper(hid_t xfer_plist)
MESSAGE(5, ("Testing 'All' Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -804,18 +812,19 @@ test_select_all_hyper(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Sselect_all");
/* Select 15x26 hyperslab for memory dataset */
- start[0]=15; start[1]=0;
- stride[0]=1; stride[1]=1;
- count[0]=15; count[1]=26;
- block[0]=1; block[1]=1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 15; start[1] = 0;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 15; count[1] = 26;
+ block[0] = 1; block[1] = 1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE3_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -914,8 +923,10 @@ test_select_combo(void)
MESSAGE(5, ("Testing Combination of Hyperslab & Element Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -957,10 +968,11 @@ test_select_combo(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1078,8 +1090,10 @@ test_select_hyper_stride(hid_t xfer_plist)
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1099,26 +1113,27 @@ test_select_hyper_stride(hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x3x3 count with a stride of 2x4x3 & 1x2x2 block hyperslab for disk dataset */
- start[0]=0; start[1]=0; start[2]=0;
- stride[0]=2; stride[1]=4; stride[2]=3;
- count[0]=2; count[1]=3; count[2]=3;
- block[0]=1; block[1]=2; block[2]=2;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0; start[1] = 0; start[2] = 0;
+ stride[0] = 2; stride[1] = 4; stride[2] = 3;
+ count[0] = 2; count[1] = 3; count[2] = 3;
+ block[0] = 1; block[1] = 2; block[2] = 2;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 4x2 count with a stride of 5x5 & 3x3 block hyperslab for memory dataset */
- start[0]=1; start[1]=1;
- stride[0]=5; stride[1]=5;
- count[0]=4; count[1]=2;
- block[0]=3; block[1]=3;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1; start[1] = 1;
+ stride[0] = 5; stride[1] = 5;
+ count[0] = 4; count[1] = 2;
+ block[0] = 3; block[1] = 3;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_STD_U16LE,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, H5T_STD_U16LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1203,8 +1218,10 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
MESSAGE(5, ("Testing Contiguous Hyperslabs Functionality\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1224,26 +1241,27 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 12x10 count with a stride of 1x3 & 3x3 block hyperslab for disk dataset */
- start[0]=0; start[1]=0;
- stride[0]=1; stride[1]=3;
- count[0]=12; count[1]=10;
- block[0]=1; block[1]=3;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0; start[1] = 0;
+ stride[0] = 1; stride[1] = 3;
+ count[0] = 12; count[1] = 10;
+ block[0] = 1; block[1] = 3;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 4x5 count with a stride of 3x6 & 3x6 block hyperslab for memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=3; stride[1]=6;
- count[0]=4; count[1]=5;
- block[0]=3; block[1]=6;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0; start[1] = 0;
+ stride[0] = 3; stride[1] = 6;
+ count[0] = 4; count[1] = 5;
+ block[0] = 3; block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",dset_type,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, dset_type, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1255,27 +1273,27 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 6x5 count with a stride of 2x6 & 2x6 block hyperslab for disk dataset */
- start[0]=0; start[1]=0;
- stride[0]=2; stride[1]=6;
- count[0]=6; count[1]=5;
- block[0]=2; block[1]=6;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0; start[1] = 0;
+ stride[0] = 2; stride[1] = 6;
+ count[0] = 6; count[1] = 5;
+ block[0] = 2; block[1] = 6;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 3x15 count with a stride of 4x2 & 4x2 block hyperslab for memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=4; stride[1]=2;
- count[0]=3; count[1]=15;
- block[0]=4; block[1]=2;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0; start[1] = 0;
+ stride[0] = 4; stride[1] = 2;
+ count[0] = 3; count[1] = 15;
+ block[0] = 4; block[1] = 2;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
- if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*30*12)) {
+ if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) {
TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__);
#ifdef QAK
for(i=0, tbuf=wbuf; i<12; i++)
@@ -1330,8 +1348,10 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
MESSAGE(5, ("Testing More Contiguous Hyperslabs Functionality\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
- rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
+ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE8_DIM1; i++)
@@ -1361,14 +1381,15 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist)
/* Select contiguous hyperslab in memory */
start[0]=0; start[1]=0; start[2]=0; start[3]=0;
count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,NULL,count,NULL);
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",dset_type,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE8_NAME, dset_type, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1454,8 +1475,10 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
MESSAGE(5, ("Testing Yet More Contiguous Hyperslabs Functionality\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
- rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
+ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE8_DIM1 * SPACE8_DIM2 * SPACE8_DIM3 * SPACE8_DIM4));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE8_DIM4; i++)
@@ -1477,22 +1500,23 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select semi-contiguous hyperslab for disk dataset */
- start[0]=0; start[1]=0; start[2]=SPACE8_DIM2/2; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2/2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 0; start[1] = 0; start[2] = SPACE8_DIM2/2; start[3] = 0;
+ count[0] = 2; count[1] = SPACE8_DIM3; count[2] = SPACE8_DIM2 / 2; count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select semi-contiguous hyperslab in memory */
- start[0]=0; start[1]=0; start[2]=SPACE8_DIM2/2; start[3]=0;
- count[0]=2; count[1]=SPACE8_DIM3; count[2]=SPACE8_DIM2/2; count[3]=SPACE8_DIM1;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,NULL,count,NULL);
+ start[0] = 0; start[1] = 0; start[2] = SPACE8_DIM2 / 2; start[3] = 0;
+ count[0] = 2; count[1] = SPACE8_DIM3; count[2] = SPACE8_DIM2 / 2; count[3] = SPACE8_DIM1;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, NULL, count, NULL);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",dset_type,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE8_NAME, dset_type, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_USHORT,sid2,sid1,xfer_plist,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_USHORT, sid2, sid1, xfer_plist, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1591,9 +1615,12 @@ test_select_hyper_copy(void)
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- rbuf2 = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
+ rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf2, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1613,19 +1640,19 @@ test_select_hyper_copy(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 2x3x3 count with a stride of 2x4x3 & 1x2x2 block hyperslab for disk dataset */
- start[0]=0; start[1]=0; start[2]=0;
- stride[0]=2; stride[1]=4; stride[2]=3;
- count[0]=2; count[1]=3; count[2]=3;
- block[0]=1; block[1]=2; block[2]=2;
- ret = H5Sselect_hyperslab(sid1,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0; start[1] = 0; start[2] = 0;
+ stride[0] = 2; stride[1] = 4; stride[2] = 3;
+ count[0] = 2; count[1] = 3; count[2] = 3;
+ block[0] = 1; block[1] = 2; block[2] = 2;
+ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Select 4x2 count with a stride of 5x5 & 3x3 block hyperslab for memory dataset */
- start[0]=1; start[1]=1;
- stride[0]=5; stride[1]=5;
- count[0]=4; count[1]=2;
- block[0]=3; block[1]=3;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 1; start[1] = 1;
+ stride[0] = 5; stride[1] = 5;
+ count[0] = 4; count[1] = 2;
+ block[0] = 3; block[1] = 3;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Make a copy of the dataspace to write */
@@ -1633,10 +1660,11 @@ test_select_hyper_copy(void)
CHECK(sid3, FAIL, "H5Scopy");
/* Create a dataset */
- data1=H5Dcreate2(fid1,"Dataset1",H5T_STD_U16LE,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ data1 = H5Dcreate2(fid1, SPACE1_NAME, H5T_STD_U16LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(data1, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(data1,H5T_STD_U16LE,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(data1, H5T_STD_U16LE, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1644,10 +1672,11 @@ test_select_hyper_copy(void)
CHECK(ret, FAIL, "H5Sclose");
/* Create another dataset */
- data2=H5Dcreate2(fid1,"Dataset2",H5T_STD_U16LE,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ data2 = H5Dcreate2(fid1, SPACE2_NAME, H5T_STD_U16LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(data2, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(data2,H5T_STD_U16LE,sid3,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(data2, H5T_STD_U16LE, sid3, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1659,11 +1688,11 @@ test_select_hyper_copy(void)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Select 3x4 count with a stride of 4x4 & 2x3 block hyperslab for memory dataset */
- start[0]=0; start[1]=0;
- stride[0]=4; stride[1]=4;
- count[0]=3; count[1]=4;
- block[0]=2; block[1]=3;
- ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block);
+ start[0] = 0; start[1] = 0;
+ stride[0] = 4; stride[1] = 4;
+ count[0] = 3; count[1] = 4;
+ block[0] = 2; block[1] = 3;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Make a copy of the dataspace to read */
@@ -1748,9 +1777,12 @@ test_select_point_copy(void)
MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
- rbuf2 = HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint16_t *)HDmalloc(sizeof(uint16_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
+ rbuf2 = (uint16_t *)HDcalloc(sizeof(uint16_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf2, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1802,10 +1834,11 @@ test_select_point_copy(void)
CHECK(sid3, FAIL, "H5Scopy");
/* Create a dataset */
- data1=H5Dcreate2(fid1,"Dataset1",H5T_STD_U16LE,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ data1 = H5Dcreate2(fid1, SPACE1_NAME, H5T_STD_U16LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(data1, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(data1,H5T_STD_U16LE,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(data1, H5T_STD_U16LE, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1813,10 +1846,11 @@ test_select_point_copy(void)
CHECK(ret, FAIL, "H5Sclose");
/* Create another dataset */
- data2=H5Dcreate2(fid1,"Dataset2",H5T_STD_U16LE,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ data2 = H5Dcreate2(fid1, SPACE2_NAME, H5T_STD_U16LE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(data2, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(data2,H5T_STD_U16LE,sid3,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(data2, H5T_STD_U16LE, sid3, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -1921,8 +1955,10 @@ test_select_hyper_offset(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with Offsets\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -1990,10 +2026,11 @@ test_select_hyper_offset(void)
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -2076,8 +2113,10 @@ test_select_hyper_offset2(void)
MESSAGE(5, ("Testing More Hyperslab Selection Functions with Offsets\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE7_DIM1 * SPACE7_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE7_DIM1 * SPACE7_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -2117,20 +2156,21 @@ test_select_hyper_offset2(void)
/* Choose a valid offset for the memory dataspace */
offset[0]=2; offset[1]=0;
- ret = H5Soffset_simple(sid2,offset);
+ ret = H5Soffset_simple(sid2, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid2);
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE7_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Read selection from disk */
- ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,rbuf);
+ ret = H5Dread(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Compare data read with data written out */
@@ -2196,8 +2236,10 @@ test_select_point_offset(void)
MESSAGE(5, ("Testing Element Selection Functions\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -2267,16 +2309,17 @@ test_select_point_offset(void)
/* Choose a valid offset for the memory dataspace */
offset[0]=5; offset[1]=1;
- ret = H5Soffset_simple(sid2,offset);
+ ret = H5Soffset_simple(sid2, offset);
CHECK(ret, FAIL, "H5Soffset_simple");
valid = H5Sselect_valid(sid2);
VERIFY(valid, TRUE, "H5Sselect_valid");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -2373,8 +2416,10 @@ test_select_hyper_union(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE3_DIM1 * SPACE3_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -2422,13 +2467,14 @@ test_select_hyper_union(void)
CHECK(ret, FAIL, "H5Sselect_hyperslab");
npoints = H5Sget_select_npoints(sid2);
- VERIFY(npoints, 15*26, "H5Sget_select_npoints");
+ VERIFY(npoints, 15 * 26, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -2518,10 +2564,11 @@ test_select_hyper_union(void)
VERIFY(npoints, 15*26, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset2",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -2603,10 +2650,11 @@ test_select_hyper_union(void)
VERIFY(npoints, 15*26, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset3",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE3_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
- ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UCHAR, sid2, sid1, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
@@ -2692,7 +2740,7 @@ test_select_hyper_union(void)
VERIFY(npoints, 15*26, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset4",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE4_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
xfer = H5Pcreate (H5P_DATASET_XFER);
@@ -2789,7 +2837,8 @@ test_select_hyper_union(void)
VERIFY(npoints, 15*26, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset5",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1,SPACE5_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
@@ -3084,8 +3133,10 @@ test_select_hyper_union_3d(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf=HDmalloc(sizeof(uint8_t)*SPACE4_DIM1*SPACE4_DIM2*SPACE4_DIM3);
- rbuf=HDcalloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2);
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE3_DIM1 * SPACE3_DIM2);
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
@@ -3138,7 +3189,8 @@ test_select_hyper_union_3d(void)
VERIFY(npoints, 15*26, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,tmp2_space,sid1,H5P_DEFAULT,wbuf);
@@ -3231,8 +3283,10 @@ test_select_hyper_and_2d(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with intersection of 2-D hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -3282,7 +3336,8 @@ test_select_hyper_and_2d(void)
VERIFY(npoints, 5*5, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
@@ -3357,8 +3412,10 @@ test_select_hyper_xor_2d(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with XOR of 2-D hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -3408,7 +3465,8 @@ test_select_hyper_xor_2d(void)
VERIFY(npoints, 150, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
@@ -3485,8 +3543,10 @@ test_select_hyper_notb_2d(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTB of 2-D hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -3536,7 +3596,8 @@ test_select_hyper_notb_2d(void)
VERIFY(npoints, 75, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
@@ -3612,8 +3673,10 @@ test_select_hyper_nota_2d(void)
MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTA of 2-D hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
- rbuf = HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE2_DIM1; i++)
@@ -3663,7 +3726,8 @@ test_select_hyper_nota_2d(void)
VERIFY(npoints, 75, "H5Sget_select_npoints");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE2_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Write selection to disk */
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,H5P_DEFAULT,wbuf);
@@ -3769,8 +3833,10 @@ test_select_hyper_union_random_5d(hid_t read_plist)
MESSAGE(5, ("Testing Hyperslab Selection Functions with random unions of 5-D hyperslabs\n"));
/* Allocate write & read buffers */
- wbuf = HDmalloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5);
- rbuf = HDcalloc(sizeof(int), (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5));
+ wbuf = (int *)HDmalloc(sizeof(int) * SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (int *)HDcalloc(sizeof(int), (size_t)(SPACE5_DIM1 * SPACE5_DIM2 * SPACE5_DIM3 * SPACE5_DIM4 * SPACE5_DIM5));
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE5_DIM1; i++)
@@ -3789,7 +3855,7 @@ test_select_hyper_union_random_5d(hid_t read_plist)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset=H5Dcreate2(fid1,"Dataset1",H5T_NATIVE_INT,sid1,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, SPACE5_NAME, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Write entire dataset to disk */
@@ -3959,8 +4025,10 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
MESSAGE(5, ("Testing Hyperslab I/O on Large Chunks\n"));
/* Allocate the transfer buffers */
- data = HDmalloc(sizeof(short) * X * Y * Z);
- data_out = HDcalloc((size_t)(NX * NY * NZ), sizeof(short));
+ data = (short *)HDmalloc(sizeof(short) * X * Y * Z);
+ CHECK(data, NULL, "HDmalloc");
+ data_out = (short *)HDcalloc((size_t)(NX * NY * NZ), sizeof(short));
+ CHECK(data_out, NULL, "HDcalloc");
/*
* Data buffer initialization.
@@ -3993,11 +4061,11 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist)
* Create a new dataset within the file using defined dataspace and
* chunking properties.
*/
- plist = H5Pcreate (H5P_DATASET_CREATE);
+ plist = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plist, FAIL, "H5Pcreate");
- status = H5Pset_chunk (plist, RANK_F, chunk_dimsf);
+ status = H5Pset_chunk(plist, RANK_F, chunk_dimsf);
CHECK(status, FAIL, "H5Pset_chunk");
- dataset = H5Dcreate2 (file, DATASETNAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, plist, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, plist, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/*
@@ -4192,8 +4260,10 @@ test_select_point_chunk(void)
MESSAGE(5, ("Testing Point Selections on Chunked Datasets\n"));
/* Allocate the transfer buffers */
- data = (unsigned*)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
- data_out = (unsigned*)HDcalloc((size_t)(SPACE7_DIM1 * SPACE7_DIM2), sizeof(unsigned));
+ data = (unsigned *)HDmalloc(sizeof(unsigned) * SPACE7_DIM1 * SPACE7_DIM2);
+ CHECK(data, NULL, "HDmalloc");
+ data_out = (unsigned *)HDcalloc((size_t)(SPACE7_DIM1 * SPACE7_DIM2), sizeof(unsigned));
+ CHECK(data_out, NULL, "HDcalloc");
/*
* Data buffer initialization.
@@ -4221,11 +4291,11 @@ test_select_point_chunk(void)
* Create a new dataset within the file using defined dataspace and
* chunking properties.
*/
- dcpl = H5Pcreate (H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
- ret = H5Pset_chunk (dcpl, SPACE7_RANK, chunk_dimsf);
+ ret = H5Pset_chunk(dcpl, SPACE7_RANK, chunk_dimsf);
CHECK(ret, FAIL, "H5Pset_chunk");
- dataset = H5Dcreate2 (file, DATASETNAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create 1st point selection */
@@ -4951,7 +5021,8 @@ test_select_fill_all(void)
MESSAGE(5, ("Testing Filling 'all' Selections\n"));
/* Allocate memory buffer */
- wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ wbuf = (unsigned short *)HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
/* Initialize memory buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -5026,7 +5097,8 @@ test_select_fill_point(hssize_t *offset)
MESSAGE(5, ("Testing Filling 'point' Selections\n"));
/* Allocate memory buffer */
- wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ wbuf = (unsigned short *)HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
/* Initialize memory buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -5122,7 +5194,8 @@ test_select_fill_hyper_simple(hssize_t *offset)
MESSAGE(5, ("Testing Filling Simple 'hyperslab' Selections\n"));
/* Allocate memory buffer */
- wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ wbuf = (unsigned short *)HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
/* Initialize memory buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -5228,7 +5301,8 @@ test_select_fill_hyper_regular(hssize_t *offset)
MESSAGE(5, ("Testing Filling Regular 'hyperslab' Selections\n"));
/* Allocate memory buffer */
- wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ wbuf = (unsigned short *)HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
/* Initialize memory buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -5285,8 +5359,8 @@ test_select_fill_hyper_regular(hssize_t *offset)
/* Add in the offset */
for(i=0; i<(int)num_points; i++) {
- points[i][0]+=real_offset[0];
- points[i][1]+=real_offset[1];
+ points[i][0] += real_offset[0];
+ points[i][1] += real_offset[1];
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -5346,7 +5420,8 @@ test_select_fill_hyper_irregular(hssize_t *offset)
MESSAGE(5, ("Testing Filling Irregular 'hyperslab' Selections\n"));
/* Allocate memory buffer */
- wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ wbuf = (unsigned short *)HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
/* Initialize memory buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -5401,18 +5476,18 @@ test_select_fill_hyper_irregular(hssize_t *offset)
} /* end for */
/* Initialize the iterator structure */
- iter_info.fill_value=SPACE7_FILL;
- iter_info.curr_coord=0;
- iter_info.coords=(hsize_t *)iter_points;
+ iter_info.fill_value = SPACE7_FILL;
+ iter_info.curr_coord = 0;
+ iter_info.coords = (hsize_t *)iter_points;
/* Add in the offset */
for(i=0; i<(int)num_iter_points; i++) {
- iter_points[i][0]+=real_offset[0];
- iter_points[i][1]+=real_offset[1];
+ iter_points[i][0] += real_offset[0];
+ iter_points[i][1] += real_offset[1];
} /* end for */
/* Iterate through selection, verifying correct data */
- ret = H5Diterate(wbuf,H5T_NATIVE_USHORT,sid1,test_select_hyper_iter3,&iter_info);
+ ret = H5Diterate(wbuf, H5T_NATIVE_USHORT, sid1, test_select_hyper_iter3, &iter_info);
CHECK(ret, FAIL, "H5Diterate");
/* Close dataspace */
@@ -5447,8 +5522,10 @@ test_select_none(void)
MESSAGE(5, ("Testing I/O on 0-sized Selections\n"));
/* Allocate write & read buffers */
- wbuf=malloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2);
- rbuf=malloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2);
+ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
+ CHECK(wbuf, NULL, "HDmalloc");
+ rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE7_DIM1 * SPACE7_DIM2);
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize write buffer */
for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++)
@@ -5548,8 +5625,10 @@ test_scalar_select(void)
MESSAGE(5, ("Testing I/O on Selections in Scalar Dataspaces\n"));
/* Allocate write & read buffers */
- wbuf_uint8=HDmalloc(sizeof(uint8_t)*SPACE7_DIM1*SPACE7_DIM2);
- wbuf_ushort=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2);
+ wbuf_uint8 = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE7_DIM1 * SPACE7_DIM2);
+ CHECK(wbuf_uint8, NULL, "HDmalloc");
+ wbuf_ushort = (unsigned short *)HDmalloc(sizeof(unsigned short) * SPACE7_DIM1 * SPACE7_DIM2);
+ CHECK(wbuf_ushort, NULL, "HDmalloc");
/* Initialize write buffers */
for(i=0, tbuf_uint8=wbuf_uint8, tbuf_ushort=wbuf_ushort; i<SPACE7_DIM1; i++)
@@ -6938,7 +7017,6 @@ test_shape_same(void)
static void
test_space_rebuild(void)
{
-
/* regular space IDs in span-tree form */
hid_t sid_reg1,sid_reg2,sid_reg3,sid_reg4,sid_reg5;
@@ -7585,10 +7663,9 @@ test_space_rebuild(void)
H5Sclose(sid_spec);
CHECK(ret, FAIL, "H5Sclose");
-
}
-
+
/****************************************************************
**
** test_select_hyper_chunk_offset(): Tests selections on dataspace,
@@ -7619,10 +7696,10 @@ test_select_hyper_chunk_offset(void)
MESSAGE(6, ("Testing hyperslab selections using offsets in chunked datasets\n"));
/* Allocate buffers */
- wbuf= HDmalloc(sizeof(int)*SPACE10_DIM1);
+ wbuf = (int *)HDmalloc(sizeof(int) * SPACE10_DIM1);
CHECK(wbuf, NULL, "HDmalloc");
- rbuf= HDmalloc(sizeof(int)*SPACE10_DIM1);
- CHECK(rbuf, NULL, "HDmalloc");
+ rbuf = (int *)HDcalloc(sizeof(int), SPACE10_DIM1);
+ CHECK(rbuf, NULL, "HDcalloc");
/* Initialize the write buffer */
for(i=0; i<SPACE10_DIM1; i++)
@@ -7675,7 +7752,7 @@ test_select_hyper_chunk_offset(void)
hsize_t size[1]; /* The size to extend the dataset to */
/* Extend the dataset */
- size[0] = i; /* The size to extend the dataset to */
+ size[0] = (hsize_t)i; /* The size to extend the dataset to */
ret = H5Dset_extent(did, size);
CHECK(ret, FAIL, "H5Dset_extent");
@@ -7740,7 +7817,7 @@ test_select_hyper_chunk_offset(void)
hsize_t size[1]; /* The size to extend the dataset to */
/* Extend the dataset */
- size[0] = i; /* The size to extend the dataset to */
+ size[0] = (hsize_t)i; /* The size to extend the dataset to */
ret = H5Dset_extent(did, size);
CHECK(ret, FAIL, "H5Dset_extent");
diff --git a/test/tsohm.c b/test/tsohm.c
index b5b489b..28854e2 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -3793,7 +3793,7 @@ test_sohm_extend_dset(void)
* Function: test_sohm_external_dtype
*
* Purpose: When a datatype is a SOHM type in one file, test that the
- * second file using the same datatype actually save it in
+ * second file using the same datatype actually save it in
* the file, too.
*
* Programmer: Raymond Lu
@@ -3814,9 +3814,9 @@ test_sohm_external_dtype(void)
hid_t fcpl, file1, file2;
hid_t dataset1, dataset2;
hid_t s1_tid, dset1_tid, dset2_tid, space;
- hsize_t dims[2] = {NX, NY};
+ hsize_t dims[2] = {NX, NY};
H5T_class_t dtype_class;
- size_t dmsg_count;
+ size_t dmsg_count;
unsigned x, i;
herr_t ret;
@@ -3843,7 +3843,7 @@ test_sohm_external_dtype(void)
/* Create a data type for s1_t */
s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
CHECK_I(s1_tid, "H5Tcreate");
-
+
ret = H5Tinsert(s1_tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
CHECK_I(ret, "H5Tinsert");
@@ -3860,7 +3860,7 @@ test_sohm_external_dtype(void)
VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test");
/* Create data set */
- dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
+ dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
CHECK_I(dataset1, "H5Dcreate2");
@@ -3880,7 +3880,7 @@ test_sohm_external_dtype(void)
s_ptr->a = i*3 + 1;
s_ptr->b = i*3 + 2;
}
-
+
/* Write the data to the dataset1 */
ret = H5Dwrite(dataset1, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig);
CHECK_I(ret, "H5Dwrite");
@@ -3898,7 +3898,7 @@ test_sohm_external_dtype(void)
VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test");
/* Create a data set using the datatype of the dataset in the first file. */
- dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
+ dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
CHECK_I(dataset2, "H5Dcreate2");
@@ -3914,7 +3914,7 @@ test_sohm_external_dtype(void)
ret = H5Dclose(dataset2);
CHECK_I(ret, "H5Dclose");
- /* Close file 1 and the dataset's datatype in file 1. Verify that the datatype in
+ /* Close file 1 and the dataset's datatype in file 1. Verify that the datatype in
* file 2 is still accessible. */
ret = H5Tclose(dset1_tid);
CHECK_I(ret, "H5Tclose");
diff --git a/test/tvlstr.c b/test/tvlstr.c
index a411b86..fbced5f 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -573,7 +573,7 @@ static void test_write_vl_string_attribute(void)
hid_t file, root, dataspace, att;
hid_t type;
herr_t ret;
- char *string_att_check;
+ char *string_att_check = NULL;
/* Open the file */
file = H5Fopen(DATAFILE, H5F_ACC_RDWR, H5P_DEFAULT);
@@ -599,13 +599,21 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att);
CHECK(ret, FAIL, "H5Awrite");
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ /* Allocate memory for read buffer */
+ if(string_att)
+ string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
+ CHECK(string_att_check, NULL, "HDmalloc");
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+ if(string_att_check) {
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- HDfree(string_att_check);
+ if(HDstrcmp(string_att_check,string_att)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+
+ HDfree(string_att_check);
+ string_att_check = NULL;
+ }
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -620,13 +628,23 @@ static void test_write_vl_string_attribute(void)
ret = H5Awrite(att, type, &string_att_write);
CHECK(ret, FAIL, "H5Awrite");
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ /* Allocate memory for read buffer */
+ if(string_att_write)
+ string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
+ CHECK(string_att_check, NULL, "HDmalloc");
+
+ if(string_att_check) {
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+
+ /* The attribute string written is freed below, in the
+ *test_read_vl_string_attribute() test */
+ HDfree(string_att_check);
+ }
- HDfree(string_att_check);
/* The attribute string written is freed below, in the test_read_vl_string_attribute() test */
/* HDfree(string_att_write); */
@@ -659,7 +677,7 @@ static void test_read_vl_string_attribute(void)
hid_t file, root, att;
hid_t type;
herr_t ret;
- char *string_att_check;
+ char *string_att_check = NULL;
/* Open file */
file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -679,13 +697,21 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ /* Allocate memory for read buffer */
+ if(string_att)
+ string_att_check = (char*)HDmalloc((strlen(string_att) + 1) * sizeof(char));
+ CHECK(string_att_check, NULL, "HDmalloc");
- if(HDstrcmp(string_att_check,string_att)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+ if(string_att_check) {
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- HDfree(string_att_check);
+ if(HDstrcmp(string_att_check,string_att)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
+
+ HDfree(string_att_check);
+ string_att_check = NULL;
+ }
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
@@ -694,14 +720,24 @@ static void test_read_vl_string_attribute(void)
att = H5Aopen(root, "test_scalar_large", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
- ret = H5Aread(att, type, &string_att_check);
- CHECK(ret, FAIL, "H5Aread");
+ /* Allocate memory for read buffer */
+ if(string_att_write)
+ string_att_check = (char*)HDmalloc((strlen(string_att_write) + 1) * sizeof(char));
+ CHECK(string_att_check, NULL, "HDmalloc");
+
+ if(string_att_check) {
+ ret = H5Aread(att, type, &string_att_check);
+ CHECK(ret, FAIL, "H5Aread");
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+
+ HDfree(string_att_check);
+ }
- HDfree(string_att_check);
- HDfree(string_att_write); /* Free string allocated in test_write_vl_string_attribute */
+ /* Free string allocated in test_write_vl_string_attribute */
+ if(string_att_write)
+ HDfree(string_att_write);
ret = H5Aclose(att);
CHECK(ret, FAIL, "HAclose");
diff --git a/test/vfd.c b/test/vfd.c
index bd642be..12ce04e 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -873,7 +873,7 @@ test_family_compat(void)
error:
H5E_BEGIN_TRY {
H5Fclose(file);
- H5Pclose(fapl);
+ H5Pclose(fapl);
} H5E_END_TRY;
return -1;