summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-04-16 15:33:08 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-04-16 15:33:08 (GMT)
commit66fb0ea64e2c26f36da922b75ce1fed1fa79d123 (patch)
tree386e6a19505679a365439a4cf7658bb2c8019fde /test
parentc45423a13de0939385a1cdd2eb969a9c478febc0 (diff)
downloadhdf5-66fb0ea64e2c26f36da922b75ce1fed1fa79d123.zip
hdf5-66fb0ea64e2c26f36da922b75ce1fed1fa79d123.tar.gz
hdf5-66fb0ea64e2c26f36da922b75ce1fed1fa79d123.tar.bz2
[svn-r25050] Description:
Bring r24995 and r24998 from the trunk to the 1.8 branch: r24995: Improve checks for NULL buffer from user during H5Dread/H5Dwrite calls. r24998: Check in Neil's changes for correctly handling case where library is reinitialized through a deprecated routine. Tested on: Mac OSX/64 10.9.2 (amazon) w/serial & paralle (change has baked on trunk for >7 days)
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c11
-rw-r--r--test/tmisc.c110
-rw-r--r--test/tselect.c12
3 files changed, 130 insertions, 3 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 54b88bc..85949bb 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -6690,8 +6690,17 @@ test_zero_dims(hid_t file)
if(H5Pset_chunk(dcpl, 1, &csize) < 0) FAIL_STACK_ERROR
if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- /* Just a no-op */
+ /* Various no-op writes */
if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
+ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
+ if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
+ if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
+
+ /* Various no-op reads */
+ if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
+ if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
+ if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR
+ if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR
if(H5Dclose(d) < 0) FAIL_STACK_ERROR
if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
diff --git a/test/tmisc.c b/test/tmisc.c
index e28b124..d599199 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -316,6 +316,15 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset
/* Definitions for misc. test #30 */
#define MISC30_FILE "tmisc30.h5"
+/* Definitions for misc. test #31 */
+#define MISC31_FILE "tmisc31.h5"
+#define MISC31_DSETNAME "dset"
+#define MISC31_ATTRNAME1 "attr1"
+#define MISC31_ATTRNAME2 "attr2"
+#define MISC31_GROUPNAME "group"
+#define MISC31_PROPNAME "misc31_prop"
+#define MISC31_DTYPENAME "dtype"
+
/****************************************************************
**
** test_misc1(): test unlinking a dataset from a group and immediately
@@ -5239,6 +5248,105 @@ test_misc30(void)
VERIFY(file_size[0], file_size[1], "test_misc30");
} /* end test_misc30() */
+
+/****************************************************************
+**
+** test_misc31(): Test reentering library through deprecated
+* routines that register an id after calling
+* H5close().
+**
+****************************************************************/
+static void
+test_misc31(void)
+{
+ hid_t file_id; /* File id */
+ hid_t space_id; /* Dataspace id */
+ hid_t dset_id; /* Dataset id */
+ hid_t attr_id; /* Attribute id */
+ hid_t group_id; /* Group id */
+ hid_t dtype_id; /* Datatype id */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Deprecated routines initialize after H5close()\n"));
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ file_id = H5Fcreate(MISC31_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fcreate");
+
+ /* Test dataset package */
+ space_id = H5Screate(H5S_SCALAR);
+ CHECK(space_id, FAIL, "H5Screate");
+ dset_id = H5Dcreate1(file_id, MISC31_DSETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate1");
+ ret = H5close();
+ CHECK(ret, FAIL, "H5close");
+ file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fopen");
+ dset_id = H5Dopen1(file_id, MISC31_DSETNAME);
+ CHECK(dset_id, FAIL, "H5Dopen1");
+
+ /* Test attribute package */
+ space_id = H5Screate(H5S_SCALAR);
+ CHECK(space_id, FAIL, "H5Screate");
+ attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME1, H5T_NATIVE_INT, space_id, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Acreate1");
+ ret = H5close();
+ CHECK(ret, FAIL, "H5close");
+ file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fopen");
+ dset_id = H5Dopen1(file_id, MISC31_DSETNAME);
+ CHECK(dset_id, FAIL, "H5Dopen1");
+ space_id = H5Screate(H5S_SCALAR);
+ CHECK(space_id, FAIL, "H5Screate");
+ attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME2, H5T_NATIVE_INT, space_id, H5P_DEFAULT);
+ CHECK(attr_id, FAIL, "H5Acreate1");
+
+ /* Test group package */
+ group_id = H5Gcreate1(file_id, MISC31_GROUPNAME, 0);
+ CHECK(group_id, FAIL, "H5Gcreate1");
+ ret = H5close();
+ CHECK(ret, FAIL, "H5close");
+ file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fopen");
+ group_id = H5Gopen1(file_id, MISC31_GROUPNAME);
+ CHECK(group_id, FAIL, "H5Gopen1");
+
+ /* Test property list package */
+ ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK(ret, FAIL, "H5Pregister1");
+ ret = H5close();
+ CHECK(ret, FAIL, "H5close");
+ ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK(ret, FAIL, "H5Pregister1");
+ ret = H5close();
+ CHECK(ret, FAIL, "H5close");
+
+ /* Test datatype package */
+ file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fopen");
+ dtype_id = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(dtype_id, FAIL, "H5Tcopy");
+ ret = H5Tcommit1(file_id, MISC31_DTYPENAME, dtype_id);
+ CHECK(ret, FAIL, "H5Tcommit1");
+ ret = H5close();
+ CHECK(ret, FAIL, "H5close");
+ file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(file_id, FAIL, "H5Fopen");
+ dtype_id = H5Topen1(file_id, MISC31_DTYPENAME);
+ CHECK(ret, FAIL, "H5Topen1");
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
+ ret = H5Tclose(dtype_id);
+ CHECK(ret, FAIL, "H5Tclose");
+
+#else /* H5_NO_DEPRECATED_SYMBOLS */
+ /* Output message about test being skipped */
+ MESSAGE(5, (" ...Skipped"));
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+} /* end test_misc31() */
+
+
/****************************************************************
**
** test_misc(): Main misc. test routine.
@@ -5284,6 +5392,7 @@ test_misc(void)
test_misc28(); /* Test that chunks are cached appropriately */
test_misc29(); /* Test that speculative metadata reads are handled correctly */
test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */
+ test_misc31(); /* Test Reentering library through deprecated routines after H5close() */
} /* test_misc() */
@@ -5340,5 +5449,6 @@ cleanup_misc(void)
HDremove(MISC28_FILE);
HDremove(MISC29_COPY_FILE);
HDremove(MISC30_FILE);
+ HDremove(MISC31_FILE);
}
diff --git a/test/tselect.c b/test/tselect.c
index eff9325..7dfb6d7 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -292,11 +292,15 @@ test_select_hyper(hid_t xfer_plist)
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,wbuf);
CHECK(ret, FAIL, "H5Dwrite");
- /* Exercise check for NULL buffer and valid selection */
+ /* Exercise checks for NULL buffer and valid selection */
H5E_BEGIN_TRY {
ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dwrite");
+ H5E_BEGIN_TRY {
+ ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Dwrite");
/* Close memory dataspace */
ret = H5Sclose(sid2);
@@ -326,11 +330,15 @@ test_select_hyper(hid_t xfer_plist)
ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf);
CHECK(ret, FAIL, "H5Dread");
- /* Exercise check for NULL buffer and valid selection */
+ /* Exercise checks for NULL buffer and valid selection */
H5E_BEGIN_TRY {
ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Dread");
+ H5E_BEGIN_TRY {
+ ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Dread");
/* Check that the values match with a dataset iterator */
tbuf=wbuf+(15*SPACE2_DIM2);