summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-17 21:29:43 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-17 21:29:43 (GMT)
commit011457075e41d587c47f89250514b3393a78d329 (patch)
treed9b12f2ffc87b12575607102d207a60cd52214b9 /test
parentb59ab36893949af14c403ab46cbdb397f0a24f5b (diff)
downloadhdf5-011457075e41d587c47f89250514b3393a78d329.zip
hdf5-011457075e41d587c47f89250514b3393a78d329.tar.gz
hdf5-011457075e41d587c47f89250514b3393a78d329.tar.bz2
[svn-r353] Changes since 19980414
---------------------- ./html/Compression.html [NEW] ./html/Datasets.html ./html/H5.format.html ./html/H5.user.html Documented compression. A couple of the H5P functions aren't quite implemented yet but they're coming soon... ./src/H5Dprivate.h ./src/H5E.c ./src/H5Epublic.h ./src/H5Farray.c ./src/H5Fistore.c ./src/H5Fprivate.h ./src/H5MF.c ./src/H5MFprivate.h ./src/H5O.c ./src/H5Ocomp.c [NEW] ./src/H5Oprivate.h ./src/H5P.c ./src/H5Ppublic.h ./src/H5Sprivate.h ./src/H5Ssimp.c ./src/H5Z.c [NEW] ./src/H5Zprivate.h [NEW] ./src/H5Zpublic.h [NEW] ./src/Makefile.in ./src/hdf5.h ./test/dsets.c ./test/istore.c Compression is now mostly working. Don't try to open a compressed dataset though because the compression message won't be read. ./html/Datatypes.html ./html/H5.api.html ./src/H5.c ./src/H5private.h ./src/H5D.c ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5Tpublic.h Added timing support. When compiled with H5T_DEBUG defined the library will print conversion bandwidths when the library closes. The H5Tregister functions take a string as the first argument so the statistics output is meaningful. ./MANIFEST Added new files. ./configure.in ./src/H5config.h.in Check for getrusage(). Check for compress2() in libz.a and the zlib.h header file. Added `z' to the debug list. ./src/H5B.c ./src/H5Bprivate.h ./src/H5Gnode.c ./src/debug.c Cleaned up some indentation and added support to print istore B-trees. From the debugger, give the B-tree address and the dimensionality from the layout message of the object header. ./src/h5ls.c The oid is printed as w:x:y:z where w and x are the file ID and y and z are the OID within the file. You can give z or y*2^32+z as an argument to the debugger to print the object header for the object. ./src/H5AC.c Cleaned up statistics and made them match those reported by H5T and H5Z. ./src/H5MM.c ./src/H5MMprivate.h ./src/H5Fistore.c Finally got rid of a couple of long-standing const cast warnings.
Diffstat (limited to 'test')
-rw-r--r--test/.distdep44
-rw-r--r--test/dsets.c145
-rw-r--r--test/istore.c12
3 files changed, 179 insertions, 22 deletions
diff --git a/test/.distdep b/test/.distdep
index cbe325d..e7c7b05 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -3,9 +3,7 @@ testhdf5.o: \
testhdf5.h \
../src/H5private.h \
../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Eprivate.h \
- ../src/H5Epublic.h
+ ../src/H5config.h
tfile.o: \
tfile.c \
testhdf5.h \
@@ -19,7 +17,8 @@ tfile.o: \
../src/H5Bpublic.h \
../src/H5Fprivate.h \
../src/H5Fpublic.h \
- ../src/H5Pprivate.h
+ ../src/H5Pprivate.h \
+ ../src/H5Ppublic.h
theap.o: \
theap.c \
testhdf5.h \
@@ -36,7 +35,8 @@ theap.o: \
../src/H5Fpublic.h \
../src/H5Pprivate.h \
../src/H5Ppublic.h \
- ../src/H5Dpublic.h
+ ../src/H5Dpublic.h \
+ ../src/H5Zpublic.h
tmeta.o: \
tmeta.c \
testhdf5.h \
@@ -44,7 +44,8 @@ tmeta.o: \
../src/H5public.h \
../src/H5config.h \
../src/H5Eprivate.h \
- ../src/H5Epublic.h
+ ../src/H5Epublic.h \
+ ../src/H5Ipublic.h
tohdr.o: \
tohdr.c \
testhdf5.h \
@@ -62,6 +63,7 @@ tohdr.o: \
../src/H5Pprivate.h \
../src/H5Ppublic.h \
../src/H5Dpublic.h \
+ ../src/H5Zpublic.h \
../src/H5Gprivate.h \
../src/H5Gpublic.h \
../src/H5Bprivate.h \
@@ -91,6 +93,7 @@ tstab.o: \
../src/H5Pprivate.h \
../src/H5Ppublic.h \
../src/H5Dpublic.h \
+ ../src/H5Zpublic.h \
../src/H5Gprivate.h \
../src/H5Gpublic.h \
../src/H5Bprivate.h \
@@ -125,7 +128,11 @@ th5s.o: \
../src/H5HGprivate.h \
../src/H5HGpublic.h \
../src/H5Tprivate.h \
- ../src/H5Tpublic.h
+ ../src/H5Tpublic.h \
+ ../src/H5Zprivate.h \
+ ../src/H5Zpublic.h \
+ ../src/H5Pprivate.h \
+ ../src/H5Ppublic.h
dtypes.o: \
dtypes.c \
../src/hdf5.h \
@@ -144,6 +151,7 @@ dtypes.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h \
../src/H5Iprivate.h \
@@ -167,6 +175,7 @@ istore.o: \
../src/H5Ppublic.h \
../src/H5Dpublic.h \
../src/H5Fpublic.h \
+ ../src/H5Zpublic.h \
../src/H5Fprivate.h \
../src/H5Gprivate.h \
../src/H5Gpublic.h \
@@ -180,8 +189,7 @@ istore.o: \
../src/H5HGpublic.h \
../src/H5Tprivate.h \
../src/H5Tpublic.h \
- ../src/H5Sprivate.h \
- ../src/H5Spublic.h
+ ../src/H5Sprivate.h
dsets.o: \
dsets.c \
../src/hdf5.h \
@@ -200,6 +208,7 @@ dsets.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
cmpd_dset.o: \
@@ -220,7 +229,9 @@ cmpd_dset.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
- ../src/H5Spublic.h
+ ../src/H5Zpublic.h \
+ ../src/H5Spublic.h \
+ ../src/H5Tpublic.h
extend.o: \
extend.c \
../src/hdf5.h \
@@ -239,7 +250,7 @@ extend.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
- ../src/H5Spublic.h
+ ../src/H5Zpublic.h
external.o: \
external.c \
../src/hdf5.h \
@@ -258,6 +269,7 @@ external.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
iopipe.o: \
@@ -278,6 +290,7 @@ iopipe.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
gheap.o: \
@@ -295,7 +308,8 @@ gheap.o: \
../src/H5Bprivate.h \
../src/H5Bpublic.h \
../src/H5HGprivate.h \
- ../src/H5HGpublic.h
+ ../src/H5HGpublic.h \
+ ../src/H5Pprivate.h
shtype.o: \
shtype.c \
../src/hdf5.h \
@@ -314,7 +328,7 @@ shtype.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
- ../src/H5Spublic.h
+ ../src/H5Zpublic.h
big.o: \
big.c \
../src/hdf5.h \
@@ -333,8 +347,10 @@ big.o: \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
+ ../src/H5Zpublic.h \
../src/H5Spublic.h \
- ../src/H5Tpublic.h
+ ../src/H5Tpublic.h \
+ ../src/H5private.h
links.o: \
links.c \
../src/hdf5.h \
diff --git a/test/dsets.c b/test/dsets.c
index bf4b75f..fab1f75 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -35,6 +35,7 @@
#define DSET_CHUNKED_NAME "chunked"
#define DSET_SIMPLE_IO_NAME "simple_io"
#define DSET_TCONV_NAME "tconv"
+#define DSET_COMPRESS_NAME "compressed"
/*-------------------------------------------------------------------------
@@ -89,6 +90,7 @@ test_create(hid_t file)
void *client_data = NULL;
printf("%-70s", "Testing create/open/close");
+ fflush (stdout);
/* Create the data space */
dims[0] = 256;
@@ -202,6 +204,7 @@ test_simple_io(hid_t file)
void *tconv_buf = NULL;
printf("%-70s", "Testing simple I/O");
+ fflush (stdout);
/* Initialize the dataset */
for (i = n = 0; i < 100; i++) {
@@ -290,7 +293,8 @@ test_tconv(hid_t file)
assert (in);
printf("%-70s", "Testing data type conversion");
-
+ fflush (stdout);
+
/* Initialize the dataset */
for (i = 0; i < 1000000; i++) {
out[i*4+0] = 0x11;
@@ -346,6 +350,132 @@ test_tconv(hid_t file)
puts(" PASSED");
return 0;
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_compression
+ *
+ * Purpose: Tests dataset compression.
+ *
+ * Return: Success: 0
+ *
+ * Failure: -1
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_compression(hid_t file)
+{
+ hid_t dataset, space, xfer, dc;
+ herr_t status;
+ int points[100][200], check[100][200];
+ int i, j, n;
+ hsize_t dims[2], chunk_size[2];
+ void *tconv_buf = NULL;
+
+ printf("%-70s", "Testing compression");
+ fflush (stdout);
+
+ /* Initialize the dataset */
+ for (i = n = 0; i < 100; i++) {
+ for (j = 0; j < 100; j++) {
+ points[i][j] = n++;
+ }
+ }
+
+ /* Create the data space */
+ dims[0] = 100;
+ dims[1] = 200;
+ space = H5Screate_simple(2, dims, NULL);
+ assert(space>=0);
+
+ /* Create a small conversion buffer to test strip mining */
+ tconv_buf = malloc (1000);
+ xfer = H5Pcreate (H5P_DATASET_XFER);
+ assert (xfer>=0);
+ status = H5Pset_buffer (xfer, 1000, tconv_buf, NULL);
+ assert (status>=0);
+
+ /* Use chunked storage with compression */
+ dc = H5Pcreate (H5P_DATASET_CREATE);
+ chunk_size[0] = 2;
+ chunk_size[1] = 25;
+ H5Pset_chunk (dc, 2, chunk_size);
+ H5Pset_deflate (dc, 6);
+
+ /* Create the dataset */
+ dataset = H5Dcreate(file, DSET_COMPRESS_NAME, H5T_NATIVE_INT, space, dc);
+ assert(dataset >= 0);
+
+ /* Write the data to the dataset */
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ xfer, points);
+ if (status<0) goto error;
+
+ /* Read the dataset back */
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ xfer, check);
+ if (status<0) goto error;
+
+ /* Check that the values read are the same as the values written */
+ for (i = 0; i < 100; i++) {
+ for (j = 0; j < 200; j++) {
+ if (points[i][j] != check[i][j]) {
+ puts("*FAILED*");
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ goto error;
+ }
+ }
+ }
+
+ /*
+ * Write some random data to the dataset, hopefully causing chunks to be
+ * reallocated as they grow.
+ */
+ for (i=0; i<100; i++) {
+ for (j=0; j<100; j++) {
+ points[i][j] = rand ();
+ }
+ }
+ status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ xfer, points);
+ if (status<0) goto error;
+
+
+ /* Read the dataset back and check it */
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ xfer, check);
+ if (status<0) goto error;
+
+ /* Check that the values read are the same as the values written */
+ for (i = 0; i < 100; i++) {
+ for (j = 0; j < 200; j++) {
+ if (points[i][j] != check[i][j]) {
+ puts("*FAILED*");
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ goto error;
+ }
+ }
+ }
+
+
+
+
+ H5Dclose(dataset);
+
+ puts(" PASSED");
+ return 0;
+
+ error:
+ return -1;
+}
/*-------------------------------------------------------------------------
* Function: main
@@ -366,7 +496,7 @@ test_tconv(hid_t file)
int
main(void)
{
- hid_t file;
+ hid_t file, grp;
herr_t status;
int nerrors = 0;
@@ -377,9 +507,15 @@ main(void)
H5Eset_auto (display_error_cb, NULL);
unlink("dataset.h5");
- file = H5Fcreate("dataset.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file = H5Fcreate("dataset.h5", H5F_ACC_TRUNC|H5F_ACC_DEBUG,
+ H5P_DEFAULT, H5P_DEFAULT);
assert(file >= 0);
+ /* Cause the library to emit initial messages */
+ grp = H5Gcreate (file, "emit diagnostics", 0);
+ H5Gclose (grp);
+
+
status = test_create(file);
nerrors += status < 0 ? 1 : 0;
@@ -388,6 +524,9 @@ main(void)
status = test_tconv(file);
nerrors += status < 0 ? 1 : 0;
+
+ status = test_compression(file);
+ nerrors += status < 0 ? 1 : 0;
status = H5Fclose(file);
diff --git a/test/istore.c b/test/istore.c
index fa90b55..9dc4de2 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -316,7 +316,8 @@ test_extend(H5F_t *f, const char *prefix,
memset(buf, (signed)(128+ctr), (size_t)nelmts);
/* Write to disk */
- if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
+ if (H5F_arr_write(f, &layout, NULL, NULL, size, size, zero, offset,
+ buf)<0) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
@@ -326,7 +327,7 @@ test_extend(H5F_t *f, const char *prefix,
}
/* Read from disk */
memset(check, 0xff, (size_t)nelmts);
- if (H5F_arr_read(f, &layout, NULL, size, size, zero, offset,
+ if (H5F_arr_read(f, &layout, NULL, NULL, size, size, zero, offset,
check)<0) {
puts("*FAILED*");
if (!isatty(1)) {
@@ -362,8 +363,8 @@ test_extend(H5F_t *f, const char *prefix,
/* Now read the entire array back out and check it */
memset(buf, 0xff, nx * ny * nz);
- if (H5F_arr_read(f, &layout, NULL, whole_size, whole_size, zero, zero,
- buf)<0) {
+ if (H5F_arr_read(f, &layout, NULL, NULL, whole_size, whole_size, zero,
+ zero, buf)<0) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
@@ -486,7 +487,8 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
memset(buf, (signed)(128+ctr), nx * ny * nz);
/* write to disk */
- if (H5F_arr_write(f, &layout, NULL, size, size, zero, offset, buf)<0) {
+ if (H5F_arr_write(f, &layout, NULL, NULL, size, size, zero, offset,
+ buf)<0) {
puts("*FAILED*");
if (!isatty(1)) {
AT();