summaryrefslogtreecommitdiffstats
path: root/test/ohdr.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-07-10 14:17:06 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-07-10 14:17:06 (GMT)
commit15f0ea3f174019d3e67e9157021229f0bc319a7b (patch)
tree13c459c0345de9ac3ea2caf2f6c44c3d0e72b9b1 /test/ohdr.c
parentb7d9670be340447e3ffb8e0e91e9b6b250f17b18 (diff)
parent8bbe712961a9b88d5fda838ec745f40217c28c8c (diff)
downloadhdf5-15f0ea3f174019d3e67e9157021229f0bc319a7b.zip
hdf5-15f0ea3f174019d3e67e9157021229f0bc319a7b.tar.gz
hdf5-15f0ea3f174019d3e67e9157021229f0bc319a7b.tar.bz2
[svn-r27369] merge from trunk.
Diffstat (limited to 'test/ohdr.c')
-rw-r--r--test/ohdr.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/test/ohdr.c b/test/ohdr.c
index bfed19f..4857356 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -665,7 +665,9 @@ main(void)
PASSED();
- /* Test reading datasets with undefined object header messages */
+ /* Test reading datasets with undefined object header messages
+ * and the various "fail/mark if unknown" object header message flags
+ */
HDputs("Accessing objects with unknown header messages:");
{
hid_t file2; /* File ID for 'bogus' object file */
@@ -687,7 +689,7 @@ main(void)
PASSED();
- TESTING("object with unknown header message & 'fail if unknown and open for write' flag set");
+ TESTING("object in r/o file with unknown header message & 'fail if unknown and open for write' flag set");
/* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
if((dset = H5Dopen2(file2, "/Dataset2", H5P_DEFAULT)) < 0)
@@ -697,10 +699,23 @@ main(void)
PASSED();
+ TESTING("object in r/o file with unknown header message & 'fail if unknown always' flag set");
+
+ /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */
+ H5E_BEGIN_TRY {
+ dset = H5Dopen2(file2, "/Dataset3", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(dset >= 0) {
+ H5Dclose(dset);
+ TEST_ERROR
+ } /* end if */
+
+ PASSED();
+
TESTING("object with unknown header message & 'mark if unknown' flag set");
/* Copy object with "mark if unknown" flag on message into file that can be modified */
- if(H5Ocopy(file2, "/Dataset3", file, "/Dataset3", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if(H5Ocopy(file2, "/Dataset4", file, "/Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Close the file we created (to flush changes to file) */
@@ -712,7 +727,7 @@ main(void)
TEST_ERROR
/* Open the dataset with the "mark if unknown" message */
- if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
+ if((dset = H5Dopen2(file, "/Dataset4", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check that the "unknown" message was _NOT_ marked */
@@ -732,7 +747,7 @@ main(void)
TEST_ERROR
/* Open the dataset with the "mark if unknown" message */
- if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
+ if((dset = H5Dopen2(file, "/Dataset4", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Create data space */
@@ -764,7 +779,7 @@ main(void)
TEST_ERROR
/* Re-open the dataset with the "mark if unknown" message */
- if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
+ if((dset = H5Dopen2(file, "/Dataset4", H5P_DEFAULT)) < 0)
TEST_ERROR
/* Check that the "unknown" message was marked */
@@ -785,7 +800,7 @@ main(void)
if((file2 = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
TEST_ERROR
- TESTING("object with unknown header message & 'fail if unknown and open for write' flag set");
+ TESTING("object in r/w file with unknown header message & 'fail if unknown and open for write' flag set");
/* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
H5E_BEGIN_TRY {
@@ -796,6 +811,19 @@ main(void)
TEST_ERROR
} /* end if */
+ PASSED();
+
+ TESTING("object in r/w file with unknown header message & 'fail if unknown always' flag set");
+
+ /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */
+ H5E_BEGIN_TRY {
+ dset = H5Dopen2(file2, "/Dataset3", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(dset >= 0) {
+ H5Dclose(dset);
+ TEST_ERROR
+ } /* end if */
+
/* Close the file with the bogus objects */
if(H5Fclose(file2) < 0)
TEST_ERROR