summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/Makefile.in12
-rw-r--r--test/dsets.c1
-rw-r--r--test/extend.c2
-rw-r--r--test/fillval.c14
-rw-r--r--test/h5test.c2
-rw-r--r--test/istore.c3
-rw-r--r--test/tmisc.c163
7 files changed, 170 insertions, 27 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index 97895cd..5ee046b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -37,12 +37,12 @@ PUB_LIB=
## specifying a file prefix or low-level driver. Changing the file
## prefix or low-level driver with environment variables will influence
## the temporary file name in ways that the makefile is not aware of.
-MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \
- tfile3.h5 th5s1.h5 lheap.h5 ohdr.h5 stab1.h5 stab2.h5 \
- extern_1.h5 extern_2.h5 extern_3.h5 extern_1a.raw extern_1b.raw \
- extern_2a.raw extern_2b.raw extern_3a.raw extern_3b.raw \
- extern_4a.raw extern_4b.raw gheap0.h5 gheap1.h5 gheap2.h5 \
- gheap3.h5 gheap4.h5 links.h5 big.data \
+MOSTLYCLEAN=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5 \
+ tfile1.h5 tfile2.h5 tfile3.h5 th5s1.h5 lheap.h5 ohdr.h5 stab1.h5 \
+ stab2.h5 extern_1.h5 extern_2.h5 extern_3.h5 extern_1a.raw \
+ extern_1b.raw extern_2a.raw extern_2b.raw extern_3a.raw \
+ extern_3b.raw extern_4a.raw extern_4b.raw gheap0.h5 gheap1.h5 \
+ gheap2.h5 gheap3.h5 gheap4.h5 links.h5 big.data \
big[0-9][0-9][0-9][0-9][0-9].h5 dtypes1.h5 dtypes2.h5 tattr.h5 \
tselect.h5 mtime.h5 unlink.h5 fillval_[0-9].h5 fillval.raw \
mount_[0-9].h5 testmeta.h5 ttime.h5 trefer[12].h5 tvltypes.h5 \
diff --git a/test/dsets.c b/test/dsets.c
index 73f9392..be52ed2 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -986,6 +986,7 @@ main(void)
#endif
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) {
goto error;
}
diff --git a/test/extend.c b/test/extend.c
index 128985f..6e64bef 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -121,6 +121,8 @@ main (void)
if (buf2[k][m]!=buf1[(i%2)*NX/2+k][(j%2)*NY/2+m]) {
H5_FAILED();
printf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
+ printf(" buf2[%d][%d]=%d\n",k,m,buf2[k][m]);
+ printf(" buf1[%d][%d]=%d\n",(i%2)*NX/2+k,(j%2)*NY/2+m,buf1[(i%2)*NX/2+k][(j%2)*NY/2+m]);
goto error;
}
}
diff --git a/test/fillval.c b/test/fillval.c
index c9925f9..fd63464 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -436,21 +436,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
/* 4. late space allocation and never write fill value */
if ((dset4=H5Dopen(file, "dset4"))<0) goto error;
if (H5Dget_space_status(dset4, &allocation)<0) goto error;
-#ifndef H5_HAVE_PARALLEL
if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) {
H5_FAILED();
puts(" Got allocated space instead of unallocated.");
printf(" Got %d\n", allocation);
goto error;
}
-#else
- if (layout == H5D_CONTIGUOUS && allocation == H5D_SPACE_STATUS_NOT_ALLOCATED) {
- H5_FAILED();
- printf(" %d: Got unallocated space instead of allocated.\n",__LINE__);
- printf(" Got %d\n", allocation);
- goto error;
- }
-#endif
if ((dcpl=H5Dget_create_plist(dset4))<0) goto error;
if(H5Pget_space_time(dcpl, &alloc_time)<0) goto error;
if(H5Pget_fill_time(dcpl, &fill_time)<0) goto error;
@@ -604,7 +595,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
hsize_t one[5] = {1, 1, 1, 1, 1};
hsize_t hs_size[5], hs_stride[5];
hssize_t hs_offset[5], nelmts;
- int fillval, val_rd, should_be;
+ int fillval=(-1), val_rd, should_be;
int i, j, *buf=NULL, odd;
comp_datatype rd_c, fill_c, should_be_c;
comp_datatype *buf_c=NULL;
@@ -617,6 +608,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
fill_c.x=((comp_datatype*)_fillval)->x;
fill_c.y=((comp_datatype*)_fillval)->y;
fill_c.z=((comp_datatype*)_fillval)->z;
+ } else {
+ puts("Invalid type for test");
+ goto error;
}
/* Create dataset */
diff --git a/test/h5test.c b/test/h5test.c
index 195819e..21dbb96 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -247,7 +247,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
const char *suffix = ".h5"; /* suffix has default */
char *ptr, last = '\0';
size_t i, j;
- hid_t driver;
+ hid_t driver=(-1);
if (!base_name || !fullname || size < 1)
return NULL;
diff --git a/test/istore.c b/test/istore.c
index d9bea45..e79754a 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -116,7 +116,8 @@ new_object(H5F_t *f, const char *name, unsigned ndims, H5G_entry_t *ent/*out*/)
layout.dim[u] = 2;
}
}
- H5F_arr_create(f, &layout/*in,out*/);
+ /* Create the root of the B-tree that describes chunked storage */
+ H5F_istore_create (f, &layout/*in,out*/);
if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, &layout) < 0) {
H5_FAILED();
puts(" H5O_modify istore message failure.");
diff --git a/test/tmisc.c b/test/tmisc.c
index 06e103f..1e1e613 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -128,6 +128,9 @@ typedef struct
#define MISC8_DSETNAME5 "Dataset5"
#define MISC8_DSETNAME6 "Dataset6"
#define MISC8_DSETNAME7 "Dataset7"
+#define MISC8_DSETNAME8 "Dataset8"
+#define MISC8_DSETNAME9 "Dataset9"
+#define MISC8_DSETNAME10 "Dataset10"
#define MISC8_RANK 2
#define MISC8_DIM0 100
#define MISC8_DIM1 100
@@ -1162,18 +1165,61 @@ test_misc8(void)
/* Close dataset ID */
ret = H5Dclose(did);
CHECK(ret, FAIL, "H5Dclose");
+
+ /* Set the space allocation time to incremental */
+ ret = H5Pset_space_time(dcpl,H5D_SPACE_ALLOC_INCR);
+ CHECK(ret, FAIL, "H5Pset_space_time");
+
+ /* Create a contiguous dataset, with space allocation late */
+ did = H5Dcreate(fid, MISC8_DSETNAME3, H5T_NATIVE_INT, sid, dcpl);
+ CHECK(did, FAIL, "H5Dcreate");
+
+ /* Check the storage size before data is written */
+ storage_size=H5Dget_storage_size(did);
+ VERIFY(storage_size, 0, "H5Dget_storage_size");
+
+ /* Write data */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Check the storage size after data is written */
+ storage_size=H5Dget_storage_size(did);
+ CHECK(storage_size, 0, "H5Dget_storage_size");
+ VERIFY(storage_size, MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size");
+
+ /* Close dataset ID */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
#endif /* H5_HAVE_PARALLEL */
/* II. compact dataset tests */
ret = H5Pset_layout(dcpl, H5D_COMPACT);
CHECK(ret, FAIL, "H5Pset_layout");
+ /* Set the space allocation time to late */
+ ret = H5Pset_space_time(dcpl,H5D_SPACE_ALLOC_LATE);
+ CHECK(ret, FAIL, "H5Pset_space_time");
+
+ /* Create a contiguous dataset, with space allocation late */
+ /* Should fail */
+ did = H5Dcreate(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, dcpl);
+ VERIFY(did, FAIL, "H5Dcreate");
+
+ /* Set the space allocation time to incremental */
+ ret = H5Pset_space_time(dcpl,H5D_SPACE_ALLOC_INCR);
+ CHECK(ret, FAIL, "H5Pset_space_time");
+
+ /* Create a contiguous dataset, with space allocation incremental */
+ /* Should fail */
+ did = H5Dcreate(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, dcpl);
+ VERIFY(did, FAIL, "H5Dcreate");
+
/* Set the space allocation time to early */
ret = H5Pset_space_time(dcpl,H5D_SPACE_ALLOC_EARLY);
CHECK(ret, FAIL, "H5Pset_space_time");
/* Create a contiguous dataset, with space allocation early */
- did = H5Dcreate(fid, MISC8_DSETNAME7, H5T_NATIVE_INT, sid, dcpl);
+ did = H5Dcreate(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, dcpl);
CHECK(did, FAIL, "H5Dcreate");
/* Check the storage size */
@@ -1200,7 +1246,7 @@ test_misc8(void)
CHECK(ret, FAIL, "H5Pset_chunk");
/* Create a chunked dataset, with space allocation early */
- did = H5Dcreate(fid, MISC8_DSETNAME3, H5T_NATIVE_INT, sid, dcpl);
+ did = H5Dcreate(fid, MISC8_DSETNAME5, H5T_NATIVE_INT, sid, dcpl);
CHECK(did, FAIL, "H5Dcreate");
/* Check the storage size after data is written */
@@ -1217,8 +1263,37 @@ test_misc8(void)
ret = H5Pset_space_time(dcpl,H5D_SPACE_ALLOC_LATE);
CHECK(ret, FAIL, "H5Pset_space_time");
+ /* Use chunked storage for this dataset */
+ ret = H5Pset_chunk(dcpl,rank,chunk_dims);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+
/* Create a chunked dataset, with space allocation late */
- did = H5Dcreate(fid, MISC8_DSETNAME4, H5T_NATIVE_INT, sid, dcpl);
+ did = H5Dcreate(fid, MISC8_DSETNAME6, H5T_NATIVE_INT, sid, dcpl);
+ CHECK(did, FAIL, "H5Dcreate");
+
+ /* Check the storage size after dataset is created */
+ storage_size=H5Dget_storage_size(did);
+ VERIFY(storage_size, 0, "H5Dget_storage_size");
+
+ /* Write part of the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Check the storage size after data is written */
+ storage_size=H5Dget_storage_size(did);
+ CHECK(storage_size, 0, "H5Dget_storage_size");
+ VERIFY(storage_size, MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size");
+
+ /* Close dataset ID */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Set the space allocation time to incremental */
+ ret = H5Pset_space_time(dcpl,H5D_SPACE_ALLOC_INCR);
+ CHECK(ret, FAIL, "H5Pset_space_time");
+
+ /* Create a chunked dataset, with space allocation incremental */
+ did = H5Dcreate(fid, MISC8_DSETNAME7, H5T_NATIVE_INT, sid, dcpl);
CHECK(did, FAIL, "H5Dcreate");
/* Check the storage size before data is written */
@@ -1274,7 +1349,7 @@ test_misc8(void)
#endif /* end H5_HAVE_COMPRESSION */
/* Create a chunked dataset, with space allocation early */
- did = H5Dcreate(fid, MISC8_DSETNAME5, H5T_NATIVE_INT, sid, dcpl);
+ did = H5Dcreate(fid, MISC8_DSETNAME8, H5T_NATIVE_INT, sid, dcpl);
CHECK(did, FAIL, "H5Dcreate");
/* Write part of the dataset */
@@ -1289,12 +1364,12 @@ test_misc8(void)
num_errs++;
printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
-#else
+#else /* Compression is not configured */
if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
- num_errs++;
- printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ num_errs++;
+ printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
}
-#endif /* end H5_HAVE_COMPRESSION */
+#endif /* H5_HAVE_COMPRESSION */
/* Close dataset ID */
ret = H5Dclose(did);
@@ -1306,7 +1381,77 @@ test_misc8(void)
CHECK(ret, FAIL, "H5Pset_space_time");
/* Create a chunked dataset, with space allocation late */
- did = H5Dcreate(fid, MISC8_DSETNAME6, H5T_NATIVE_INT, sid, dcpl);
+ did = H5Dcreate(fid, MISC8_DSETNAME9, H5T_NATIVE_INT, sid, dcpl);
+ CHECK(did, FAIL, "H5Dcreate");
+
+ /* Check the storage size before data is written */
+ storage_size=H5Dget_storage_size(did);
+ VERIFY(storage_size, 0, "H5Dget_storage_size");
+
+ /* Write part of the dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, wdata);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Check the storage size after only four chunks are written */
+ storage_size=H5Dget_storage_size(did);
+ CHECK(storage_size, 0, "H5Dget_storage_size");
+#ifdef H5_HAVE_COMPRESSION
+ if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
+ num_errs++;
+ printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ }
+#else /* Compression is not configured */
+ if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
+ num_errs++;
+ printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ }
+#endif /* H5_HAVE_COMPRESSION */
+
+ /* Write entire dataset */
+ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+#ifdef VERIFY_DATA
+ /* Read data */
+ ret = H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Check values written */
+ tdata=wdata;
+ tdata2=rdata;
+ for(u=0; u<MISC8_DIM0; u++)
+ for(v=0; v<MISC8_DIM1; v++,tdata++,tdata2++)
+ if(*tdata!=*tdata2) {
+ num_errs++;
+ printf("Error on line %d: u=%u, v=%d, *tdata=%d, *tdata2=%d\n",__LINE__,(unsigned)u,(unsigned)v,(int)*tdata,(int)*tdata2);
+ }
+#endif /* VERIFY_DATA */
+
+ /* Check the storage size after data is written */
+ storage_size=H5Dget_storage_size(did);
+ CHECK(storage_size, 0, "H5Dget_storage_size");
+#ifdef H5_HAVE_COMPRESSION
+ if(storage_size>=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
+ num_errs++;
+ printf("Error on line %d: data wasn't compressed! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ }
+#else
+ if(storage_size!=(MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT))) {
+ num_errs++;
+ printf("Error on line %d: wrong storage size! storage_size=%u\n",__LINE__,(unsigned)storage_size);
+ }
+#endif /*H5_HAVE_COMPRESSION*/
+
+ /* Close dataset ID */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Set the space allocation time to incremental */
+ ret = H5Pset_space_time(dcpl,H5D_SPACE_ALLOC_INCR);
+ CHECK(ret, FAIL, "H5Pset_space_time");
+
+ /* Create a chunked dataset, with space allocation incremental */
+ did = H5Dcreate(fid, MISC8_DSETNAME10, H5T_NATIVE_INT, sid, dcpl);
CHECK(did, FAIL, "H5Dcreate");
/* Check the storage size before data is written */