summaryrefslogtreecommitdiffstats
path: root/test/mount.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-10-16 15:40:37 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-10-16 15:40:37 (GMT)
commit80f20333264434b449ba014161899a6d7b522b98 (patch)
tree0188b179ec625f3aeea1ee349e7dc53b1598c283 /test/mount.c
parent194c45d07d5fd876e6ada1e27148035f223a0e29 (diff)
downloadhdf5-80f20333264434b449ba014161899a6d7b522b98.zip
hdf5-80f20333264434b449ba014161899a6d7b522b98.tar.gz
hdf5-80f20333264434b449ba014161899a6d7b522b98.tar.bz2
[svn-r764] Changes since 19981014
---------------------- ./bin/trace ./src/H5.c ./src/H5F.c ./src/H5Fprivate.h ./src/H5Fpublic.h Added a `scope' argument to H5Fflush() which should be either H5F_SCOPE_LOCAL or H5F_SCOPE_GLOBAL and determines which files are flushed (just the specified file or the entire virtual file). ./src/H5F.c Added reference counts to the H5F_t struct so we get the correct behavior between H5Funmount() and H5Fclose(). ./src/H5O.c Fixed a memory leak that happens during error handling. ./test/cmpd_dset.c ./test/unlink.c Fixed a memory leak. ./test/mount.c Enabled the H5Fclose() test.
Diffstat (limited to 'test/mount.c')
-rw-r--r--test/mount.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/test/mount.c b/test/mount.c
index 516eba8..e5d37ad 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -986,11 +986,6 @@ test_close(void)
printf("%-70s", "Testing file handle close");
fflush(stdout);
-#if 1
- puts(" SKIP");
- puts(" Skipped for now (until H5F_t refcounts are implemented)...");
- return 0;
-#endif
/* Build the virtual file */
if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
@@ -998,16 +993,34 @@ test_close(void)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
- /* Close by file1 */
+ /*
+ * Close file1 unmounting it from the virtual file. Objects in file2 are
+ * still accessible through the file2 handle, but nothing in file1 is
+ * accessible.
+ */
if (H5Fclose(file1)<0) goto error;
H5E_BEGIN_TRY {
- status = H5Fclose(file2);
+ status = H5Gget_objinfo(file2, "/mnt1", TRUE, NULL);
} H5E_END_TRY;
if (status>=0) {
puts("*FAILED*");
- puts(" File close should have closed all virtual file members!");
+ puts(" File1 contents are still accessible!");
goto error;
}
+ if (H5Fclose(file2)<0) goto error;
+
+ /* Build the virtual file again */
+ if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
+ (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ goto error;
+ if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
+
+ /*
+ * Close file2. It is not actually closed because it's a child of file1.
+ */
+ if (H5Fclose(file2)<0) goto error;
+ if (H5Gget_objinfo(file1, "/mnt1/file2", TRUE, NULL)<0) goto error;
+ if (H5Fclose(file1)<0) goto error;
/* Shut down */
puts(" PASSED");