summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST2
-rw-r--r--test/gen_mergemsg.c331
-rw-r--r--test/mergemsg.h5bin0 -> 3472 bytes
-rw-r--r--test/tmisc.c141
4 files changed, 427 insertions, 47 deletions
diff --git a/MANIFEST b/MANIFEST
index 358082d..03cf0f2 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -676,6 +676,7 @@
./test/flush2.c
./test/gen_cross.c
./test/gen_deflate.c _DO_NOT_DISTRIBUTE_
+./test/gen_mergemsg.c _DO_NOT_DISTRIBUTE_
./test/gen_new_array.c _DO_NOT_DISTRIBUTE_
./test/gen_new_fill.c _DO_NOT_DISTRIBUTE_
./test/gen_new_group.c _DO_NOT_DISTRIBUTE_
@@ -697,6 +698,7 @@
./test/le_data.h5
./test/lheap.c
./test/links.c
+./test/mergemsg.h5
./test/mount.c
./test/mtime.c
./test/noencoder.h5
diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c
new file mode 100644
index 0000000..a7b56a9
--- /dev/null
+++ b/test/gen_mergemsg.c
@@ -0,0 +1,331 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Friday, June 30, 2006
+ *
+ * This program creates an object with fragmented object header messages
+ * that will be merged when the object is read from the file. This program
+ * needs to be compiled against the 1.6.5 or earlier version of the library
+ * in order to generate the file as desired.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include "hdf5.h"
+
+#define FILENAME "mergemsg.h5"
+#define GROUP1 "grp1"
+#define GROUP2 "grp2"
+#define GROUP3 "grp3"
+#define ATTR1 "__111111111111__"
+#define ATTR1_LEN 11
+#define ATTR2 "__222222222__"
+#define ATTR2_LEN 11
+#define ATTR3 "__333333333__"
+#define ATTR3_LEN 1
+
+int main()
+{
+ hid_t fid; /* File ID */
+ hid_t gid, gid2, gid3; /* Group IDs */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ herr_t ret; /* Generic return value */
+
+ /* Create file */
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ assert(fid > 0);
+
+ /* Create first group */
+ gid = H5Gcreate(fid, GROUP1, (size_t)0);
+ assert(gid > 0);
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ assert(ret >= 0);
+
+ /* Create second group */
+ gid2 = H5Gcreate(fid, GROUP2, (size_t)0);
+ assert(gid2 > 0);
+
+ /* Close second group */
+ ret = H5Gclose(gid2);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+
+ /* Re-open file */
+ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ assert(fid > 0);
+
+ /* Re-open first group */
+ gid = H5Gopen(fid, GROUP1);
+ assert(gid > 0);
+
+ /* Create dataspace for attribute */
+ sid = H5Screate(H5S_SCALAR);
+ assert(sid > 0);
+
+ /* Create dataype for attribute */
+ tid = H5Tcopy(H5T_C_S1);
+ assert(tid > 0);
+ ret = H5Tset_size(tid, ATTR1_LEN);
+ assert(ret >= 0);
+
+ /* Add 1st attribute on first group */
+ aid = H5Acreate(gid, ATTR1, tid, sid, H5P_DEFAULT);
+ assert(aid > 0);
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ assert(ret >= 0);
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ assert(ret >= 0);
+
+ /* Close attribute */
+ ret = H5Aclose(aid);
+ assert(ret >= 0);
+
+ /* Create dataspace for 2nd attribute */
+ sid = H5Screate(H5S_SCALAR);
+ assert(sid > 0);
+
+ /* Create dataype for attribute */
+ tid = H5Tcopy(H5T_C_S1);
+ assert(tid > 0);
+ ret = H5Tset_size(tid, ATTR2_LEN);
+ assert(ret >= 0);
+
+ /* Add 2nd attribute on first group */
+ aid = H5Acreate(gid, ATTR2, tid, sid, H5P_DEFAULT);
+ assert(aid > 0);
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ assert(ret >= 0);
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ assert(ret >= 0);
+
+ /* Close 2nd attribute */
+ ret = H5Aclose(aid);
+ assert(ret >= 0);
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+
+ /* Re-open file */
+ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ assert(fid > 0);
+
+ /* Create third group */
+ gid3 = H5Gcreate(fid, GROUP3, (size_t)0);
+ assert(gid3 > 0);
+
+ /* Close third group */
+ ret = H5Gclose(gid3);
+ assert(ret >= 0);
+
+ /* Re-open first group */
+ gid = H5Gopen(fid, GROUP1);
+ assert(gid > 0);
+
+ /* Delete 2nd attribute */
+ ret = H5Adelete(gid, ATTR2);
+ assert(ret >= 0);
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+
+
+
+ /* Re-open file */
+ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ assert(fid > 0);
+
+ /* Re-open first group */
+ gid = H5Gopen(fid, GROUP1);
+ assert(gid > 0);
+
+ /* Create dataspace for 3rd attribute */
+ sid = H5Screate(H5S_SCALAR);
+ assert(sid > 0);
+
+ /* Create dataype for attribute */
+ tid = H5Tcopy(H5T_C_S1);
+ assert(tid > 0);
+ ret = H5Tset_size(tid, ATTR3_LEN);
+ assert(ret >= 0);
+
+ /* Add 3rd attribute on first group (smaller than 2nd attribute) */
+ aid = H5Acreate(gid, ATTR3, tid, sid, H5P_DEFAULT);
+ assert(aid > 0);
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ assert(ret >= 0);
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ assert(ret >= 0);
+
+ /* Close 3rd attribute */
+ ret = H5Aclose(aid);
+ assert(ret >= 0);
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+
+
+ /* Re-open file */
+ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ assert(fid > 0);
+
+ /* Re-open first group */
+ gid = H5Gopen(fid, GROUP1);
+ assert(gid > 0);
+
+ /* Delete 3rd attribute */
+ ret = H5Adelete(gid, ATTR3);
+ assert(ret >= 0);
+
+ /* Create dataspace for 3rd attribute */
+ sid = H5Screate(H5S_SCALAR);
+ assert(sid > 0);
+
+ /* Create dataype for attribute */
+ tid = H5Tcopy(H5T_C_S1);
+ assert(tid > 0);
+ ret = H5Tset_size(tid, ATTR2_LEN);
+ assert(ret >= 0);
+
+ /* Re-create 2nd attribute on first group */
+ aid = H5Acreate(gid, ATTR2, tid, sid, H5P_DEFAULT);
+ assert(aid > 0);
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ assert(ret >= 0);
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ assert(ret >= 0);
+
+ /* Close 2nd attribute */
+ ret = H5Aclose(aid);
+ assert(ret >= 0);
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+
+ /* Re-open file */
+ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ assert(fid > 0);
+
+ /* Re-open first group */
+ gid = H5Gopen(fid, GROUP1);
+ assert(gid > 0);
+
+ /* Delete 2nd attribute */
+ ret = H5Adelete(gid, ATTR2);
+ assert(ret >= 0);
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+
+ /* Re-open file */
+ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ assert(fid > 0);
+
+ /* Re-open first group */
+ gid = H5Gopen(fid, GROUP1);
+ assert(gid > 0);
+
+ /* Create dataspace for 3rd attribute */
+ sid = H5Screate(H5S_SCALAR);
+ assert(sid > 0);
+
+ /* Create dataype for attribute */
+ tid = H5Tcopy(H5T_C_S1);
+ assert(tid > 0);
+ ret = H5Tset_size(tid, ATTR2_LEN);
+ assert(ret >= 0);
+
+ /* Re-create 2nd attribute on first group */
+ aid = H5Acreate(gid, ATTR2, tid, sid, H5P_DEFAULT);
+ assert(aid > 0);
+
+ /* Close dataspace */
+ ret = H5Sclose(sid);
+ assert(ret >= 0);
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ assert(ret >= 0);
+
+ /* Close 2nd attribute */
+ ret = H5Aclose(aid);
+ assert(ret >= 0);
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ assert(ret >= 0);
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ assert(ret >= 0);
+
+ return(0);
+}
+
+
diff --git a/test/mergemsg.h5 b/test/mergemsg.h5
new file mode 100644
index 0000000..3a9e352
--- /dev/null
+++ b/test/mergemsg.h5
Binary files differ
diff --git a/test/tmisc.c b/test/tmisc.c
index 7f39cf3..cc4d7b2 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -272,18 +272,20 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
#define MISC24_DATATYPE_NAME "datatype"
#define MISC24_DATATYPE_LINK "datatype_link"
-/* Definitions for misc. test #25 */
-#define MISC25_FILE "foo.h5"
-#define MISC25_GROUP0_NAME "grp0"
-#define MISC25_GROUP1_NAME "/grp0/grp1"
-#define MISC25_GROUP2_NAME "/grp0/grp2"
-#define MISC25_GROUP3_NAME "/grp0/grp3"
-#define MISC25_ATTR1_NAME "_long attribute_"
-#define MISC25_ATTR1_LEN 11
-#define MISC25_ATTR2_NAME "_short attr__"
-#define MISC25_ATTR2_LEN 11
-#define MISC25_ATTR3_NAME "_short attr__"
-#define MISC25_ATTR3_LEN 1
+/* Definitions for misc. test #25 'a' & 'b' */
+#define MISC25A_FILE "foo.h5"
+#define MISC25A_GROUP0_NAME "grp0"
+#define MISC25A_GROUP1_NAME "/grp0/grp1"
+#define MISC25A_GROUP2_NAME "/grp0/grp2"
+#define MISC25A_GROUP3_NAME "/grp0/grp3"
+#define MISC25A_ATTR1_NAME "_long attribute_"
+#define MISC25A_ATTR1_LEN 11
+#define MISC25A_ATTR2_NAME "_short attr__"
+#define MISC25A_ATTR2_LEN 11
+#define MISC25A_ATTR3_NAME "_short attr__"
+#define MISC25A_ATTR3_LEN 1
+#define MISC25B_FILE "mergemsg.h5"
+#define MISC25B_GROUP "grp1"
/****************************************************************
**
@@ -4280,11 +4282,12 @@ test_misc24(void)
/****************************************************************
**
-** test_misc25(): Exercise null object header message merge bug
+** test_misc25a(): Exercise null object header message merge bug
+** with new file
**
****************************************************************/
static void
-test_misc25(void)
+test_misc25a(void)
{
hid_t fid; /* File ID */
hid_t gid, gid2, gid3; /* Group IDs */
@@ -4297,11 +4300,11 @@ test_misc25(void)
MESSAGE(5, ("Exercise null object header message bug\n"));
/* Create file */
- fid = H5Fcreate(MISC25_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(MISC25A_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
/* Create top group */
- gid = H5Gcreate(fid, MISC25_GROUP0_NAME, (size_t)0);
+ gid = H5Gcreate(fid, MISC25A_GROUP0_NAME, (size_t)0);
CHECK(gid, FAIL, "H5Gcreate");
/* Close top group */
@@ -4309,7 +4312,7 @@ test_misc25(void)
CHECK(ret, FAIL, "H5Gclose");
/* Create first group */
- gid = H5Gcreate(fid, MISC25_GROUP1_NAME, (size_t)0);
+ gid = H5Gcreate(fid, MISC25A_GROUP1_NAME, (size_t)0);
CHECK(gid, FAIL, "H5Gcreate");
/* Close first group */
@@ -4317,7 +4320,7 @@ test_misc25(void)
CHECK(ret, FAIL, "H5Gclose");
/* Create second group */
- gid2 = H5Gcreate(fid, MISC25_GROUP2_NAME, (size_t)0);
+ gid2 = H5Gcreate(fid, MISC25A_GROUP2_NAME, (size_t)0);
CHECK(gid2, FAIL, "H5Gcreate");
/* Close second group */
@@ -4330,11 +4333,11 @@ test_misc25(void)
/* Re-open file */
- fid = H5Fopen(MISC25_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
/* Re-open first group */
- gid = H5Gopen(fid, MISC25_GROUP1_NAME);
+ gid = H5Gopen(fid, MISC25A_GROUP1_NAME);
CHECK(gid, FAIL, "H5Gopen");
/* Create dataspace for attribute */
@@ -4344,11 +4347,11 @@ test_misc25(void)
/* Create dataype for attribute */
tid = H5Tcopy(H5T_C_S1);
CHECK(tid, FAIL, "H5Tcopy");
- ret = H5Tset_size(tid, MISC25_ATTR1_LEN);
+ ret = H5Tset_size(tid, MISC25A_ATTR1_LEN);
CHECK(ret, FAIL, "H5Tset_size");
/* Add 1st attribute on first group */
- aid = H5Acreate(gid, MISC25_ATTR1_NAME, tid, sid, H5P_DEFAULT);
+ aid = H5Acreate(gid, MISC25A_ATTR1_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
/* Close dataspace */
@@ -4370,11 +4373,11 @@ test_misc25(void)
/* Create dataype for attribute */
tid = H5Tcopy(H5T_C_S1);
CHECK(tid, FAIL, "H5Tcopy");
- ret = H5Tset_size(tid, MISC25_ATTR2_LEN);
+ ret = H5Tset_size(tid, MISC25A_ATTR2_LEN);
CHECK(ret, FAIL, "H5Tset_size");
/* Add 2nd attribute on first group */
- aid = H5Acreate(gid, MISC25_ATTR2_NAME, tid, sid, H5P_DEFAULT);
+ aid = H5Acreate(gid, MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
/* Close dataspace */
@@ -4399,11 +4402,11 @@ test_misc25(void)
/* Re-open file */
- fid = H5Fopen(MISC25_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
/* Create third group */
- gid3 = H5Gcreate(fid, MISC25_GROUP3_NAME, (size_t)0);
+ gid3 = H5Gcreate(fid, MISC25A_GROUP3_NAME, (size_t)0);
CHECK(gid3, FAIL, "H5Gcreate");
/* Close third group */
@@ -4411,11 +4414,11 @@ test_misc25(void)
CHECK(ret, FAIL, "H5Gclose");
/* Re-open first group */
- gid = H5Gopen(fid, MISC25_GROUP1_NAME);
+ gid = H5Gopen(fid, MISC25A_GROUP1_NAME);
CHECK(gid, FAIL, "H5Gopen");
/* Delete 2nd attribute */
- ret = H5Adelete(gid, MISC25_ATTR2_NAME);
+ ret = H5Adelete(gid, MISC25A_ATTR2_NAME);
CHECK(ret, FAIL, "H5Adelete");
/* Close first group */
@@ -4429,11 +4432,11 @@ test_misc25(void)
/* Re-open file */
- fid = H5Fopen(MISC25_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
/* Re-open first group */
- gid = H5Gopen(fid, MISC25_GROUP1_NAME);
+ gid = H5Gopen(fid, MISC25A_GROUP1_NAME);
CHECK(gid, FAIL, "H5Gopen");
/* Create dataspace for 3rd attribute */
@@ -4443,11 +4446,11 @@ test_misc25(void)
/* Create dataype for attribute */
tid = H5Tcopy(H5T_C_S1);
CHECK(tid, FAIL, "H5Tcopy");
- ret = H5Tset_size(tid, MISC25_ATTR3_LEN);
+ ret = H5Tset_size(tid, MISC25A_ATTR3_LEN);
CHECK(ret, FAIL, "H5Tset_size");
/* Add 3rd attribute on first group (smaller than 2nd attribute) */
- aid = H5Acreate(gid, MISC25_ATTR3_NAME, tid, sid, H5P_DEFAULT);
+ aid = H5Acreate(gid, MISC25A_ATTR3_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
/* Close dataspace */
@@ -4473,15 +4476,15 @@ test_misc25(void)
/* Re-open file */
- fid = H5Fopen(MISC25_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
/* Re-open first group */
- gid = H5Gopen(fid, MISC25_GROUP1_NAME);
+ gid = H5Gopen(fid, MISC25A_GROUP1_NAME);
CHECK(gid, FAIL, "H5Gopen");
/* Delete 3rd attribute */
- ret = H5Adelete(gid, MISC25_ATTR3_NAME);
+ ret = H5Adelete(gid, MISC25A_ATTR3_NAME);
CHECK(ret, FAIL, "H5Adelete");
/* Create dataspace for 3rd attribute */
@@ -4491,11 +4494,11 @@ test_misc25(void)
/* Create dataype for attribute */
tid = H5Tcopy(H5T_C_S1);
CHECK(tid, FAIL, "H5Tcopy");
- ret = H5Tset_size(tid, MISC25_ATTR2_LEN);
+ ret = H5Tset_size(tid, MISC25A_ATTR2_LEN);
CHECK(ret, FAIL, "H5Tset_size");
/* Re-create 2nd attribute on first group */
- aid = H5Acreate(gid, MISC25_ATTR2_NAME, tid, sid, H5P_DEFAULT);
+ aid = H5Acreate(gid, MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
/* Close dataspace */
@@ -4520,15 +4523,15 @@ test_misc25(void)
/* Re-open file */
- fid = H5Fopen(MISC25_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
/* Re-open first group */
- gid = H5Gopen(fid, MISC25_GROUP1_NAME);
+ gid = H5Gopen(fid, MISC25A_GROUP1_NAME);
CHECK(gid, FAIL, "H5Gopen");
/* Delete 2nd attribute */
- ret = H5Adelete(gid, MISC25_ATTR2_NAME);
+ ret = H5Adelete(gid, MISC25A_ATTR2_NAME);
CHECK(ret, FAIL, "H5Adelete");
/* Close first group */
@@ -4541,11 +4544,11 @@ test_misc25(void)
/* Re-open file */
- fid = H5Fopen(MISC25_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid = H5Fopen(MISC25A_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
/* Re-open first group */
- gid = H5Gopen(fid, MISC25_GROUP1_NAME);
+ gid = H5Gopen(fid, MISC25A_GROUP1_NAME);
CHECK(gid, FAIL, "H5Gopen");
/* Create dataspace for 3rd attribute */
@@ -4555,11 +4558,11 @@ test_misc25(void)
/* Create dataype for attribute */
tid = H5Tcopy(H5T_C_S1);
CHECK(tid, FAIL, "H5Tcopy");
- ret = H5Tset_size(tid, MISC25_ATTR2_LEN);
+ ret = H5Tset_size(tid, MISC25A_ATTR2_LEN);
CHECK(ret, FAIL, "H5Tset_size");
/* Re-create 2nd attribute on first group */
- aid = H5Acreate(gid, MISC25_ATTR2_NAME, tid, sid, H5P_DEFAULT);
+ aid = H5Acreate(gid, MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
/* Close dataspace */
@@ -4581,7 +4584,50 @@ test_misc25(void)
/* Close file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
-} /* end test_misc25() */
+} /* end test_misc25a() */
+
+/****************************************************************
+**
+** test_misc25b(): Exercise null object header message merge bug
+** with existing file (This test relies on
+** the file produced by test/gen_mergemsg.c)
+**
+****************************************************************/
+static void
+test_misc25b(void)
+{
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ char testfile[512]="";
+ char *srcdir = HDgetenv("srcdir");
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Exercise null object header message bug\n"));
+
+ /* Build the name of the file, with the source directory */
+ if (srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC25B_FILE) + 1) < sizeof(testfile))){
+ HDstrcpy(testfile, srcdir);
+ HDstrcat(testfile, "/");
+ }
+ HDstrcat(testfile, MISC25B_FILE);
+
+ /* Open file */
+ fid = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Re-open group with object header messages that will merge */
+ gid = H5Gopen(fid, MISC25B_GROUP);
+ CHECK(gid, FAIL, "H5Gopen");
+
+ /* Close first group */
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* end test_misc25a() */
/****************************************************************
**
@@ -4622,7 +4668,8 @@ test_misc(void)
test_misc23(); /* Test intermediate group creation */
#endif /* H5_GROUP_REVISION */
test_misc24(); /* Test inappropriate API opens of objects */
- test_misc25(); /* Exercise null object header message merge bug */
+ test_misc25a(); /* Exercise null object header message merge bug */
+ test_misc25b(); /* Exercise null object header message merge bug on existing file */
} /* test_misc() */
@@ -4673,6 +4720,6 @@ cleanup_misc(void)
#endif /* H5_HAVE_FILTER_SZIP */
HDremove(MISC23_FILE);
HDremove(MISC24_FILE);
- HDremove(MISC25_FILE);
+ HDremove(MISC25A_FILE);
}