summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-03-07 15:59:39 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-03-07 15:59:39 (GMT)
commitd5fea5b80a2ccc21fb4f187d0efeda80b9134156 (patch)
tree8cc95b236a40ce0567887d189bc077136cf0e2e6
parent503ab9d88d6fb4b0866cb8bb77ee1df68dd735c1 (diff)
downloadhdf5-d5fea5b80a2ccc21fb4f187d0efeda80b9134156.zip
hdf5-d5fea5b80a2ccc21fb4f187d0efeda80b9134156.tar.gz
hdf5-d5fea5b80a2ccc21fb4f187d0efeda80b9134156.tar.bz2
Bring fix for HDFFV-9697 from develop branch.
Populate the fix for HDFFV-9697: Fix for unknown message from develop branch. Tested on ostrich, platypus, kite, quail, osx1010test, emu, mayll, moohan, kituo.
-rw-r--r--src/H5Dint.c12
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fsuper.c2
-rw-r--r--src/H5O.c82
-rw-r--r--src/H5Obogus.c66
-rw-r--r--src/H5Ocache.c11
-rw-r--r--src/H5Opkg.h8
-rw-r--r--src/H5Oprivate.h70
-rw-r--r--test/gen_bogus.c72
-rw-r--r--test/ohdr.c446
-rw-r--r--test/tbogus.h5bin1944 -> 3792 bytes
11 files changed, 503 insertions, 268 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 16ced02..b5adfc4 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -869,16 +869,22 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
- /* Check whether to add a "bogus" message */
- if(H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) {
+ /* Check whether to add a "bogus" message */
+ if( (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) &&
+ (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) {
+
uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
+ unsigned bogus_id; /* "bogus" ID */
+ /* Retrieve "bogus" message ID */
+ if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
/* Retrieve "bogus" message flags */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
/* Add a "bogus" message (for error testing). */
- if(H5O_bogus_oh(file, dxpl_id, oh, (unsigned)bogus_flags) < 0)
+ if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
} /* end if */
}
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 21034d7..3a343cc 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -310,7 +310,7 @@ H5_DLL herr_t H5F_super_free(H5F_super_t *sblock);
/* Superblock extension related routines */
H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr);
-H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create);
+H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create);
H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id,
hbool_t was_created);
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 3f2b33f..5f71f61 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -712,7 +712,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create)
+H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create)
{
hbool_t ext_created = FALSE; /* Whether superblock extension was created */
hbool_t ext_opened = FALSE; /* Whether superblock extension was opened */
diff --git a/src/H5O.c b/src/H5O.c
index 38d9f6b..8c2d08d 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -98,34 +98,39 @@ static const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh);
*/
const H5O_msg_class_t *const H5O_msg_class_g[] = {
- H5O_MSG_NULL, /*0x0000 Null */
- H5O_MSG_SDSPACE, /*0x0001 Dataspace */
- H5O_MSG_LINFO, /*0x0002 Link information */
- H5O_MSG_DTYPE, /*0x0003 Datatype */
- H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
- H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */
- H5O_MSG_LINK, /*0x0006 Link */
- H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
- H5O_MSG_LAYOUT, /*0x0008 Data Layout */
+ H5O_MSG_NULL, /*0x0000 Null */
+ H5O_MSG_SDSPACE, /*0x0001 Dataspace */
+ H5O_MSG_LINFO, /*0x0002 Link information */
+ H5O_MSG_DTYPE, /*0x0003 Datatype */
+ H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */
+ H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */
+ H5O_MSG_LINK, /*0x0006 Link */
+ H5O_MSG_EFL, /*0x0007 Data storage -- external data files */
+ H5O_MSG_LAYOUT, /*0x0008 Data Layout */
#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS, /*0x0009 "Bogus" (for testing) */
+ H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */
#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x0009 "Bogus" (for testing) */
+ NULL, /*0x0009 "Bogus valid" (for testing) */
+#endif /* H5O_ENABLE_BOGUS */
+ H5O_MSG_GINFO, /*0x000A Group information */
+ H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
+ H5O_MSG_ATTR, /*0x000C Attribute */
+ H5O_MSG_NAME, /*0x000D Object name */
+ H5O_MSG_MTIME, /*0x000E Object modification date and time */
+ H5O_MSG_SHMESG, /*0x000F File-wide shared message table */
+ H5O_MSG_CONT, /*0x0010 Object header continuation */
+ H5O_MSG_STAB, /*0x0011 Symbol table */
+ H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */
+ H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */
+ H5O_MSG_DRVINFO, /*0x0014 Driver info settings */
+ H5O_MSG_AINFO, /*0x0015 Attribute information */
+ H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
+ H5O_MSG_UNKNOWN, /*0x0017 Placeholder for unknown message */
+#ifdef H5O_ENABLE_BOGUS
+ H5O_MSG_BOGUS_INVALID /*0x0018 "Bogus invalid" (for testing) */
+#else /* H5O_ENABLE_BOGUS */
+ NULL /*0x0018 "Bogus invalid" (for testing) */
#endif /* H5O_ENABLE_BOGUS */
- H5O_MSG_GINFO, /*0x000A Group information */
- H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */
- H5O_MSG_ATTR, /*0x000C Attribute */
- H5O_MSG_NAME, /*0x000D Object name */
- H5O_MSG_MTIME, /*0x000E Object modification date and time */
- H5O_MSG_SHMESG, /*0x000F File-wide shared message table */
- H5O_MSG_CONT, /*0x0010 Object header continuation */
- H5O_MSG_STAB, /*0x0011 Symbol table */
- H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */
- H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */
- H5O_MSG_DRVINFO, /*0x0014 Driver info settings */
- H5O_MSG_AINFO, /*0x0015 Attribute information */
- H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
- H5O_MSG_UNKNOWN /*0x0017 Placeholder for unknown message */
};
/* Declare a free list to manage the H5O_t struct */
@@ -2122,10 +2127,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
+H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags)
{
- size_t idx; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t idx; /* Local index variable */
+ H5O_msg_class_t *type; /* Message class type */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -2134,7 +2140,8 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
/* Look for existing message */
for(idx = 0; idx < oh->nmesgs; idx++)
- if(H5O_MSG_BOGUS == oh->mesg[idx].type)
+ if(H5O_MSG_BOGUS_VALID == oh->mesg[idx].type ||
+ H5O_MSG_BOGUS_INVALID == oh->mesg[idx].type)
break;
/* Create a new message */
@@ -2142,18 +2149,25 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags)
H5O_bogus_t *bogus; /* Pointer to the bogus information */
/* Allocate the native message in memory */
- if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
+ if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t))))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message")
/* Update the native value */
bogus->u = H5O_BOGUS_VALUE;
+ if(bogus_id == H5O_BOGUS_VALID_ID)
+ type = H5O_MSG_BOGUS_VALID;
+ else if(bogus_id == H5O_BOGUS_INVALID_ID)
+ type = H5O_MSG_BOGUS_INVALID;
+ else
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message")
+
/* Allocate space in the object header for bogus message */
- if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus, &idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
+ if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, bogus, &idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message")
/* Point to "bogus" information (take it over) */
- oh->mesg[idx].native = bogus;
+ oh->mesg[idx].native = bogus;
/* Set the appropriate flags for the message */
oh->mesg[idx].flags = mesg_flags;
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index b368ab6..3effae3 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -46,27 +46,51 @@ static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *
int indent, int fwidth);
/* This message derives from H5O message class */
-const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{
- H5O_BOGUS_ID, /*message id number */
- "bogus", /*message name for debugging */
- 0, /*native message size */
- 0, /* messages are sharable? */
- H5O_bogus_decode, /*decode message */
- H5O_bogus_encode, /*encode message */
- NULL, /*copy the native value */
- H5O_bogus_size, /*raw message size */
- NULL, /*free internal memory */
- NULL, /*free method */
- NULL, /* file delete method */
- NULL, /* link method */
- NULL, /*set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- NULL, /* copy native value to file */
- NULL, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_bogus_debug /*debug the message */
+const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{
+ H5O_BOGUS_VALID_ID, /*message id number */
+ "bogus valid", /*message name for debugging */
+ 0, /*native message size */
+ 0, /*messages are sharable? */
+ H5O_bogus_decode, /*decode message */
+ H5O_bogus_encode, /*encode message */
+ NULL, /*copy the native value */
+ H5O_bogus_size, /*raw message size */
+ NULL, /*free internal memory */
+ NULL, /*free method */
+ NULL, /* file delete method */
+ NULL, /* link method */
+ NULL, /*set share method */
+ NULL, /*can share method */
+ NULL, /* pre copy native value to file */
+ NULL, /* copy native value to file */
+ NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_bogus_debug /*debug the message */
+}};
+
+/* This message derives from H5O message class */
+const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
+ H5O_BOGUS_INVALID_ID, /*message id number */
+ "bogus invalid", /*message name for debugging */
+ 0, /*native message size */
+ 0, /*messages are sharable? */
+ H5O_bogus_decode, /*decode message */
+ H5O_bogus_encode, /*encode message */
+ NULL, /*copy the native value */
+ H5O_bogus_size, /*raw message size */
+ NULL, /*free internal memory */
+ NULL, /*free method */
+ NULL, /* file delete method */
+ NULL, /* link method */
+ NULL, /*set share method */
+ NULL, /*can share method */
+ NULL, /* pre copy native value to file */
+ NULL, /* copy native value to file */
+ NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_bogus_debug /*debug the message */
}};
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 2aaf933..0f22acb 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -1116,10 +1116,6 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
else
id = *p++;
- /* Check for unknown message ID getting encoded in file */
- if(id == H5O_UNKNOWN_ID)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "'unknown' message ID encoded in file?!?")
-
/* Message size */
UINT16DECODE(p, mesg_size);
HDassert(mesg_size == H5O_ALIGN_OH(oh, mesg_size));
@@ -1193,7 +1189,12 @@ H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
/* Point unknown messages at 'unknown' message class */
/* (Usually from future versions of the library) */
- if(id >= NELMTS(H5O_msg_class_g) || NULL == H5O_msg_class_g[id]) {
+ if(id >= H5O_UNKNOWN_ID ||
+#ifdef H5O_ENABLE_BOGUS
+ id == H5O_BOGUS_VALID_ID ||
+#endif
+ NULL == H5O_msg_class_g[id]) {
+
H5O_unknown_t *unknown; /* Pointer to "unknown" message info */
/* Allocate "unknown" message info */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 2c8c5a0..c7789fe 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -31,7 +31,7 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */
-#define H5O_MSG_TYPES 24 /* # of types of messages */
+#define H5O_MSG_TYPES 25 /* # of types of messages */
#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
@@ -441,11 +441,13 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_EFL[1];
H5_DLLVAR const H5O_msg_class_t H5O_MSG_LAYOUT[1];
#ifdef H5O_ENABLE_BOGUS
-/* "Bogus" Message. (0x0009) */
+/* "Bogus valid" Message. (0x0009) */
+/* "Bogus invalid" Message. (0x00018) */
/*
* Used for debugging - should never be found in valid HDF5 file.
*/
-H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS[1];
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1];
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1];
#endif /* H5O_ENABLE_BOGUS */
/* Group Information Message. (0x000a) */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 94ba6a0..e749398 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -83,6 +83,9 @@ typedef struct H5O_t H5O_t;
/* Hash value constants */
#define H5O_HASH_SIZE 32
+/* Enable reading/writing "bogus" messages */
+/* #define H5O_ENABLE_BOGUS */
+
/* ========= Object Creation properties ============ */
#define H5O_CRT_ATTR_MAX_COMPACT_NAME "max compact attr" /* Max. # of attributes to store compactly */
#define H5O_CRT_ATTR_MIN_DENSE_NAME "min dense attr" /* Min. # of attributes to store densely */
@@ -92,6 +95,11 @@ typedef struct H5O_t H5O_t;
#ifdef H5O_ENABLE_BOGUS
#define H5O_BOGUS_MSG_FLAGS_NAME "bogus msg flags" /* Flags for 'bogus' message */
#define H5O_BOGUS_MSG_FLAGS_SIZE sizeof(uint8_t)
+
+/* bogus ID can be either (a) H5O_BOGUS_VALID_ID or (b) H5O_BOGUS_INVALID_ID */
+#define H5O_BOGUS_MSG_ID_NAME "bogus msg id" /* ID for 'bogus' message */
+#define H5O_BOGUS_MSG_ID_SIZE sizeof(unsigned)
+
#endif /* H5O_ENABLE_BOGUS */
#ifdef H5O_ENABLE_BAD_MESG_COUNT
#define H5O_BAD_MESG_COUNT_NAME "bad message count" /* Flag setting bad message count */
@@ -168,32 +176,41 @@ typedef struct H5O_copy_t {
} H5O_copy_t;
/* Header message IDs */
-#define H5O_NULL_ID 0x0000 /* Null Message. */
-#define H5O_SDSPACE_ID 0x0001 /* Dataspace Message. */
-#define H5O_LINFO_ID 0x0002 /* Link info Message. */
-#define H5O_DTYPE_ID 0x0003 /* Datatype Message. */
-#define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */
-#define H5O_FILL_NEW_ID 0x0005 /* Fill Value Message. (New) */
-#define H5O_LINK_ID 0x0006 /* Link Message. */
-#define H5O_EFL_ID 0x0007 /* External File List Message */
-#define H5O_LAYOUT_ID 0x0008 /* Data Layout Message. */
-#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */
-#define H5O_GINFO_ID 0x000a /* Group info Message. */
-#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */
-#define H5O_ATTR_ID 0x000c /* Attribute Message. */
-#define H5O_NAME_ID 0x000d /* Object name message. */
-#define H5O_MTIME_ID 0x000e /* Modification time message. (Old) */
-#define H5O_SHMESG_ID 0x000f /* Shared message "SOHM" table. */
-#define H5O_CONT_ID 0x0010 /* Object header continuation message. */
-#define H5O_STAB_ID 0x0011 /* Symbol table message. */
-#define H5O_MTIME_NEW_ID 0x0012 /* Modification time message. (New) */
-#define H5O_BTREEK_ID 0x0013 /* v1 B-tree 'K' values message. */
-#define H5O_DRVINFO_ID 0x0014 /* Driver info message. */
-#define H5O_AINFO_ID 0x0015 /* Attribute info message. */
-#define H5O_REFCOUNT_ID 0x0016 /* Reference count message. */
-#define H5O_UNKNOWN_ID 0x0017 /* Placeholder message ID for unknown message. */
+#define H5O_NULL_ID 0x0000 /* Null Message. */
+#define H5O_SDSPACE_ID 0x0001 /* Dataspace Message. */
+#define H5O_LINFO_ID 0x0002 /* Link info Message. */
+#define H5O_DTYPE_ID 0x0003 /* Datatype Message. */
+#define H5O_FILL_ID 0x0004 /* Fill Value Message. (Old) */
+#define H5O_FILL_NEW_ID 0x0005 /* Fill Value Message. (New) */
+#define H5O_LINK_ID 0x0006 /* Link Message. */
+#define H5O_EFL_ID 0x0007 /* External File List Message */
+#define H5O_LAYOUT_ID 0x0008 /* Data Layout Message. */
+#define H5O_BOGUS_VALID_ID 0x0009 /* "Bogus valid" Message. */
+#define H5O_GINFO_ID 0x000a /* Group info Message. */
+#define H5O_PLINE_ID 0x000b /* Filter pipeline message. */
+#define H5O_ATTR_ID 0x000c /* Attribute Message. */
+#define H5O_NAME_ID 0x000d /* Object name message. */
+#define H5O_MTIME_ID 0x000e /* Modification time message. (Old) */
+#define H5O_SHMESG_ID 0x000f /* Shared message "SOHM" table. */
+#define H5O_CONT_ID 0x0010 /* Object header continuation message. */
+#define H5O_STAB_ID 0x0011 /* Symbol table message. */
+#define H5O_MTIME_NEW_ID 0x0012 /* Modification time message. (New) */
+#define H5O_BTREEK_ID 0x0013 /* v1 B-tree 'K' values message. */
+#define H5O_DRVINFO_ID 0x0014 /* Driver info message. */
+#define H5O_AINFO_ID 0x0015 /* Attribute info message. */
+#define H5O_REFCOUNT_ID 0x0016 /* Reference count message. */
+#define H5O_UNKNOWN_ID 0x0017 /* Placeholder message ID for unknown message. */
/* (this should never exist in a file) */
+/*
+ * Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g
+ * in H5O.c when creating a new message type. Also bump the value of
+ * H5O_BOGUS_INVALID_ID, below, to be one greater than the value of
+ * H5O_UNKNOWN_ID.
+ *
+ * (this should never exist in a file)
+ */
+#define H5O_BOGUS_INVALID_ID 0x0018 /* "Bogus invalid" Message. */
/* Shared object message types.
* Shared objects can be committed, in which case the shared message contains
@@ -425,9 +442,6 @@ typedef struct H5O_layout_t {
H5O_storage_t storage; /* Information for storing dataset elements */
} H5O_layout_t;
-/* Enable reading/writing "bogus" messages */
-/* #define H5O_ENABLE_BOGUS */
-
#ifdef H5O_ENABLE_BOGUS
/*
* "Bogus" Message.
@@ -641,7 +655,7 @@ H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id);
H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
hbool_t force);
#ifdef H5O_ENABLE_BOGUS
-H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags);
+H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_id, unsigned mesg_flags);
#endif /* H5O_ENABLE_BOGUS */
H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr);
diff --git a/test/gen_bogus.c b/test/gen_bogus.c
index df1e81f..290ec08 100644
--- a/test/gen_bogus.c
+++ b/test/gen_bogus.c
@@ -36,18 +36,21 @@
#define FALSE 0
#endif /* FALSE */
-int main(void)
-{
#ifdef H5O_ENABLE_BOGUS
- hid_t fid = -1; /* File ID */
+
+/*
+ * Create datasets in the location (in "/" or "/group") with
+ * message id: (a) H5O_BOGUS_VALID_ID or (b)H5O_BOGUS_INVALID_ID
+ * and various unknown message flags
+ */
+static int
+generate_datasets(hid_t loc_id, unsigned bogus_id)
+{
hid_t sid = -1; /* Dataspace ID */
hid_t dcpl = -1; /* Dataset creation property list ID */
hid_t did = -1; /* Dataset ID */
uint8_t bogus_flags = 0; /* Flags for bogus message */
- /* Create file for test datasets */
- if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
-
/* Create dataspace for datasets */
if((sid = H5Screate(H5S_SCALAR)) < 0) goto error;
@@ -57,24 +60,30 @@ int main(void)
/* Add property for bogus message flags */
if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, H5O_BOGUS_MSG_FLAGS_SIZE, &bogus_flags, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error;
+ /* Add property for bogus message ID */
+ if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_ID_NAME, H5O_BOGUS_MSG_ID_SIZE, &bogus_id, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error;
+
/* Create dataset with "bogus" message, but no message flags */
- if((did = H5Dcreate2(fid, "/Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ if((did = H5Dcreate2(loc_id, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
if(H5Dclose(did) < 0) goto error;
- /* Set "fail if unknown" message flag for bogus message */
+ /* Set "fail if unknown and open for write" message flag for bogus message */
bogus_flags = H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE;
if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;
/* Create second dataset, with "fail if unknown" message flag */
- if((did = H5Dcreate2(fid, "/Dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ if((did = H5Dcreate2(loc_id, "Dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
if(H5Dclose(did) < 0) goto error;
+ /* Set "fail if unknown always" message flag for bogus message */
+ /* There is no H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS, skip creating "Dataset3" */
+
/* Set "mark if unknown" message flag for bogus message */
bogus_flags = H5O_MSG_FLAG_MARK_IF_UNKNOWN;
if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;
- /* Create second dataset, with "mark if unknown" message flag */
- if((did = H5Dcreate2(fid, "/Dataset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ /* Create fourth dataset, with "mark if unknown" message flag */
+ if((did = H5Dcreate2(loc_id, "Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
if(H5Dclose(did) < 0) goto error;
/* Close dataset creation property list */
@@ -83,9 +92,6 @@ int main(void)
/* Close dataspace */
if(H5Sclose(sid) < 0) goto error;
- /* Close file */
- if(H5Fclose(fid) < 0) goto error;
-
return 0;
error:
@@ -93,6 +99,43 @@ error:
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dcpl);
+ } H5E_END_TRY;
+
+ return -1;
+} /* generate_datasets() */
+#endif
+
+int main(void)
+{
+#ifdef H5O_ENABLE_BOGUS
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+
+ /* Create file for test datasets */
+ if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
+
+ /* Create datasets in "/" group with bogus message H5O_BOGUS_VALID_ID */
+ if(generate_datasets(fid, H5O_BOGUS_VALID_ID) < 0)
+ goto error;
+
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create datasets in "/group" with bogus message H5O_BOGUS_INVALID_ID */
+ if(generate_datasets(gid, H5O_BOGUS_INVALID_ID) < 0)
+ goto error;
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0) goto error;
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) goto error;
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
#else /* H5O_ENABLE_BOGUS */
@@ -100,4 +143,3 @@ error:
#endif /* H5O_ENABLE_BOGUS */
return 1;
}
-
diff --git a/test/ohdr.c b/test/ohdr.c
index 1b324a9..6e6faa4 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -288,6 +288,280 @@ error:
return -1;
} /* test_ohdr_cache() */
+/*
+ * To test objects with unknown messages in a file with:
+ * a) H5O_BOGUS_VALID_ID:
+ * --the bogus_id is within the range of H5O_msg_class_g[]
+ * b) H5O_BOGUS_INVALID_ID:
+ * --the bogus_id is outside the range of H5O_msg_class_g[]
+ *
+ * The test file is FILE_BOGUS: "tbogus.h5" generated with gen_bogus.c
+ * --objects that have unknown header messages with H5O_BOGUS_VALID_ID in "/"
+ * --objects that have unknown header messages with H5O_BOGUS_INVALID_ID in "/group"
+ *
+ * The test also uses the test file FILENAME[0] (ohdr.h5): the parameter "filename"
+ */
+static herr_t
+test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
+{
+ hid_t fid = -1; /* file ID */
+ hid_t gid = -1; /* group ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t loc = -1; /* location: file or group ID */
+ hid_t fid_bogus = -1; /* bogus file ID */
+ hid_t gid_bogus = -1; /* bogus group ID */
+ hid_t loc_bogus = -1; /* location: bogus file or group ID */
+ char testfile[256];
+
+ /* create a different name for a local copy of the data file to be
+ opened with rd/wr file permissions in case build and test are
+ done in the source directory. */
+ HDstrncpy(testfile, FILE_BOGUS, strlen(FILE_BOGUS));
+ testfile[strlen(FILE_BOGUS)]='\0';
+ HDstrncat(testfile, ".copy", 5);
+
+ /* Make a copy of the data file from svn. */
+ if(h5_make_local_copy(FILE_BOGUS, testfile) < 0)
+ FAIL_STACK_ERROR
+
+ TESTING("object with unknown header message and no flags set");
+
+ /* Open filename */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open FILE_BOGUS */
+ if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set up location ID depending on bogus_id */
+ if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ /* Open "group" in FILE_BOGUS */
+ if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc_bogus = gid_bogus;
+
+ /* Create "group" in filename */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
+
+ } else { /* H5O_BOGUS_VALID_ID */
+ loc_bogus = fid_bogus;
+ loc = fid;
+ } /* end else */
+
+ /* Open the dataset with the unknown header message, but no extra flags */
+ if((did = H5Dopen2(loc_bogus, "Dataset1", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ 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((did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ /* TESTING("object in r/o file with unknown header message & 'fail if unknown always' flag set"); */
+ /* There is no H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS */
+
+ TESTING("object with unknown header message & 'mark if unknown' flag set");
+
+ /* Copy object with "mark if unknown" flag on message into file (FILENAME[0]) that can be modified */
+ if(H5Ocopy(loc_bogus, "Dataset4", loc, "Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Closing: filename */
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open filename, with read-only permissions */
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set up location ID depending on bogus_id */
+ if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ /* Open "group" in filename */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
+ } else
+ loc = fid;
+
+ /* Open the dataset with the "mark if unknown" message */
+ if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check that the "unknown" message was _NOT_ marked */
+ if(H5O_check_msg_marked_test(did, FALSE) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close "group" in filename depending on bogus_id */
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close filename (to flush change to object header) */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open filename */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set up location ID depending on bogus_id */
+ if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ /* Open "group" in filename */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
+ } else
+ loc = fid;
+
+ /* Open the dataset with the "mark if unknown" message */
+ if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create data space */
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create an attribute, to get the object header into write access */
+ if((aid = H5Acreate2(did, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close attribute */
+ if(H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close "group" in filename depending on bogus_id */
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close filename (to flush change to object header) */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open filename */
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set up location ID depending on bogus_id */
+ if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ /* Open "group" in filename */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc = gid;
+ } else
+ loc = fid;
+
+ /* Re-open the dataset with the "mark if unknown" message */
+ if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check that the "unknown" message was marked */
+ if(H5O_check_msg_marked_test(did, TRUE) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Closing: filename */
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ /* Closing: FILE_BOGUS */
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid_bogus) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid_bogus) < 0)
+ FAIL_STACK_ERROR
+
+ TESTING("object in r/w file with unknown header message & 'fail if unknown and open for write' flag set");
+
+ /* Open FILE_BOGUS with RW intent this time */
+ if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Set up location ID */
+ if(bogus_id == H5O_BOGUS_INVALID_ID) {
+ /* Open "group" in FILE_BOGUS */
+ if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ loc_bogus = gid_bogus;
+ } else
+ loc_bogus = fid_bogus;
+
+ /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
+ H5E_BEGIN_TRY {
+ did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(did >= 0) {
+ H5Dclose(did);
+ TEST_ERROR
+ } /* end if */
+
+ PASSED();
+
+ /* TESTING("object in r/w file with unknown header message & 'fail if unknown always' flag set"); */
+ /* There is no H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS */
+
+ /* Closing: FILE_BOGUS */
+ if(bogus_id == H5O_BOGUS_INVALID_ID)
+ if(H5Gclose(gid_bogus) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(fid_bogus) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid);
+ H5Gclose(gid);
+ H5Fclose(fid_bogus);
+ H5Gclose(gid_bogus);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Aclose(aid);
+ } H5E_END_TRY;
+
+ return FAIL;
+} /* test_unknown() */
+
/*-------------------------------------------------------------------------
* Function: main
@@ -334,8 +608,8 @@ main(void)
if(H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
- /* test on object continuation block */
- if(test_cont(filename, fapl) < 0)
+ /* test on object continuation block */
+ if(test_cont(filename, fapl) < 0)
FAIL_STACK_ERROR
/* Create the file to operate on */
@@ -650,164 +924,22 @@ main(void)
PASSED();
-
- /* Test reading datasets with undefined object header messages */
- HDputs("Accessing objects with unknown header messages:");
- {
- hid_t file2; /* File ID for 'bogus' object file */
- hid_t sid; /* Dataspace ID */
- hid_t aid; /* Attribute ID */
- char testpath[512] = "";
- char testfile[512] = "";
- char *srcdir = HDgetenv("srcdir");
-
- /* Build path to all test files */
- if(srcdir && ((HDstrlen(srcdir) + 2) < sizeof(testpath))) {
- HDstrcpy(testpath, srcdir);
- HDstrcat(testpath, "/");
- } /* end if */
-
- /* Build path to test file */
- if(srcdir && ((HDstrlen(testpath) + HDstrlen(FILE_BOGUS) + 1) < sizeof(testfile)))
- HDstrcpy(testfile, testpath);
- HDstrcat(testfile, FILE_BOGUS);
-
- TESTING("object with unknown header message and no flags set");
-
- /* Open the file with objects that have unknown header messages (generated with gen_bogus.c) */
- if((file2 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- TEST_ERROR
-
- /* Open the dataset with the unknown header message, but no extra flags */
- if((dset = H5Dopen2(file2, "/Dataset1", H5P_DEFAULT)) < 0)
- TEST_ERROR
- if(H5Dclose(dset) < 0)
- TEST_ERROR
-
- PASSED();
-
- TESTING("object 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)
- TEST_ERROR
- if(H5Dclose(dset) < 0)
- TEST_ERROR
-
- 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)
- TEST_ERROR
-
- /* Close the file we created (to flush changes to file) */
- if(H5Fclose(file) < 0)
- TEST_ERROR
-
- /* Re-open the file created, with read-only permissions */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
-
- /* Open the dataset with the "mark if unknown" message */
- if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
- TEST_ERROR
-
- /* Check that the "unknown" message was _NOT_ marked */
- if(H5O_check_msg_marked_test(dset, FALSE) < 0)
- FAIL_STACK_ERROR
-
- /* Close the dataset */
- if(H5Dclose(dset) < 0)
- TEST_ERROR
-
- /* Close the file we created (to flush change to object header) */
- if(H5Fclose(file) < 0)
- TEST_ERROR
-
- /* Re-open the file created */
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- TEST_ERROR
-
- /* Open the dataset with the "mark if unknown" message */
- if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
- TEST_ERROR
-
- /* Create data space */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
- FAIL_STACK_ERROR
-
- /* Create an attribute, to get the object header into write access */
- if((aid = H5Acreate2(dset, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
-
- /* Close dataspace */
- if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR
-
- /* Close attribute */
- if(H5Aclose(aid) < 0)
- FAIL_STACK_ERROR
-
- /* Close the dataset */
- if(H5Dclose(dset) < 0)
- TEST_ERROR
-
- /* Close the file we created (to flush change to object header) */
- if(H5Fclose(file) < 0)
- TEST_ERROR
-
- /* Re-open the file created */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
-
- /* Re-open the dataset with the "mark if unknown" message */
- if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0)
- TEST_ERROR
-
- /* Check that the "unknown" message was marked */
- if(H5O_check_msg_marked_test(dset, TRUE) < 0)
- FAIL_STACK_ERROR
-
- /* Close the dataset */
- if(H5Dclose(dset) < 0)
- TEST_ERROR
-
- /* Close the file with the bogus objects */
- if(H5Fclose(file2) < 0)
- TEST_ERROR
-
- PASSED();
-
- /* Open the file with objects that have unknown header messages (generated with gen_bogus.c) with RW intent this time */
- 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");
-
- /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
- H5E_BEGIN_TRY {
- dset = H5Dopen2(file2, "/Dataset2", 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
-
- PASSED();
- }
-
- /* Close the file we created */
+ /* Close the file we created */
if(H5Fclose(file) < 0)
TEST_ERROR
- /* Test object header creation metadata cache issues */
- if(test_ohdr_cache(filename, fapl) < 0)
+ /* 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: H5O_BOGUS_VALID_ID");
+ if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0)
+ TEST_ERROR
+ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID");
+ if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test object header creation metadata cache issues */
+ if(test_ohdr_cache(filename, fapl) < 0)
TEST_ERROR
} /* end for */
diff --git a/test/tbogus.h5 b/test/tbogus.h5
index 5b1d85e..87b183b 100644
--- a/test/tbogus.h5
+++ b/test/tbogus.h5
Binary files differ