diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-10-07 04:17:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-10-07 04:17:35 (GMT) |
commit | 9f60f016ab71cf8ce39c859fd9eb61c6fca35d63 (patch) | |
tree | 0ddbcb2f8707b578af22c62748420b9e3c19177b /test/tfile.c | |
parent | 504c67846e6a4cc5706403bf21a9ae4f07aae7b4 (diff) | |
download | hdf5-9f60f016ab71cf8ce39c859fd9eb61c6fca35d63.zip hdf5-9f60f016ab71cf8ce39c859fd9eb61c6fca35d63.tar.gz hdf5-9f60f016ab71cf8ce39c859fd9eb61c6fca35d63.tar.bz2 |
[svn-r15800] Description:
Bring file free space branch changes through r15795 into trunk, which
includes a fair bit of code cleanup & rearrangement along with a couple of
bug fixes also.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'test/tfile.c')
-rw-r--r-- | test/tfile.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/tfile.c b/test/tfile.c index ff8aa2b..b5f024c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1191,6 +1191,8 @@ static void test_file_freespace(void) { hid_t file; /* File opened with read-write permission */ + h5_stat_size_t empty_filesize; /* Size of file when empty */ + h5_stat_size_t mod_filesize; /* Size of file after being modified */ hssize_t free_space; /* Amount of free space in file */ hid_t dspace; /* Dataspace ID */ hid_t dset; /* Dataset ID */ @@ -1202,10 +1204,20 @@ test_file_freespace(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File Free Space\n")); - /* Create the file (with read-write permission) */ + /* Create an "empty" file */ file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); + ret = H5Fclose(file); + CHECK_I(ret, "H5Fclose"); + + /* Get the "empty" file size */ + empty_filesize = h5_get_file_size(FILE1); + + /* Re-open the file (with read-write permission) */ + file = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK_I(file, "H5Fopen"); + /* Check that the free space is 0 */ free_space = H5Fget_freespace(file); CHECK(free_space, FAIL, "H5Fget_freespace"); @@ -1244,7 +1256,7 @@ test_file_freespace(void) /* Check that there is the right amount of free space in the file */ free_space = H5Fget_freespace(file); CHECK(free_space, FAIL, "H5Fget_freespace"); - VERIFY(free_space, 2376, "H5Fget_freespace"); + VERIFY(free_space, 2008, "H5Fget_freespace"); /* Delete datasets in file */ for(u = 0; u < 10; u++) { @@ -1261,6 +1273,12 @@ test_file_freespace(void) /* Close file */ ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); + + /* Get the file size after modifications*/ + mod_filesize = h5_get_file_size(FILE1); + + /* Check that the file reverted to empty size */ + VERIFY(mod_filesize, empty_filesize, "H5Fget_freespace"); } /* end test_file_freespace() */ /**************************************************************** |