summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-02-22 19:37:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-02-22 19:37:06 (GMT)
commit727b687ae6c80c9854cb53814fa1c12f27c2994c (patch)
treefabe359aaddbe3b4d1e2bb58ceb3b94311d66a1c /test
parent25486d50895fa4a30809d289b9aff4de583a9b84 (diff)
downloadhdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.zip
hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.gz
hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.bz2
[svn-r20146] Description:
Bring r19714:20145 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, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.6 (amazon) in debug mode Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt100
-rw-r--r--test/Makefile.am15
-rw-r--r--test/Makefile.in63
-rw-r--r--test/be_data.h5bin2288 -> 40320 bytes
-rw-r--r--test/big.c408
-rw-r--r--test/bittests.c39
-rwxr-xr-xtest/cross_read.c862
-rw-r--r--test/dsets.c385
-rw-r--r--test/dtypes.c82
-rw-r--r--test/efc.c3213
-rw-r--r--test/external.c2
-rwxr-xr-xtest/gen_cross.c826
-rw-r--r--test/h5test.c10
-rw-r--r--test/h5test.h2
-rw-r--r--test/le_data.h5bin2288 -> 40320 bytes
-rw-r--r--test/links.c649
-rw-r--r--test/links_env.c192
-rw-r--r--test/mf.c132
-rw-r--r--test/testfiles/links_env.out6
-rw-r--r--test/testframe.c2
-rw-r--r--test/testlinks_env.sh.in46
-rw-r--r--test/th5o.c333
-rw-r--r--test/vms_data.h5bin2288 -> 40320 bytes
23 files changed, 6902 insertions, 465 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0d60993..8fb93b5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -55,16 +55,17 @@ SET (HDF5_REFERENCE_FILES
err_compat_2
error_test_1
error_test_2
+ links_env.out
)
FOREACH (ref_file ${HDF5_REFERENCE_FILES})
- SET (dest "${PROJECT_BINARY_DIR}/testfiles/${ref_file}")
+ SET (dest "${PROJECT_BINARY_DIR}/${ref_file}")
#MESSAGE (STATUS " Copying ${h5_file}")
ADD_CUSTOM_COMMAND (
TARGET ${HDF5_TEST_LIB_TARGET}
POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} -l3
)
ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES})
@@ -145,8 +146,7 @@ SET (testhdf5_SRCS
#-- Adding test for testhdf5
ADD_EXECUTABLE (testhdf5 ${testhdf5_SRCS})
-H5_NAMING (testhdf5)
-TARGET_WIN_PROPERTIES (testhdf5)
+H5_NAMING (testhdf5 ${LIB_TYPE})
TARGET_LINK_LIBRARIES (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>)
@@ -159,8 +159,7 @@ ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>)
MACRO (ADD_H5_TEST file)
ADD_EXECUTABLE (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c)
- H5_NAMING (${file})
- TARGET_WIN_PROPERTIES (${file})
+ H5_NAMING (${file} ${LIB_TYPE})
TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ADD_TEST (NAME ${file} COMMAND $<TARGET_FILE:${file}>)
@@ -178,6 +177,12 @@ ADD_TEST (
dtransform.h5
dtypes4.h5
dtypes5.h5
+ efc0.h5
+ efc1.h5
+ efc2.h5
+ efc3.h5
+ efc4.h5
+ efc5.h5
extlinks16A00000.h5
extlinks16A00001.h5
extlinks16A00002.h5
@@ -257,6 +262,7 @@ SET (H5_TESTS
filter_fail
extend
external
+ efc
objcopy
links
unlink
@@ -283,16 +289,19 @@ SET (H5_TESTS
earray
btree2
fheap
- error_test
- err_compat
+ #error_test
+ #err_compat
tcheck_version
testmeta
+ #links_env
)
FOREACH (test ${H5_TESTS})
- ADD_H5_TEST(${test})
+ ADD_H5_TEST(${test})
+ SET_TESTS_PROPERTIES(${test} PROPERTIES DEPENDS h5test-clear-objects)
ENDFOREACH (test ${H5_TESTS})
+SET_TESTS_PROPERTIES(flush2 PROPERTIES DEPENDS flush1)
##############################################################################
##############################################################################
@@ -302,24 +311,22 @@ ENDFOREACH (test ${H5_TESTS})
#-- Adding test for cache
ADD_EXECUTABLE (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-H5_NAMING (cache)
-TARGET_WIN_PROPERTIES (cache)
+H5_NAMING (cache ${LIB_TYPE})
TARGET_LINK_LIBRARIES (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME cache COMMAND $<TARGET_FILE:cache>)
+SET_TESTS_PROPERTIES(cache PROPERTIES DEPENDS h5test-clear-objects)
#-- Adding test for cache_api
ADD_EXECUTABLE (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-H5_NAMING (cache_api)
-TARGET_WIN_PROPERTIES (cache_api)
+H5_NAMING (cache_api ${LIB_TYPE})
TARGET_LINK_LIBRARIES (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME cache_api COMMAND $<TARGET_FILE:cache_api>)
#-- Adding test for cache_tagging
ADD_EXECUTABLE (cache_tagging ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-H5_NAMING (cache_tagging)
-TARGET_WIN_PROPERTIES (cache_tagging)
+H5_NAMING (cache_tagging ${LIB_TYPE})
TARGET_LINK_LIBRARIES (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME cache_tagging COMMAND $<TARGET_FILE:cache_tagging>)
@@ -331,12 +338,62 @@ ADD_EXECUTABLE (ttsafe
${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c
${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c
)
-H5_NAMING (ttsafe)
-TARGET_WIN_PROPERTIES (ttsafe)
+H5_NAMING (ttsafe ${LIB_TYPE})
TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>)
+#-- Adding test for err_compat
+IF (HDF5_ENABLE_DEPRECATED_SYMBOLS)
+ ADD_EXECUTABLE (err_compat ${HDF5_TEST_SOURCE_DIR}/err_compat.c)
+ H5_NAMING (err_compat ${LIB_TYPE})
+ TARGET_LINK_LIBRARIES (err_compat ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME err_compat COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:err_compat>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_MASK_ERROR=true"
+ -D "TEST_OUTPUT=err_compat.txt"
+ -D "TEST_REFERENCE=err_compat_1"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ENDIF (HDF5_ENABLE_DEPRECATED_SYMBOLS)
+
+#-- Adding test for error_test
+ADD_EXECUTABLE (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c)
+H5_NAMING (error_test ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ADD_TEST (NAME error_test COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:error_test>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_MASK_ERROR=true"
+ -D "TEST_OUTPUT=error_test.txt"
+ -D "TEST_REFERENCE=error_test_1"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+)
+
+#-- Adding test for links_env
+ADD_EXECUTABLE (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c)
+H5_NAMING (links_env ${LIB_TYPE})
+TARGET_LINK_LIBRARIES (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ADD_TEST (NAME links_env COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:links_env>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX"
+ -D "TEST_ENV_VALUE:STRING=.:tmp"
+ -D "TEST_EXPECT=0"
+ -D "TEST_OUTPUT=links_env.txt"
+ -D "TEST_REFERENCE=links_env.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+)
+
IF (HDF5_TEST_VFD)
SET (VFD_LIST
@@ -368,6 +425,7 @@ IF (HDF5_TEST_VFD)
filter_fail
extend
external
+ efc
objcopy
links
unlink
@@ -398,6 +456,7 @@ IF (HDF5_TEST_VFD)
err_compat
tcheck_version
testmeta
+ links_env
)
IF (DIRECT_VFD)
@@ -449,8 +508,7 @@ ENDIF (HDF5_TEST_VFD)
IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
MACRO (ADD_H5_GENERATOR genfile)
ADD_EXECUTABLE (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c)
- H5_NAMING (${genfile})
- TARGET_WIN_PROPERTIES (${genfile})
+ H5_NAMING (${genfile} ${LIB_TYPE})
TARGET_LINK_LIBRARIES (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ENDMACRO (ADD_H5_GENERATOR genfile)
@@ -477,7 +535,7 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
FOREACH (gen ${H5_GENERATORS})
ADD_EXECUTABLE (${gen} ${HDF5_TEST_SOURCE_DIR}/${gen}.c)
- H5_NAMING (${gen})
+ H5_NAMING (${gen} ${LIB_TYPE})
TARGET_LINK_LIBRARIES (${gen} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
ENDFOREACH (gen ${H5_GENERATORS})
diff --git a/test/Makefile.am b/test/Makefile.am
index 5d0dcd2..e47c978 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -24,9 +24,10 @@ include $(top_srcdir)/config/commence.am
INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src
# Test script for error_test and err_compat
-TEST_SCRIPT = testerror.sh testlibinfo.sh $(srcdir)/testswmr.sh testcheck_version.sh testflushrefresh.sh
+TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \
+ $(srcdir)/testswmr.sh testflushrefresh.sh
check_SCRIPTS = $(TEST_SCRIPT)
-SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
+SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT)
# These are our main targets. They should be listed in the order to be
@@ -38,7 +39,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
# other current library code tests.
TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \
pool accum hyperslab istore bittests dt_arith \
- dtypes dsets cmpd_dset filter_fail extend external objcopy links unlink \
+ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \
big mtime fillval mount flush1 flush2 app_ref enum \
set_extent ttsafe \
getname vfd ntypes dangle dtransform reserved cross_read \
@@ -52,7 +53,8 @@ bin_PROGRAMS=swmr_generator swmr_reader swmr_writer
# 'make check' doesn't run them directly, so they are not included in TEST_PROG.
# Also build testmeta, which is used for timings test. It builds quickly,
# and this lets automake keep all its test programs in one place.
-check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta flushrefresh
+check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta links_env \
+ flushrefresh
# These programs generate test files for the tests. They don't need to be
@@ -129,7 +131,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.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 flushrefresh.h5 flushrefresh_VERIFICATION_START \
+ earray.h5 efc[0-5].h5 swmr_data.h5 flushrefresh.h5 flushrefresh_VERIFICATION_START \
flushrefresh_VERIFICATION_CHECKPOINT1 flushrefresh_VERIFICATION_CHECKPOINT2 \
flushrefresh_VERIFICATION_DONE
@@ -140,6 +142,7 @@ testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
tvlstr.c tvltypes.c
# Temporary files.
-DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testflushrefresh.sh
+DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \
+ testflushrefresh.sh
include $(top_srcdir)/config/conclude.am
diff --git a/test/Makefile.in b/test/Makefile.in
index a244c53..e5667c2 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -55,13 +55,14 @@ host_triplet = @host@
DIST_COMMON = $(srcdir)/H5srcdir_str.h.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/testcheck_version.sh.in \
$(srcdir)/testerror.sh.in $(srcdir)/testflushrefresh.sh.in \
- $(srcdir)/testlibinfo.sh.in $(top_srcdir)/config/commence.am \
+ $(srcdir)/testlibinfo.sh.in $(srcdir)/testlinks_env.sh.in \
+ $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
bin_PROGRAMS = swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) \
swmr_writer$(EXEEXT)
check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \
err_compat$(EXEEXT) tcheck_version$(EXEEXT) testmeta$(EXEEXT) \
- flushrefresh$(EXEEXT)
+ links_env$(EXEEXT) flushrefresh$(EXEEXT)
@BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_2)
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
subdir = test
@@ -72,7 +73,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh \
- testflushrefresh.sh H5srcdir_str.h testlibinfo.sh
+ testflushrefresh.sh H5srcdir_str.h testlibinfo.sh \
+ testlinks_env.sh
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libh5test_la_LIBADD =
@@ -86,7 +88,7 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
hyperslab$(EXEEXT) istore$(EXEEXT) bittests$(EXEEXT) \
dt_arith$(EXEEXT) dtypes$(EXEEXT) dsets$(EXEEXT) \
cmpd_dset$(EXEEXT) filter_fail$(EXEEXT) extend$(EXEEXT) \
- external$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \
+ external$(EXEEXT) efc$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \
unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \
mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \
app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \
@@ -167,6 +169,10 @@ earray_SOURCES = earray.c
earray_OBJECTS = earray.$(OBJEXT)
earray_LDADD = $(LDADD)
earray_DEPENDENCIES = libh5test.la $(LIBHDF5)
+efc_SOURCES = efc.c
+efc_OBJECTS = efc.$(OBJEXT)
+efc_LDADD = $(LDADD)
+efc_DEPENDENCIES = libh5test.la $(LIBHDF5)
enum_SOURCES = enum.c
enum_OBJECTS = enum.$(OBJEXT)
enum_LDADD = $(LDADD)
@@ -311,6 +317,10 @@ links_SOURCES = links.c
links_OBJECTS = links.$(OBJEXT)
links_LDADD = $(LDADD)
links_DEPENDENCIES = libh5test.la $(LIBHDF5)
+links_env_SOURCES = links_env.c
+links_env_OBJECTS = links_env.$(OBJEXT)
+links_env_LDADD = $(LDADD)
+links_env_DEPENDENCIES = libh5test.la $(LIBHDF5)
mf_SOURCES = mf.c
mf_OBJECTS = mf.$(OBJEXT)
mf_LDADD = $(LDADD)
@@ -417,23 +427,23 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \
btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \
cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \
- earray.c enum.c err_compat.c error_test.c extend.c external.c \
- farray.c fheap.c fillval.c filter_fail.c flush1.c flush2.c \
- flushrefresh.c freespace.c gen_bad_ohdr.c gen_bogus.c \
+ earray.c efc.c enum.c err_compat.c error_test.c extend.c \
+ external.c farray.c fheap.c fillval.c filter_fail.c flush1.c \
+ flush2.c flushrefresh.c freespace.c gen_bad_ohdr.c gen_bogus.c \
gen_cross.c gen_deflate.c gen_filespace.c gen_filters.c \
gen_idx.c gen_new_array.c gen_new_fill.c gen_new_group.c \
gen_new_mtime.c gen_new_super.c gen_noencoder.c \
gen_nullspace.c gen_sizes_lheap.c gen_specmetaread.c \
gen_udlinks.c getname.c gheap.c hyperslab.c istore.c lheap.c \
- links.c mf.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
- reserved.c set_extent.c space_overflow.c stab.c \
+ links.c links_env.c mf.c mount.c mtime.c ntypes.c objcopy.c \
+ ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c \
swmr_generator.c swmr_reader.c swmr_writer.c tcheck_version.c \
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
vfd.c
DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \
bittests.c btree2.c cache.c cache_api.c cache_tagging.c \
cmpd_dset.c cross_read.c dangle.c dsets.c dt_arith.c \
- dtransform.c dtypes.c earray.c enum.c err_compat.c \
+ dtransform.c dtypes.c earray.c efc.c enum.c err_compat.c \
error_test.c extend.c external.c farray.c fheap.c fillval.c \
filter_fail.c flush1.c flush2.c flushrefresh.c freespace.c \
gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \
@@ -441,8 +451,8 @@ DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \
gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \
gen_noencoder.c gen_nullspace.c gen_sizes_lheap.c \
gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \
- istore.c lheap.c links.c mf.c mount.c mtime.c ntypes.c \
- objcopy.c ohdr.c pool.c reserved.c set_extent.c \
+ istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \
+ ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \
space_overflow.c stab.c swmr_generator.c swmr_reader.c \
swmr_writer.c tcheck_version.c $(testhdf5_SOURCES) testmeta.c \
$(ttsafe_SOURCES) unlink.c vfd.c
@@ -497,6 +507,7 @@ DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DIRECT_VFD = @DIRECT_VFD@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DYNAMIC_DIRS = @DYNAMIC_DIRS@
@@ -558,6 +569,7 @@ LTLIBOBJS = @LTLIBOBJS@
LT_STATIC_EXEC = @LT_STATIC_EXEC@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
MPI_GET_SIZE = @MPI_GET_SIZE@
@@ -614,6 +626,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
@@ -747,17 +760,19 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.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 flushrefresh.h5 \
- flushrefresh_VERIFICATION_START \
+ app_ref.h5 farray.h5 earray.h5 efc[0-5].h5 swmr_data.h5 \
+ flushrefresh.h5 flushrefresh_VERIFICATION_START \
flushrefresh_VERIFICATION_CHECKPOINT1 \
flushrefresh_VERIFICATION_CHECKPOINT2 \
flushrefresh_VERIFICATION_DONE
INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
# Test script for error_test and err_compat
-TEST_SCRIPT = testerror.sh testlibinfo.sh $(srcdir)/testswmr.sh testcheck_version.sh testflushrefresh.sh
+TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \
+ $(srcdir)/testswmr.sh testflushrefresh.sh
+
check_SCRIPTS = $(TEST_SCRIPT)
-SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
+SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT)
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
@@ -768,7 +783,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
# other current library code tests.
TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \
pool accum hyperslab istore bittests dt_arith \
- dtypes dsets cmpd_dset filter_fail extend external objcopy links unlink \
+ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \
big mtime fillval mount flush1 flush2 app_ref enum \
set_extent ttsafe \
getname vfd ntypes dangle dtransform reserved cross_read \
@@ -810,7 +825,9 @@ testhdf5_SOURCES = testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
# Temporary files.
-DISTCLEANFILES = testerror.sh testlibinfo.sh testcheck_version.sh testflushrefresh.sh
+DISTCLEANFILES = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \
+ testflushrefresh.sh
+
# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
@@ -871,6 +888,8 @@ 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)/$@
+testlinks_env.sh: $(top_builddir)/config.status $(srcdir)/testlinks_env.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -991,6 +1010,9 @@ dtypes$(EXEEXT): $(dtypes_OBJECTS) $(dtypes_DEPENDENCIES)
earray$(EXEEXT): $(earray_OBJECTS) $(earray_DEPENDENCIES)
@rm -f earray$(EXEEXT)
$(LINK) $(earray_OBJECTS) $(earray_LDADD) $(LIBS)
+efc$(EXEEXT): $(efc_OBJECTS) $(efc_DEPENDENCIES)
+ @rm -f efc$(EXEEXT)
+ $(LINK) $(efc_OBJECTS) $(efc_LDADD) $(LIBS)
enum$(EXEEXT): $(enum_OBJECTS) $(enum_DEPENDENCIES)
@rm -f enum$(EXEEXT)
$(LINK) $(enum_OBJECTS) $(enum_LDADD) $(LIBS)
@@ -1099,6 +1121,9 @@ lheap$(EXEEXT): $(lheap_OBJECTS) $(lheap_DEPENDENCIES)
links$(EXEEXT): $(links_OBJECTS) $(links_DEPENDENCIES)
@rm -f links$(EXEEXT)
$(LINK) $(links_OBJECTS) $(links_LDADD) $(LIBS)
+links_env$(EXEEXT): $(links_env_OBJECTS) $(links_env_DEPENDENCIES)
+ @rm -f links_env$(EXEEXT)
+ $(LINK) $(links_env_OBJECTS) $(links_env_LDADD) $(LIBS)
mf$(EXEEXT): $(mf_OBJECTS) $(mf_DEPENDENCIES)
@rm -f mf$(EXEEXT)
$(LINK) $(mf_OBJECTS) $(mf_LDADD) $(LIBS)
@@ -1183,6 +1208,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtransform.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtypes.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err_compat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error_test.Po@am__quote@
@@ -1220,6 +1246,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/istore.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lheap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/links.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/links_env.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime.Po@am__quote@
diff --git a/test/be_data.h5 b/test/be_data.h5
index f906545..0feefa3 100644
--- a/test/be_data.h5
+++ b/test/be_data.h5
Binary files differ
diff --git a/test/big.c b/test/big.c
index 8d65559..24b2d25 100644
--- a/test/big.c
+++ b/test/big.c
@@ -16,16 +16,45 @@
/*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Wednesday, April 8, 1998
+ * Modified: Albert Cheng <acheng@hdfgroup.org>
+ * September 11, 2010
+ */
+/*
+ * The purpose of this test is to verify if a virtual file driver can handle:
+ * a. Large file (2GB)
+ * This should exceed 32bits I/O system since offset is a signed
+ * integral type (in order to support negative offset with respect to
+ * end of file).
+ * b. Extra Large file (4GB)
+ * This definite exceeds 32bit I/O and file systems.
+ * c. Huge file (tens of GB)
+ * This verifies the HDF5 library handles big logical file size
+ * correctly.
+ * In practice, if a VFD can handle a big file size, there is no need to
+ * test the smaller file sizes. E.g., If it can handle the Huge file,
+ * there is no need to test the Extra large or Large files. Therefore the
+ * test starts with larger size files and continues to test the smaller size
+ * files only if the large sige file tests have failed.
+ *
+ * Another consideration is that even if a VFD is capable to handle a
+ * huge file but it is likely to take a long time to write every byte
+ * of a huge file. E.g., a simple workstation may have disks of write
+ * speed of 10MB/sec. A huge file of 30GB will take about an hour to
+ * write it. Therefore, this test will run the huge file test only if the
+ * underlying file system supports sparse file. (A Sparse file here means
+ * that disk space is allocated only when the contents are actually written.
+ * E.g., If one creates a new file, seeks forward 10 million bytes, writes
+ * 1 bytes and closes the file, then a sparse file, will show file size of
+ * 10 million bytes but actaully uses only couple disk blocks, much smaller
+ * than the formal file size.)
+ *
+ * One more consideration is that we want to distinguish an HDF5 library
+ * failure from some system limits such as current free disk space or user
+ * disk space quota. Therefore, the test will first attempt to verify no
+ * such limits exist before running the actual VFD tests.
*/
#include "h5test.h"
-const char *FILENAME[] = {
- "big",
- "sec2",
- "stdio",
- NULL
-};
-
#define DNAME "big.data"
#define WRT_N 50
@@ -42,8 +71,29 @@ const char *FILENAME[] = {
# define GB8LL 0 /*cannot do the test*/
#endif
+/* Define Small, Large, Extra Large, Huge File which
+ * corrspond to less than 2GB, 2GB, 4GB, and tens of GB file size.
+ * NOFILE stands for "no file" to be tested.
+ */
+typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NOFILE} fsizes_t;
+/* Lists of vfd to test */
+typedef enum vfd_t { SEC2_VFD, STDIO_VFD, FAMILY_VFD } vfd_t;
+fsizes_t file_size= NOFILE;
+
+const char *FILENAME[] = {
+ "big",
+ "sec2",
+ "stdio",
+ NULL
+};
+int cflag=1; /* check file system before test */
+int sparse_support=0; /* sparse file supported, default false */
+int have_space=0; /* enough space for huge file test, default false */
+hsize_t family_size_def=FAMILY_SIZE; /* default family file size */
+
/* Protocols */
static void usage(void);
+int testvfd(vfd_t vfd);
/* Array used to record all addresses at which data has been written */
/* so far. Used to prevent overlapping writes. */
@@ -129,7 +179,7 @@ is_sparse(void)
if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
if (HDclose(fd) < 0) return 0;
if (HDstat("x.h5", &sb) < 0) return 0;
- if (HDunlink("x.h5") < 0) return 0;
+ if (HDremove("x.h5") < 0) return 0;
#ifdef H5_HAVE_STAT_ST_BLOCKS
return ((unsigned long)sb.st_blocks*512 < (unsigned long)sb.st_size);
#else
@@ -156,25 +206,67 @@ is_sparse(void)
*
*-------------------------------------------------------------------------
*/
-static int
-supports_big(void)
+static fsizes_t
+supports_big(vfd_t vfd)
{
- int fd;
+ int fd = -1;
+ fsizes_t fsize = NOFILE;
+
+ switch (vfd){
+ case FAMILY_VFD:
+ case SEC2_VFD:
+ case STDIO_VFD:
+ if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0)
+ goto error;
- if ((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0) return 0;
+ /* Write a few byte at the beginning */
+ if (5!=HDwrite(fd, "hello", (size_t)5))
+ goto quit;
+ fsize = SFILE;
- /* Write a few bytes at 2GB */
- if (HDlseek(fd, 2*GB, SEEK_SET)!=2*GB) return 0;
- if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
+ /* Write a few bytes at 2GB */
+ if (HDlseek(fd, 2*GB, SEEK_SET)!=2*GB)
+ goto quit;
+ if (5!=HDwrite(fd, "hello", (size_t)5))
+ goto quit;
+ fsize = LFILE;
- /* Write a few bytes at 4GB */
- if (HDlseek(fd, 4*GB, SEEK_SET) != 4*GB) return 0;
- if (5!=HDwrite(fd, "hello", (size_t)5)) return 0;
+ /* Write a few bytes at 4GB */
+ if (HDlseek(fd, 4*GB, SEEK_SET) != 4*GB)
+ goto quit;
+ if (5!=HDwrite(fd, "hello", (size_t)5))
+ goto quit;
+ fsize = XLFILE;
- if (HDclose(fd) < 0) return 0;
- if (HDremove("y.h5") < 0) return 0;
+ /* If this supports sparse_file, write a few bytes at 32GB */
+ if (!sparse_support)
+ goto quit;
+ if (HDlseek(fd, 32*GB, SEEK_SET) != 32*GB)
+ goto quit;
+ if (5!=HDwrite(fd, "hello", (size_t)5))
+ goto quit;
+ fsize = HUGEFILE;
- return (1);
+ break;
+ default:
+ /* unknown or unsupported VFD */
+ goto error;
+ break;
+ }
+
+quit:
+ if (HDclose(fd) < 0)
+ goto error;
+ if (HDremove("y.h5") < 0)
+ goto error;
+ return(fsize);
+
+error:
+ if (fd >= 0){
+ HDclose(fd);
+ HDremove("y.h5");
+ }
+ return (fsize);
}
@@ -231,7 +323,7 @@ enough_room(hid_t fapl)
HDsnprintf(name, sizeof name, filename, i);
if(HDclose(fd[i]) < 0)
ret_value=0;
- HDunlink(name);
+ HDremove(name);
}
return ret_value;
@@ -257,7 +349,7 @@ enough_room(hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
-writer (char* filename, hid_t fapl, int wrt_n)
+writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n)
{
hsize_t size1[4] = {8, 1024, 1024, 1024};
hsize_t size2[1] = {GB8LL};
@@ -269,7 +361,39 @@ writer (char* filename, hid_t fapl, int wrt_n)
FILE *out = fopen(DNAME, "w");
hid_t dcpl;
- TESTING("large dataset write");
+ switch(testsize){
+ case LFILE:
+ TESTING("Large dataset write(2GB)");
+ /* reduce size1 to produce a 2GB dataset */
+ size1[1] = 1024/16;
+ size2[0] /= 16;
+ break;
+
+ case XLFILE:
+ TESTING("Extra large dataset write(4GB)");
+ /* reduce size1 to produce a 4GB dataset */
+ size1[1] = 1024/8;
+ size2[0] /= 8;
+ break;
+
+ case HUGEFILE:
+ TESTING("Huge dataset write");
+ /* Leave size1 as 32GB */
+ break;
+
+ case SFILE:
+ TESTING("small dataset write(1GB)");
+ /* reduce size1 to produce a 1GB dataset */
+ size1[1] = 1024/32;
+ size2[0] /= 32;
+ break;
+
+ case NOFILE:
+ /* what to do?? */
+ HDfprintf(stdout, "Unexpected file size of NOFILE\n");
+ goto error;
+ break;
+ }
/*
* We might be on a machine that has 32-bit files, so create an HDF5 file
@@ -475,6 +599,124 @@ usage(void)
+/* Flush stdout at the end of this test routine to ensure later output to */
+/* stderr will not come out before it.*/
+int testvfd(vfd_t vfd)
+{
+ hid_t fapl=-1;
+ hsize_t family_size;
+ char filename[1024];
+ fsizes_t testsize;
+
+
+ switch(vfd){
+ case FAMILY_VFD:
+ /* Test huge file with the family driver */
+ puts("Testing big file with the Family Driver ");
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0)
+ goto error;
+
+ if (cflag){
+ /*
+ * We shouldn't run this test if the file system doesn't support holes
+ * because we would generate multi-gigabyte files.
+ */
+ puts("Checking if file system is adequate for this test...");
+ if (sizeof(long long)<8 || 0==GB8LL) {
+ puts("Test skipped because sizeof(long long) is too small. This");
+ puts("hardware apparently doesn't support 64-bit integer types.");
+ usage();
+ goto quit;
+ }
+ if (!sparse_support) {
+ puts("Test skipped because file system does not support holes.");
+ usage();
+ goto quit;
+ }
+ if (!enough_room(fapl)) {
+ puts("Test skipped because of quota (file size or num open files).");
+ usage();
+ goto quit;
+ }
+ }
+
+ /* Do the test with the Family Driver */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if (writer(filename, fapl, HUGEFILE, WRT_N)) goto error;
+ if (reader(filename, fapl)) goto error;
+
+ puts("Test passed with the Family Driver.");
+ break;
+
+ case SEC2_VFD:
+ testsize = supports_big(SEC2_VFD);
+ if (testsize == NOFILE) {
+ HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n");
+ goto quit;
+ }
+ /* Test big file with the SEC2 driver */
+ puts("Testing big file with the SEC2 Driver ");
+
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_fapl_sec2(fapl) < 0)
+ goto error;
+
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+
+ if (writer(filename, fapl, testsize, WRT_N)) goto error;
+ if (reader(filename, fapl)) goto error;
+
+ puts("Test passed with the SEC2 Driver.");
+ break;
+
+ case STDIO_VFD:
+ testsize = supports_big(STDIO_VFD);
+ if (testsize == NOFILE) {
+ HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n");
+ goto quit;
+ }
+ puts("\nTesting big file with the STDIO Driver ");
+
+ if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_fapl_stdio(fapl) < 0)
+ goto error;
+
+ h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+
+ if (writer(filename, fapl, testsize, WRT_N)) goto error;
+ if (reader(filename, fapl)) goto error;
+ puts("Test passed with the STDIO Driver.");
+ break;
+
+ default:
+ puts("Unsupprted VFD");
+ usage();
+ goto error;;
+ } /* end of switch (vfd) */
+
+quit:
+ /* End with normal return code */
+ /* Clean up the test file */
+ if (h5_cleanup(FILENAME, fapl)) HDremove(DNAME);
+ fflush(stdout);
+ return 0;
+
+
+error:
+ if (fapl>=0) H5Pclose(fapl);
+ puts("*** TEST FAILED ***");
+ fflush(stdout);
+ return 1;
+}
+
+
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -501,15 +743,9 @@ usage(void)
int
main (int ac, char **av)
{
- hid_t fapl=-1;
- hsize_t family_size;
- hsize_t family_size_def; /* default family file size */
unsigned long seed = 0; /* Random # seed */
- int cflag=1; /* check file system before test */
- char filename[1024];
/* parameters setup */
- family_size_def = FAMILY_SIZE;
while (--ac > 0){
av++;
@@ -538,6 +774,11 @@ main (int ac, char **av)
}
}
+ /* check sparse file support unless cflag is not set. */
+ if (cflag)
+ sparse_support = is_sparse();
+
+
/* Choose random # seed */
seed = (unsigned long)HDtime(NULL);
#ifdef QAK
@@ -546,113 +787,18 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
#endif /* QAK */
HDsrandom(seed);
- /* Reset library */
- h5_reset();
- fapl = h5_fileaccess();
-
- /* Test big file with the family driver */
- puts("Testing big file with the Family Driver ");
- if (H5FD_FAMILY!=H5Pget_driver(fapl)) {
- HDfprintf(stdout,
- "Changing file drivers to the family driver, %Hu bytes each\n",
- family_size_def);
- if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0) goto error;
- } else if (H5Pget_fapl_family(fapl, &family_size, NULL) < 0) {
+/*=================================================*/
+ if (testvfd(FAMILY_VFD) != 0)
+ goto error;
+ if (testvfd(SEC2_VFD) != 0)
+ goto error;
+ if (testvfd(STDIO_VFD) != 0)
goto error;
- } else if (family_size!=family_size_def) {
- HDfprintf(stdout, "Changing family member size from %Hu to %Hu\n",
- family_size, family_size_def);
- if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT) < 0)
- goto error;
- }
-
- if (cflag){
- /*
- * We shouldn't run this test if the file system doesn't support holes
- * because we would generate multi-gigabyte files.
- */
- puts("Checking if file system is adequate for this test...");
- if (sizeof(long long)<8 || 0==GB8LL) {
- puts("Test skipped because sizeof(long long) is too small. This");
- puts("hardware apparently doesn't support 64-bit integer types.");
- usage();
- goto quit;
- }
- if (!is_sparse()) {
- puts("Test skipped because file system does not support holes.");
- usage();
- goto quit;
- }
- if (!enough_room(fapl)) {
- puts("Test skipped because of quota (file size or num open files).");
- usage();
- goto quit;
- }
- }
-
- /* Do the test with the Family Driver */
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
-
- if (writer(filename, fapl, WRT_N)) goto error;
- if (reader(filename, fapl)) goto error;
-
- puts("Test passed with the Family Driver.");
-
- /*
- * We shouldn't run this test if the file system doesn't support big files
- * because we would generate multi-gigabyte files.
- */
- puts("\nChecking if file system supports big files...");
- if (!supports_big()) {
- puts("Tests for sec2 and stdio are skipped because file system does not support big files.");
- usage();
- goto quit;
- }
-
- /* Clean up the test file */
- if (h5_cleanup(FILENAME, fapl)) remove(DNAME);
-
- /* Test big file with the SEC2 driver */
- puts("Testing big file with the SEC2 Driver ");
-
- fapl = h5_fileaccess();
- if(H5Pset_fapl_sec2(fapl) < 0)
-
- HDmemset(filename, 0, sizeof(filename));
- h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
-
- if (writer(filename, fapl, WRT_N)) goto error;
- if (reader(filename, fapl)) goto error;
-
- puts("Test passed with the SEC2 Driver.");
-
-#ifdef H5_HAVE_FSEEKO
- /* Clean up the test file */
- if (h5_cleanup(FILENAME, fapl)) remove(DNAME);
-
- /* Test big file with the STDIO driver only if fseeko is supported,
- * because the OFFSET parameter of fseek has the type LONG, not big
- * enough to support big files. */
- puts("\nTesting big file with the STDIO Driver ");
-
- fapl = h5_fileaccess();
- if(H5Pset_fapl_stdio(fapl) < 0)
-
- HDmemset(filename, 0, sizeof(filename));
- h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
-
- if (writer(filename, fapl, WRT_N)) goto error;
- if (reader(filename, fapl)) goto error;
- puts("Test passed with the STDIO Driver.");
-#endif
-quit:
/* End with normal exit code */
- if (h5_cleanup(FILENAME, fapl)) remove(DNAME);
return 0;
error:
- if (fapl>=0) H5Pclose(fapl);
puts("*** TEST FAILED ***");
return 1;
}
diff --git a/test/bittests.c b/test/bittests.c
index e435d6c..f063cee 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -908,41 +908,36 @@ test_clear (void)
* Programmer: Robb Matzke
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- int nerrors=0;
+ int nerrors = 0;
/*
- * Open the library explicitly for thread-safe builds, so per-thread
- * things are initialized correctly.
+ * Open the library explicitly.
*/
-#ifdef H5_HAVE_THREADSAFE
H5open();
-#endif /* H5_HAVE_THREADSAFE */
-
- nerrors += test_find ()<0?1:0;
- nerrors += test_set ()<0?1:0;
- nerrors += test_clear()<0?1:0;
- nerrors += test_copy ()<0?1:0;
- nerrors += test_shift()<0?1:0;
- nerrors += test_increment ()<0?1:0;
- nerrors += test_decrement ()<0?1:0;
- nerrors += test_negate ()<0?1:0;
-
- if (nerrors) {
+
+ nerrors += test_find() < 0 ? 1 : 0;
+ nerrors += test_set() < 0 ? 1 : 0;
+ nerrors += test_clear() < 0 ? 1 : 0;
+ nerrors += test_copy() < 0 ? 1 : 0;
+ nerrors += test_shift() < 0 ? 1 : 0;
+ nerrors += test_increment() < 0 ? 1 : 0;
+ nerrors += test_decrement() < 0 ? 1 : 0;
+ nerrors += test_negate() < 0 ? 1 : 0;
+
+ if(nerrors) {
printf("***** %u FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
+ nerrors, 1 == nerrors ? "" : "S");
exit(1);
}
printf("All bit tests passed.\n");
-#ifdef H5_HAVE_THREADSAFE
H5close();
-#endif /* H5_HAVE_THREADSAFE */
+
return 0;
}
+
diff --git a/test/cross_read.c b/test/cross_read.c
index 6b2badf..6588031 100755
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -17,8 +17,8 @@
* Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
* Thursday, March 23, 2006
*
- * Purpose: Check if floating-point data created on OpenVMS (VAX type), Solaris,
- * and Linux machines can be read on the machine running this test.
+ * Purpose: Check if floating-point data created on OpenVMS, big-endian, and
+ * little-endian machines can be read on the machine running this test.
*/
#include "h5test.h"
@@ -31,21 +31,63 @@ const char *FILENAME[] = {
NULL
};
-#define DATASETNAME "Array"
-#define NX 5 /* output buffer dimensions */
-#define NY 6
-#define RANK 2
+#define DATASETNAME "Array"
+#define DATASETNAME2 "Scale_offset_float_data_le"
+#define DATASETNAME3 "Scale_offset_float_data_be"
+#define DATASETNAME4 "Scale_offset_double_data_le"
+#define DATASETNAME5 "Scale_offset_double_data_be"
+#define DATASETNAME6 "Scale_offset_char_data_le"
+#define DATASETNAME7 "Scale_offset_char_data_be"
+#define DATASETNAME8 "Scale_offset_short_data_le"
+#define DATASETNAME9 "Scale_offset_short_data_be"
+#define DATASETNAME10 "Scale_offset_int_data_le"
+#define DATASETNAME11 "Scale_offset_int_data_be"
+#define DATASETNAME12 "Scale_offset_long_long_data_le"
+#define DATASETNAME13 "Scale_offset_long_long_data_be"
+#define NX 6
+#define NY 6
+
+/*-------------------------------------------------------------------------
+ * Function: read_data
+ *
+ * Purpose: Read data from a data file.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 21 January 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
static int read_data(char *fname)
{
const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */
hid_t file, dataset; /* handles */
- hid_t datatype;
- hid_t dt;
- double data_in[NX][NY]; /* input buffer */
- double data_out[NX][NY]; /* output buffer */
+ double data_in[NX+1][NY]; /* input buffer */
+ double data_out[NX+1][NY]; /* output buffer */
+ long long int_data_in[NX+1][NY]; /* input buffer */
+ long long int_data_out[NX+1][NY]; /* output buffer */
int i, j;
unsigned nerrors = 0;
+ const char *not_supported= " Scaleoffset filter is not enabled.";
+
+ /*
+ * Open the file.
+ */
+ if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ TESTING("regular dataset");
+
+ /*
+ * Open the regular dataset.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/*
* Data and output buffer initialization.
@@ -56,42 +98,277 @@ static int read_data(char *fname)
data_out[j][i] = 0;
}
}
+ for (i = 0; i < NY; i++) {
+ data_in[NX][i] = -2.2;
+ data_out[NX][i] = 0;
+ }
/*
* 0 1 2 3 4 5
* 1 2 3 4 5 6
* 2 3 4 5 6 7
* 3 4 5 6 7 8
* 4 5 6 7 8 9
+ * 5 6 7 8 9 10
+ * -2.2 -2.2 -2.2 -2.2 -2.2 -2.2
*/
/*
- * Open the file and the dataset.
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
*/
- if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ data_out) < 0)
TEST_ERROR;
- if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0)
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ /* if (data_out[j][i] != data_in[j][i]) { */
+ if (!FLT_ABS_EQUAL(data_out[j][i], data_in[j][i])) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %g but should have been %g\n",
+ j, i, data_out[j][i], data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+ TESTING("dataset of LE FLOAT with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME2, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ data_in[j][i] = ((double)(i + j + 1))/3;
+ data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ data_in[NX][i] = -2.2;
+ data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %g but should have been %g\n",
+ j, i, data_out[j][i], data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of BE FLOAT with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ data_in[j][i] = ((double)(i + j + 1))/3;
+ data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ data_in[NX][i] = -2.2;
+ data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %g but should have been %g\n",
+ j, i, data_out[j][i], data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of LE DOUBLE with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0)
TEST_ERROR;
/*
- * Get datatype and dataspace handles and then query
- * dataset class, order, size, rank and dimensions.
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ data_in[j][i] = ((double)(i + j + 1))/3;
+ data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ data_in[NX][i] = -2.2;
+ data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
*/
- if((dt = H5Dget_type(dataset)) < 0) /* datatype handle */
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ data_out) < 0)
TEST_ERROR;
- if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT)) < 0)
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %g but should have been %g\n",
+ j, i, data_out[j][i], data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of BE DOUBLE with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME5, H5P_DEFAULT)) < 0)
TEST_ERROR;
/*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ data_in[j][i] = ((double)(i + j + 1))/3;
+ data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ data_in[NX][i] = -2.2;
+ data_out[NX][i] = 0;
+ }
+
+ /*
* Read data from hyperslab in the file into the hyperslab in
* memory and display.
*/
- if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ data_out) < 0)
TEST_ERROR;
/* Check results */
- for (j=0; j<NX; j++) {
+ for (j=0; j<(NX+1); j++) {
for (i=0; i<NY; i++) {
- if (data_out[j][i] != data_in[j][i]) {
+ if (!DBL_REL_EQUAL(data_out[j][i], data_in[j][i], 0.001)) {
if (!nerrors++) {
H5_FAILED();
printf("element [%d][%d] is %g but should have been %g\n",
@@ -104,10 +381,519 @@ static int read_data(char *fname)
/*
* Close/release resources.
*/
- H5Tclose(dt);
- H5Tclose(datatype);
- H5Dclose(dataset);
- H5Fclose(file);
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of LE CHAR with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME6, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of BE CHAR with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME7, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of LE SHORT with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME8, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of BE SHORT with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME9, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of LE INT with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME10, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of BE INT with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME11, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of LE LONG LONG with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME12, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Failure */
+ if (nerrors) {
+ printf("total of %d errors out of %d elements\n", nerrors, NX*NY);
+ return 1;
+ }
+
+ PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ TESTING("dataset of BE LONG LONG with scale-offset filter");
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ /*
+ * Open the dataset with scale-offset filter.
+ */
+ if((dataset = H5Dopen2(file, DATASETNAME13, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ int_data_in[j][i] = i + j;
+ int_data_out[j][i] = 0;
+ }
+ }
+ for (i = 0; i < NY; i++) {
+ int_data_in[NX][i] = -2;
+ int_data_out[NX][i] = 0;
+ }
+
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ if(H5Dread(dataset, H5T_NATIVE_LLONG, H5S_ALL, H5S_ALL, H5P_DEFAULT,
+ int_data_out) < 0)
+ TEST_ERROR;
+
+ /* Check results */
+ for (j=0; j<(NX+1); j++) {
+ for (i=0; i<NY; i++) {
+ if (int_data_out[j][i] != int_data_in[j][i]) {
+ if (!nerrors++) {
+ H5_FAILED();
+ printf("element [%d][%d] is %d but should have been %d\n",
+ j, i, (int)int_data_out[j][i],
+ (int)int_data_in[j][i]);
+ }
+ }
+ }
+ }
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
/* Failure */
if (nerrors) {
@@ -116,6 +902,14 @@ static int read_data(char *fname)
}
PASSED();
+
+#else /*H5_HAVE_FILTER_SCALEOFFSET*/
+ SKIPPED();
+ puts(not_supported);
+#endif /*H5_HAVE_FILTER_SCALEOFFSET*/
+
+ if(H5Fclose(file))
+ TEST_ERROR
return 0;
error:
@@ -125,6 +919,20 @@ error:
return 1;
}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests the basic features of Virtual File Drivers
+ *
+ * Return: Success: exit(0)
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * Tuesday, Sept 24, 2002
+ *
+ *-------------------------------------------------------------------------
+ */
int main(void)
{
char filename[1024];
@@ -132,15 +940,15 @@ int main(void)
h5_reset();
- TESTING("reading data created on OpenVMS");
+ puts("Testing reading data created on OpenVMS");
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
nerrors += read_data(filename);
- TESTING("reading data created on Linux");
+ puts("Testing reading data created on Linux");
h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename);
nerrors += read_data(filename);
- TESTING("reading data created on Solaris");
+ puts("Testing reading data created on Solaris");
h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename);
nerrors += read_data(filename);
diff --git a/test/dsets.c b/test/dsets.c
index 74abdb5..be6988b 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -64,6 +64,7 @@ const char *FILENAME[] = {
NULL
};
#define FILENAME_BUF_SIZE 1024
+#define KB 1024
#define FILE_DEFLATE_NAME "deflate.h5"
@@ -110,6 +111,8 @@ const char *FILENAME[] = {
#define DSET_NBIT_COMPOUND_NAME "nbit_compound"
#define DSET_NBIT_COMPOUND_NAME_2 "nbit_compound_2"
#define DSET_NBIT_COMPOUND_NAME_3 "nbit_compound_3"
+#define DSET_NBIT_INT_SIZE_NAME "nbit_int_size"
+#define DSET_NBIT_FLT_SIZE_NAME "nbit_flt_size"
#define DSET_SCALEOFFSET_INT_NAME "scaleoffset_int"
#define DSET_SCALEOFFSET_INT_NAME_2 "scaleoffset_int_2"
#define DSET_SCALEOFFSET_FLOAT_NAME "scaleoffset_float"
@@ -4019,6 +4022,384 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_nbit_int_size
+ *
+ * Purpose: Tests the correct size of the integer datatype for nbit filter
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 19 November 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_nbit_int_size(hid_t file)
+{
+#ifdef H5_HAVE_FILTER_NBIT
+ hid_t dataspace, dataset, datatype, mem_datatype, dset_create_props;
+ hsize_t dims[2], chunk_size[2];
+ hsize_t dset_size = 0;
+ int orig_data[DSET_DIM1][DSET_DIM2];
+ int i, j;
+ size_t precision, offset;
+#else /* H5_HAVE_FILTER_NBIT */
+ const char *not_supported= " Nbit is not enabled.";
+#endif /* H5_HAVE_FILTER_NBIT */
+
+ TESTING(" nbit integer dataset size");
+#ifdef H5_HAVE_FILTER_NBIT
+
+ /* Define dataset datatype (integer), and set precision, offset */
+ if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
+ H5_FAILED();
+ printf(" line %d: H5Tcopy failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ precision = 16; /* precision includes sign bit */
+ if(H5Tset_precision(datatype,precision)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_precision failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ offset = 8;
+ if(H5Tset_offset(datatype,offset)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Tset_offset failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Copy to memory datatype */
+ if((mem_datatype = H5Tcopy(datatype)) < 0) {
+ H5_FAILED();
+ printf(" line %d: H5Tcopy failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Set order of dataset datatype */
+ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_order failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ if(H5Tset_size(datatype, 4)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_size failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Initiliaze data buffer with random data within correct range
+ * corresponding to the memory datatype's precision and offset.
+ */
+ for (i=0; i < DSET_DIM1; i++)
+ for (j=0; j < DSET_DIM2; j++)
+ orig_data[i][j] = rand() % (int)pow(2, precision-1) <<offset;
+
+
+ /* Describe the dataspace. */
+ dims[0] = DSET_DIM1;
+ dims[1] = DSET_DIM2;
+ if((dataspace = H5Screate_simple (2, dims, NULL))<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Set the dataset creation property list to specify the chunks
+ */
+ chunk_size[0] = DSET_DIM1/10;
+ chunk_size[1] = DSET_DIM2/10;
+ if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_chunk failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Set for n-bit compression
+ */
+ if(H5Pset_nbit (dset_create_props)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_nbit failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Create a new dataset within the file.
+ */
+ if((dataset = H5Dcreate2 (file, DSET_NBIT_INT_SIZE_NAME, datatype,
+ dataspace, H5P_DEFAULT,
+ dset_create_props, H5P_DEFAULT))<0) {
+ H5_FAILED();
+ printf(" line %d: H5dwrite failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Write the array to the file.
+ */
+ if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, orig_data)<0) {
+ H5_FAILED();
+ printf(" Line %d: H5Dwrite failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Get the precision of the data type
+ */
+ if((precision = H5Tget_precision(datatype)) == 0) {
+ H5_FAILED();
+ printf(" Line %d: wrong precision size: %d\n",__LINE__, precision);
+ goto error;
+ } /* end if */
+
+ /*
+ * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
+ */
+ if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
+ dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
+ H5_FAILED();
+ printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size);
+ goto error;
+ } /* end if */
+
+ H5Tclose (datatype);
+ H5Tclose (mem_datatype);
+ H5Dclose (dataset);
+ H5Sclose (dataspace);
+ H5Pclose (dset_create_props);
+
+ PASSED();
+#else
+ SKIPPED();
+ puts(not_supported);
+#endif
+
+ return 0;
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_nbit_flt_size
+ *
+ * Purpose: Tests the correct size of the floating-number datatype for
+ * nbit filter
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 19 November 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_nbit_flt_size(hid_t file)
+{
+#ifdef H5_HAVE_FILTER_NBIT
+ hid_t dataspace, dataset, datatype, dset_create_props;
+ hsize_t dims[2], chunk_size[2];
+ hsize_t dset_size = 0;
+ float orig_data[DSET_DIM1][DSET_DIM2];
+ int i, j;
+ size_t precision, offset;
+ size_t spos, epos, esize, mpos, msize;
+#else /* H5_HAVE_FILTER_NBIT */
+ const char *not_supported= " Nbit is not enabled.";
+#endif /* H5_HAVE_FILTER_NBIT */
+
+ TESTING(" nbit floating-number dataset size");
+#ifdef H5_HAVE_FILTER_NBIT
+
+ /* Define floating-point type for dataset
+ *-------------------------------------------------------------------
+ * size=4 byte, precision=16 bits, offset=8 bits,
+ * mantissa size=9 bits, mantissa position=8,
+ * exponent size=6 bits, exponent position=17,
+ * exponent bias=31.
+ * It can be illustrated in little-endian order as:
+ * (S - sign bit, E - exponent bit, M - mantissa bit,
+ * ? - padding bit)
+ *
+ * 3 2 1 0
+ * ???????? SEEEEEEM MMMMMMMM ????????
+ *
+ * To create a new floating-point type, the following
+ * properties must be set in the order of
+ * set fields -> set offset -> set precision -> set size.
+ * All these properties must be set before the type can function.
+ * Other properties can be set anytime. Derived type size cannot
+ * be expanded bigger than original size but can be decreased.
+ * There should be no holes among the significant bits. Exponent
+ * bias usually is set 2^(n-1)-1, where n is the exponent size.
+ *-------------------------------------------------------------------*/
+ if((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0) {
+ H5_FAILED();
+ printf(" line %d: H5Tcopy failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ msize = 9;
+ spos = 23;
+ epos = 17;
+ esize = 6;
+ mpos = 8;
+ offset = 8;
+ precision = 16;
+
+ if(H5Tset_fields(datatype, spos, epos, esize, mpos, msize)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Tset_fields failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ if(H5Tset_offset(datatype,offset)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Tset_offset failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ if(H5Tset_precision(datatype,precision)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Tset_precision failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ if(H5Tset_size(datatype, 4)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_size failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Set order of dataset datatype */
+ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_order failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ if(H5Tset_ebias(datatype, 31)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_size failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Initiliaze data buffer with random data
+ */
+ for (i=0; i < DSET_DIM1; i++)
+ for (j=0; j < DSET_DIM2; j++)
+ orig_data[i][j] = (rand() % 1234567) / 2;
+
+
+ /* Describe the dataspace. */
+ dims[0] = DSET_DIM1;
+ dims[1] = DSET_DIM2;
+ if((dataspace = H5Screate_simple (2, dims, NULL))<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Set the dataset creation property list to specify the chunks
+ */
+ chunk_size[0] = DSET_DIM1/10;
+ chunk_size[1] = DSET_DIM2/10;
+ if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_chunk failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Set for n-bit compression
+ */
+ if(H5Pset_nbit (dset_create_props)<0) {
+ H5_FAILED();
+ printf(" line %d: H5Pset_nbit failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Create a new dataset within the file.
+ */
+ if((dataset = H5Dcreate2 (file, DSET_NBIT_FLT_SIZE_NAME, datatype,
+ dataspace, H5P_DEFAULT,
+ dset_create_props, H5P_DEFAULT))<0) {
+ H5_FAILED();
+ printf(" line %d: H5dwrite failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Write the array to the file.
+ */
+ if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, orig_data)<0) {
+ H5_FAILED();
+ printf(" Line %d: H5Dwrite failed\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /*
+ * Get the precision of the data type
+ */
+ if((precision = H5Tget_precision(datatype)) == 0) {
+ H5_FAILED();
+ printf(" Line %d: wrong precision size: %d\n",__LINE__, precision);
+ goto error;
+ } /* end if */
+
+ /*
+ * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
+ */
+ if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
+ dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
+ H5_FAILED();
+ printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size);
+ goto error;
+ } /* end if */
+
+ H5Tclose (datatype);
+ H5Dclose (dataset);
+ H5Sclose (dataspace);
+ H5Pclose (dset_create_props);
+
+ PASSED();
+#else
+ SKIPPED();
+ puts(not_supported);
+#endif
+
+ return 0;
+error:
+ return -1;
+}
+
+/*-------------------------------------------------------------------------
* Function: test_scaleoffset_int
*
* Purpose: Tests the integer datatype for scaleoffset filter
@@ -6974,7 +7355,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
if(H5Fclose(file) < 0) TEST_ERROR;
/* Open third file again */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR;
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR;
/* Open dataset */
if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR;
@@ -9483,6 +9864,8 @@ main(void)
nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
diff --git a/test/dtypes.c b/test/dtypes.c
index 0a3b6e4..655472c 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -4900,6 +4900,10 @@ opaque_funcs(void)
* Modifications: Raymond Lu
* July 13, 2009
* Added the test for VL string types.
+ *
+ * Raymond Lu
+ * 17 February 2011
+ * I added the test of reference count for decoded datatypes.
*-------------------------------------------------------------------------
*/
static int
@@ -5328,37 +5332,93 @@ test_encode(void)
} /* end if */
/*-----------------------------------------------------------------------
- * Close and release
+ * Test the reference count of the decoded datatypes
*-----------------------------------------------------------------------
*/
- /* Close datatype and file */
- if(H5Tclose(tid1) < 0) {
+
+ /* Make sure the reference counts for the decoded datatypes are one. */
+ if(H5Iget_ref(decoded_tid1) != 1) {
H5_FAILED();
- printf("Can't close datatype\n");
+ printf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- if(H5Tclose(tid2) < 0) {
+
+ if(H5Iget_ref(decoded_tid2) != 1) {
H5_FAILED();
- printf("Can't close datatype\n");
+ printf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- if(H5Tclose(tid3) < 0) {
+
+ if(H5Iget_ref(decoded_tid3) != 1) {
H5_FAILED();
- printf("Can't close datatype\n");
+ printf("Decoded datatype has incorrect reference count\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid1) < 0) {
+ /* Make sure the reference counts for the decoded datatypes can be
+ * decremented and the datatypes are closed. */
+ if(H5Idec_ref(decoded_tid1) != 0) {
+ H5_FAILED();
+ printf("Decoded datatype can't close\n");
+ goto error;
+ } /* end if */
+
+ if(H5Idec_ref(decoded_tid2) != 0) {
+ H5_FAILED();
+ printf("Decoded datatype can't close\n");
+ goto error;
+ } /* end if */
+
+ if(H5Idec_ref(decoded_tid3) != 0) {
+ H5_FAILED();
+ printf("Decoded datatype can't close\n");
+ goto error;
+ } /* end if */
+
+ /* Make sure the decoded datatypes are already closed. */
+ H5E_BEGIN_TRY {
+ ret = H5Tclose(decoded_tid1);
+ } H5E_END_TRY;
+ if(ret!=FAIL) {
+ H5_FAILED();
+ printf("Decoded datatype should have been closed\n");
+ goto error;
+ }
+
+ H5E_BEGIN_TRY {
+ ret = H5Tclose(decoded_tid2);
+ } H5E_END_TRY;
+ if(ret!=FAIL) {
+ H5_FAILED();
+ printf("Decoded datatype should have been closed\n");
+ goto error;
+ }
+
+ H5E_BEGIN_TRY {
+ ret = H5Tclose(decoded_tid3);
+ } H5E_END_TRY;
+ if(ret!=FAIL) {
+ H5_FAILED();
+ printf("Decoded datatype should have been closed\n");
+ goto error;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Close and release
+ *-----------------------------------------------------------------------
+ */
+ /* Close datatype and file */
+ if(H5Tclose(tid1) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid2) < 0) {
+ if(H5Tclose(tid2) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
} /* end if */
- if(H5Tclose(decoded_tid3) < 0) {
+ if(H5Tclose(tid3) < 0) {
H5_FAILED();
printf("Can't close datatype\n");
goto error;
diff --git a/test/efc.c b/test/efc.c
new file mode 100644
index 0000000..1ee7ce3
--- /dev/null
+++ b/test/efc.c
@@ -0,0 +1,3213 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: Neil Fortner
+ * December 16, 2010
+ */
+
+#include "h5test.h"
+
+#define H5F_PACKAGE
+#include "H5Fpkg.h"
+#include "H5Iprivate.h"
+
+const char *FILENAME[] = {
+ "efc0",
+ "efc1",
+ "efc2",
+ "efc3",
+ "efc4",
+ "efc5",
+ NULL
+};
+
+/* Global patched filename buffer */
+static char filename[6][1024];
+
+/* Global property lists - just copies of the defaults (necessary to use
+ * internal functions */
+hid_t fcpl_id = -1;
+hid_t fapl_id = -1;
+hid_t dxpl_id = -1;
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_single
+ *
+ * Purpose: Tests manipulations on a single external file cache.
+ *
+ * Return: Success: 0
+ * Failure: Number of errors
+ *
+ * Programmer: Neil Fortner
+ * December 16, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_single(void)
+{
+ H5F_t *f0 = NULL; /* Parent file containing EFC */
+ H5F_t *f1 = NULL; /* Child file */
+ H5F_t *f2 = NULL; /* Child file */
+ H5F_t *f3 = NULL; /* Child file */
+ H5F_t *f4 = NULL; /* Child file */
+ H5F_t *ftmp1 = NULL; /* Temp file */
+ H5F_t *ftmp2 = NULL; /* Temp file */
+ H5F_t *ftmp3 = NULL; /* Temp file */
+ H5F_t *ftmp4 = NULL; /* Temp file */
+
+ TESTING("single EFC");
+
+ /* Set EFC size to 3. Do this instead of H5F_efc_create() so we can pass
+ * a file pointer to H5F_efc_open containing the EFC. */
+ if(H5Pset_elink_file_cache_size(fapl_id, 3) < 0)
+ TEST_ERROR
+
+ /* Open parent file */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+
+ /* Disable EFC for child files */
+ if(H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
+ TEST_ERROR
+
+
+ /* Test 1: Open file 1 through EFC, close, then open normally, verify ref
+ * count = 2, release EFC, verify ref count = 1. Verifies a file can be
+ * held open by the EFC. */
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 2: Verify that subsequent efc_open requests return the cached top
+ * level file pointer. Open file 1 through EFC, close, open again, verify
+ * file pointers are the same. */
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ ftmp1 = f1;
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1 != ftmp1)
+ TEST_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 3: Verify LRU functionality. Add four files to the EFC and verify
+ * that the one added first is evicted. Then reopen files in a different
+ * order. Open each file normally after closing through EFC the first time
+ * to track ref counts. */
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f4 = H5F_efc_open(f0, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (ftmp3 = H5F_efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp3) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (ftmp2 = H5F_efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (ftmp1 = H5F_efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(NULL == (ftmp4 = H5F_efc_open(f0, filename[4], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp4) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(f4->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f4) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 4: Verify that files kept open through the EFC are not evicted by
+ * H5F_efc_release(). */
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 5: Verify that files kept open through the EFC are not evicted by
+ * filling up the cache. Open 4 files while holding the first open. Verify
+ * that the second file is evicted. Close the first file, reopen the
+ * second, and verify that the first file is evicted. */
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp1->shared != f1->shared)
+ TEST_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f4 = H5F_efc_open(f0, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f4) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 6: Verify that having a full EFC filled only with open files
+ * prevents further files from being cached. Open and hold open 3 files
+ * through the EFC, then open the fourth and verify that it was not added to
+ * the EFC. */
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp1->shared != f1->shared)
+ TEST_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp2->shared != f2->shared)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp3->shared != f3->shared)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f4 = H5F_efc_open(f0, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp4->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp4->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp4) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 7: Test multiple file opens. Open a file twice, close it once, then
+ * verify that it is not evicted by H5F_efc_release(). */
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Close parent file */
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ return 1;
+} /* test_single */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_graph_nocycle
+ *
+ * Purpose: Tests manipulations on a graph of files with external file
+ * caches. The graph does not contain cycles.
+ *
+ * Return: Success: 0
+ * Failure: Number of errors
+ *
+ * Programmer: Neil Fortner
+ * January 4, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_graph_nocycle(void)
+{
+ H5F_t *f0 = NULL; /* Parent file containing EFC */
+ H5F_t *f1 = NULL; /* Child file */
+ H5F_t *f2 = NULL; /* Child file */
+ H5F_t *f3 = NULL; /* Child file */
+ H5F_t *f4 = NULL; /* Child file */
+ H5F_t *ftmp1 = NULL; /* Temp file */
+ H5F_t *ftmp2 = NULL; /* Temp file */
+ H5F_t *ftmp3 = NULL; /* Temp file */
+ H5F_t *ftmp4 = NULL; /* Temp file */
+
+ TESTING("graph of EFCs without cycles");
+
+ /* Set EFC size to 8. Do this instead of H5F_efc_create() so we can pass
+ * a file pointer to H5F_efc_open containing the EFC. Set to a high number
+ * because we don't test the EFC becoming too large in this test. */
+ if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ TEST_ERROR
+
+
+ /* Test 1: Simple 3 file chain. Open file 1 through file 0, then open file
+ * 2 through file 1. Release file 0's EFC and verify that file 2 gets its
+ * ref count reduced (implying file 1 was closed). Do the same with the
+ * opening order reversed. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(ftmp1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 2: 5 file chain. The parent file has 2 child files, each of which
+ * has their own child file. Verifies that releasing the parent's EFC
+ * closes all 4 children. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f3, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, f4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp4->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp4->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 3: Simple "inverted" tree. Two parent files share a child file,
+ * which has its own child file. Verify that the child's child is not
+ * closed until both parents' EFCs are released. First release through one
+ * parent, then reopen through that parent and release the other, then
+ * re-release the first parent. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_release(f1->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 4: Simple "diamond" tree. The parent file has two children, which
+ * shared the same child. Verify that releasing the parent file closes all
+ * files. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 3)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 5: Dense 5 file graph. f0 caches f1, f2, f3 and f4. f1 and f2
+ * each cache f3 and f4. f3 caches f4. Verify that releasing f0 closes all
+ * files. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f0, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f1, filename[4], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f2, filename[4], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f3, filename[4], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, f4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp4->shared->nrefs != 5)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp4->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ PASSED();
+
+ return 0;
+
+error:
+ return 1;
+} /* test_graph_nocycle */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_graph_cycle
+ *
+ * Purpose: Tests manipulations on a graph of files with external file
+ * caches containing cycles.
+ *
+ * Return: Success: 0
+ * Failure: Number of errors
+ *
+ * Programmer: Neil Fortner
+ * January 6, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_graph_cycle(void)
+{
+ H5F_t *f0 = NULL; /* File */
+ H5F_t *f1 = NULL; /* File */
+ H5F_t *f2 = NULL; /* File */
+ H5F_t *f3 = NULL; /* File */
+ H5F_t *f4 = NULL; /* File */
+ H5F_t *f5 = NULL; /* File */
+ H5F_t *ftmp0 = NULL; /* Temp file */
+ H5F_t *ftmp1 = NULL; /* Temp file */
+ H5F_t *ftmp2 = NULL; /* Temp file */
+ H5F_t *ftmp3 = NULL; /* Temp file */
+
+ TESTING("graph of EFCs with cycles");
+
+ /* Set EFC size to 8. Do this instead of H5F_efc_create() so we can pass
+ * a file pointer to H5F_efc_open containing the EFC. Set to a high number
+ * because we don't test the EFC becoming too large in this test. */
+ if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ TEST_ERROR
+
+
+ /* Test 1: File caches itself. Verify that closing the file causes it to be
+ * actually closed, and there is no other unexpected behavior. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(NULL == (ftmp0 = H5F_efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 2: Indirectly referenced file caches itself. Same as above except
+ * the file is part of another file's EFC. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 3: Simple 2 file cycle */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 4: Simple 2 file cycle (indirectly referenced) */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 5: Parallel double cycle */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 3)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 6: Parallel double cycle with release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 3)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 7: Chained parallel double cycle */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 8: Chained parallel double cycle with release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 9: Simple 2 file cycle, extra ID on root */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared != ftmp0->shared)
+ TEST_ERROR
+ if(f0->shared->nrefs != 3)
+ TEST_ERROR
+ if(H5F_try_close(ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 10: Simple 2 file cycle, extra ID on second file */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp1->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 11: Parallel double cycle, extra ID on a child file */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 3)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 3)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 12: Parallel double cycle, extra ID on a child file, with release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 3)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_release(ftmp2->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp2) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 13: Chained parallel double cycle, extra ID on a child file */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 14: Chained parallel double cycle, extra ID on a child file, with
+ * release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(ftmp3->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 15: One local and one remote cycle */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 16: One local and one remote cycle, with release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 17: One local and one remote cycle, remote cycle held open */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 18: One local and one remote cycle, remote cycle held open, with
+ * release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(ftmp3->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_release(ftmp3->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(ftmp3->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 19: "Diamond" shape with links moving from bottom (root) to top.
+ * Also cycle between bottom (root) and top and cycles on the sides. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f1, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f4, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_efc_open(f2, filename[5],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f5, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f5) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_open(filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f4->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_open(filename[5],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f5->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f5) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 20: "Diamond" shape with links moving from bottom (root) to top.
+ * Also cycle between bottom (root) and top, cycles on the sides, and
+ * release the files instead of closing. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f1, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f4, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_efc_open(f2, filename[5],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f5, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f5) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_open(filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f4->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_open(filename[5],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f5->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f5) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 21: "Diamond" shape with links moving from bottom (root) to top.
+ * Also cycle between bottom (root) and top, cycles on sides held open. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f1, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f4, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_efc_open(f2, filename[5],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f5, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f5) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+ if(f5->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+ if(f5->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f4) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f5->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(f5->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_try_close(f5) < 0)
+ FAIL_STACK_ERROR
+
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_open(filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f4->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_open(filename[5],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f5->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f5) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 22: "Diamond" shape with links moving from bottom (root) to top.
+ * Also cycle between bottom (root) and top, cycles on sides held open.
+ * Also release the files instead of closing. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_efc_open(f1, filename[4],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f4, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f4, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, f4) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f4 = H5F_open(filename[4], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_efc_open(f2, filename[5],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f5, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f5, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f5) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f5 = H5F_open(filename[5], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+ if(f5->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 2)
+ TEST_ERROR
+ if(f5->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 3)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_release(f4->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f4->shared->nrefs != 1)
+ TEST_ERROR
+ if(f5->shared->nrefs != 2)
+ TEST_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_release(f5->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(f4->shared->nrefs != 1)
+ TEST_ERROR
+ if(f5->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f4) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f5) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 23: Dense "ball" of files. 4 files each cache all files (including
+ * itself). */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+ if(NULL == (ftmp0 = H5F_efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+ if(NULL == (ftmp0 = H5F_efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 24: Dense "ball" of files. 4 files each cache all files (including
+ * itself). Release the files instead of closing. */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f0, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f0, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f1, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f1, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_efc_open(f1, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+ if(NULL == (ftmp0 = H5F_efc_open(f2, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f2, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_efc_open(f2, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+ if(NULL == (ftmp0 = H5F_efc_open(f3, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp1 = H5F_efc_open(f3, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp2 = H5F_efc_open(f3, filename[2], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp3 = H5F_efc_open(f3, filename[3], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f3, ftmp3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 25: File held open by EFC client interrupts cycle, with release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 26: File held open by EFC does not interrupt cycle, with release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_efc_open(f0, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 27: File held open by EFC client through non-parent file does not
+ * interrupt cycle, but parent file does (no valid way around it) */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_efc_close(f2, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 3)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 28: File held open by EFC client through non-parent file does not
+ * interrupt cycle, but parent file does (no valid way around it), with
+ * release */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f2, filename[1], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_efc_open(f1, filename[3],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f1->shared->nrefs != 2)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_release(f0->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_release(f2->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_efc_close(f1, f3) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f2, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_release(f2->shared->efc) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f3 = H5F_open(filename[3], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f3->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f3) < 0)
+ FAIL_STACK_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 29: File without EFC interrupts cycle */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
+ TEST_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ TEST_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Test 30: File without EFC does not interrupt cycle */
+ if(NULL == (f0 = H5F_open(filename[0],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_efc_open(f0, filename[1],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(NULL == (ftmp0 = H5F_efc_open(f1, filename[0], H5F_ACC_RDWR, fcpl_id,
+ fapl_id, dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f1, ftmp0) < 0)
+ FAIL_STACK_ERROR
+ if(H5F_efc_close(f0, f1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_elink_file_cache_size(fapl_id, 0) < 0)
+ TEST_ERROR
+ if(NULL == (f2 = H5F_efc_open(f1, filename[2],
+ H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(H5Pset_elink_file_cache_size(fapl_id, 8) < 0)
+ TEST_ERROR
+ if(H5F_efc_close(f1, f2) < 0)
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 2)
+ TEST_ERROR
+
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f0 = H5F_open(filename[0], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f0->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f0) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f1 = H5F_open(filename[1], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f1->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f1) < 0)
+ FAIL_STACK_ERROR
+ if(NULL == (f2 = H5F_open(filename[2], H5F_ACC_RDWR, fcpl_id, fapl_id,
+ dxpl_id)))
+ FAIL_STACK_ERROR
+ if(f2->shared->nrefs != 1)
+ TEST_ERROR
+ if(H5F_try_close(f2) < 0)
+ FAIL_STACK_ERROR
+
+
+ PASSED();
+
+ return 0;
+
+error:
+ return 1;
+} /* test_graph_cycle */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Test the external file cache code
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Neil Fortner
+ * December 16, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ unsigned nerrors = 0; /* track errors */
+
+ /* Test Setup */
+ puts("Testing the external file cache");
+
+ /* Create property lists */
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ fapl_id = h5_fileaccess();
+ dxpl_id = H5Pcreate(H5P_DATASET_XFER);
+
+ /* Patch filenames */
+ h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0]));
+ h5_fixname(FILENAME[1], fapl_id, filename[1], sizeof(filename[1]));
+ h5_fixname(FILENAME[2], fapl_id, filename[2], sizeof(filename[2]));
+ h5_fixname(FILENAME[3], fapl_id, filename[3], sizeof(filename[3]));
+ h5_fixname(FILENAME[4], fapl_id, filename[4], sizeof(filename[4]));
+ h5_fixname(FILENAME[5], fapl_id, filename[5], sizeof(filename[5]));
+
+ /* Test Functions */
+ nerrors += test_single();
+ nerrors += test_graph_nocycle();
+ nerrors += test_graph_cycle();
+
+ /* Close property lists */
+ if(H5Pclose(dxpl_id) < 0)
+ TEST_ERROR
+ if(H5Pclose(fcpl_id) < 0)
+ TEST_ERROR
+
+ if(nerrors)
+ goto error;
+
+ puts("All external file cache tests passed.");
+
+ h5_cleanup(FILENAME, fapl_id);
+
+ return 0;
+
+error:
+ puts("*** TESTS FAILED ***");
+
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl_id);
+ } H5E_END_TRY
+
+ return 1;
+} /* end main() */
+
diff --git a/test/external.c b/test/external.c
index 7fd344e..3e1388c 100644
--- a/test/external.c
+++ b/test/external.c
@@ -879,7 +879,7 @@ test_4 (hid_t fapl)
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
goto error;
- /* Open the external link */
+ /* Open the external link which is "/ link" as created previously via H5Lcreate_external() */
if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0)
goto error;
diff --git a/test/gen_cross.c b/test/gen_cross.c
index 46afc35..32be867 100755
--- a/test/gen_cross.c
+++ b/test/gen_cross.c
@@ -27,19 +27,56 @@
#include "h5test.h"
#define H5FILE_NAME "data.h5"
-#define DATASETNAME "Array"
-#define NX 5 /* dataset dimensions */
-#define NY 6
-#define RANK 2
+#define DATASETNAME "Array"
+#define DATASETNAME2 "Scale_offset_float_data_le"
+#define DATASETNAME3 "Scale_offset_float_data_be"
+#define DATASETNAME4 "Scale_offset_double_data_le"
+#define DATASETNAME5 "Scale_offset_double_data_be"
+#define DATASETNAME6 "Scale_offset_char_data_le"
+#define DATASETNAME7 "Scale_offset_char_data_be"
+#define DATASETNAME8 "Scale_offset_short_data_le"
+#define DATASETNAME9 "Scale_offset_short_data_be"
+#define DATASETNAME10 "Scale_offset_int_data_le"
+#define DATASETNAME11 "Scale_offset_int_data_be"
+#define DATASETNAME12 "Scale_offset_long_long_data_le"
+#define DATASETNAME13 "Scale_offset_long_long_data_be"
+#define NX 6
+#define NY 6
+#define RANK 2
+#define CHUNK0 4
+#define CHUNK1 3
+int create_normal_dset(hid_t fid, hid_t fsid, hid_t msid);
+int create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid);
+int create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid);
+int create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid);
+int create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid);
+int create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid);
+int create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid);
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_normal_dset
+ *
+ * Purpose: Create a regular dataset of DOUBLE datatype.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * Some time ago
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
int
-main (void)
+create_normal_dset(hid_t fid, hid_t fsid, hid_t msid)
{
- hid_t file, dataset; /* file and dataset handles */
- hid_t datatype, dataspace; /* handles */
- hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status;
+ hid_t dataset; /* file and dataset handles */
+ hid_t dcpl;
float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2;
int i, j;
/*
@@ -55,49 +92,776 @@ main (void)
* 2 3 4 5 6 7
* 3 4 5 6 7 8
* 4 5 6 7 8 9
+ * 5 6 7 8 9 10
+ * -2.2 -2.2 -2.2 -2.2 -2.2 -2.2
*/
/*
- * Create a new file using H5F_ACC_TRUNC access,
- * default file creation properties, and default file
- * access properties.
+ * Create the dataset creation property list, set the fill value.
*/
- file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ TEST_ERROR
/*
- * Describe the size of the array and create the data space for fixed
- * size dataset.
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
*/
- dimsf[0] = NX;
- dimsf[1] = NY;
- dataspace = H5Screate_simple(RANK, dimsf, NULL);
+ if((dataset = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_DOUBLE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/*
- * Define datatype for the data in the file.
- * We will store little endian INT numbers.
+ * Write the data to the dataset using default transfer properties.
*/
- datatype = H5Tcopy(H5T_NATIVE_DOUBLE);
+ if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
/*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
+ * Close/release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return -1;
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_scale_offset_dsets_float
+ *
+ * Purpose: Create a dataset of FLOAT datatype with scale-offset filter
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * 27 January 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+create_scale_offset_dsets_float(hid_t fid, hid_t fsid, hid_t msid)
+{
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ hid_t dataset; /* dataset handles */
+ hid_t dcpl;
+ float data[NX][NY]; /* data to write */
+ float fillvalue = -2.2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = ((float)(i + j + 1))/3;
+ }
+
+ /*
+ * Create the dataset creation property list, add the Scale-Offset
+ * filter, set the chunk size, and set the fill value.
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0)
+ TEST_ERROR
+ if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ TEST_ERROR
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_FLOAT, &fillvalue) < 0)
+ TEST_ERROR
+
+ /*
+ * Create a new dataset within the file using defined dataspace, little
+ * endian datatype and default dataset creation properties.
+ */
+ if((dataset = H5Dcreate2(fid, DATASETNAME2, H5T_IEEE_F32LE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Now create a dataset with a big-endian type */
+ if((dataset = H5Dcreate2(fid, DATASETNAME3, H5T_IEEE_F32BE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+
+#else /* H5_HAVE_FILTER_SCALEOFFSET */
+ const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset.";
+
+ puts(not_supported);
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return -1;
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_scale_offset_dsets_double
+ *
+ * Purpose: Create a dataset of DOUBLE datatype with scale-offset filter
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 21 January 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+create_scale_offset_dsets_double(hid_t fid, hid_t fsid, hid_t msid)
+{
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ hid_t dataset; /* dataset handles */
+ hid_t dcpl;
+ double data[NX][NY]; /* data to write */
+ double fillvalue = -2.2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = ((double)(i + j + 1))/3;
+ }
+
+ /*
+ * Create the dataset creation property list, add the Scale-Offset
+ * filter, set the chunk size, and set the fill value.
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_FLOAT_DSCALE, 3) < 0)
+ TEST_ERROR
+ if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ TEST_ERROR
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fillvalue) < 0)
+ TEST_ERROR
+
+ /*
+ * Create a new dataset within the file using defined dataspace, little
+ * endian datatype and default dataset creation properties.
+ */
+ if((dataset = H5Dcreate2(fid, DATASETNAME4, H5T_IEEE_F64LE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Now create a dataset with a big-endian type */
+ if((dataset = H5Dcreate2(fid, DATASETNAME5, H5T_IEEE_F64BE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+
+#else /* H5_HAVE_FILTER_SCALEOFFSET */
+ const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset.";
+
+ puts(not_supported);
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return -1;
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_scale_offset_dset_char
+ *
+ * Purpose: Create a dataset of CHAR datatype with scale-offset filter
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * 27 January 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+create_scale_offset_dsets_char(hid_t fid, hid_t fsid, hid_t msid)
+{
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ hid_t dataset; /* dataset handles */
+ hid_t dcpl;
+ char data[NX][NY]; /* data to write */
+ char fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+ }
+ /*
+ * 0 1 2 3 4 5
+ * 1 2 3 4 5 6
+ * 2 3 4 5 6 7
+ * 3 4 5 6 7 8
+ * 4 5 6 7 8 9
+ * 5 6 7 8 9 10
+ */
+
+ /*
+ * Create the dataset creation property list, add the Scale-Offset
+ * filter, set the chunk size, and set the fill value.
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ TEST_ERROR
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0)
+ TEST_ERROR
+
+ /*
+ * Create a new dataset within the file using defined dataspace, little
+ * endian datatype and default dataset creation properties.
+ */
+ if((dataset = H5Dcreate2(fid, DATASETNAME6, H5T_STD_I8LE, fsid, H5P_DEFAULT,
+ dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ if(H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Now create a dataset with a big-endian type */
+ if((dataset = H5Dcreate2(fid, DATASETNAME7, H5T_STD_I8BE, fsid, H5P_DEFAULT,
+ dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dataset, H5T_NATIVE_CHAR, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+
+#else /* H5_HAVE_FILTER_SCALEOFFSET */
+ const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset.";
+
+ puts(not_supported);
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return -1;
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_scale_offset_dset_short
+ *
+ * Purpose: Create a dataset of SHORT datatype with scale-offset filter
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * 27 January 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+create_scale_offset_dsets_short(hid_t fid, hid_t fsid, hid_t msid)
+{
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ hid_t dataset; /* dataset handles */
+ hid_t dcpl;
+ short data[NX][NY]; /* data to write */
+ short fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+ }
+ /*
+ * 0 1 2 3 4 5
+ * 1 2 3 4 5 6
+ * 2 3 4 5 6 7
+ * 3 4 5 6 7 8
+ * 4 5 6 7 8 9
+ * 5 6 7 8 9 10
+ */
+
+ /*
+ * Create the dataset creation property list, add the Scale-Offset
+ * filter, set the chunk size, and set the fill value.
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ TEST_ERROR
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fillvalue) < 0)
+ TEST_ERROR
+
+ /*
+ * Create a new dataset within the file using defined dataspace, little
+ * endian datatype and default dataset creation properties.
+ */
+ if((dataset = H5Dcreate2(fid, DATASETNAME8, H5T_STD_I16LE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ if(H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Now create a dataset with a big-endian type */
+ if((dataset = H5Dcreate2(fid, DATASETNAME9, H5T_STD_I16BE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dataset, H5T_NATIVE_SHORT, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+
+#else /* H5_HAVE_FILTER_SCALEOFFSET */
+ const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset.";
+
+ puts(not_supported);
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return -1;
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_scale_offset_dset_int
+ *
+ * Purpose: Create a dataset of INT datatype with scale-offset filter
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Raymond Lu
+ * 21 January 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+create_scale_offset_dsets_int(hid_t fid, hid_t fsid, hid_t msid)
+{
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ hid_t dataset; /* dataset handles */
+ hid_t dcpl;
+ int data[NX][NY]; /* data to write */
+ int fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+ }
+ /*
+ * 0 1 2 3 4 5
+ * 1 2 3 4 5 6
+ * 2 3 4 5 6 7
+ * 3 4 5 6 7 8
+ * 4 5 6 7 8 9
+ * 5 6 7 8 9 10
+ */
+
+ /*
+ * Create the dataset creation property list, add the Scale-Offset
+ * filter, set the chunk size, and set the fill value.
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ TEST_ERROR
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue) < 0)
+ TEST_ERROR
+
+ /*
+ * Create a new dataset within the file using defined dataspace, little
+ * endian datatype and default dataset creation properties.
+ */
+ if((dataset = H5Dcreate2(fid, DATASETNAME10, H5T_STD_I32LE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Now create a dataset with a big-endian type */
+ if((dataset = H5Dcreate2(fid, DATASETNAME11, H5T_STD_I32BE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+
+#else /* H5_HAVE_FILTER_SCALEOFFSET */
+ const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset.";
+
+ puts(not_supported);
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return -1;
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_scale_offset_dset_long_long
+ *
+ * Purpose: Create a dataset of LONG LONG datatype with scale-offset
+ * filter
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * 27 January 2011
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+create_scale_offset_dsets_long_long(hid_t fid, hid_t fsid, hid_t msid)
+{
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+ hid_t dataset; /* dataset handles */
+ hid_t dcpl;
+ long long data[NX][NY]; /* data to write */
+ long long fillvalue = -2;
+ hsize_t chunk[RANK] = {CHUNK0, CHUNK1};
+ int i, j;
+
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+ }
+ /*
+ * 0 1 2 3 4 5
+ * 1 2 3 4 5 6
+ * 2 3 4 5 6 7
+ * 3 4 5 6 7 8
+ * 4 5 6 7 8 9
+ * 5 6 7 8 9 10
+ */
+
+ /*
+ * Create the dataset creation property list, add the Scale-Offset
+ * filter, set the chunk size, and set the fill value.
+ */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+ if(H5Pset_scaleoffset(dcpl, H5Z_SO_INT, H5Z_SO_INT_MINBITS_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Pset_chunk(dcpl, RANK, chunk) < 0)
+ TEST_ERROR
+ if(H5Pset_fill_value(dcpl, H5T_NATIVE_LLONG, &fillvalue) < 0)
+ TEST_ERROR
+
+ /*
+ * Create a new dataset within the file using defined dataspace, little
+ * endian datatype and default dataset creation properties.
*/
- dataset = H5Dcreate2(file, DATASETNAME, datatype, dataspace,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if((dataset = H5Dcreate2(fid, DATASETNAME12, H5T_STD_I64LE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
/*
* Write the data to the dataset using default transfer properties.
*/
- status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, data);
+ if(H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+
+ /* Close dataset */
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /* Now create a dataset with a big-endian type */
+ if((dataset = H5Dcreate2(fid, DATASETNAME13, H5T_STD_I64BE, fsid,
+ H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dwrite(dataset, H5T_NATIVE_LLONG, msid, fsid, H5P_DEFAULT, data) < 0)
+ TEST_ERROR
+ if(H5Dclose(dataset) < 0)
+ TEST_ERROR
+
+ /*
+ * Close/release resources.
+ */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+
+#else /* H5_HAVE_FILTER_SCALEOFFSET */
+ const char *not_supported= "Scaleoffset filter is not enabled. Can't create the dataset.";
+
+ puts(not_supported);
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+
+ return 0;
+
+#ifdef H5_HAVE_FILTER_SCALEOFFSET
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
+ return -1;
+#endif /* H5_HAVE_FILTER_SCALEOFFSET */
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Create a file for cross_read.c test.
+ *
+ * Return: Success: exit(0)
+ * Failure: exit(1)
+ *
+ * Programmer: Raymond Lu
+ * Some time ago
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main (void)
+{
+ hid_t file = -1;
+ hid_t filespace = -1;
+ hid_t memspace = -1;
+ hsize_t dimsf[RANK];
+ hsize_t start[RANK] = {0, 0};
+
+ /*
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
+ if((file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))
+ < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /*
+ * Describe the size of the array and create the data space for fixed
+ * size dataset. Increase the size in the X direction to have some fill
+ * values.
+ */
+ dimsf[0] = NX + 1;
+ dimsf[1] = NY;
+ if((filespace = H5Screate_simple(RANK, dimsf, NULL)) < 0)
+ {H5_FAILED(); AT(); return 1;}
+ dimsf[0] = NX;
+ if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dimsf, NULL)
+ < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create memory space. This does not include the extra row for fill
+ * values. */
+ HDassert(dimsf[0] == NX);
+ HDassert(dimsf[1] == NY);
+ if((memspace = H5Screate_simple(RANK, dimsf, NULL)) < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create a regular dataset */
+ if(create_normal_dset(file, filespace, memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create a dataset of FLOAT with scale-offset filter */
+ if(create_scale_offset_dsets_float(file, filespace, memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create a dataset of DOUBLE with scale-offset filter */
+ if(create_scale_offset_dsets_double(file, filespace, memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create a dataset of CHAR with scale-offset filter */
+ if(create_scale_offset_dsets_char(file, filespace, memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create a dataset of SHORT with scale-offset filter */
+ if(create_scale_offset_dsets_short(file, filespace, memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create a dataset of INT with scale-offset filter */
+ if(create_scale_offset_dsets_int(file, filespace, memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+
+ /* Create a dataset of LONG LONG with scale-offset filter */
+ if(create_scale_offset_dsets_long_long(file, filespace, memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
/*
* Close/release resources.
*/
- H5Sclose(dataspace);
- H5Tclose(datatype);
- H5Dclose(dataset);
- H5Fclose(file);
+ if(H5Sclose(memspace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+ if(H5Sclose(filespace) < 0)
+ {H5_FAILED(); AT(); return 1;}
+ if(H5Fclose(file) < 0)
+ {H5_FAILED(); AT(); return 1;}
return 0;
}
diff --git a/test/h5test.c b/test/h5test.c
index 229efec..25b751f 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -27,11 +27,11 @@
#include "h5test.h"
#include "H5srcdir.h"
-#ifdef _WIN32
+#ifdef H5_HAVE_WINSOCK_H
#include <process.h>
#include <direct.h>
#include <winsock2.h>
-#endif /* _WIN32 */
+#endif /* H5_HAVE_WINSOCK_H */
/*
* Define these environment variables or constants to influence functions in
@@ -648,7 +648,7 @@ void
h5_show_hostname(void)
{
char hostname[80];
-#ifdef _WIN32
+#ifdef H5_HAVE_WINSOCK_H
WSADATA wsaData;
int err;
#endif
@@ -670,7 +670,7 @@ h5_show_hostname(void)
#else
printf("thread 0.");
#endif
-#ifdef _WIN32
+#ifdef H5_HAVE_WINSOCK_H
err = WSAStartup( MAKEWORD(2,2), &wsaData );
if ( err != 0 ) {
@@ -700,7 +700,7 @@ h5_show_hostname(void)
#else
printf(" gethostname not supported\n");
#endif
-#ifdef _WIN32
+#ifdef H5_HAVE_WINSOCK_H
WSACleanup();
#endif
}
diff --git a/test/h5test.h b/test/h5test.h
index 70408d9..0467cd7 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -83,7 +83,7 @@
* This contains the filename prefix specificied as command line option for
* the parallel test files.
*/
-H5_DLLVAR char *paraprefix;
+H5TEST_DLLVAR char *paraprefix;
#ifdef H5_HAVE_PARALLEL
extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#endif
diff --git a/test/le_data.h5 b/test/le_data.h5
index c944c9f..1225d21 100644
--- a/test/le_data.h5
+++ b/test/le_data.h5
Binary files differ
diff --git a/test/links.c b/test/links.c
index f96ed83..a9fd954 100644
--- a/test/links.c
+++ b/test/links.c
@@ -2640,6 +2640,8 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
{
hid_t fid = (-1); /* File ID */
hid_t gid = (-1); /* Group IDs */
+ hid_t rid = (-1); /* Root Group ID */
+ hid_t status = (-1); /* Status */
char filename1[NAME_BUF_SIZE],
filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
@@ -2672,6 +2674,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
/* Open first file */
if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Get root group ID */
+ if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR;
+
/* Open object through dangling file external link */
H5E_BEGIN_TRY {
gid = H5Gopen2(fid, "no_file", H5P_DEFAULT);
@@ -2692,125 +2697,36 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
goto error;
}
- /* Close first file */
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- PASSED();
- return 0;
-
- error:
+ /* Try to get name of object by index through dangling file external link */
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ status = H5Lget_name_by_idx(rid, "no_file", H5_INDEX_NAME, H5_ITER_INC, 0, NULL, 0, H5P_DEFAULT);
} H5E_END_TRY;
- return -1;
-} /* end external_link_dangling() */
-
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_env: test 1
- *
- * Purpose:
- * 1. target link: "extlinks1"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks1"
- * 4. The environment variable "HDF5_EXT_PREFIX" should be set to ".:tmp"
- * Should be able to access the target file in tmp directory through searching
- * the pathnames set in HDF5_EXT_PREFIX.
- * This test will be skipped if HDF5_EXT_PREFIX is not set as expected.
- *
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_env(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- const char *envval = NULL;
-
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via environment variable (w/new group format)")
- else
- TESTING("external links via environment variable")
-
- if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL)
- envval = "nomatch";
- if (HDstrcmp(envval, ".:tmp")) {
- SKIPPED();
- return(0);
- }
-
- /* set up name for main file:"extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* set up name for external linked target file: "extlinks1" */
- h5_fixname(FILENAME[14], fapl, filename2, sizeof filename2);
-
- if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
-
- /* set up name for target file: "tmp/extlinks1" */
- h5_fixname(FILENAME[15], fapl, filename3, sizeof filename3);
+ if (status >= 0) {
+ H5_FAILED();
+ puts(" Retreiving name of object by index through dangling file external link should have failed.");
+ } /* end if */
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Close root group */
+ if(H5Gclose(rid) < 0) TEST_ERROR
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
+ /* Close first file */
if(H5Fclose(fid) < 0) TEST_ERROR
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file from pathnames set via environment variable */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
return -1;
-} /* end external_link_env() */
+} /* end external_link_dangling() */
/*-------------------------------------------------------------------------
- * Function: external_link_prefix: test 2
+ * Function: external_link_prefix
*
* Purpose: 1. target link: "extlinks2"
* 2. main file: "extlinks0"
@@ -6819,6 +6735,421 @@ error:
/*-------------------------------------------------------------------------
+ * Function: external_file_cache
+ *
+ * Purpose: Tests that the external file cache works with external
+ * links in a few basic cases. More complicated cases are
+ * tested by interfacing directly with the cache in efc.c.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Neil Fortner
+ * Thursday, January 13, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_file_cache(hid_t fapl, hbool_t new_format)
+{
+ hid_t my_fapl = (-1); /* Temporary FAPL */
+ hid_t fid1 = (-1); /* File ID */
+ hid_t fid2 = (-1); /* File ID */
+ hid_t fid3 = (-1); /* File ID */
+ hid_t fid4 = (-1); /* File ID */
+ hid_t oid = (-1); /* Object ID */
+ unsigned efc_size;
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ char filename3[NAME_BUF_SIZE];
+ char filename4[NAME_BUF_SIZE];
+
+ if(new_format)
+ TESTING("external file cache with external links (w/new group format)")
+ else
+ TESTING("external file cache with external links")
+
+ /* Set up filenames */
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
+ h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4);
+
+ /* Verify that the default EFC size is 0 */
+ if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0)
+ TEST_ERROR
+ if(efc_size != 0)
+ FAIL_PUTS_ERROR("default external file cache size is not 0")
+
+ /* Copy FAPL and enable external file caching */
+ if((my_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
+ if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
+ TEST_ERROR
+
+ /* Verify that the external file cache size has been set */
+ if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0)
+ TEST_ERROR
+ if(efc_size != 8)
+ FAIL_PUTS_ERROR("external file cache size different from expected")
+
+
+ /*
+ * Test 1: One file caches another
+ */
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+
+ /* Create link */
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close file 2 */
+ if(H5Fclose(fid2) < 0)
+ TEST_ERROR
+
+ /* Verify that only 1 file is open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Open and close the target of the external link */
+ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that both files are now open */
+ if(H5F_sfile_assert_num(2) < 0)
+ TEST_ERROR
+
+ /* Close file 1 */
+ if(H5Fclose(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that both files are now closed */
+ if(H5F_sfile_assert_num(0) < 0)
+ TEST_ERROR
+
+
+ /*
+ * Test 2: One file caches another, release parent's EFC
+ */
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+
+ /* Create link */
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close file 2 */
+ if(H5Fclose(fid2) < 0)
+ TEST_ERROR
+
+ /* Verify that only 1 file is open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Open and close the target of the external link */
+ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that both files are now open */
+ if(H5F_sfile_assert_num(2) < 0)
+ TEST_ERROR
+
+ /* Release file 1's EFC */
+ if(H5Frelease_file_cache(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that only the parent file is now open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Close file 1 */
+ if(H5Fclose(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that both files are now closed */
+ if(H5F_sfile_assert_num(0) < 0)
+ TEST_ERROR
+
+
+ /*
+ * Test 3: "Y" shaped tree
+ */
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+
+ /* Create links */
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close files 2-4 */
+ if(H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if(H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if(H5Fclose(fid4) < 0)
+ TEST_ERROR
+
+ /* Verify that only 1 file is open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Open and close one branch of the tree */
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that files 2 and 3 are now open */
+ if(H5F_sfile_assert_num(3) < 0)
+ TEST_ERROR
+
+ /* Open and close the other branch of the tree */
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now open */
+ if(H5F_sfile_assert_num(4) < 0)
+ TEST_ERROR
+
+ /* Close file 1 */
+ if(H5Fclose(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now closed */
+ if(H5F_sfile_assert_num(0) < 0)
+ TEST_ERROR
+
+
+ /*
+ * Test 4: "Y" shaped tree, release parent's EFC
+ */
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+
+ /* Create links */
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close files 2-4 */
+ if(H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if(H5Fclose(fid3) < 0)
+ TEST_ERROR
+ if(H5Fclose(fid4) < 0)
+ TEST_ERROR
+
+ /* Verify that only 1 file is open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Open and close one branch of the tree */
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that files 2 and 3 are now open */
+ if(H5F_sfile_assert_num(3) < 0)
+ TEST_ERROR
+
+ /* Open and close the other branch of the tree */
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now open */
+ if(H5F_sfile_assert_num(4) < 0)
+ TEST_ERROR
+
+ /* Release file 1's EFC */
+ if(H5Frelease_file_cache(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that only file 1 is now open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Close file 1 */
+ if(H5Fclose(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now closed */
+ if(H5F_sfile_assert_num(0) < 0)
+ TEST_ERROR
+
+
+ /*
+ * Test 3: 3 file cycle
+ */
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+
+ /* Create links */
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close files 2-3 */
+ if(H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if(H5Fclose(fid3) < 0)
+ TEST_ERROR
+
+ /* Verify that only 1 file is open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Open and close one complete cycle */
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now open */
+ if(H5F_sfile_assert_num(3) < 0)
+ TEST_ERROR
+
+ /* Close file 1 */
+ if(H5Fclose(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now closed */
+ if(H5F_sfile_assert_num(0) < 0)
+ TEST_ERROR
+
+
+ /*
+ * Test 3: 3 file cycle, release parent's EFC
+ */
+ /* Create files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ TEST_ERROR
+
+ /* Create links */
+ if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+ if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close files 2-3 */
+ if(H5Fclose(fid2) < 0)
+ TEST_ERROR
+ if(H5Fclose(fid3) < 0)
+ TEST_ERROR
+
+ /* Verify that only 1 file is open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Open and close one complete cycle */
+ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Oclose(oid) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now open */
+ if(H5F_sfile_assert_num(3) < 0)
+ TEST_ERROR
+
+ /* Release file 1's EFC */
+ if(H5Frelease_file_cache(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that only file 1 is now open */
+ if(H5F_sfile_assert_num(1) < 0)
+ TEST_ERROR
+
+ /* Close file 1 */
+ if(H5Fclose(fid1) < 0)
+ TEST_ERROR
+
+ /* Verify that all files are now closed */
+ if(H5F_sfile_assert_num(0) < 0)
+ TEST_ERROR
+
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Oclose(oid);
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+ H5Fclose(fid3);
+ H5Fclose(fid4);
+ H5Pclose(my_fapl);
+ } H5E_END_TRY
+
+ return -1;
+} /* end external_file_cache */
+
+
+/*-------------------------------------------------------------------------
* Function: ud_hard_links
*
* Purpose: Check that the functionality of hard links can be duplicated
@@ -14019,6 +14350,7 @@ main(void)
hid_t fapl, fapl2; /* File access property lists */
int nerrors = 0;
hbool_t new_format; /* Whether to use the new format or not */
+ hbool_t efc; /* Whether to use the external file cache */
const char *env_h5_drvr; /* File Driver value from environment */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
@@ -14060,58 +14392,83 @@ main(void)
#ifndef H5_NO_DEPRECATED_SYMBOLS
nerrors += test_deprec(my_fapl, new_format);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+ /* tests for external link */
+ /* Test external file cache first, so it sees the default efc setting on
+ * the fapl */
+ nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* This test cannot run with the EFC because it assumes that an
+ * intermediate file is not held open */
+ nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* This test cannot run with the EFC because the EFC cannot currently
+ * reopen a cached file with a different intent */
+ nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Try external link tests both with and without the external file cache
+ */
+ for(efc = FALSE; efc <= TRUE; efc++) {
+ if(efc) {
+ if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
+ TEST_ERROR
+ printf("\n---Testing with external file cache---\n");
+ } /* end if */
+ else {
+ if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
+ TEST_ERROR
+ printf("\n---Testing without external file cache---\n");
+ } /* end else */
+
#ifndef H5_CANNOT_OPEN_TWICE
- nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
#endif /* H5_CANNOT_OPEN_TWICE */
- nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
#ifndef H5_CANNOT_OPEN_TWICE
- 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;
+ 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;
- nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0;
+ 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(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;
-
- /* tests for external link */
- nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_endian(new_format) < 0 ? 1 : 0;
+ nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
+
+ nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0;
#ifdef H5_HAVE_WINDOW_PATH
- nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0;
+ 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;
+ 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;
+ } /* end for */
/* These tests assume that external links are a form of UD links,
* so assume that everything that passed for external links
diff --git a/test/links_env.c b/test/links_env.c
new file mode 100644
index 0000000..c792386
--- /dev/null
+++ b/test/links_env.c
@@ -0,0 +1,192 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Tests hard, soft (symbolic) & external links.
+ */
+
+#define H5G_PACKAGE
+#define H5G_TESTING
+
+#include "h5test.h"
+#include "H5srcdir.h"
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+
+#ifdef H5_VMS
+#define TMPDIR "[.tmp]"
+#else /* H5_VMS */
+#define TMPDIR "tmp/"
+#endif /* H5_VMS */
+#define NAME_BUF_SIZE 1024
+
+const char *FILENAME[] = {
+ "extlinks_env0", /* 0: main file */
+ "extlinks_env1", /* 1: target file */
+ TMPDIR "extlinks_env1", /* 2 */
+ NULL
+};
+
+static int external_link_env(hid_t fapl, hbool_t new_format);
+
+
+/*-------------------------------------------------------------------------
+ * Function: external_link_env (moved from links.c)
+ *
+ * Purpose: Verify that the target file is found successfully in "tmp" directory
+ * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX.
+ * 1. Target link: "extlinks_env1"
+ * 2. Main file: "extlinks_env0"
+ * 3. Target file is created in: "tmp/extlinks_env1"
+ * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp"
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Vailin Choi
+ * Feb. 20, 2008
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_link_env(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ const char *envval = NULL; /* Pointer to environment variable */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE]; /* Holders for filename */
+
+ if(new_format)
+ TESTING("external links via environment variable (w/new group format)")
+ else
+ TESTING("external links via environment variable")
+
+ if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL)
+ envval = "nomatch";
+ if (HDstrcmp(envval, ".:tmp")) TEST_ERROR
+
+ /* Set up name for main file:"extlinks_env0" */
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+
+ /* Set up name for external linked target file: "extlinks_env1" */
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
+
+ /* Create "tmp" directory */
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
+
+ /* Set up name (location) for the target file: "tmp/extlinks1" */
+ h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
+
+ /* Create the target file in "tmp" directory */
+ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Closing for target file */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+
+ /* Create the main file */
+ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create external link to target file */
+ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Open object through external link */
+ H5E_BEGIN_TRY {
+ gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */
+ if (gid < 0) {
+ H5_FAILED();
+ puts(" Should have found the file in tmp directory.");
+ goto error;
+ }
+
+ /* closing for main file */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Gclose (gid);
+ H5Fclose (fid);
+ } H5E_END_TRY;
+ return -1;
+} /* end external_link_env() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Test external link with environment variable HDF5_EXT_PREFIX
+ *
+ * Return: Success: exit(0)
+ * Failure: exit(non-zero)
+ *
+ * Programmer: Vailin Choi; Nov 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl; /* File access property lists */
+ int nerrors = 0; /* Error from tests */
+ const char *env_h5_drvr; /* File Driver value from environment */
+
+ env_h5_drvr = HDgetenv("HDF5_DRIVER");
+ if(env_h5_drvr == NULL)
+ env_h5_drvr = "nomatch";
+
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ nerrors += external_link_env(fapl, FALSE) < 0 ? 1 : 0;
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+
+ nerrors += external_link_env(fapl, TRUE) < 0 ? 1 : 0;
+
+ h5_cleanup(FILENAME, fapl);
+
+ /* Results */
+ if(nerrors) {
+ printf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "s");
+ exit(1);
+ }
+ printf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
+
+ /* clean up tmp directory created by external link tests */
+ HDrmdir(TMPDIR);
+
+ return 0;
+
+error:
+ puts("*** TESTS FAILED ***");
+ return 1;
+}
diff --git a/test/mf.c b/test/mf.c
index 6bfa44e..2b55417 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -178,7 +178,7 @@ static unsigned
test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t fapl_new; /* copy of fapl */
+ hid_t fapl_new = -1; /* copy of fapl */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
@@ -277,9 +277,12 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
+ if(H5Pclose(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
PASSED()
} /* end if */
else {
@@ -291,6 +294,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl)
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl_new);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -317,7 +321,7 @@ static unsigned
test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t fapl_new; /* copy of fapl */
+ hid_t fapl_new = -1; /* copy of fapl */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
@@ -403,8 +407,10 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if(new_ma_addr != ma_addr)
+ TEST_ERROR
+ if(new_ma_size != ma_size)
+ TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -414,7 +420,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
PASSED()
@@ -462,7 +468,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30))
+ if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
TEST_ERROR
PASSED()
@@ -506,7 +512,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30))
+ if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
TEST_ERROR
PASSED()
@@ -538,8 +544,10 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size);
- if (new_ma_addr != ma_addr) TEST_ERROR
- if (new_ma_size != ma_size) TEST_ERROR
+ if(new_ma_addr != ma_addr)
+ TEST_ERROR
+ if(new_ma_size != ma_size)
+ TEST_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -549,9 +557,12 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+10))
+ if(new_file_size != (file_size + 10))
TEST_ERROR
+ if(H5Pclose(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
PASSED()
} /* end if */
else {
@@ -563,6 +574,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl)
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl_new);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -585,7 +597,7 @@ static unsigned
test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t fapl_new; /* copy of fapl */
+ hid_t fapl_new = -1; /* copy of fapl */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* File size */
@@ -621,8 +633,10 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Turn off using meta/small data aggregator */
- H5Pset_meta_block_size(fapl_new, (hsize_t)0);
- H5Pset_small_data_block_size(fapl_new, (hsize_t)0);
+ if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0)
+ FAIL_STACK_ERROR
/* Re-open the file with meta/small data setting */
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
@@ -652,7 +666,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30))
+ if(new_file_size != (file_size + TEST_BLOCK_SIZE30))
TEST_ERROR
/* Re-open the file */
@@ -682,7 +696,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50))
+ if(new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50))
TEST_ERROR
PASSED()
@@ -715,12 +729,12 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
type = H5FD_MEM_SUPER;
addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30);
- if (addr < (haddr_t)file_size)
+ if(addr < (haddr_t)file_size)
TEST_ERROR
/* nothing should be changed in meta_aggr */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
- if (new_ma_addr != ma_addr)
+ if(new_ma_addr != ma_addr)
TEST_ERROR
extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50));
@@ -742,9 +756,12 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size+TEST_BLOCK_SIZE30)
+ if(new_file_size != file_size + TEST_BLOCK_SIZE30)
TEST_ERROR
+ if(H5Pclose(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
PASSED()
} /* end if */
else {
@@ -756,6 +773,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl_new);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -947,7 +965,7 @@ static unsigned
test_mf_fs_start(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t fapl_new; /* copy of fapl */
+ hid_t fapl_new = -1; /* copy of fapl */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
@@ -1010,15 +1028,19 @@ test_mf_fs_start(hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
+ if(H5Pclose(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
PASSED()
return(0);
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl_new);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -1054,7 +1076,7 @@ static unsigned
test_mf_fs_alloc_free(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t fapl_new; /* copy of fapl */
+ hid_t fapl_new = -1; /* copy of fapl */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
@@ -1343,15 +1365,19 @@ test_mf_fs_alloc_free(hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
+ if(H5Pclose(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
PASSED()
return(0);
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl_new);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -1399,7 +1425,7 @@ static unsigned
test_mf_fs_extend(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t fapl_new; /* copy of fapl */
+ hid_t fapl_new = -1; /* copy of fapl */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
h5_stat_size_t file_size, new_file_size; /* file size */
@@ -1889,15 +1915,19 @@ test_mf_fs_extend(hid_t fapl)
TEST_ERROR
/* Verify the file is the correct size */
- if (new_file_size != file_size)
+ if(new_file_size != file_size)
TEST_ERROR
+ if(H5Pclose(fapl_new) < 0)
+ FAIL_STACK_ERROR
+
PASSED()
return(0);
error:
H5E_BEGIN_TRY {
+ H5Pclose(fapl_new);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -6635,7 +6665,7 @@ error:
HDmemset(memb_name, 0, sizeof memb_name); \
HDmemset(memb_addr, 0, sizeof memb_addr); \
HDmemset(sv, 0, sizeof sv); \
- for (mt = 0; mt < H5FD_MEM_NTYPES; mt++) { \
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { \
memb_map[mt] = H5FD_MEM_SUPER; \
memb_fapl[mt] = H5P_DEFAULT; \
} \
@@ -6670,20 +6700,21 @@ error:
static unsigned
test_mf_fs_drivers(hid_t fapl)
{
- hid_t fcpl; /* file creation property list */
- hid_t fapl_new; /* copy of file access property list */
- hid_t fapl2; /* copy of file access property list */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t fapl_new = -1; /* copy of file access property list */
+ hid_t fapl2 = -1; /* copy of file access property list */
hbool_t new_format; /* To use new library format or not */
unsigned ret = 0; /* return value */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
- char sv[H5FD_MEM_NTYPES][500]; /* Name generators */
+ char sv[H5FD_MEM_NTYPES][64]; /* Name generators */
const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
/* Create a non-standard file-creation template */
- fcpl = H5Pcreate(H5P_FILE_CREATE);
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR
if(H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0) < 0)
TEST_ERROR
@@ -6784,14 +6815,19 @@ test_mf_fs_drivers(hid_t fapl)
} /* 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);
error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fcpl);
+ H5Pclose(fapl2);
+ H5Pclose(fapl_new);
+ } H5E_END_TRY;
return(1);
} /* test_mf_fs_drivers() */
@@ -6804,7 +6840,7 @@ static unsigned
test_filespace_strategy_threshold(hid_t fapl_new)
{
hid_t file = -1; /* File ID */
- hid_t fcpl; /* File creation property list template */
+ hid_t fcpl = -1; /* File creation property list template */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FD_mem_t type; /* File allocation type */
@@ -6922,7 +6958,10 @@ test_filespace_strategy_threshold(hid_t fapl_new)
TEST_ERROR
break;
+ case H5F_FILE_SPACE_DEFAULT:
+ case H5F_FILE_SPACE_NTYPES:
default:
+ TEST_ERROR
break;
} /* end switch */
@@ -6941,6 +6980,7 @@ test_filespace_strategy_threshold(hid_t fapl_new)
error:
H5E_BEGIN_TRY {
+ H5Pclose(fcpl);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -6954,7 +6994,7 @@ static unsigned
test_filespace_gone(hid_t fapl_new)
{
hid_t file = -1; /* File ID */
- hid_t fcpl; /* File creation propertly list template */
+ hid_t fcpl = -1; /* File creation propertly list template */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FD_mem_t type; /* File allocation type */
@@ -7074,6 +7114,7 @@ test_filespace_gone(hid_t fapl_new)
error:
H5E_BEGIN_TRY {
+ H5Pclose(fcpl);
H5Fclose(file);
} H5E_END_TRY;
return(1);
@@ -7085,14 +7126,14 @@ error:
static unsigned
test_filespace_drivers(hid_t fapl)
{
- hid_t fapl_new; /* copy of file access property list */
- hid_t fapl2; /* copy of file access property list */
+ hid_t fapl_new = -1; /* copy of file access property list */
+ hid_t fapl2 = -1; /* copy of file access property list */
hbool_t new_format; /* Using library new format or not */
unsigned ret = 0; /* return value */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; /* Memory usage map */
hid_t memb_fapl[H5FD_MEM_NTYPES]; /* Member access properties */
- char sv[H5FD_MEM_NTYPES][500]; /* Name generators */
+ char sv[H5FD_MEM_NTYPES][64]; /* Name generators */
const char *memb_name[H5FD_MEM_NTYPES]; /* Name generators */
haddr_t memb_addr[H5FD_MEM_NTYPES]; /* Member starting address */
@@ -7201,6 +7242,10 @@ test_filespace_drivers(hid_t fapl)
return(ret);
error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl_new);
+ H5Pclose(fapl2);
+ } H5E_END_TRY;
return(1);
} /* test_filespace_drivers() */
@@ -7259,10 +7304,9 @@ main(void)
nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl);
/* Tests for alignment */
- for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) {
+ for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) {
switch(curr_test) {
-
case TEST_NORMAL: /* set alignment = 1024 */
if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
TEST_ERROR
@@ -7273,6 +7317,7 @@ main(void)
TEST_ERROR
break;
+ case TEST_NTESTS:
default:
TEST_ERROR;
break;
@@ -7294,7 +7339,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);
@@ -7302,13 +7347,14 @@ main(void)
goto error;
puts("All free-space manager tests for file memory passed.");
- return (0);
+ return(0);
error:
puts("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5Pclose(fapl);
+ H5Pclose(new_fapl);
} H5E_END_TRY;
- return (1);
+ return(1);
} /* main() */
diff --git a/test/testfiles/links_env.out b/test/testfiles/links_env.out
new file mode 100644
index 0000000..3ca9b99
--- /dev/null
+++ b/test/testfiles/links_env.out
@@ -0,0 +1,6 @@
+#############################
+Expected output for links_env
+#############################
+Testing external links via environment variable PASSED
+Testing external links via environment variable (w/new group format) PASSED
+All external Link (HDF5_EXT_PREFIX) tests passed.
diff --git a/test/testframe.c b/test/testframe.c
index 082a27f..6fbace1 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -124,7 +124,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
*/
void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]))
{
-#if !(defined MAC || defined __MWERKS__ || defined SYMANTEC_C)
+#if !(defined MAC)
/* Un-buffer the stdout and stderr */
setbuf(stderr, NULL);
setbuf(stdout, NULL);
diff --git a/test/testlinks_env.sh.in b/test/testlinks_env.sh.in
new file mode 100644
index 0000000..e71dfc8
--- /dev/null
+++ b/test/testlinks_env.sh.in
@@ -0,0 +1,46 @@
+#! /bin/sh
+#
+# 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.
+#
+# Test for external link with environment variable: HDF5_EXT_PREFIX
+
+nerrors=0
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+# test for external links with HDF5_EXT_PREFIX
+echo "Testing external link with HDF5_EXT_PREFIX"
+TEST_NAME=links_env # The test name
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+ENVCMD="env HDF5_EXT_PREFIX=.:tmp" # The environment variable & value
+#
+# Run the test
+$ENVCMD $TEST_BIN
+exitcode=$?
+if [ $exitcode -eq 0 ]; then
+ echo "Test for HDF5_EXT_PREFIX PASSED"
+ else
+ nerrors="`expr $nerrors + 1`"
+ echo "***Error encountered for HDF5_EXT_PREFIX test***"
+fi
+exit $nerrors
diff --git a/test/th5o.c b/test/th5o.c
index 6091776..17619ee 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -898,6 +898,337 @@ test_h5o_link(void)
/****************************************************************
**
+** test_h5o_comment(): Test H5Oset(get)_comment functions.
+**
+****************************************************************/
+static void
+test_h5o_comment(void)
+{
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ hid_t attr_space, attr_id;
+ hsize_t dims[RANK];
+ hsize_t attr_dims = 1;
+ int attr_value = 5;
+ const char *file_comment = "file comment";
+ const char *grp_comment = "group comment";
+ const char *dset_comment = "dataset comment";
+ const char *dtype_comment = "datatype comment";
+ char check_comment[64];
+ ssize_t comment_len = 0;
+ herr_t ret; /* Value returned from API calls */
+ int ret_value;
+
+ /* Create a new HDF5 file */
+ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create an attribute for the file */
+ attr_space = H5Screate_simple(1, &attr_dims, NULL);
+ CHECK(attr_space, FAIL, "H5Screate_simple");
+ attr_id = H5Acreate2(fid, "file attribute", H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Acreate2");
+ ret = H5Awrite(attr_id, H5T_NATIVE_INT, &attr_value);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Putting a comment on the file through its attribute */
+ ret = H5Oset_comment(attr_id, file_comment);
+ CHECK(ret, FAIL, "H5Oset_comment");
+
+ ret = H5Sclose(attr_space);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Create a group, dataset, and committed datatype within the file */
+ /* Create the group */
+ grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp, FAIL, "H5Gcreate2");
+
+ /* Putting a comment on the group */
+ ret = H5Oset_comment(grp, grp_comment);
+ CHECK(ret, FAIL, "H5Oset_comment");
+
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Commit the type inside the group */
+ dtype = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(dtype, FAIL, "H5Tcopy");
+ ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Putting a comment on the committed data type */
+ ret = H5Oset_comment(dtype, dtype_comment);
+ CHECK(ret, FAIL, "H5Oset_comment");
+
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Create the data space for the dataset. */
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ dspace = H5Screate_simple(RANK, dims, NULL);
+ CHECK(dspace, FAIL, "H5Screate_simple");
+
+ /* Create the dataset. */
+ dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+
+ /* Putting a comment on the dataset */
+ ret = H5Oset_comment(dset, dset_comment);
+ CHECK(ret, FAIL, "H5Oset_comment");
+
+ /* Putting a comment on the dataspace. It's supposed to fail. */
+ H5E_BEGIN_TRY {
+ ret = H5Oset_comment(dspace, "dataspace comment");
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Oset_comment");
+
+ /* Close the file */
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+
+ /* Now make sure that the comments are correct all 4 types of objects */
+ /* Open file */
+ fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Getting the comment on the file and verify it */
+ comment_len = H5Oget_comment(fid, NULL, (size_t)0);
+ CHECK(comment_len, FAIL, "H5Oget_comment");
+
+ ret = H5Oget_comment(fid, check_comment, (size_t)comment_len+1);
+ CHECK(ret, FAIL, "H5Oget_comment");
+
+ ret_value = HDstrcmp(file_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment");
+
+ /* Open the group */
+ grp = H5Gopen2(fid, "group", H5P_DEFAULT);
+ CHECK(grp, FAIL, "H5Gopen2");
+
+ /* Getting the comment on the group and verify it */
+ comment_len = H5Oget_comment(grp, NULL, (size_t)0);
+ CHECK(comment_len, FAIL, "H5Oget_comment");
+
+ ret = H5Oget_comment(grp, check_comment, (size_t)comment_len+1);
+ CHECK(ret, FAIL, "H5Oget_comment");
+
+ ret_value = HDstrcmp(grp_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment");
+
+ /* Open the datatype */
+ dtype = H5Topen2(fid, "group/datatype", H5P_DEFAULT);
+ CHECK(dtype, FAIL, "H5Topen2");
+
+ /* Getting the comment on the datatype and verify it */
+ comment_len = H5Oget_comment(dtype, NULL, (size_t)0);
+ CHECK(comment_len, FAIL, "H5Oget_comment");
+
+ ret = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1);
+ CHECK(ret, FAIL, "H5Oget_comment");
+
+ ret_value = HDstrcmp(dtype_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment");
+
+ /* Open the dataset */
+ dset = H5Dopen2(fid, "dataset", H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dopen2");
+
+ /* Getting the comment on the dataset and verify it */
+ comment_len = H5Oget_comment(dset, NULL, (size_t)0);
+ CHECK(comment_len, FAIL, "H5Oget_comment");
+
+ ret = H5Oget_comment(dset, check_comment, (size_t)comment_len+1);
+ CHECK(ret, FAIL, "H5Oget_comment");
+
+ ret_value = HDstrcmp(dset_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment");
+
+
+ /* Close the IDs */
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+} /* test_h5o_comment() */
+
+
+/****************************************************************
+**
+** test_h5o_comment_by_name(): Test H5Oset(get)_comment_by_name functions.
+**
+****************************************************************/
+static void
+test_h5o_comment_by_name(void)
+{
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ hid_t attr_space, attr_id;
+ hsize_t dims[RANK];
+ hsize_t attr_dims = 1;
+ int attr_value = 5;
+ const char *file_comment = "file comment by name";
+ const char *grp_comment = "group comment by name";
+ const char *dset_comment = "dataset comment by name";
+ const char *dtype_comment = "datatype comment by name";
+ char check_comment[64];
+ ssize_t comment_len = 0;
+ herr_t ret; /* Value returned from API calls */
+ int ret_value;
+
+ /* Create a new HDF5 file */
+ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create an attribute for the file */
+ attr_space = H5Screate_simple(1, &attr_dims, NULL);
+ CHECK(attr_space, FAIL, "H5Screate_simple");
+ attr_id = H5Acreate2(fid, "file attribute", H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Acreate2");
+ ret = H5Awrite(attr_id, H5T_NATIVE_INT, &attr_value);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Putting a comment on the file through its attribute */
+ ret = H5Oset_comment_by_name(attr_id, ".", file_comment, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oset_comment_by_name");
+
+ ret = H5Sclose(attr_space);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Aclose(attr_id);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Create a group, dataset, and committed datatype within the file */
+ /* Create the group */
+ grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp, FAIL, "H5Gcreate2");
+
+ /* Putting a comment on the group */
+ ret = H5Oset_comment_by_name(fid, "group", grp_comment, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oset_comment_by_name");
+
+ /* Commit the type inside the group */
+ dtype = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(dtype, FAIL, "H5Tcopy");
+ ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Putting a comment on the committed data type */
+ ret = H5Oset_comment_by_name(grp, "datatype", dtype_comment, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oset_comment_by_name");
+
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create the data space for the dataset. */
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ dspace = H5Screate_simple(RANK, dims, NULL);
+ CHECK(dspace, FAIL, "H5Screate_simple");
+
+ /* Create the dataset. */
+ dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+
+ /* Putting a comment on the dataset */
+ ret = H5Oset_comment_by_name(fid, "dataset", dset_comment, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oset_comment_by_name");
+
+ /* Putting a comment on the dataspace. It's supposed to fail. */
+ H5E_BEGIN_TRY {
+ ret = H5Oset_comment_by_name(dspace, ".", "dataspace comment", H5P_DEFAULT);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Oset_comment");
+
+ /* Close the file */
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Now make sure that the comments are correct all 4 types of objects */
+ /* Open file */
+ fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Getting the comment on the file and verify it */
+ comment_len = H5Oget_comment_by_name(fid, ".", NULL, (size_t)0, H5P_DEFAULT);
+ CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
+
+ ret = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_comment_by_name");
+
+ ret_value = HDstrcmp(file_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment_by_name");
+
+ /* Open the group */
+ grp = H5Gopen2(fid, "group", H5P_DEFAULT);
+ CHECK(grp, FAIL, "H5Gopen2");
+
+ /* Getting the comment on the group and verify it */
+ comment_len = H5Oget_comment_by_name(fid, "group", NULL, (size_t)0, H5P_DEFAULT);
+ CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
+
+ ret = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_comment_by_name");
+
+ ret_value = HDstrcmp(grp_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment_by_name");
+
+ /* Getting the comment on the datatype and verify it */
+ comment_len = H5Oget_comment_by_name(grp, "datatype", NULL, (size_t)0, H5P_DEFAULT);
+ CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
+
+ ret = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_comment");
+
+ ret_value = HDstrcmp(dtype_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment_by_name");
+
+ /* Getting the comment on the dataset and verify it */
+ comment_len = H5Oget_comment_by_name(fid, "dataset", NULL, (size_t)0, H5P_DEFAULT);
+ CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
+
+ ret = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_comment_by_name");
+
+ ret_value = HDstrcmp(dset_comment, check_comment);
+ VERIFY(ret_value, 0, "H5Oget_comment_by_name");
+
+ /* Close the IDs */
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+} /* test_h5o_comment_by_name() */
+
+
+
+/****************************************************************
+**
** test_h5o(): Main H5O (generic object) testing routine.
**
****************************************************************/
@@ -913,6 +1244,8 @@ test_h5o(void)
test_h5o_refcount(); /* Test incrementing and decrementing reference count */
test_h5o_plist(); /* Test object creation properties */
test_h5o_link(); /* Test object link routine */
+ test_h5o_comment(); /* Test routines for comment */
+ test_h5o_comment_by_name(); /* Test routines for comment by name */
} /* test_h5o() */
diff --git a/test/vms_data.h5 b/test/vms_data.h5
index 9c243ff..14aeef2 100644
--- a/test/vms_data.h5
+++ b/test/vms_data.h5
Binary files differ