summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.distdep23
-rw-r--r--test/dsets.c74
2 files changed, 87 insertions, 10 deletions
diff --git a/test/.distdep b/test/.distdep
index 349d760..991f255 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -41,8 +41,8 @@ tfile.o: \
../src/H5Bpublic.h \
../src/H5Fprivate.h \
../src/H5Fpublic.h \
- ../src/H5Pprivate.h \
- ../src/H5Ppublic.h
+ ../src/H5Dpublic.h \
+ ../src/H5Pprivate.h
theap.o: \
theap.c \
testhdf5.h \
@@ -57,9 +57,9 @@ theap.o: \
../src/H5ACpublic.h \
../src/H5Fprivate.h \
../src/H5Fpublic.h \
+ ../src/H5Dpublic.h \
../src/H5Pprivate.h \
../src/H5Ppublic.h \
- ../src/H5Dpublic.h \
../src/H5Zpublic.h
tmeta.o: \
tmeta.c \
@@ -84,9 +84,9 @@ tohdr.o: \
../src/H5ACpublic.h \
../src/H5Fprivate.h \
../src/H5Fpublic.h \
+ ../src/H5Dpublic.h \
../src/H5Pprivate.h \
../src/H5Ppublic.h \
- ../src/H5Dpublic.h \
../src/H5Zpublic.h \
../src/H5Gprivate.h \
../src/H5Gpublic.h \
@@ -114,9 +114,9 @@ tstab.o: \
../src/H5ACpublic.h \
../src/H5Fprivate.h \
../src/H5Fpublic.h \
+ ../src/H5Dpublic.h \
../src/H5Pprivate.h \
../src/H5Ppublic.h \
- ../src/H5Dpublic.h \
../src/H5Zpublic.h \
../src/H5Gprivate.h \
../src/H5Gpublic.h \
@@ -143,6 +143,7 @@ th5s.o: \
../src/H5Bpublic.h \
../src/H5Fprivate.h \
../src/H5Fpublic.h \
+ ../src/H5Dpublic.h \
../src/H5Sprivate.h \
../src/H5Spublic.h \
../src/H5Gprivate.h \
@@ -155,8 +156,7 @@ th5s.o: \
../src/H5Tpublic.h \
../src/H5Zprivate.h \
../src/H5Zpublic.h \
- ../src/H5Pprivate.h \
- ../src/H5Ppublic.h
+ ../src/H5Pprivate.h
dtypes.o: \
dtypes.c \
../src/hdf5.h \
@@ -328,13 +328,13 @@ gheap.o: \
../src/H5Ipublic.h \
../src/H5Fprivate.h \
../src/H5Fpublic.h \
+ ../src/H5Dpublic.h \
../src/H5Gprivate.h \
../src/H5Gpublic.h \
../src/H5Bprivate.h \
../src/H5Bpublic.h \
../src/H5HGprivate.h \
- ../src/H5HGpublic.h \
- ../src/H5Pprivate.h
+ ../src/H5HGpublic.h
shtype.o: \
shtype.c \
../src/hdf5.h \
@@ -397,7 +397,10 @@ links.o: \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
../src/H5Opublic.h \
- ../src/H5Ppublic.h
+ ../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
chunk.o: \
chunk.c \
../src/hdf5.h \
diff --git a/test/dsets.c b/test/dsets.c
index fac3bdb..576a575 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -670,6 +670,77 @@ test_compression(hid_t file)
error:
return -1;
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_multiopen
+ *
+ * Purpose: Tests that a bug no longer exists. If a dataset is opened
+ * twice and one of the handles is used to extend the dataset,
+ * then the other handle should return the new size when
+ * queried.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, June 9, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_multiopen (hid_t file)
+{
+ hid_t dcpl, space, dset1, dset2;
+ hsize_t cur_size[1] = {10};
+ static hsize_t max_size[1] = {H5S_UNLIMITED};
+ hsize_t tmp_size[1];
+
+ printf ("%-70s", "Testing multi-open with extending");
+
+ /* Create the dataset and open it twice */
+ if ((dcpl=H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
+ if (H5Pset_chunk (dcpl, 1, cur_size)<0) goto error;
+ if ((space=H5Screate_simple (1, cur_size, max_size))<0) goto error;
+ if ((dset1=H5Dcreate (file, "multiopen", H5T_NATIVE_INT, space,
+ dcpl))<0) goto error;
+ if ((dset2=H5Dopen (file, "multiopen"))<0) goto error;
+ if (H5Sclose (space)<0) goto error;
+
+ /* Extend with the first handle */
+ cur_size[0] = 20;
+ if (H5Dextend (dset1, cur_size)<0) goto error;
+
+ /* Get the size from the second handle */
+ if ((space = H5Dget_space (dset2))<0) goto error;
+ if (H5Sget_dims (space, tmp_size)<0) goto error;
+ if (cur_size[0]!=tmp_size[0]) {
+ puts ("*FAILED*");
+ printf (" Got %d instead of %d!\n",
+ (int)tmp_size[0], (int)cur_size[0]);
+ goto error;
+ }
+
+ if (H5Dclose (dset1)<0) goto error;
+ if (H5Dclose (dset2)<0) goto error;
+ if (H5Sclose (space)<0) goto error;
+ if (H5Pclose (dcpl)<0) goto error;
+ puts (" PASSED");
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Dclose (dset1);
+ H5Dclose (dset2);
+ H5Sclose (space);
+ H5Pclose (dcpl);
+ } H5E_END_TRY;
+ return -1;
+}
+
/*-------------------------------------------------------------------------
* Function: cleanup
@@ -744,6 +815,9 @@ main(void)
status = test_compression(file);
nerrors += status < 0 ? 1 : 0;
+ status = test_multiopen (file);
+ nerrors += status < 0 ? 1 : 0;
+
status = H5Fclose(file);
if (nerrors) {