summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-08-15 07:03:44 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-08-15 07:03:44 (GMT)
commit6c5e37a5938f3dc614f908d5d955b3103db4f367 (patch)
tree26cf3732aac362d9014ae0d9e81bd62767d6fe83 /test
parent58067df6c710c92c596ceac6b570f085e69c25d4 (diff)
downloadhdf5-6c5e37a5938f3dc614f908d5d955b3103db4f367.zip
hdf5-6c5e37a5938f3dc614f908d5d955b3103db4f367.tar.gz
hdf5-6c5e37a5938f3dc614f908d5d955b3103db4f367.tar.bz2
[svn-r17366] Description:
Bring r17346:17365 from trunk to revise_chunks branch Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/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 debug mode Mac OS X/32 10.5.8 (amazon) in debug mode Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'test')
-rw-r--r--test/tattr.c8
-rw-r--r--test/testhdf5.c1
-rw-r--r--test/tfile.c56
-rw-r--r--test/tvltypes.c6
4 files changed, 63 insertions, 8 deletions
diff --git a/test/tattr.c b/test/tattr.c
index 20058fc..afe45eb 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -5293,13 +5293,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
ret = H5Dclose(dset3);
CHECK(ret, FAIL, "H5Dclose");
- /* Close dataspace */
- ret = H5Sclose(sid);
- CHECK(ret, FAIL, "H5Sclose");
-
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
} /* test_attr_corder_transition() */
diff --git a/test/testhdf5.c b/test/testhdf5.c
index 95ec90c..f14c2c3 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -88,3 +88,4 @@ main(int argc, char *argv[])
return (GetTestNumErrs());
} /* end main() */
+
diff --git a/test/tfile.c b/test/tfile.c
index 25c1590..518138c 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1351,7 +1351,7 @@ test_file_ishdf5(void)
/* Create non-HDF5 file and check it */
fd=HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, 0666);
- CHECK(ret, FAIL, "HDopen");
+ CHECK(fd, FAIL, "HDopen");
/* Initialize information to write */
for(u=0; u<1024; u++)
@@ -2026,6 +2026,59 @@ test_cached_stab_info(void)
/****************************************************************
**
+** test_rw_noupdate(): low-level file test routine.
+** This test checks to ensure that opening and closing a file
+** with read/write permissions does not write anything to the
+** file if the file does not change.
+**
+** Programmer: Mike McGreevy
+** mamcgree@hdfgroup.org
+** June 29, 2009
+**
+*****************************************************************/
+static void
+test_rw_noupdate(void)
+{
+ hid_t file_id; /* HDF5 File ID */
+ h5_stat_t sb1, sb2; /* Info from 'stat' call */
+ double diff; /* Difference in modification times */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing to verify that nothing is written if nothing is changed.\n"));
+
+ /* Create and Close File */
+ file_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fcreate");
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Determine File's Initial Timestamp */
+ ret = HDstat(FILE1, &sb1);
+ VERIFY(ret, 0, "HDfstat");
+
+ /* Wait for 2 seconds */
+ /* This ensures a system time difference between the two file accesses */
+ HDsleep(2);
+
+ /* Open and Close File With Read/Write Permission */
+ file_id = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fopen");
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Determine File's New Timestamp */
+ ret = HDstat(FILE1, &sb2);
+ VERIFY(ret, 0, "HDstat");
+
+ /* Ensure That Timestamps Are Equal */
+ diff = HDdifftime(sb2.st_mtime, sb1.st_mtime);
+ ret = (diff > 0.0);
+ VERIFY(ret, 0, "Timestamp");
+} /* end test_rw_noupdate() */
+
+/****************************************************************
+**
** test_swmr_write(): low-level file test routine.
** This test checks that the H5F_ACC_SWMR_WRITE access flag is
** working properly.
@@ -2253,6 +2306,7 @@ test_file(void)
#endif /*H5_CANNOT_OPEN_TWICE*/
test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */
test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
+ test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */
test_swmr_write(); /* Tests for SWMR write access flag */
test_swmr_read(); /* Tests for SWMR read access flag */
} /* test_file() */
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 867d8d5..ab4d880 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -2831,7 +2831,7 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Dclose(dset_id);
@@ -3001,7 +3001,7 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Dclose(dset_id);
@@ -3097,7 +3097,7 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Dclose(dset_id);