diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-14 21:13:50 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-14 21:13:50 (GMT) |
commit | e117aee161db792d2dd9ee9f235f95803feb9178 (patch) | |
tree | f1da16ded0805b6e8aad4a8c8e87c8d72030f011 /test | |
parent | b5c82e2e41db6df61af1029beb910dcf86ee7be8 (diff) | |
download | hdf5-e117aee161db792d2dd9ee9f235f95803feb9178.zip hdf5-e117aee161db792d2dd9ee9f235f95803feb9178.tar.gz hdf5-e117aee161db792d2dd9ee9f235f95803feb9178.tar.bz2 |
[svn-r17184] Description:
Add "SWMR read" file access flag, for applications that are
concurrently reading from a file open with the "SWMR write" access flag.
This flag relaxes the internal checks for reading beyond the 'eoa'
for the file (since the eoa for the file could be out of date until the
SWMR write application flushes or closes the file)
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
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.7 (amazon) in debug mode
Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'test')
-rw-r--r-- | test/tfile.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/test/tfile.c b/test/tfile.c index 445f5c2..25c1590 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -2137,6 +2137,91 @@ test_swmr_write(void) /**************************************************************** ** +** test_swmr_read(): low-level file test routine. +** This test checks that the H5F_ACC_SWMR_READ access flag is +** working properly. +** +*****************************************************************/ +static void +test_swmr_read(void) +{ + hid_t fid, fid2; /* File IDs */ + unsigned intent; /* File access flags */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing H5F_ACC_SWMR_READ access flag\n")); + + + /* Try to create file w/SWMR_READ flag */ + H5E_BEGIN_TRY { + fid = H5Fcreate(FILE1, (H5F_ACC_TRUNC | H5F_ACC_SWMR_READ), H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(fid, FAIL, "H5Fcreate"); + + + /* Create file, without SWMR_READ flag */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Get the intent & check that the SWMR_READ flag is not set */ + ret = H5Fget_intent(fid, &intent); + CHECK(ret, FAIL, "H5Fget_intent"); + VERIFY(intent, H5F_ACC_RDWR, "H5Fget_intent"); + + /* Try to reopen file w/SWMR_READ flag */ + H5E_BEGIN_TRY { + fid2 = H5Fopen(FILE1, (H5F_ACC_RDWR | H5F_ACC_SWMR_READ), H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(fid2, FAIL, "H5Fopen"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + + /* Try to open file, with read-write access & SWMR_READ flag */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE1, (H5F_ACC_RDWR | H5F_ACC_SWMR_READ), H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(fid, FAIL, "H5Fopen"); + + + /* Open file, with SWMR_READ flag */ + fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fopen"); + + /* Get the intent & check that the SWMR_READ flag is set */ + ret = H5Fget_intent(fid, &intent); + CHECK(ret, FAIL, "H5Fget_intent"); + VERIFY(intent, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), "H5Fget_intent"); + + /* Try to reopen file w/o SWMR_READ flag */ + H5E_BEGIN_TRY { + fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(fid2, FAIL, "H5Fopen"); + + /* Reopen file, with read-only and SWMR_READ access */ + fid2 = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), H5P_DEFAULT); + CHECK(fid2, FAIL, "H5Fopen"); + + /* Get the intent & check that the SWMR_READ flag is set */ + ret = H5Fget_intent(fid2, &intent); + CHECK(ret, FAIL, "H5Fget_intent"); + VERIFY(intent, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), "H5Fget_intent"); + + /* Close file */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +} /* end test_swmr_read() */ + +/**************************************************************** +** ** test_file(): Main low-level file I/O test routine. ** ****************************************************************/ @@ -2169,6 +2254,7 @@ test_file(void) 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_swmr_write(); /* Tests for SWMR write access flag */ + test_swmr_read(); /* Tests for SWMR read access flag */ } /* test_file() */ |