summaryrefslogtreecommitdiffstats
path: root/test/istore.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-11-14 14:42:14 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-11-14 14:42:14 (GMT)
commitcdeeb5553a3920565d87201761dadd1fe32aa3b1 (patch)
treea209c61f85983c1a76bf5c65d1f3285c4861ec46 /test/istore.c
parent73897627660169de753597b9ff045d3112646506 (diff)
downloadhdf5-cdeeb5553a3920565d87201761dadd1fe32aa3b1.zip
hdf5-cdeeb5553a3920565d87201761dadd1fe32aa3b1.tar.gz
hdf5-cdeeb5553a3920565d87201761dadd1fe32aa3b1.tar.bz2
[svn-r136] ./MANIFEST
./src/Makefile.in Added H5Ffamily.c and H5Fsplit.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5Gnode.c Added `const' to sublass arguments. ./src/H5F.c ./src/H5Flow.c ./src/H5Fsec2.c Make sure file buffers get flushed during a call to H5Fflush(). Check for overflow in address encoding and decoding. ./src/H5Ffam.c ./src/H5Fprivate.c ./test/istore.c Implementation of file families so 32-bit machines can access 64-bit files. ./src/H5Oprivate.h Removed H5O_NO_ADDR constant. ./config/freebsd2.2.1 ./config/linux Added -DH5G_DEBUG and -DH5F_DEBUG to the list of debugging flags. ./html/H5.format.html Changed some <offset>-sized things to <length>-sized things. ./src/H5AC.c ./src/H5ACprivate.h ./src/H5B.c ./src/H5Bprivate.h ./src/H5C.c ./src/H5D.c ./src/H5F.c ./src/H5Fcore.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5Gshad.c ./src/H5Gstab.c ./src/H5H.c ./src/H5Hprivate.h ./src/H5MF.c ./src/H5MFprivate.h ./src/H5O.c ./src/H5Ocont.c ./src/H5Oistore.c ./src/H5Oprivate.h ./src/H5Ostab.c ./src/H5Ostdst.c ./src/H5pivate.h ./src/debug.c ./test/istore.c ./test/theap.c ./test/tohdr.c ./test/tstab.c Lots of changes caused by generalizing addresses. The haddr_t is now a struct, so you can no longer perform arithmetic on it. But since it's small, simple, and often used, storage is allocated like with an integer. But we always pass them around by reference. That is, when using an address in another struct, allocate space: struct my_struct { char *name; haddr_t address; } x; But when passing it to a function, pass by reference: H5F_addr_print (stderr, &(x.address)); Addresses should be initialized with H5F_addr_undef (&(x.address)); Functions for operating on addresses are in H5Flow.c and begin with H5F_addr_... Functions never return haddr_t or haddr_t*; they always pass them through arguments instead. A function that returns an address through an argument does so with its last argument and it is marked with `/*out*/'. Calls to such functions also mark output-only arguments with `/*out*/' ./src/H5Fsplit.c (new) A two-member family where all meta data goes in the first member and all raw data goes in the second member. ./src/H5B.c ./src/H5D.c ./src/H5F.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fstdio.c ./src/H5Gnode.c ./src/H5H.c ./src/H5MF.c ./src/H5MFprivate.h ./src/H5O.c Differentiate between meta data storage and raw data storage. Provide a mechanism so that the file driver can extend the file to allocate more memory. ./src/H5E.c ./src/H5Epublic.c Added the error H5E_TRUNCATED to be reported when the file is shorter than the length recorded in the boot block. ./src/H5F.c Added H5F_locate_signature() so we only do it in one place now. ./INSTALL ./INSTALL_MAINT Just a couple clarifications. ./html/ExternalFiles.html ./html/storage.html Documents how external files work. ./test/hyperslab.c ./test/istore.c Fixed printf's on 64-bit machines. ./test/istore.c Added ifdef's to test the split file driver.
Diffstat (limited to 'test/istore.c')
-rw-r--r--test/istore.c117
1 files changed, 89 insertions, 28 deletions
diff --git a/test/istore.c b/test/istore.c
index c50ef3f..6487a30 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -14,14 +14,25 @@
#include <H5Oprivate.h>
#include <H5Vprivate.h>
-#define FILENAME "istore.h5"
+#if 0
+# define FILETYPE H5F_LOW_DFLT
+# define FILENAME "istore.h5"
+#elif 0
+# define FILETYPE H5F_LOW_FAM
+# define FILENAME "istore-%05d.h5"
+#else
+# define FILETYPE H5F_LOW_SPLIT
+# define FILENAME "istore-split"
+#endif
#define TEST_SMALL 0x0001
#define TEST_MEDIUM 0x0002
+#define TEST_LARGE 0x0004
#define AT() printf (" at %s:%d in %s()...\n", \
__FILE__, __LINE__, __FUNCTION__);
-
+
+size_t align_g[3] = {50, 50, 50};
/*-------------------------------------------------------------------------
@@ -99,9 +110,16 @@ new_object (H5F_t *f, const char *name, size_t ndims)
}
/* Add the indexed-storage message */
- for (i=0; i<ndims; i++) alignment[i] = 2;
+ for (i=0; i<ndims; i++) {
+ if (i<NELMTS (align_g)) {
+ alignment[i] = align_g[i];
+ } else {
+ alignment[i] = 2;
+ }
+ }
+
H5F_istore_new (f, &istore, ndims, alignment);
- if (H5O_modify (f, H5O_NO_ADDR, handle, H5O_ISTORE, H5O_NEW_MESG,
+ if (H5O_modify (f, NO_ADDR, handle, H5O_ISTORE, H5O_NEW_MESG,
&istore)<0) {
printf ("*FAILED*\n");
if (!isatty (1)) {
@@ -140,7 +158,6 @@ test_create (H5F_t *f, const char *prefix)
char name[256];
printf ("%-70s", "Testing istore create");
- fflush (stdout);
for (i=1; i<=H5O_ISTORE_NDIMS; i++) {
sprintf (name, "%s_%02d", prefix, i);
@@ -191,21 +208,21 @@ test_extend (H5F_t *f, const char *prefix,
if (!ny) {
ndims = 1;
ny = nz = 1;
- sprintf (dims, "%d", nx);
+ sprintf (dims, "%lu", (unsigned long)nx);
} else {
ndims = 2;
nz = 1;
- sprintf (dims, "%dx%d", nx, ny);
+ sprintf (dims, "%lux%lu", (unsigned long)nx, (unsigned long)ny);
}
} else {
ndims = 3;
- sprintf (dims, "%dx%dx%d", nx, ny, nz);
+ sprintf (dims, "%lux%lux%lu",
+ (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
}
sprintf (s, "Testing istore extend: %s", dims);
printf ("%-70s", s);
- fflush (stdout);
buf = H5MM_xmalloc (nx*ny*nz);
check = H5MM_xmalloc (nx*ny*nz);
whole = H5MM_xcalloc (nx*ny*nz, 1);
@@ -219,7 +236,7 @@ test_extend (H5F_t *f, const char *prefix,
}
goto error;
}
- if (NULL==H5O_read (f, H5O_NO_ADDR, handle, H5O_ISTORE, 0, &istore)) {
+ if (NULL==H5O_read (f, NO_ADDR, handle, H5O_ISTORE, 0, &istore)) {
puts ("*FAILED*");
if (!isatty (1)) {
AT ();
@@ -274,7 +291,6 @@ test_extend (H5F_t *f, const char *prefix,
printf ("), %d element%s", nelmts, 1==nelmts?"":"s");
if (0==nelmts) printf (" *SKIPPED*");
printf ("\n");
- fflush (stdout);
#endif
/* Fill the source array */
@@ -309,7 +325,7 @@ test_extend (H5F_t *f, const char *prefix,
printf (" Wrote:\n");
print_array (buf, size[0], size[1], size[2]);
printf (" Read:\n");
- print_array (buf, size[0], size[1], size[2]);
+ print_array (check, size[0], size[1], size[2]);
}
goto error;
}
@@ -395,7 +411,7 @@ test_sparse (H5F_t *f, const char *prefix, size_t nblocks,
{
intn ndims, ctr;
char dims[64], s[256], name[256];
- size_t offset[3], size[3];
+ size_t offset[3], size[3], total=0;
H5G_entry_t *handle = NULL;
H5O_istore_t istore;
uint8 *buf = NULL;
@@ -404,20 +420,20 @@ test_sparse (H5F_t *f, const char *prefix, size_t nblocks,
if (!ny) {
ndims = 1;
ny = nz = 1;
- sprintf (dims, "%d", nx);
+ sprintf (dims, "%lu", (unsigned long)nx);
} else {
ndims = 2;
nz = 1;
- sprintf (dims, "%dx%d", nx, ny);
+ sprintf (dims, "%lux%lu", (unsigned long)nx, (unsigned long)ny);
}
} else {
ndims = 3;
- sprintf (dims, "%dx%dx%d", nx, ny, nz);
+ sprintf (dims, "%lux%lux%lu",
+ (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
}
sprintf (s, "Testing istore sparse: %s", dims);
printf ("%-70s", s);
- fflush (stdout);
buf = H5MM_xmalloc (nx*ny*nz);
/* Build the new empty object */
@@ -429,7 +445,7 @@ test_sparse (H5F_t *f, const char *prefix, size_t nblocks,
}
goto error;
}
- if (NULL==H5O_read (f, H5O_NO_ADDR, handle, H5O_ISTORE, 0, &istore)) {
+ if (NULL==H5O_read (f, NO_ADDR, handle, H5O_ISTORE, 0, &istore)) {
puts ("*FAILED*");
if (!isatty (1)) {
AT ();
@@ -453,16 +469,20 @@ test_sparse (H5F_t *f, const char *prefix, size_t nblocks,
if (!isatty (1)) {
AT ();
printf (" Write failed: ctr=%d\n", ctr);
- printf (" offset=(%d", offset[0]);
- if (ndims>1) printf (",%d", offset[1]);
- if (ndims>2) printf (",%d", offset[2]);
- printf ("), size=(%d", size[0]);
- if (ndims>1) printf (",%d", size[1]);
- if (ndims>2) printf (",%d", size[2]);
+ printf (" offset=(%lu", (unsigned long)(offset[0]));
+ if (ndims>1) printf (",%lu", (unsigned long)(offset[1]));
+ if (ndims>2) printf (",%lu", (unsigned long)(offset[2]));
+ printf ("), size=(%lu", (unsigned long)(size[0]));
+ if (ndims>1) printf (",%lu", (unsigned long)(size[1]));
+ if (ndims>2) printf (",%lu", (unsigned long)(size[2]));
printf (")\n");
}
goto error;
}
+ total += nx*ny*nz;
+#if 0
+ printf ("ctr: ctr=%d, total=%lu\n", ctr, (unsigned long)total);
+#endif
/* We don't test reading yet.... */
}
@@ -502,6 +522,12 @@ main (int argc, char *argv[])
herr_t status;
int nerrors = 0;
uintn size_of_test;
+ uint8 offset_size;
+ H5G_entry_t *ent = NULL;
+ hid_t template_id;
+ file_create_temp_t *creation_template = NULL;
+
+ setbuf (stdout, NULL);
/* Parse arguments or assume `small' */
if (1==argc) {
@@ -513,6 +539,8 @@ main (int argc, char *argv[])
size_of_test |= TEST_SMALL;
} else if (!strcmp (argv[i], "medium")) {
size_of_test |= TEST_MEDIUM;
+ } else if (!strcmp (argv[i], "large")) {
+ size_of_test |= TEST_LARGE;
} else {
printf ("unrecognized argument: %s\n", argv[i]);
exit (1);
@@ -522,18 +550,47 @@ main (int argc, char *argv[])
printf ("Test sizes: ");
if (size_of_test & TEST_SMALL) printf (" SMALL");
if (size_of_test & TEST_MEDIUM) printf (" MEDIUM");
+ if (size_of_test & TEST_LARGE) printf (" LARGE");
printf ("\n");
-
+
+ /*
+ * Use larger file addresses...
+ */
+ offset_size = 8;
+ template_id = H5C_copy (H5C_get_default_atom (H5_TEMPLATE));
+ H5Csetparm (template_id, H5_OFFSET_SIZE, &offset_size);
+ creation_template = H5Aatom_object (template_id);
/* Create the test file */
- if (NULL==(f=H5F_open (H5F_LOW_DFLT, FILENAME,
+ if (NULL==(f=H5F_open (FILETYPE, FILENAME,
(H5F_ACC_CREAT|H5F_ACC_WRITE|H5F_ACC_TRUNC|
H5F_ACC_DEBUG),
- NULL))) {
+ creation_template))) {
printf ("Cannot create file %s; test aborted\n", FILENAME);
exit (1);
}
+#if 0
+ {
+ /*
+ * For testing file families, fool the library into thinking it already
+ * allocated a whole bunch of data.
+ */
+ haddr_t addr;
+ addr.offset = (uint64)1<<33; /*8GB*/
+ H5F_low_seteof (f->shared->lf, &addr);
+ }
+#endif
+
+ /*
+ * By creating a group we cause the library to emit it's debugging
+ * diagnostic messages before we begin testing...
+ */
+ ent = H5G_new (f, "flushing_diagnostics", 0);
+ H5G_close (f, ent);
+ ent = NULL;
+
+
/*
* Creation test: Creates empty objects with various raw data sizes
* and alignments.
@@ -557,7 +614,6 @@ main (int argc, char *argv[])
status = test_extend (f, "extend", 10, 400, 10);
nerrors += status<0 ? 1 : 0;
}
-
if (size_of_test & TEST_SMALL) {
status = test_sparse (f, "sparse", 100, 5, 0, 0);
nerrors += status<0 ? 1 : 0;
@@ -574,6 +630,11 @@ main (int argc, char *argv[])
status = test_sparse (f, "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);
+ nerrors += status<0 ? 1 : 0;
+ }
+
/* Close the test file and exit */
H5F_close (f);