From 077d7c8c864c5452911117ee6b97c855487ff4cd Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Wed, 15 Jul 1998 16:21:15 -0500 Subject: [svn-r511] Changes since 19980715 ---------------------- ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsplit.c Changed the allocation size request from `size_t' to `hsize_t' because it was overflowing for the `big' test. ./src/H5detect.c If `long double' and `double' are the same size then we define H5T_NATIVE_LDOUBLE to be the same as H5T_NATIVE_DOUBLE. Similarly for `long' vs. `long long' and `unsigned long' vs. `unsigned long long'. ./test/Makefile.in Added `big' to the list of tests to normally run. ./test/big.c Added a check to see if the file system supports holes and if it doesn't then the test is skipped. --- README | 2 +- src/H5D.c | 3 +- src/H5Flow.c | 2 +- src/H5Fprivate.h | 4 +- src/H5Fsplit.c | 4 +- src/H5detect.c | 48 ++++++++--- test/.distdep | 46 +++++------ test/Makefile.in | 5 +- test/big.c | 243 ++++++++++++++++++++++++++++++++++++++++++------------- 9 files changed, 257 insertions(+), 100 deletions(-) diff --git a/README b/README index 9fab1e1..e977d9d 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is hdf5-1.0.23a released on 1998-06-15 16:36 UTC +This is hdf5-1.0.23a released on 1998-06-15 18:31 UTC Please refer to the INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/src/H5D.c b/src/H5D.c index eea820c..ac91502 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -821,11 +821,10 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space, * Also, only the slowest varying dimension of a simple data space * can be extendible. */ - if ((ndims=H5S_extent_dims(space, new_dset->layout.dim, max_dim)) < 0) { + if ((ndims=H5S_extent_dims(space, new_dset->layout.dim, max_dim))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize contiguous storage"); } - for (i=1; inew_dset->layout.dim[i]) { HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL, diff --git a/src/H5Flow.c b/src/H5Flow.c index dc4195f..2196341 100644 --- a/src/H5Flow.c +++ b/src/H5Flow.c @@ -545,7 +545,7 @@ H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, */ intn H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold, - size_t size, H5MF_free_t *blk, haddr_t *addr/*out*/) + hsize_t size, H5MF_free_t *blk, haddr_t *addr/*out*/) { intn ret_value = FAIL; hsize_t wasted; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index dd2b5a8..b9d0c59 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -323,7 +323,7 @@ typedef struct H5F_low_class_t { const H5F_access_t *access_parms, intn op, hsize_t size, haddr_t *addr/*out*/); intn (*alloc)(struct H5F_low_t *lf, intn op, hsize_t alignment, - hsize_t threshold, size_t size, H5MF_free_t *blk, + hsize_t threshold, hsize_t size, H5MF_free_t *blk, haddr_t *addr/*out*/); } H5F_low_class_t; @@ -557,7 +557,7 @@ herr_t H5F_low_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, hsize_t size, haddr_t *addr/*out*/); herr_t H5F_low_seteof(H5F_low_t *lf, const haddr_t *addr); intn H5F_low_alloc (H5F_low_t *lf, intn op, hsize_t alignment, - hsize_t threshold, size_t size, H5MF_free_t *blk, + hsize_t threshold, hsize_t size, H5MF_free_t *blk, haddr_t *addr/*out*/); hbool_t H5F_low_access(const H5F_low_class_t *type, const char *name, const H5F_access_t *access_parms, int mode, diff --git a/src/H5Fsplit.c b/src/H5Fsplit.c index 6e87192..c49d2e0 100644 --- a/src/H5Fsplit.c +++ b/src/H5Fsplit.c @@ -44,7 +44,7 @@ static herr_t H5F_split_flush(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, hsize_t size, haddr_t *addr/*out*/); static intn H5F_split_alloc (H5F_low_t *lf, intn op, hsize_t alignment, - hsize_t threshold, size_t size, H5MF_free_t *blk, + hsize_t threshold, hsize_t size, H5MF_free_t *blk, haddr_t *addr/*out*/); const H5F_low_class_t H5F_LOW_SPLIT_g[1] = {{ @@ -487,7 +487,7 @@ H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, */ static intn H5F_split_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold, - size_t size, H5MF_free_t *blk, haddr_t *addr/*out*/) + hsize_t size, H5MF_free_t *blk, haddr_t *addr/*out*/) { intn ret_value = FAIL; hsize_t wasted; diff --git a/src/H5detect.c b/src/H5detect.c index 9e07688..7398cc1 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -937,19 +937,41 @@ main(void) print_header(); - DETECT_I (signed char, CHAR, d[nd]); nd++; - DETECT_I (unsigned char, UCHAR, d[nd]); nd++; - DETECT_I (short, SHORT, d[nd]); nd++; - DETECT_I (unsigned short, USHORT, d[nd]); nd++; - DETECT_I (int, INT, d[nd]); nd++; - DETECT_I (unsigned int, UINT, d[nd]); nd++; - DETECT_I (long, LONG, d[nd]); nd++; - DETECT_I (unsigned long, ULONG, d[nd]); nd++; - DETECT_I (long long, LLONG, d[nd]); nd++; - DETECT_I (unsigned long long, ULLONG, d[nd]); nd++; - DETECT_F (float, FLOAT, d[nd]); nd++; - DETECT_F (double, DOUBLE, d[nd]); nd++; - DETECT_F (long double, LDOUBLE, d[nd]); nd++; + DETECT_I(signed char, CHAR, d[nd]); nd++; + DETECT_I(unsigned char, UCHAR, d[nd]); nd++; + DETECT_I(short, SHORT, d[nd]); nd++; + DETECT_I(unsigned short, USHORT, d[nd]); nd++; + DETECT_I(int, INT, d[nd]); nd++; + DETECT_I(unsigned int, UINT, d[nd]); nd++; + DETECT_I(long, LONG, d[nd]); nd++; + DETECT_I(unsigned long, ULONG, d[nd]); nd++; + +#if SIZEOF_LONG == SIZEOF_LONG_LONG + /* + * If sizeof(long)==sizeof(long long) then assume that `long long' isn't + * supported and use `long' instead. This suppresses warnings on some + * systems. + */ + DETECT_I(long, LLONG, d[nd]); nd++; + DETECT_I(unsigned long, ULLONG, d[nd]); dn++; +#else + DETECT_I(long long, LLONG, d[nd]); nd++; + DETECT_I(unsigned long long, ULLONG, d[nd]); nd++; +#endif + + DETECT_F(float, FLOAT, d[nd]); nd++; + DETECT_F(double, DOUBLE, d[nd]); nd++; + +#if SIZEOF_DOUBLE == SIZEOF_LONG_DOUBLE + /* + * If sizeof(double)==sizeof(long double) then assume that `long double' + * isn't supported and use `double' instead. This suppresses warnings on + * some systems. + */ + DETECT_F(double, LDOUBLE, d[nd]); nd++; +#else + DETECT_F(long double, LDOUBLE, d[nd]); nd++; +#endif print_results (nd, d); return 0; diff --git a/test/.distdep b/test/.distdep index c348692..36186c3 100644 --- a/test/.distdep +++ b/test/.distdep @@ -283,29 +283,6 @@ shtype.o: \ ../src/H5Ppublic.h \ ../src/H5Zpublic.h \ ../src/H5Spublic.h -big.o: \ - big.c \ - ../src/hdf5.h \ - ../src/H5public.h \ - ../src/H5config.h \ - ../src/H5Ipublic.h \ - ../src/H5Apublic.h \ - ../src/H5ACpublic.h \ - ../src/H5Bpublic.h \ - ../src/H5Dpublic.h \ - ../src/H5Epublic.h \ - ../src/H5Fpublic.h \ - ../src/H5Gpublic.h \ - ../src/H5HGpublic.h \ - ../src/H5HLpublic.h \ - ../src/H5MFpublic.h \ - ../src/H5MMpublic.h \ - ../src/H5Opublic.h \ - ../src/H5Ppublic.h \ - ../src/H5Zpublic.h \ - ../src/H5Spublic.h \ - ../src/H5Tpublic.h \ - ../src/H5private.h links.o: \ links.c \ ../src/hdf5.h \ @@ -470,3 +447,26 @@ dsets.o: \ ../src/H5Zpublic.h \ ../src/H5Spublic.h \ ../src/H5Tpublic.h +big.o: \ + big.c \ + ../src/hdf5.h \ + ../src/H5public.h \ + ../src/H5config.h \ + ../src/H5Ipublic.h \ + ../src/H5Apublic.h \ + ../src/H5ACpublic.h \ + ../src/H5Bpublic.h \ + ../src/H5Dpublic.h \ + ../src/H5Epublic.h \ + ../src/H5Fpublic.h \ + ../src/H5Gpublic.h \ + ../src/H5HGpublic.h \ + ../src/H5HLpublic.h \ + ../src/H5MFpublic.h \ + ../src/H5MMpublic.h \ + ../src/H5Opublic.h \ + ../src/H5Ppublic.h \ + ../src/H5Zpublic.h \ + ../src/H5Spublic.h \ + ../src/H5Tpublic.h \ + ../src/H5private.h diff --git a/test/Makefile.in b/test/Makefile.in index d3aa02f..7c64e6e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -12,7 +12,7 @@ CPPFLAGS=-I. -I../src @CPPFLAGS@ # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. TESTS=testhdf5 gheap hyperslab istore bittests dtypes dsets cmpd_dset extend \ - external shtype links + external shtype links big TIMINGS=iopipe chunk # Temporary files @@ -22,7 +22,8 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \ extern_2.raw extern_2b.raw extern_3.raw extern_3b.raw \ extern_4.raw extern_4b.raw iopipe.raw iopipe.h5 gheap0.h5 \ gheap1.h5 gheap2.h5 gheap3.h5 gheap4.h5 shtype0.h5 shtype1.h5 \ - shtype2a.h5 shtype2b.h5 shtype3.h5 links.h5 chunk.h5 + shtype2a.h5 shtype2b.h5 shtype3.h5 links.h5 chunk.h5 big.data \ + big[0-9][0-9][0-9][0-9][0-9].h5 # Source and object files for programs... The TEST_SRC list contains all the # source files and is used for things like dependencies, archiving, etc. The diff --git a/test/big.c b/test/big.c index 6dd72bb..c5aadd6 100644 --- a/test/big.c +++ b/test/big.c @@ -7,16 +7,21 @@ */ #include #include +#include #include #include +#include #include +#include #include /*needed for HDfprintf() */ #define FNAME "big%05d.h5" +#define DNAME "big.data" #define WRT_N 50 #define WRT_SIZE 4*1024 #define FAMILY_SIZE 1024*1024*1024 +#define GB8LL ((unsigned long long)8*1024*1024*1024) static hsize_t randll (hsize_t limit) @@ -27,35 +32,97 @@ randll (hsize_t limit) return acc % limit; } + +/*------------------------------------------------------------------------- + * Function: display_error_cb + * + * Purpose: Displays the error stack after printing "*FAILED*". + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Wednesday, March 4, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +display_error_cb (void __unused__ *client_data) +{ + puts ("*FAILED*"); + H5Eprint (stdout); + return 0; +} /*------------------------------------------------------------------------- - * Function: main + * Function: is_sparse + * + * Purpose: Determines if the file system of the current working + * directory supports holes. + * + * Return: Success: Non-zero if holes are supported; zero + * otherwise. + * + * Failure: zero + * + * Programmer: Robb Matzke + * Wednesday, July 15, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +is_sparse(void) +{ + int fd; + struct stat sb; + + if ((fd=open("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0; + if (lseek(fd, 1024*1024, SEEK_SET)!=1024*1024) return 0; + if (5!=write(fd, "hello", 5)) return 0; + if (stat("x.h5", &sb)<0) return 0; + if (unlink("x.h5")<0) return 0; + return (sb.st_blocks*512 < (unsigned)sb.st_size); +} + + +/*------------------------------------------------------------------------- + * Function: writer * * Purpose: Creates a *big* dataset. * - * Return: Success: + * Return: Success: 0 * - * Failure: + * Failure: >0 * * Programmer: Robb Matzke * Wednesday, April 8, 1998 * * Modifications: + * Robb Matzke, 15 Jul 1998 + * Addresses are written to the file DNAME instead of stdout. * *------------------------------------------------------------------------- */ -static void +static int writer (int wrt_n) { hsize_t size1[4] = {8, 1024, 1024, 1024}; - hsize_t size2[1] = {8589934592LL}; + hsize_t size2[1] = {GB8LL}; hssize_t hs_start[1]; hsize_t hs_size[1]; hid_t plist, file, space1, space2, mem_space, d1, d2; int *buf = malloc (sizeof(int) * WRT_SIZE); int i, j; + FILE *out = fopen(DNAME, "w"); + printf("%-70s", "Writing large dataset"); + /* * Make sure that `hsize_t' is large enough to represent the entire data * space. @@ -66,39 +133,53 @@ writer (int wrt_n) * We might be on a machine that has 32-bit files, so create an HDF5 file * which is a family of files. Each member of the family will be 1GB */ - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_family (plist, FAMILY_SIZE, H5P_DEFAULT); + if ((plist = H5Pcreate (H5P_FILE_ACCESS))<0) goto error; + if (H5Pset_family (plist, FAMILY_SIZE, H5P_DEFAULT)<0) goto error; file = H5Fcreate (FNAME, H5F_ACC_TRUNC|H5F_ACC_DEBUG, H5P_DEFAULT, plist); - H5Pclose (plist); + if (file<0) goto error; + if (H5Pclose (plist)<0) goto error; /* Create simple data spaces according to the size specified above. */ - space1 = H5Screate_simple (4, size1, size1); - space2 = H5Screate_simple (1, size2, size2); - + if ((space1 = H5Screate_simple (4, size1, size1))<0 || + (space2 = H5Screate_simple (1, size2, size2))<0) { + goto error; + } + /* Create the datasets */ - d1 = H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT); - d2 = H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT); + if ((d1=H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT))<0 || + (d2=H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT))<0) { + goto error; + } + /* Write some things to them randomly */ hs_size[0] = WRT_SIZE; - mem_space = H5Screate_simple (1, hs_size, hs_size); + if ((mem_space = H5Screate_simple (1, hs_size, hs_size))<0) goto error; for (i=0; i0 * * Programmer: Robb Matzke * Friday, April 10, 1998 @@ -116,43 +199,48 @@ writer (int wrt_n) * *------------------------------------------------------------------------- */ -static void -reader (const char *script_name) +static int +reader (void) { FILE *script; hid_t plist, file, mspace, fspace, d2; - char ln[64], *s; + char ln[128], *s; hssize_t hs_offset[1]; hsize_t hs_size[1] = {WRT_SIZE}; int *buf = malloc (sizeof(int) * WRT_SIZE); - int i, j, zero, wrong; + int i, j, zero, wrong, nerrors=0; /* Open script file */ - script = fopen (script_name, "r"); + script = fopen (DNAME, "r"); /* Open HDF5 file */ - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_family (plist, FAMILY_SIZE, H5P_DEFAULT); - file = H5Fopen (FNAME, H5F_ACC_RDONLY|H5F_ACC_DEBUG, plist); - H5Pclose (plist); + if ((plist = H5Pcreate (H5P_FILE_ACCESS))<0) goto error; + if (H5Pset_family (plist, FAMILY_SIZE, H5P_DEFAULT)<0) goto error; + if ((file = H5Fopen (FNAME, H5F_ACC_RDONLY|H5F_ACC_DEBUG, plist))<0) { + goto error; + } + if (H5Pclose (plist)<0) goto error; /* Open the dataset */ - d2 = H5Dopen (file, "d2"); - fspace = H5Dget_space (d2); + if ((d2 = H5Dopen (file, "d2"))<0) goto error; + if ((fspace = H5Dget_space (d2))<0) goto error; /* Describe `buf' */ - mspace = H5Screate_simple (1, hs_size, hs_size); + if ((mspace = H5Screate_simple (1, hs_size, hs_size))<0) goto error; /* Read each region */ while (fgets (ln, sizeof(ln), script)) { if ('#'!=ln[0]) break; i = (int)strtol (ln+1, &s, 10); hs_offset[0] = HDstrtoll (s, NULL, 0); - HDfprintf (stdout, "#%03d 0x%016Hx", i, hs_offset[0]); + HDfprintf (stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); fflush (stdout); - H5Sselect_hyperslab (fspace, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); - H5Dread (d2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf); + if (H5Sselect_hyperslab (fspace, H5S_SELECT_SET, hs_offset, NULL, + hs_size, NULL)<0) goto error; + if (H5Dread (d2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf)<0) { + goto error; + } /* Check */ for (j=zero=wrong=0; j0) exit(nerrors); + nerrors = reader(); + cleanup(); + return nerrors; } -- cgit v0.12