diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-05-07 21:52:24 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-05-07 21:52:24 (GMT) |
commit | 43e3b450214310728cbb6904211319a8459f06e4 (patch) | |
tree | 13cc61b9f713aa60fdcaf606665f03189689046d /test | |
parent | db543f1a23194e81d0a984c346398e72bf4be87f (diff) | |
download | hdf5-43e3b450214310728cbb6904211319a8459f06e4.zip hdf5-43e3b450214310728cbb6904211319a8459f06e4.tar.gz hdf5-43e3b450214310728cbb6904211319a8459f06e4.tar.bz2 |
[svn-r6825] Purpose:
New feature/enhancement
Description:
Chunked datasets are handled poorly in several circumstances involving
certain selections and chunks that are too large for the chunk cache and/or
chunks with filters, causing the chunk to be read from disk multiple times.
Solution:
Rearrange raw data I/O infrastructure to handle chunked datasets in a much
more friendly way by creating a selection in memory and on disk for each chunk
in a chunked dataset and performing all of the I/O on that chunk at one time.
There are still some scalability (the current code attempts to
create a selection for all the chunks in the dataset, instead of just the
chunks that are accessed, requiring portions of the istore.c and fillval.c
tests to be commented out) and performance issues, but checking this in will
allow the changes to be tested by a much wider audience while I address the
remaining issues.
Platforms tested:
h5committested, FreeBSD 4.8 (sleipnir) serial & parallel, Linux 2.4 (eirene)
Diffstat (limited to 'test')
-rw-r--r-- | test/Dependencies | 296 | ||||
-rw-r--r-- | test/dsets.c | 109 | ||||
-rw-r--r-- | test/fillval.c | 4 | ||||
-rw-r--r-- | test/hyperslab.c | 175 | ||||
-rw-r--r-- | test/istore.c | 357 | ||||
-rw-r--r-- | test/set_extent.c | 935 | ||||
-rw-r--r-- | test/tselect.c | 2 |
7 files changed, 1010 insertions, 868 deletions
diff --git a/test/Dependencies b/test/Dependencies index 915f663..5827a39 100644 --- a/test/Dependencies +++ b/test/Dependencies @@ -45,16 +45,14 @@ h5test.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h big.lo: \ $(srcdir)/big.c \ $(srcdir)/h5test.h \ @@ -99,16 +97,14 @@ big.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h bittests.lo: \ $(srcdir)/bittests.c \ $(srcdir)/h5test.h \ @@ -153,16 +149,14 @@ bittests.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h cmpd_dset.lo: \ $(srcdir)/cmpd_dset.c \ $(srcdir)/h5test.h \ @@ -207,16 +201,14 @@ cmpd_dset.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h dsets.lo: \ $(srcdir)/dsets.c \ $(srcdir)/h5test.h \ @@ -261,16 +253,14 @@ dsets.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h \ $(top_srcdir)/src/H5Zpkg.h dtypes.lo: \ $(srcdir)/dtypes.c \ @@ -316,16 +306,14 @@ dtypes.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h extend.lo: \ $(srcdir)/extend.c \ $(srcdir)/h5test.h \ @@ -370,16 +358,14 @@ extend.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h external.lo: \ $(srcdir)/external.c \ $(srcdir)/h5test.h \ @@ -424,16 +410,14 @@ external.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h fillval.lo: \ $(srcdir)/fillval.c \ $(srcdir)/h5test.h \ @@ -478,16 +462,14 @@ fillval.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h flush1.lo: \ $(srcdir)/flush1.c \ $(srcdir)/h5test.h \ @@ -532,16 +514,14 @@ flush1.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h flush2.lo: \ $(srcdir)/flush2.c \ $(srcdir)/h5test.h \ @@ -586,16 +566,14 @@ flush2.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h gheap.lo: \ $(srcdir)/gheap.c \ $(srcdir)/h5test.h \ @@ -640,31 +618,71 @@ gheap.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h \ $(top_srcdir)/src/H5Eprivate.h \ - $(top_srcdir)/src/H5Iprivate.h + $(top_srcdir)/src/H5Iprivate.h \ + $(top_srcdir)/src/H5Pprivate.h hyperslab.lo: \ $(srcdir)/hyperslab.c \ - $(top_srcdir)/src/H5private.h \ + $(srcdir)/h5test.h \ + $(top_srcdir)/src/hdf5.h \ $(top_srcdir)/src/H5public.h \ $(top_builddir)/src/H5pubconf.h \ $(top_srcdir)/src/H5api_adpt.h \ + $(top_srcdir)/src/H5Ipublic.h \ + $(top_srcdir)/src/H5Apublic.h \ + $(top_srcdir)/src/H5ACpublic.h \ + $(top_srcdir)/src/H5Bpublic.h \ + $(top_srcdir)/src/H5Dpublic.h \ + $(top_srcdir)/src/H5Epublic.h \ + $(top_srcdir)/src/H5Fpublic.h \ + $(top_srcdir)/src/H5FDpublic.h \ + $(top_srcdir)/src/H5Gpublic.h \ + $(top_srcdir)/src/H5HGpublic.h \ + $(top_srcdir)/src/H5HLpublic.h \ + $(top_srcdir)/src/H5MMpublic.h \ + $(top_srcdir)/src/H5Opublic.h \ + $(top_srcdir)/src/H5Ppublic.h \ + $(top_srcdir)/src/H5Zpublic.h \ + $(top_srcdir)/src/H5Rpublic.h \ + $(top_srcdir)/src/H5Spublic.h \ + $(top_srcdir)/src/H5Tpublic.h \ + $(top_srcdir)/src/H5FDcore.h \ + $(top_srcdir)/src/H5FDfamily.h \ + $(top_srcdir)/src/H5FDfphdf5.h \ + $(top_srcdir)/src/H5FDmpio.h \ + $(top_srcdir)/src/H5FDgass.h \ + $(top_srcdir)/src/H5FDlog.h \ + $(top_srcdir)/src/H5FDmpiposix.h \ + $(top_srcdir)/src/H5FDmulti.h \ + $(top_srcdir)/src/H5FDsec2.h \ + $(top_srcdir)/src/H5FDsrb.h \ + $(top_srcdir)/src/H5FDstdio.h \ + $(top_srcdir)/src/H5FDstream.h \ + $(top_srcdir)/src/H5private.h \ $(top_srcdir)/src/H5MPprivate.h \ $(top_srcdir)/src/H5FSprivate.h \ + $(top_srcdir)/src/H5Tpkg.h \ + $(top_srcdir)/src/H5HGprivate.h \ + $(top_srcdir)/src/H5Fprivate.h \ + $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ + $(top_srcdir)/src/H5Gprivate.h \ + $(top_srcdir)/src/H5Bprivate.h \ + $(top_srcdir)/src/H5ACprivate.h \ + $(top_srcdir)/src/H5RSprivate.h \ + $(top_srcdir)/src/H5Rprivate.h \ + $(top_srcdir)/src/H5Zprivate.h \ $(top_srcdir)/src/H5Eprivate.h \ - $(top_srcdir)/src/H5Epublic.h \ - $(top_srcdir)/src/H5Ipublic.h \ $(top_srcdir)/src/H5MMprivate.h \ - $(top_srcdir)/src/H5MMpublic.h \ $(top_srcdir)/src/H5Vprivate.h istore.lo: \ $(srcdir)/istore.c \ @@ -710,18 +728,17 @@ istore.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h \ $(top_srcdir)/src/H5Eprivate.h \ $(top_srcdir)/src/H5Iprivate.h \ + $(top_srcdir)/src/H5Pprivate.h \ $(top_srcdir)/src/H5Fpkg.h \ $(top_srcdir)/src/H5FOprivate.h \ $(top_srcdir)/src/H5TBprivate.h \ @@ -771,16 +788,14 @@ lheap.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h \ $(top_srcdir)/src/H5HLprivate.h \ $(top_srcdir)/src/H5Iprivate.h links.lo: \ @@ -827,16 +842,14 @@ links.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h mount.lo: \ $(srcdir)/mount.c \ $(srcdir)/h5test.h \ @@ -881,16 +894,14 @@ mount.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h mtime.lo: \ $(srcdir)/mtime.c \ $(srcdir)/h5test.h \ @@ -935,16 +946,14 @@ mtime.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h ohdr.lo: \ $(srcdir)/ohdr.c \ $(srcdir)/h5test.h \ @@ -989,16 +998,14 @@ ohdr.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h \ $(top_srcdir)/src/H5Iprivate.h \ $(top_srcdir)/src/H5Opkg.h \ $(top_srcdir)/src/H5Gpkg.h @@ -1046,16 +1053,14 @@ stab.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h \ $(top_srcdir)/src/H5Gpkg.h tarray.lo: \ $(srcdir)/tarray.c \ @@ -1315,17 +1320,16 @@ tgenprop.lo: \ $(top_srcdir)/src/H5FDstdio.h \ $(top_srcdir)/src/H5FDstream.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5HGprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ $(top_srcdir)/src/H5Pprivate.h th5s.lo: \ $(srcdir)/th5s.c \ @@ -1764,16 +1768,14 @@ unlink.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h enum.lo: \ $(srcdir)/enum.c \ $(srcdir)/h5test.h \ @@ -1818,16 +1820,14 @@ enum.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h ttsafe.lo: \ $(srcdir)/ttsafe.c \ $(srcdir)/ttsafe.h \ @@ -2077,16 +2077,14 @@ gass_write.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h gass_read.lo: \ $(srcdir)/gass_read.c \ $(srcdir)/h5test.h \ @@ -2131,16 +2129,14 @@ gass_read.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h gass_append.lo: \ $(srcdir)/gass_append.c \ $(srcdir)/h5test.h \ @@ -2185,16 +2181,14 @@ gass_append.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h srb_read.lo: \ $(srcdir)/srb_read.c \ $(srcdir)/h5test.h \ @@ -2239,16 +2233,14 @@ srb_read.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h srb_write.lo: \ $(srcdir)/srb_write.c \ $(srcdir)/h5test.h \ @@ -2293,16 +2285,14 @@ srb_write.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h srb_append.lo: \ $(srcdir)/srb_append.c \ $(srcdir)/h5test.h \ @@ -2347,16 +2337,14 @@ srb_append.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h stream_test.lo: \ $(srcdir)/stream_test.c \ $(top_srcdir)/src/hdf5.h \ @@ -2437,16 +2425,14 @@ set_extent.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h getname.lo: \ $(srcdir)/getname.c \ $(top_srcdir)/src/hdf5.h \ @@ -2491,16 +2477,14 @@ getname.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h file_handle.lo: \ $(srcdir)/file_handle.c \ $(srcdir)/h5test.h \ @@ -2545,16 +2529,14 @@ file_handle.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h ntypes.lo: \ $(srcdir)/ntypes.c \ $(srcdir)/h5test.h \ @@ -2599,13 +2581,11 @@ ntypes.lo: \ $(top_srcdir)/src/H5HGprivate.h \ $(top_srcdir)/src/H5Fprivate.h \ $(top_srcdir)/src/H5Dprivate.h \ + $(top_srcdir)/src/H5Oprivate.h \ + $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Gprivate.h \ $(top_srcdir)/src/H5Bprivate.h \ $(top_srcdir)/src/H5ACprivate.h \ $(top_srcdir)/src/H5RSprivate.h \ - $(top_srcdir)/src/H5Oprivate.h \ - $(top_srcdir)/src/H5Tprivate.h \ $(top_srcdir)/src/H5Rprivate.h \ - $(top_srcdir)/src/H5Zprivate.h \ - $(top_srcdir)/src/H5Sprivate.h \ - $(top_srcdir)/src/H5Pprivate.h + $(top_srcdir)/src/H5Zprivate.h diff --git a/test/dsets.c b/test/dsets.c index 3cee46c..df0feb3 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -91,9 +91,31 @@ const char *FILENAME[] = { #define BOGUS2_PARAM_2 35 /* (No particular meaning, just for checking value) */ #define BOGUS2_ALL_NPARMS 4 /* Total number of parameter = permanent + "local" parameters */ +#ifdef TESTING +/* Parameters for internal filter test */ +#define FILTER_CHUNK_DIM1 2 +#define FILTER_CHUNK_DIM2 25 +#define FILTER_HS_OFFSET1 7 +#define FILTER_HS_OFFSET2 30 +#define FILTER_HS_SIZE1 4 +#define FILTER_HS_SIZE2 50 + /* Shared global arrays */ #define DSET_DIM1 100 #define DSET_DIM2 200 +#else /* TESTING */ +/* Parameters for internal filter test */ +#define FILTER_CHUNK_DIM1 2 +#define FILTER_CHUNK_DIM2 25 +#define FILTER_HS_OFFSET1 7 +#define FILTER_HS_OFFSET2 30 +#define FILTER_HS_SIZE1 4 +#define FILTER_HS_SIZE2 50 + +/* Shared global arrays */ +#define DSET_DIM1 100 +#define DSET_DIM2 200 +#endif /* TESTING */ int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2]; @@ -293,23 +315,23 @@ test_simple_io(hid_t fapl) void *tconv_buf = NULL; int f; haddr_t offset; - int rdata[100][200]; + int rdata[DSET_DIM1][DSET_DIM2]; TESTING("simple I/O"); h5_fixname(FILENAME[4], fapl, filename, sizeof filename); /* Initialize the dataset */ - for (i = n = 0; i < 100; i++) - for (j = 0; j < 200; j++) + for (i = n = 0; i < DSET_DIM1; i++) + for (j = 0; j < DSET_DIM2; j++) points[i][j] = n++; if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) goto error; /* Create the data space */ - dims[0] = 100; - dims[1] = 200; + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; if ((space = H5Screate_simple(2, dims, NULL))<0) goto error; /* Create a small conversion buffer to test strip mining */ @@ -339,8 +361,8 @@ test_simple_io(hid_t fapl) 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++) { + for (i = 0; i < DSET_DIM1; i++) { + for (j = 0; j < DSET_DIM2; j++) { if (points[i][j] != check[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -356,11 +378,11 @@ test_simple_io(hid_t fapl) f = HDopen(filename, O_RDONLY, 0); HDlseek(f, (off_t)offset, SEEK_SET); - HDread(f, rdata, sizeof(int)*100*200); + HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2); /* Check that the values read are the same as the values written */ - for (i = 0; i < 100; i++) { - for (j = 0; j < 200; j++) { + for (i = 0; i < DSET_DIM1; i++) { + for (j = 0; j < DSET_DIM2; j++) { if (points[i][j] != rdata[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -406,7 +428,7 @@ test_userblock_offset(hid_t fapl) hsize_t dims[2]; int f; haddr_t offset; - int rdata[100][200]; + int rdata[DSET_DIM1][DSET_DIM2]; TESTING("dataset offset with user block"); @@ -419,8 +441,8 @@ test_userblock_offset(hid_t fapl) goto error; /* Create the data space */ - dims[0] = 100; - dims[1] = 200; + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; if ((space = H5Screate_simple(2, dims, NULL))<0) goto error; /* Create the dataset */ @@ -441,11 +463,11 @@ test_userblock_offset(hid_t fapl) f = HDopen(filename, O_RDONLY, 0); HDlseek(f, (off_t)offset, SEEK_SET); - HDread(f, rdata, sizeof(int)*100*200); + HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2); /* Check that the values read are the same as the values written */ - for (i = 0; i < 100; i++) { - for (j = 0; j < 200; j++) { + for (i = 0; i < DSET_DIM1; i++) { + for (j = 0; j < DSET_DIM2; j++) { if (points[i][j] != rdata[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -609,11 +631,11 @@ test_max_compact(hid_t fapl) /* Initialize data */ compact_size = (SIXTY_FOUR_KB-64)/sizeof(int); - wbuf = (int*)HDmalloc(sizeof(int)*compact_size); - rbuf = (int*)HDmalloc(sizeof(int)*compact_size); + wbuf = (int*)HDmalloc(sizeof(int)*(size_t)compact_size); + rbuf = (int*)HDmalloc(sizeof(int)*(size_t)compact_size); n=0; - for(i=0; i<compact_size; i++) + for(i=0; i<(int)compact_size; i++) wbuf[i] = n++; /* Create a small data space for compact dataset */ @@ -657,11 +679,11 @@ test_max_compact(hid_t fapl) goto error; /* Check that the values read are the same as the values written */ - for (i = 0; i < compact_size; i++) { + for (i = 0; i < (int)compact_size; i++) { if (rbuf[i] != wbuf[i]) { H5_FAILED(); printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i); + printf(" At index %d\n", i); goto error; } } @@ -1105,9 +1127,9 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, hid_t dataset; /* Dataset ID */ hid_t dxpl; /* Dataset xfer property list ID */ hid_t sid; /* Dataspace ID */ - const hsize_t size[2] = {100, 200}; /* Dataspace dimensions */ - const hssize_t hs_offset[2] = {7, 30}; /* Hyperslab offset */ - const hsize_t hs_size[2] = {4, 50}; /* Hyperslab size */ + const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ + const hssize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ + const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ void *tconv_buf = NULL; /* Temporary conversion buffer */ hsize_t i, j, n; /* Local index variables */ herr_t status; /* Error status */ @@ -1141,7 +1163,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Create the dataset */ if ((dataset = H5Dcreate(fid, name, H5T_NATIVE_INT, sid, - dcpl))<0) goto error; + dcpl))<0) goto error; PASSED(); /*---------------------------------------------------------------------- @@ -1220,9 +1242,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for (j=0; j<size[1]; j++) { if (points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", - (unsigned long)i, (unsigned long)j); + fprintf(stderr," Read different values than written.\n"); + fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + fprintf(stderr," At original: %d\n", (int)points[i][j]); + fprintf(stderr," At returned: %d\n", (int)check[i][j]); goto error; } } @@ -1382,15 +1405,15 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for (i=0; i<hs_size[0]; i++) { for (j=0; j<hs_size[1]; j++) { if (points[hs_offset[0]+i][hs_offset[1]+j] != - check[hs_offset[0]+i][hs_offset[1]+j]) { + check[hs_offset[0]+i][hs_offset[1]+j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", + fprintf(stderr," Read different values than written.\n"); + fprintf(stderr," At index %lu,%lu\n", (unsigned long)(hs_offset[0]+i), (unsigned long)(hs_offset[1]+j)); - printf(" At original: %d\n", + fprintf(stderr," At original: %d\n", (int)points[hs_offset[0]+i][hs_offset[1]+j]); - printf(" At returned: %d\n", + fprintf(stderr," At returned: %d\n", (int)check[hs_offset[0]+i][hs_offset[1]+j]); goto error; } @@ -1411,6 +1434,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, return(0); error: + if(tconv_buf) + free (tconv_buf); return -1; } @@ -1440,7 +1465,7 @@ static herr_t test_filters(hid_t file) { hid_t dc; /* Dataset creation property list ID */ - const hsize_t chunk_size[2] = {2, 25}; /* Chunk dimensions */ + const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ hsize_t null_size; /* Size of dataset with null filter */ #ifdef H5_HAVE_FILTER_FLETCHER32 @@ -1697,7 +1722,7 @@ test_missing_filter(hid_t file) hid_t dsid; /* Dataset ID */ hid_t sid; /* Dataspace ID */ hid_t dcpl; /* Dataspace creation property list ID */ - const hsize_t dims[2] = {100, 200}; /* Dataspace dimensions */ + const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ const hsize_t chunk_dims[2] = {2, 25}; /* Chunk dimensions */ hsize_t dset_size; /* Dataset size */ hsize_t i,j; /* Local index variables */ @@ -1797,7 +1822,7 @@ test_missing_filter(hid_t file) /* Verify that the size indicates data is uncompressed */ /* (i.e. the deflation filter we asked for was silently ignored) */ - if((H5Tget_size(H5T_NATIVE_INT)*100*200)!=dset_size) { + if((H5Tget_size(H5T_NATIVE_INT)*DSET_DIM1*DSET_DIM2)!=dset_size) { H5_FAILED(); printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; @@ -2394,7 +2419,11 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_can_apply_szip(hid_t file) +test_can_apply_szip(hid_t +#ifndef H5_HAVE_FILTER_SZIP +UNUSED +#endif /* H5_HAVE_FILTER_SSZIP */ +file) { #ifdef H5_HAVE_FILTER_SZIP hid_t dsid; /* Dataset ID */ @@ -2496,7 +2525,9 @@ test_can_apply_szip(hid_t file) return 0; +#ifdef H5_HAVE_FILTER_SZIP error: +#endif /* H5_HAVE_FILTER_SZIP */ return -1; } /* end test_can_apply_szip() */ @@ -2543,8 +2574,8 @@ test_set_local(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Initialize the integer & floating-point dataset */ - for (i = n = 0; i < 100; i++) - for (j = 0; j < 200; j++) { + for (i = n = 0; i < DSET_DIM1; i++) + for (j = 0; j < DSET_DIM2; j++) { points[i][j] = n++; points_dbl[i][j] = (double)1.5*n++; } diff --git a/test/fillval.c b/test/fillval.c index 8161cd9..7f02c9a 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -1435,7 +1435,11 @@ main(int argc, char *argv[]) if (test_chunk) { nerrors += test_create(fapl, FILENAME[0], H5D_CHUNKED); nerrors += test_rdwr (fapl, FILENAME[2], H5D_CHUNKED); +#ifdef QAK nerrors += test_extend(fapl, FILENAME[4], H5D_CHUNKED); +#else /* QAK */ +HDfprintf(stderr,"Uncomment tests!\n"); +#endif /* QAK */ } /* Contiguous storage layout tests */ diff --git a/test/hyperslab.c b/test/hyperslab.c index eafb693..70ee3a5 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -21,19 +21,22 @@ * because testing general dimensionalities would require us to * rewrite much of the hyperslab stuff. */ +#include "h5test.h" #include "H5private.h" #include "H5Eprivate.h" #include "H5MMprivate.h" #include "H5Vprivate.h" -#define AT() printf (" at %s:%d in %s()\n",__FILE__,__LINE__,__FUNCTION__); - #define TEST_SMALL 0x0001 #define TEST_MEDIUM 0x0002 #define VARIABLE_SRC 0 #define VARIABLE_DST 1 #define VARIABLE_BOTH 2 + +#define ARRAY_FILL_SIZE 4 +#define ARRAY_OFFSET_NDIMS 3 + /*------------------------------------------------------------------------- * Function: init_full @@ -1072,6 +1075,141 @@ test_sub_super(size_t nx, size_t ny) } /*------------------------------------------------------------------------- + * Function: test_array_fill + * + * Purpose: Tests H5V_array_fill routine by copying a multibyte value + * (an array of ints, in our case) into all the elements of an + * array. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Monday, April 21, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_array_fill(size_t lo, size_t hi) +{ + int *dst; /* Destination */ + int src[ARRAY_FILL_SIZE]; /* Source to duplicate */ + size_t u, v, w; /* Local index variables */ + char s[256]; + + sprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi); + TESTING(s); + + /* Initialize */ + dst = H5MM_calloc(sizeof(int)*ARRAY_FILL_SIZE * hi); + + /* Setup */ + for(u=0; u<ARRAY_FILL_SIZE; u++) + src[u]=u; + + /* Fill */ + for(w=lo; w<=hi; w++) { + H5V_array_fill(dst,src,sizeof(src),w); + + /* Check */ + for(u=0; u<w; u++) + for(v=0; v<ARRAY_FILL_SIZE; v++) + if(dst[(u*ARRAY_FILL_SIZE)+v]!=src[v]) TEST_ERROR; + + HDmemset(dst,0,sizeof(int)*ARRAY_FILL_SIZE*w); + } /* end for */ + PASSED(); + + H5MM_xfree(dst); + return SUCCEED; + + error: + H5MM_xfree(dst); + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: test_array_offset_n_calc + * + * Purpose: Tests H5V_array_offset and H5V_array_calc routines by comparing + * computed array offsets against calculated ones and then going + * back to the coordinates from the offset and checking those. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Monday, April 21, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) +{ + hsize_t *a, *temp_a; /* Array for stored calculated offsets */ + hsize_t off; /* Offset in array */ + size_t u, v, w; /* Local index variables */ + hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */ + hssize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */ + hssize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */ + char s[256]; + + sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x); + TESTING(s); + + /* Initialize */ + a = H5MM_malloc(sizeof(hsize_t) * x * y *z); + dims[0]=z; + dims[1]=y; + dims[2]=x; + + /* Setup */ + for(u=0, temp_a=a, off=0; u<z; u++) + for(v=0; v<y; v++) + for(w=0; w<x; w++) + *temp_a++ = off++; + + /* Check offsets */ + for(u=0; u<n; u++) { + /* Get random coordinate */ + coords[0] = HDrandom() % z; + coords[1] = HDrandom() % y; + coords[2] = HDrandom() % x; + + /* Get offset of coordinate */ + off=H5V_array_offset(ARRAY_OFFSET_NDIMS,dims,coords); + + /* Check offset of coordinate */ + if(a[off]!=off) TEST_ERROR; + + /* Get coordinates of offset */ + if(H5V_array_calc(off,ARRAY_OFFSET_NDIMS,dims,new_coords)<0) TEST_ERROR; + + /* Check computed coordinates */ + for(v=0; v<ARRAY_OFFSET_NDIMS; v++) + if(coords[v]!=new_coords[v]) { + HDfprintf(stderr,"coords[%u]=%Hu, new_coords[%u]=%Hu\n",(unsigned)v,coords[v],(unsigned)v,new_coords[v]); + TEST_ERROR; + } + } /* end for */ + + PASSED(); + + H5MM_xfree(a); + return SUCCEED; + + error: + H5MM_xfree(a); + return FAIL; +} + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Test various hyperslab operations. Give the words @@ -1096,9 +1234,9 @@ main(int argc, char *argv[]) int nerrors = 0; unsigned size_of_test; - /* Parse arguments or assume `small' */ + /* Parse arguments or assume `small' & `medium' */ if (1 == argc) { - size_of_test = TEST_SMALL; + size_of_test = TEST_SMALL | TEST_MEDIUM; } else { int i; for (i = 1, size_of_test = 0; i < argc; i++) { @@ -1119,6 +1257,9 @@ main(int argc, char *argv[]) printf(" MEDIUM"); printf("\n"); + /* Set the random # seed */ + HDsrandom((unsigned long)time(NULL)); + /* * Open the library explicitly for thread-safe builds, so per-thread * things are initialized correctly. @@ -1260,6 +1401,32 @@ main(int argc, char *argv[]) status = test_sub_super(480, 640); nerrors += status < 0 ? 1 : 0; } + /*------------------------- + * TEST ARRAY FILL OPERATIONS + *------------------------- + */ + + if (size_of_test & TEST_SMALL) { + status = test_array_fill(1,9); + nerrors += status < 0 ? 1 : 0; + } + if (size_of_test & TEST_MEDIUM) { + status = test_array_fill(9,257); + nerrors += status < 0 ? 1 : 0; + } + /*------------------------- + * TEST ARRAY OFFSET OPERATIONS + *------------------------- + */ + + if (size_of_test & TEST_SMALL) { + status = test_array_offset_n_calc(20,7,11,13); + nerrors += status < 0 ? 1 : 0; + } + if (size_of_test & TEST_MEDIUM) { + status = test_array_offset_n_calc(500,71,193,347); + nerrors += status < 0 ? 1 : 0; + } /*--- END OF TESTS ---*/ diff --git a/test/istore.c b/test/istore.c index 7078bc3..ab69950 100644 --- a/test/istore.c +++ b/test/istore.c @@ -43,7 +43,13 @@ const char *FILENAME[] = { #define TEST_MEDIUM 0x0002 #define TEST_LARGE 0x0004 -hsize_t align_g[3] = {50, 50, 50}; +/* The datatype of the dataset operated on by this test */ +#define TEST_DATATYPE H5T_NATIVE_UCHAR + +#define TEST_CHUNK_SIZE 50 +#define TEST_SPARSE_SIZE 1000000 + +hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; hssize_t zero[H5O_LAYOUT_NDIMS]; @@ -68,21 +74,21 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz) for (i = 0; i < nx; i++) { if (nz > 1) { - printf("i=%lu:\n", (unsigned long)i); + fprintf(stderr,"i=%lu:\n", (unsigned long)i); } else { - printf("%03lu:", (unsigned long)i); + fprintf(stderr,"%03lu:", (unsigned long)i); } for (j = 0; j < ny; j++) { if (nz > 1) - printf("%03lu:", (unsigned long)j); + fprintf(stderr,"%03lu:", (unsigned long)j); for (k = 0; k < nz; k++) { - printf(" %3d", *array++); + fprintf(stderr," %3d", *array++); } if (nz > 1) - printf("\n"); + fprintf(stderr,"\n"); } - printf("\n"); + fprintf(stderr,"\n"); } } @@ -93,7 +99,7 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz) * Purpose: Creates a new object that refers to a indexed storage of raw * data. No raw data is stored. * - * Return: Success: 0 + * Return: Success: ID of dataset * * Failure: -1 * @@ -101,53 +107,44 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz) * Wednesday, October 15, 1997 * * Modifications: + * Converted to use datasets instead of directly messing with + * the istore routines, etc. since the new raw data architecture + * performs hyperslab operations at a higher level than the + * istore routines did and the new istore routines can't handle + * I/O on more than one chunk at a time. QAK - 2003/04/16 * *------------------------------------------------------------------------- */ -static int -new_object(H5F_t *f, const char *name, unsigned ndims, H5G_entry_t *ent/*out*/) +static hid_t +new_object(hid_t f, const char *name, int ndims, hsize_t dims[], hsize_t cdims[]) { - H5O_layout_t layout; - unsigned u; + hid_t dataset; /* Dataset ID */ + hid_t space; /* Dataspace ID */ + hid_t dcpl; /* Dataset creation property list ID */ - /* Create the object header */ - HDmemset(ent,0,sizeof(H5G_entry_t)); - if (H5O_create(f, H5P_DATASET_XFER_DEFAULT, 64, ent)) { - H5_FAILED(); - puts(" H5O_create() = NULL"); - goto error; - } + /* Create the dataset creation property list */ + if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR; - /* create chunked storage */ - layout.type = H5D_CHUNKED; - layout.ndims = ndims; - for (u = 0; u < ndims; u++) { - if (u < (int)NELMTS(align_g)) { - layout.dim[u] = align_g[u]; - } else { - layout.dim[u] = 2; - } - } - /* Create the root of the B-tree that describes chunked storage */ - H5F_istore_create (f, H5P_DATASET_XFER_DEFAULT, &layout/*in,out*/); - if (H5O_modify(ent, H5O_LAYOUT_ID, H5O_NEW_MESG, 0, 1, &layout, H5P_DATASET_XFER_DEFAULT) < 0) { - H5_FAILED(); - puts(" H5O_modify istore message failure."); - goto error; - } + /* Set the chunk dimensions */ + if(H5Pset_chunk(dcpl, ndims, cdims) < 0) TEST_ERROR; - /* Give the object header a name */ - if (H5G_insert(H5G_entof(H5G_rootof(f)), name, ent, H5P_DATASET_XFER_DEFAULT) < 0) { - H5_FAILED(); - printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name); - goto error; - } + /* Create the dataspace */ + if((space = H5Screate_simple(ndims, dims, NULL))<0) TEST_ERROR; - /* Close the header */ - H5O_close(ent); - return 0; + /* Create the dataset */ + if((dataset = H5Dcreate (f, name, TEST_DATATYPE, space, dcpl))<0) TEST_ERROR; + + /* Clean up */ - error: + /* Close property lists */ + if(H5Pclose(dcpl)<0) TEST_ERROR; + + /* Close dataspace */ + if(H5Sclose(space)<0) TEST_ERROR; + + return dataset; + +error: return -1; } @@ -170,18 +167,28 @@ new_object(H5F_t *f, const char *name, unsigned ndims, H5G_entry_t *ent/*out*/) *------------------------------------------------------------------------- */ static herr_t -test_create(H5F_t *f, const char *prefix) +test_create(hid_t f, const char *prefix) { - H5G_entry_t handle; - unsigned u; - char name[256]; + hid_t dataset; /* Dataset ID */ + hsize_t dims[H5O_LAYOUT_NDIMS+1]; /* Dimensions of dataset */ + char name[256]; /* Dataset name */ + unsigned u; /* Local index variable */ TESTING("istore create"); - for (u = 1; u <= H5O_LAYOUT_NDIMS; u++) { + dims[0]=TEST_CHUNK_SIZE; + for (u = 1; u <= H5S_MAX_RANK; u++) { + /* Initialize the dimension size in this new dimension */ + dims[u]=TEST_CHUNK_SIZE; + + /* Create chunked dataset of this dimensionality */ HDsnprintf(name, sizeof name, "%s_%02u", prefix, u); - if (new_object(f, name, u, &handle) < 0) + if ((dataset=new_object(f, name, (int)u, dims, chunk_dims)) < 0) return FAIL; + + /* Close dataset created */ + if(H5Dclose(dataset)<0) + return FAIL; } PASSED(); @@ -208,12 +215,14 @@ test_create(H5F_t *f, const char *prefix) *------------------------------------------------------------------------- */ static herr_t -test_extend(H5F_t *f, const char *prefix, +test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz) { - H5G_entry_t handle; + hid_t dataset; /* Dataset ID */ + hid_t fspace; /* Dataset's file dataspace */ + hid_t mspace; /* Dataset's memory dataspace */ hsize_t i, j, k, ctr; - unsigned ndims; + int ndims; uint8_t *buf = NULL, *check = NULL, *whole = NULL; char dims[64], s[256], name[256]; hssize_t offset[3]; @@ -221,8 +230,6 @@ test_extend(H5F_t *f, const char *prefix, hsize_t size[3]; hsize_t whole_size[3]; hsize_t nelmts; - H5O_layout_t layout; - H5P_genplist_t *dc_plist=NULL; if (!nz) { if (!ny) { @@ -241,33 +248,11 @@ test_extend(H5F_t *f, const char *prefix, } sprintf(s, "Testing istore extend: %s", dims); - printf("%-70s", s); + TESTING(s); buf = H5MM_malloc(nx * ny * nz); check = H5MM_malloc(nx * ny * nz); whole = H5MM_calloc(nx*ny*nz); - /* Get the default dataset creation property list */ - if(NULL == (dc_plist = H5I_object(H5P_DATASET_CREATE_DEFAULT))) { - printf("not a dset creation property list\n"); - goto error; - } - - /* Build the new empty object */ - sprintf(name, "%s_%s", prefix, dims); - if (new_object(f, name, ndims, &handle) < 0) { - printf(" Cannot create %u-d object `%s'\n", ndims, name); - goto error; - } - if (NULL == H5O_read(&handle, H5O_LAYOUT_ID, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { - H5_FAILED(); - puts(" Unable to read istore message."); - goto error; - } - if (ndims != layout.ndims) { - H5_FAILED(); - printf(" Header read error: istore.ndims != %d\n", ndims); - goto error; - } whole_size[0] = nx; whole_size[1] = ny; whole_size[2] = nz; @@ -275,8 +260,18 @@ test_extend(H5F_t *f, const char *prefix, max_corner[1] = 0; max_corner[2] = 0; + /* Build the new empty object */ + sprintf(name, "%s_%s", prefix, dims); + if ((dataset=new_object(f, name, ndims, whole_size, whole_size)) < 0) { + fprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name); + goto error; + } + + /* Get dataset's dataspace */ + if((fspace=H5Dget_space(dataset))<0) TEST_ERROR; + for (ctr = 0; - H5V_vector_lt_s(ndims, max_corner, (hssize_t*)whole_size); + H5V_vector_lt_s((unsigned)ndims, max_corner, (hssize_t*)whole_size); ctr++) { /* Size and location */ @@ -299,57 +294,64 @@ test_extend(H5F_t *f, const char *prefix, #if 0 if (0 == ctr) - printf("\n"); - printf(" Insert: ctr=%d, corner=(%d", ctr, offset[0]); + fprintf(stderr,"\n"); + fprintf(stderr," Insert: ctr=%d, corner=(%d", ctr, offset[0]); if (ndims > 1) - printf(",%d", offset[1]); + fprintf(stderr,",%d", offset[1]); if (ndims > 2) - printf(",%d", offset[2]); - printf("), size=(%d", size[0]); + fprintf(stderr,",%d", offset[2]); + fprintf(stderr,"), size=(%d", size[0]); if (ndims > 1) - printf(",%d", size[1]); + fprintf(stderr,",%d", size[1]); if (ndims > 2) - printf(",%d", size[2]); - printf("), %d element%s", nelmts, 1 == nelmts ? "" : "s"); + fprintf(stderr,",%d", size[2]); + fprintf(stderr,"), %d element%s", nelmts, 1 == nelmts ? "" : "s"); if (0 == nelmts) - printf(" *SKIPPED*"); - printf("\n"); + fprintf(stderr," *SKIPPED*"); + fprintf(stderr,"\n"); #endif /* Fill the source array */ if (0 == nelmts) continue; - memset(buf, (signed)(128+ctr), (size_t)nelmts); + HDmemset(buf, (signed)(128+ctr), (size_t)nelmts); + + /* Create dataspace for selection in memory */ + if((mspace=H5Screate_simple(1,&nelmts,NULL))<0) TEST_ERROR; + + /* Select region in file dataspace */ + if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL)<0) TEST_ERROR; /* Write to disk */ - if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &layout, dc_plist, size, - size, zero, offset, buf)<0) { + if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf)<0) { H5_FAILED(); - printf(" Write failed: ctr=%lu\n", (unsigned long)ctr); + fprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr); goto error; } /* Read from disk */ - memset(check, 0xff, (size_t)nelmts); - if (H5F_arr_read(f, H5P_DATASET_XFER_DEFAULT, &layout, dc_plist, size, - size, zero, offset, check)<0) { + HDmemset(check, 0xff, (size_t)nelmts); + if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check)<0) { H5_FAILED(); - printf(" Read failed: ctr=%lu\n", (unsigned long)ctr); + fprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr); goto error; } - if (memcmp(buf, check, (size_t)nelmts)) { + if (HDmemcmp(buf, check, (size_t)nelmts)) { H5_FAILED(); - printf(" Read check failed: ctr=%lu\n", (unsigned long)ctr); - printf(" Wrote:\n"); + fprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr); + fprintf(stderr," Wrote:\n"); print_array(buf, (size_t)size[0], (size_t)size[1], (size_t)size[2]); - printf(" Read:\n"); + fprintf(stderr," Read:\n"); print_array(check, (size_t)size[0], (size_t)size[1], (size_t)size[2]); goto error; } + /* Close memory dataspace */ + if(H5Sclose(mspace)<0) TEST_ERROR; + /* Write to `whole' buffer for later checking */ - H5V_hyper_copy(ndims, size, + H5V_hyper_copy((unsigned)ndims, size, whole_size, offset, whole, /*dst*/ size, H5V_ZERO, buf); /*src*/ @@ -360,11 +362,10 @@ 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, H5P_DATASET_XFER_DEFAULT, &layout, dc_plist, whole_size, - whole_size, zero, zero, buf)<0) { + HDmemset(buf, 0xff, nx * ny * nz); + if (H5Dread(dataset, TEST_DATATYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0) { H5_FAILED(); - puts(" Read failed for whole array."); + fprintf(stderr," Read failed for whole array.\n"); goto error; } for (i=0; i<nx; i++) { @@ -372,16 +373,16 @@ test_extend(H5F_t *f, const char *prefix, for (k=0; k<nz; k++) { if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) { H5_FAILED(); - printf(" Check failed at i=%lu", (unsigned long)i); + fprintf(stderr," Check failed at i=%lu", (unsigned long)i); if (ndims > 1) { - printf(", j=%lu", (unsigned long)j); + fprintf(stderr,", j=%lu", (unsigned long)j); } if (ndims > 2) { - printf(", k=%lu", (unsigned long)k); + fprintf(stderr,", k=%lu", (unsigned long)k); } - printf("\n Check array is:\n"); + fprintf(stderr,"\n Check array is:\n"); print_array(whole, nx, ny, nz); - printf(" Value read is:\n"); + fprintf(stderr," Value read is:\n"); print_array(buf, nx, ny, nz); goto error; } @@ -389,13 +390,21 @@ test_extend(H5F_t *f, const char *prefix, } } + /* Close dataset's dataspace */ + if(H5Sclose(fspace)<0) TEST_ERROR; + + /* Close dataset */ + if(H5Dclose(dataset)<0) TEST_ERROR; + + /* Free memory used */ H5MM_xfree(buf); H5MM_xfree(check); H5MM_xfree(whole); + PASSED(); return SUCCEED; - error: +error: H5MM_xfree(buf); H5MM_xfree(check); H5MM_xfree(whole); @@ -421,18 +430,20 @@ test_extend(H5F_t *f, const char *prefix, *------------------------------------------------------------------------- */ static herr_t -test_sparse(H5F_t *f, const char *prefix, size_t nblocks, +test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, size_t nz) { - unsigned ndims; + hid_t dataset; /* Dataset ID */ + hid_t fspace; /* Dataset's file dataspace */ + hid_t mspace; /* Dataset's memory dataspace */ + int ndims; hsize_t ctr; char dims[64], s[256], name[256]; hssize_t offset[3]; hsize_t size[3], total = 0; - H5G_entry_t handle; - H5O_layout_t layout; uint8_t *buf = NULL; - H5P_genplist_t *dc_plist=NULL; + hsize_t whole_size[3]; /* Size of dataset's dataspace */ + size_t u; /* Local index variable */ if (!nz) { if (!ny) { @@ -451,39 +462,43 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks, } sprintf(s, "Testing istore sparse: %s", dims); - printf("%-70s", s); + TESTING(s); buf = H5MM_malloc(nx * ny * nz); - /* Get the default dataset creation property list */ - if(NULL == (dc_plist = H5I_object(H5P_DATASET_CREATE_DEFAULT))) { - printf("not a dset creation property list\n"); - goto error; - } + /* Set dimensions of dataset */ + for (u=0; u<(size_t)ndims; u++) + whole_size[u]=TEST_SPARSE_SIZE; + /* Set dimensions of selection */ + size[0] = nx; + size[1] = ny; + size[2] = nz; /* Build the new empty object */ sprintf(name, "%s_%s", prefix, dims); - if (new_object(f, name, ndims, &handle) < 0) { + if ((dataset=new_object(f, name, ndims, whole_size, chunk_dims)) < 0) { printf(" Cannot create %u-d object `%s'\n", ndims, name); goto error; } - if (NULL == H5O_read(&handle, H5O_LAYOUT_ID, 0, &layout, H5P_DATASET_XFER_DEFAULT)) { - H5_FAILED(); - printf(" Unable to read istore message\n"); - goto error; - } + + /* Get dataset's dataspace */ + if((fspace=H5Dget_space(dataset))<0) TEST_ERROR; + + /* Create dataspace for memory buffer */ + if((mspace=H5Screate_simple(ndims,size,NULL))<0) TEST_ERROR; + for (ctr=0; ctr<nblocks; ctr++) { - offset[0] = rand() % 1000000; - offset[1] = rand() % 1000000; - offset[2] = rand() % 1000000; - size[0] = nx; - size[1] = ny; - size[2] = nz; - memset(buf, (signed)(128+ctr), nx * ny * nz); + offset[0] = HDrandom() % (TEST_SPARSE_SIZE-nx); + offset[1] = HDrandom() % (TEST_SPARSE_SIZE-ny); + offset[2] = HDrandom() % (TEST_SPARSE_SIZE-nz); + + HDmemset(buf, (signed)(128+ctr), nx * ny * nz); + + /* Select region in file dataspace */ + if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL)<0) TEST_ERROR; /* write to disk */ - if (H5F_arr_write(f, H5P_DATASET_XFER_DEFAULT, &layout, dc_plist, size, - size, zero, offset, buf)<0) { + if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf)<0) { H5_FAILED(); printf(" Write failed: ctr=%lu\n", (unsigned long)ctr); printf(" offset=(%lu", (unsigned long) (offset[0])); @@ -507,11 +522,20 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks, /* We don't test reading yet.... */ } + /* Close memory dataspace */ + if(H5Sclose(mspace)<0) TEST_ERROR; + + /* Close dataset's dataspace */ + if(H5Sclose(fspace)<0) TEST_ERROR; + + /* Close dataset */ + if(H5Dclose(dataset)<0) TEST_ERROR; + H5MM_xfree(buf); PASSED(); return SUCCEED; - error: +error: H5MM_xfree(buf); return FAIL; } @@ -537,15 +561,15 @@ int main(int argc, char *argv[]) { hid_t fapl=-1, file=-1, fcpl=-1; - H5F_t *f; herr_t status; int nerrors = 0; unsigned size_of_test; + unsigned u; /* Local index variable */ char filename[1024]; - /* Parse arguments or assume `small' */ + /* Parse arguments or assume all tests (`small', `medium' and `large') */ if (1 == argc) { - size_of_test = TEST_SMALL; + size_of_test = TEST_SMALL | TEST_MEDIUM | TEST_LARGE; } else { int i; for (i = 1, size_of_test = 0; i < argc; i++) { @@ -572,6 +596,9 @@ main(int argc, char *argv[]) printf(" LARGE"); printf("\n"); + /* Set the random # seed */ + HDsrandom((unsigned long)time(NULL)); + /* Reset library */ h5_reset(); fapl = h5_fileaccess(); @@ -582,8 +609,7 @@ main(int argc, char *argv[]) /* Create the test file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl))<0 || - NULL==(f=H5I_object(file))) { + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl))<0) { printf("Cannot create file %s; test aborted\n", filename); exit(1); } @@ -594,56 +620,67 @@ main(int argc, char *argv[]) */ if (H5FD_FAMILY==H5Pget_driver(fapl)) { haddr_t addr; + H5F_t *f; + addr = 8 * ((uint64_t)1<<30); /*8 GB */ + f=H5I_object(file); if (H5FDset_eoa(f->shared->lf, addr)<0) { printf("Cannot create large file family\n"); exit(1); } } + /* Initialize chunk dimensions */ + for (u = 0; u < H5O_LAYOUT_NDIMS; u++) + chunk_dims[u]=TEST_CHUNK_SIZE; + /* * Creation test: Creates empty objects with various raw data sizes * and alignments. */ - status = test_create(f, "create"); + status = test_create(file, "create"); nerrors += status < 0 ? 1 : 0; if (size_of_test & TEST_SMALL) { - status = test_extend(f, "extend", 10, 0, 0); + status = test_extend(file, "extend", 10, 0, 0); nerrors += status < 0 ? 1 : 0; - status = test_extend(f, "extend", 10, 10, 0); + status = test_extend(file, "extend", 10, 10, 0); nerrors += status < 0 ? 1 : 0; - status = test_extend(f, "extend", 10, 10, 10); + status = test_extend(file, "extend", 10, 10, 10); nerrors += status < 0 ? 1 : 0; } if (size_of_test & TEST_MEDIUM) { - status = test_extend(f, "extend", 10000, 0, 0); + status = test_extend(file, "extend", 10000, 0, 0); nerrors += status < 0 ? 1 : 0; - status = test_extend(f, "extend", 2500, 10, 0); + status = test_extend(file, "extend", 2500, 10, 0); nerrors += status < 0 ? 1 : 0; - status = test_extend(f, "extend", 10, 400, 10); + status = test_extend(file, "extend", 10, 400, 10); nerrors += status < 0 ? 1 : 0; } +#ifdef QAK if (size_of_test & TEST_SMALL) { - status = test_sparse(f, "sparse", 100, 5, 0, 0); + status = test_sparse(file, "sparse", 100, 5, 0, 0); nerrors += status < 0 ? 1 : 0; - status = test_sparse(f, "sparse", 100, 3, 4, 0); + status = test_sparse(file, "sparse", 100, 3, 4, 0); nerrors += status < 0 ? 1 : 0; - status = test_sparse(f, "sparse", 100, 2, 3, 4); + status = test_sparse(file, "sparse", 100, 2, 3, 4); nerrors += status < 0 ? 1 : 0; } if (size_of_test & TEST_MEDIUM) { - status = test_sparse(f, "sparse", 1000, 30, 0, 0); + status = test_sparse(file, "sparse", 1000, 30, 0, 0); nerrors += status < 0 ? 1 : 0; - status = test_sparse(f, "sparse", 2000, 7, 3, 0); + status = test_sparse(file, "sparse", 2000, 7, 3, 0); nerrors += status < 0 ? 1 : 0; - status = test_sparse(f, "sparse", 2000, 4, 2, 3); + status = test_sparse(file, "sparse", 2000, 4, 2, 3); nerrors += status < 0 ? 1 : 0; } if (size_of_test & TEST_LARGE) { - status = test_sparse(f, "sparse", 800, 50, 50, 50); + status = test_sparse(file, "sparse", 800, 50, 50, 50); nerrors += status < 0 ? 1 : 0; } +#else /* QAK */ +HDfprintf(stderr,"Uncomment tests!\n"); +#endif /* QAK */ /* Close the test file and exit */ H5Pclose(fcpl); diff --git a/test/set_extent.c b/test/set_extent.c index c7d8e67..220c376 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -37,522 +37,445 @@ int main( void ) { - - hid_t file_id; - hid_t dataset_id=(-1); - hid_t space_id=(-1); - hid_t plist_id=(-1); - hsize_t dims[RANK] = { 90, 90 }; - hsize_t dims_new[RANK] = { 70, 70 }; - hsize_t dims_chunk[RANK] = { 20, 20 }; - hsize_t dims_out[RANK]; - hsize_t maxdims[RANK] = { H5S_UNLIMITED, H5S_UNLIMITED }; - int data[ 90 ][ 90 ]; - int buf1[ 70 ][ 70 ]; - int buf2[ 90 ][ 90 ]; - int i, j, n = 0; - int fillvalue = 1; /* Fill value for the dataset */ - - - for( i = 0; i < 90; i++ ) - { - for( j = 0; j < 90; j++ ) - { - data[i][j] = n++; - } - } - -/*------------------------------------------------------------------------- - * Test H5Dset_extent with chunks on the raw data cache - *------------------------------------------------------------------------- - */ - - - /* Create a new file using default properties. */ - if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) goto out; - - TESTING("extend dataset create with fill value"); - - /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; - - /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) goto out; - - -/*------------------------------------------------------------------------- - * Create and write one dataset - *------------------------------------------------------------------------- - */ - - /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; - - /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; - -/*------------------------------------------------------------------------- - * Set new dimensions for the array; shrink it - *------------------------------------------------------------------------- - */ - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims_new[0] ) - goto out; - - -/*------------------------------------------------------------------------- - * Read - *------------------------------------------------------------------------- - */ - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; - - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( buf1[i][j] != data[i][j] ) { - goto out; - } - } - } - - -/*------------------------------------------------------------------------- - * Set new dimensions for the array; expand it again - *------------------------------------------------------------------------- - */ - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims[0] ) - goto out; - - -/*------------------------------------------------------------------------- - * Read - *------------------------------------------------------------------------- - */ - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( i >= 70 || j >= 70 ) - { - if ( buf2[i][j] != fillvalue ) { - goto out; - } - } - else - { - if ( buf2[i][j] != data[i][j] ) { - goto out; - } - } - - } - } - - -/*------------------------------------------------------------------------- - * Close/release resources - *------------------------------------------------------------------------- - */ - - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - - PASSED(); - TESTING("extend dataset create without fill value"); - - /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; - - /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - -/*------------------------------------------------------------------------- - * Create and write one dataset - *------------------------------------------------------------------------- - */ - - /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; - - /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; - -/*------------------------------------------------------------------------- - * Set new dimensions for the array; shrink it - *------------------------------------------------------------------------- - */ - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims_new[0] ) - goto out; - - -/*------------------------------------------------------------------------- - * Read - *------------------------------------------------------------------------- - */ - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; - - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( buf1[i][j] != data[i][j] ) { - goto out; - } - } - } - - -/*------------------------------------------------------------------------- - * Set new dimensions for the array; expand it again - *------------------------------------------------------------------------- - */ - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims[0] ) - goto out; - - -/*------------------------------------------------------------------------- - * Read - *------------------------------------------------------------------------- - */ - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( i >= 70 || j >= 70 ) - { - if ( buf2[i][j] != 0 ) { - goto out; - } - } - else - { - if ( buf2[i][j] != data[i][j] ) { - goto out; - } - } - - } - } - - -/*------------------------------------------------------------------------- - * Close/release resources - *------------------------------------------------------------------------- - */ - - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); + hid_t file_id; + hid_t dataset_id=(-1); + hid_t space_id=(-1); + hid_t plist_id=(-1); + hsize_t dims[RANK] = { 90, 90 }; + hsize_t dims_new[RANK] = { 70, 70 }; + hsize_t dims_chunk[RANK] = { 20, 20 }; + hsize_t dims_out[RANK]; + hsize_t maxdims[RANK] = { H5S_UNLIMITED, H5S_UNLIMITED }; + int data[ 90 ][ 90 ]; + int buf1[ 70 ][ 70 ]; + int buf2[ 90 ][ 90 ]; + int i, j, n = 0; + int fillvalue = 1; /* Fill value for the dataset */ - H5Fclose( file_id ); - - PASSED(); - - -/*------------------------------------------------------------------------- - * Test H5Dset_extent with chunks written to file - *------------------------------------------------------------------------- - */ - - - /* Create a new file using default properties. */ - if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) goto out; - - - TESTING("extend dataset read with fill value"); - - /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; - - /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) goto out; - - /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; - - /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; - - /* Close/release resources. */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - H5Fclose( file_id ); - - - /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) goto out; - - /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset1" ))<0) goto out; - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims_new[0] ) - goto out; - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( buf1[i][j] != data[i][j] ) { - goto out; - } - } - } - -/*------------------------------------------------------------------------- - * Set new dimensions for the array; expand it again - *------------------------------------------------------------------------- - */ - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims[0] ) - goto out; - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( i >= 70 || j >= 70 ) - { - if ( buf2[i][j] != fillvalue ) { - goto out; + for( i = 0; i < 90; i++ ) + for( j = 0; j < 90; j++ ) + data[i][j] = n++; + + /*------------------------------------------------------------------------- + * Test H5Dset_extent with chunks on the raw data cache + *------------------------------------------------------------------------- + */ + + + /* Create a new file using default properties. */ + if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) goto out; + + TESTING("extend dataset create with fill value"); + + /* Create the data space with unlimited dimensions. */ + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + + /* Modify dataset creation properties, i.e. enable chunking. */ + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; + if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) goto out; + + + /*------------------------------------------------------------------------- + * Create and write one dataset + *------------------------------------------------------------------------- + */ + + /* Create a new dataset */ + if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + + /* Write the data. */ + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + + /*------------------------------------------------------------------------- + * Set new dimensions for the array; shrink it + *------------------------------------------------------------------------- + */ + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id , dims_new )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims_new[0] ) goto out; + + + /*------------------------------------------------------------------------- + * Read + *------------------------------------------------------------------------- + */ + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) + if ( buf1[i][j] != data[i][j] ) goto out; + + + /*------------------------------------------------------------------------- + * Set new dimensions for the array; expand it again + *------------------------------------------------------------------------- + */ + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id , dims )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims[0] ) goto out; + + + /*------------------------------------------------------------------------- + * Read + *------------------------------------------------------------------------- + */ + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) { + for( j = 0; j < (int)dims_out[1]; j++ ) { + if ( i >= 70 || j >= 70 ) { + if ( buf2[i][j] != fillvalue ) goto out; + } + else { + if ( buf2[i][j] != data[i][j] ) goto out; + } + } } - } - else - { - if ( buf2[i][j] != data[i][j] ) { - goto out; + + + /*------------------------------------------------------------------------- + * Close/release resources + *------------------------------------------------------------------------- + */ + + H5Dclose( dataset_id ); + H5Sclose( space_id ); + H5Pclose( plist_id ); + + PASSED(); + TESTING("extend dataset create without fill value"); + + /* Create the data space with unlimited dimensions. */ + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + + /* Modify dataset creation properties, i.e. enable chunking. */ + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; + + /*------------------------------------------------------------------------- + * Create and write one dataset + *------------------------------------------------------------------------- + */ + + /* Create a new dataset */ + if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + + /* Write the data. */ + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + + /*------------------------------------------------------------------------- + * Set new dimensions for the array; shrink it + *------------------------------------------------------------------------- + */ + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id , dims_new )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims_new[0] ) goto out; + + + /*------------------------------------------------------------------------- + * Read + *------------------------------------------------------------------------- + */ + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) + if ( buf1[i][j] != data[i][j] ) goto out; + + + /*------------------------------------------------------------------------- + * Set new dimensions for the array; expand it again + *------------------------------------------------------------------------- + */ + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id , dims )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims[0] ) goto out; + + + /*------------------------------------------------------------------------- + * Read + *------------------------------------------------------------------------- + */ + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) { + for( j = 0; j < (int)dims_out[1]; j++ ) { + if ( i >= 70 || j >= 70 ) { + if ( buf2[i][j] != 0 ) goto out; + } + else { + if ( buf2[i][j] != data[i][j] ) goto out; + } + } } - } - - } - } - - -/*------------------------------------------------------------------------- - * Close/release resources - *------------------------------------------------------------------------- - */ - - H5Dclose( dataset_id ); - H5Sclose( space_id ); - - PASSED(); - - - TESTING("extend dataset read without fill value"); - - /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; - - /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - - /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; - - /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; - - /* Close/release resources. */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - H5Fclose( file_id ); - - - /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) goto out; - - /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset2" ))<0) goto out; - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims_new[0] ) - goto out; - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( buf1[i][j] != data[i][j] ) { - goto out; - } - } - } - -/*------------------------------------------------------------------------- - * Set new dimensions for the array; expand it again - *------------------------------------------------------------------------- - */ - - /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; - - /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; - - /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; - - if ( dims_out[0] != dims[0] ) - goto out; - - /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; - - /* Compare the read array with the original array */ - for( i = 0; i < (int)dims_out[0]; i++ ) - { - for( j = 0; j < (int)dims_out[1]; j++ ) - { - if ( i >= 70 || j >= 70 ) - { - if ( buf2[i][j] != 0 ) { - goto out; + + + /*------------------------------------------------------------------------- + * Close/release resources + *------------------------------------------------------------------------- + */ + + H5Dclose( dataset_id ); + H5Sclose( space_id ); + H5Pclose( plist_id ); + + H5Fclose( file_id ); + + PASSED(); + + + + /*------------------------------------------------------------------------- + * Test H5Dset_extent with chunks written to file + *------------------------------------------------------------------------- + */ + + + /* Create a new file using default properties. */ + if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) goto out; + + + TESTING("extend dataset read with fill value"); + + /* Create the data space with unlimited dimensions. */ + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + + /* Modify dataset creation properties, i.e. enable chunking. */ + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; + if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) goto out; + + /* Create a new dataset within the file using cparms creation properties. */ + if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + + /* Write the data. */ + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + + /* Close/release resources. */ + H5Dclose( dataset_id ); + H5Sclose( space_id ); + H5Pclose( plist_id ); + H5Fclose( file_id ); + + + /* Open the file */ + if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) goto out; + + /* Open the dataset */ + if ((dataset_id = H5Dopen( file_id , "Dataset1" ))<0) goto out; + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id, dims_new )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims_new[0] ) goto out; + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) + if ( buf1[i][j] != data[i][j] ) goto out; + + /*------------------------------------------------------------------------- + * Set new dimensions for the array; expand it again + *------------------------------------------------------------------------- + */ + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id , dims )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims[0] ) goto out; + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) { + for( j = 0; j < (int)dims_out[1]; j++ ) { + if ( i >= 70 || j >= 70 ) { + if ( buf2[i][j] != fillvalue ) goto out; + } + else { + if ( buf2[i][j] != data[i][j] ) goto out; + } + } } - } - else - { - if ( buf2[i][j] != data[i][j] ) { - goto out; + + + /*------------------------------------------------------------------------- + * Close/release resources + *------------------------------------------------------------------------- + */ + + H5Dclose( dataset_id ); + H5Sclose( space_id ); + + PASSED(); + + + TESTING("extend dataset read without fill value"); + + /* Create the data space with unlimited dimensions. */ + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + + /* Modify dataset creation properties, i.e. enable chunking. */ + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; + + /* Create a new dataset within the file using cparms creation properties. */ + if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + + /* Write the data. */ + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + + /* Close/release resources. */ + H5Dclose( dataset_id ); + H5Sclose( space_id ); + H5Pclose( plist_id ); + H5Fclose( file_id ); + + + /* Open the file */ + if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) goto out; + + /* Open the dataset */ + if ((dataset_id = H5Dopen( file_id , "Dataset2" ))<0) goto out; + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id, dims_new )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims_new[0] ) goto out; + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) + for( j = 0; j < (int)dims_out[1]; j++ ) + if ( buf1[i][j] != data[i][j] ) goto out; + + /*------------------------------------------------------------------------- + * Set new dimensions for the array; expand it again + *------------------------------------------------------------------------- + */ + + /* Set new dimensions for the array. */ + if (H5Dset_extent( dataset_id , dims )<0) goto out; + + /* Get the space. */ + if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + + /* Get dimensions. */ + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + + if ( dims_out[0] != dims[0] ) goto out; + + /* Read the new dataset. */ + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + + /* Compare the read array with the original array */ + for( i = 0; i < (int)dims_out[0]; i++ ) { + for( j = 0; j < (int)dims_out[1]; j++ ) { + if ( i >= 70 || j >= 70 ) { + if ( buf2[i][j] != 0 ) goto out; + } + else { + if ( buf2[i][j] != data[i][j] ) goto out; + } + } } - } - - } - } - - -/*------------------------------------------------------------------------- - * Close/release resources - *------------------------------------------------------------------------- - */ - - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Fclose( file_id ); - - PASSED(); + /*------------------------------------------------------------------------- + * Close/release resources + *------------------------------------------------------------------------- + */ + + H5Dclose( dataset_id ); + H5Sclose( space_id ); - - return 0; - - -out: - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Pclose( plist_id ); - H5Fclose( file_id ); - H5_FAILED(); - return 1; - -} + H5Fclose( file_id ); + PASSED(); + + return 0; + + +out: + H5Dclose( dataset_id ); + H5Sclose( space_id ); + H5Pclose( plist_id ); + H5Fclose( file_id ); + H5_FAILED(); + return 1; +} diff --git a/test/tselect.c b/test/tselect.c index af36f11..7bf3871 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -3941,7 +3941,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) for (k = 0; k < Z; k++,tmpdata++,tmpdata_out++) { if(*tmpdata!=*tmpdata_out) { num_errs++; - printf("Error! j=%d, i=%d, k=%d, *tmpdata=%x, *tmpdata_out=%x\n",j,i,k,(unsigned)*tmpdata,(unsigned)*tmpdata_out); + printf("Line %d: Error! j=%d, i=%d, k=%d, *tmpdata=%x, *tmpdata_out=%x\n",__LINE__,j,i,k,(unsigned)*tmpdata,(unsigned)*tmpdata_out); } /* end if */ } /* end for */ |