summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-07-14 19:06:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-07-14 19:06:32 (GMT)
commitf6b8e380c60f7a759fdfad5b71252a0b8607627c (patch)
tree32ac728f41e68fb596407b087dcef97272c8dac4
parent3d936a4764804bdebccbacf40d227f63bb024bdb (diff)
downloadhdf5-f6b8e380c60f7a759fdfad5b71252a0b8607627c.zip
hdf5-f6b8e380c60f7a759fdfad5b71252a0b8607627c.tar.gz
hdf5-f6b8e380c60f7a759fdfad5b71252a0b8607627c.tar.bz2
[svn-r12466] Add regression test to check that the library handles files with merged
object header messages properly. Too minor to require h5committest
-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 3383093..9e20180 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1342,6 +1342,7 @@
./test/gass_read.c
./test/gass_write.c
./test/gen_deflate.c _DO_NOT_DISTRIBUTE_
+./test/gen_mergemsg.c _DO_NOT_DISTRIBUTE_
./test/gen_old_array.c _DO_NOT_DISTRIBUTE_
./test/gen_old_group.c _DO_NOT_DISTRIBUTE_
./test/gen_old_layout.c _DO_NOT_DISTRIBUTE_
@@ -1360,6 +1361,7 @@
./test/istore.c
./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 1aa663b..d186a2b 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -263,18 +263,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"
/****************************************************************
**
@@ -3836,11 +3838,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 */
@@ -3853,11 +3856,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 */
@@ -3865,7 +3868,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 */
@@ -3873,7 +3876,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 */
@@ -3886,11 +3889,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 */
@@ -3900,11 +3903,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 */
@@ -3926,11 +3929,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 */
@@ -3955,11 +3958,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 */
@@ -3967,11 +3970,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 */
@@ -3985,11 +3988,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 */
@@ -3999,11 +4002,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 */
@@ -4029,15 +4032,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 */
@@ -4047,11 +4050,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 */
@@ -4076,15 +4079,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 */
@@ -4097,11 +4100,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 */
@@ -4111,11 +4114,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 */
@@ -4137,7 +4140,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() */
/****************************************************************
**
@@ -4176,7 +4222,8 @@ test_misc(void)
#endif /* H5_HAVE_FILTER_SZIP */
/* misc. test #23 only in 1.7/main branch */
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() */
@@ -4226,6 +4273,6 @@ cleanup_misc(void)
HDremove(MISC22_FILE);
#endif /* H5_HAVE_FILTER_SZIP */
HDremove(MISC24_FILE);
- HDremove(MISC25_FILE);
+ HDremove(MISC25A_FILE);
}