diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 8 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 22 | ||||
-rw-r--r-- | test/efc.c | 3213 | ||||
-rw-r--r-- | test/links.c | 528 |
5 files changed, 3723 insertions, 52 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 98fffe0..9a2dd88 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -177,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 @@ -256,6 +262,7 @@ SET (H5_TESTS filter_fail extend external + efc objcopy links unlink @@ -415,6 +422,7 @@ IF (HDF5_TEST_VFD) filter_fail extend external + efc objcopy links unlink diff --git a/test/Makefile.am b/test/Makefile.am index 06c56f8..6f4a46a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -38,7 +38,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(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 \ @@ -125,7 +125,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse 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 + earray.h5 efc[0-5].h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/Makefile.in b/test/Makefile.in index a734045..98fa754 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -82,7 +82,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) \ @@ -163,6 +163,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) @@ -397,9 +401,9 @@ 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 \ - freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.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 freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \ gen_deflate.c gen_filespace.c gen_filters.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 \ @@ -411,7 +415,7 @@ SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.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 freespace.c gen_bad_ohdr.c \ gen_bogus.c gen_cross.c gen_deflate.c gen_filespace.c \ @@ -727,7 +731,7 @@ 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 + app_ref.h5 farray.h5 earray.h5 efc[0-5].h5 INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat @@ -744,7 +748,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(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 \ @@ -924,6 +928,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) @@ -1104,6 +1111,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@ 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/links.c b/test/links.c index c8ece99..54b4a1b 100644 --- a/test/links.c +++ b/test/links.c @@ -6666,6 +6666,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 @@ -13866,6 +14281,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"); @@ -13907,57 +14323,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_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 |