hdf5/test/hyperslab.c

1401 lines
50 KiB
C
Raw Normal View History

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Programmer: Robb Matzke
2018-02-15 00:08:09 +08:00
* Friday, October 10, 1997
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Hyperslab operations are rather complex, so this file
* attempts to test them extensively so we can be relatively
* sure they really work. We only test 1d, 2d, and 3d cases
* because testing general dimensionalities would require us to
* rewrite much of the hyperslab stuff.
1997-10-21 07:22:19 +08:00
*/
#include "h5test.h"
#include "H5VMprivate.h"
1997-10-21 07:22:19 +08:00
2020-09-30 22:27:10 +08:00
#define TEST_SMALL 0x0001
#define TEST_MEDIUM 0x0002
1997-10-21 07:22:19 +08:00
2020-09-30 22:27:10 +08:00
#define VARIABLE_SRC 0
#define VARIABLE_DST 1
#define VARIABLE_BOTH 2
2020-09-30 22:27:10 +08:00
#define ARRAY_FILL_SIZE 4
#define ARRAY_OFFSET_NDIMS 3
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: init_full
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Initialize full array.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: void
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Friday, October 10, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static unsigned
[svn-r925] Changes since 19981116 ---------------------- ./INSTALL.parallel [NEW] We're beginning to unify some of the parallel installation steps. This file will contain general information for installing the parallel library. It's not complete yet. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Check for xdr_int() in libnsl required on Solaris when linking with hdf4. It's found on the Irix system I tested which complains that `-lnsl' didn't resolve any symbols. Oh well. Fixed the order of searching for libdf and libmfhdf for hdf4 linking. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5Z.c Check for compress() in libz in order to find older versions of the library that will still work for hdf4. Added a separate check for compress2() that hdf5 will use. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5R.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./test/bittests.c ./test/gheap.c ./test/hyperslab.c ./test/istore.c ./test/tmeta.c ./test/trefer.c ./test/tselect.c ./tools/h5debug.c ./tools/h5tols.c Added checks for Posix.1g types like `int8_t'. If not defined then H5private.h defines them. Changed all `int8' etc. to `int8_t'. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Calling H5*_term_interface() resets interface_initialize_g to FALSE so a subsequent call to H5open() (implied or explicit) reinitializes global variables properly. ./src/H5private.h ./src/H5Oefl.c ./src/H5S.c Changed MAX_SIZET, MAX_SSIZET, MAX_HSIZET, and MAX_HSSIZET to SIZET_MAX, SSIZET_MAX, HSIZET_MAX, and HSSIZE_MAX to they match the Posix.1 constants in <limits.h>. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5detect.c Added 36 more integer hardware conversion functions to the type conversion table for conversions to/from `long long' and `unsigned long long'. The `long long' names will be changed shortly to make them portable to Win32. Changed H5T_init() to H5T_native_open() and added an H5T_native_close() to open and close the predefined native data types. Increased the initial size of the type conversion table from 64 to 128 entries. Reordered the 90 new integer conversion functions so the names that are printed favor `int' over `short' or `long' when two of them are the same. ./test/dtypes.c Added hardware and software integer conversion tests for the 56 functions I added recently but not the additional 36 checked in this time. That will come next. Call H5close() after each test so type conversion statistics are easier to follow. Try this: $ HDF5_DEBUG=t ./dtypes Added more debugging output for when things go wrong. ./src/H5private.h Removed trailing carriage-returns inserted by broken operating system ;-)
1998-11-19 02:40:09 +08:00
init_full(uint8_t *array, size_t nx, size_t ny, size_t nz)
1997-10-21 07:22:19 +08:00
{
2020-09-30 22:27:10 +08:00
uint8_t acc = 128;
unsigned total = 0;
size_t i, j, k;
for (i = 0; i < nx; i++)
for (j = 0; j < ny; j++)
for (k = 0; k < nz; k++) {
total += acc;
*array = acc;
acc++;
array++;
} /* end for */
return total;
} /* end init_full() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: print_array
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Prints the values in an array
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: void
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Friday, October 10, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static void
[svn-r925] Changes since 19981116 ---------------------- ./INSTALL.parallel [NEW] We're beginning to unify some of the parallel installation steps. This file will contain general information for installing the parallel library. It's not complete yet. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Check for xdr_int() in libnsl required on Solaris when linking with hdf4. It's found on the Irix system I tested which complains that `-lnsl' didn't resolve any symbols. Oh well. Fixed the order of searching for libdf and libmfhdf for hdf4 linking. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5Z.c Check for compress() in libz in order to find older versions of the library that will still work for hdf4. Added a separate check for compress2() that hdf5 will use. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5R.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./test/bittests.c ./test/gheap.c ./test/hyperslab.c ./test/istore.c ./test/tmeta.c ./test/trefer.c ./test/tselect.c ./tools/h5debug.c ./tools/h5tols.c Added checks for Posix.1g types like `int8_t'. If not defined then H5private.h defines them. Changed all `int8' etc. to `int8_t'. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Calling H5*_term_interface() resets interface_initialize_g to FALSE so a subsequent call to H5open() (implied or explicit) reinitializes global variables properly. ./src/H5private.h ./src/H5Oefl.c ./src/H5S.c Changed MAX_SIZET, MAX_SSIZET, MAX_HSIZET, and MAX_HSSIZET to SIZET_MAX, SSIZET_MAX, HSIZET_MAX, and HSSIZE_MAX to they match the Posix.1 constants in <limits.h>. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5detect.c Added 36 more integer hardware conversion functions to the type conversion table for conversions to/from `long long' and `unsigned long long'. The `long long' names will be changed shortly to make them portable to Win32. Changed H5T_init() to H5T_native_open() and added an H5T_native_close() to open and close the predefined native data types. Increased the initial size of the type conversion table from 64 to 128 entries. Reordered the 90 new integer conversion functions so the names that are printed favor `int' over `short' or `long' when two of them are the same. ./test/dtypes.c Added hardware and software integer conversion tests for the 56 functions I added recently but not the additional 36 checked in this time. That will come next. Call H5close() after each test so type conversion statistics are easier to follow. Try this: $ HDF5_DEBUG=t ./dtypes Added more debugging output for when things go wrong. ./src/H5private.h Removed trailing carriage-returns inserted by broken operating system ;-)
1998-11-19 02:40:09 +08:00
print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
1997-10-21 07:22:19 +08:00
{
2020-09-30 22:27:10 +08:00
size_t i, j, k;
for (i = 0; i < nx; i++) {
if (nz > 1)
HDprintf("i=%lu:\n", (unsigned long)i);
else
HDprintf("%03lu:", (unsigned long)i);
for (j = 0; j < ny; j++) {
if (nz > 1)
HDprintf("%03lu:", (unsigned long)j);
for (k = 0; k < nz; k++)
HDprintf(" %3d", *array++);
if (nz > 1)
HDprintf("\n");
} /* end for */
2019-08-16 05:46:00 +08:00
HDprintf("\n");
2018-02-15 00:08:09 +08:00
} /* end for */
} /* end print_array() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: print_ref
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Prints the reference value
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: Success: 0
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Failure:
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Friday, October 10, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static void
print_ref(size_t nx, size_t ny, size_t nz)
1997-10-21 07:22:19 +08:00
{
uint8_t *array;
1997-10-21 07:22:19 +08:00
2020-09-30 22:27:10 +08:00
if (NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) {
2019-08-16 05:46:00 +08:00
HDprintf("Reference array:\n");
init_full(array, nx, ny, nz);
print_array(array, nx, ny, nz);
HDfree(array);
} /* end if */
} /* end print_ref() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_fill
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Tests the H5VM_hyper_fill() function.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Saturday, October 11, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static herr_t
2020-09-30 22:27:10 +08:00
test_fill(size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size_t ddx, size_t ddy,
size_t ddz)
1997-10-21 07:22:19 +08:00
{
2020-09-30 22:27:10 +08:00
uint8_t *dst = NULL; /*destination array */
hsize_t hs_size[3]; /*hyperslab size */
hsize_t dst_size[3]; /*destination total size */
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
unsigned ref_value; /*reference value */
unsigned acc; /*accumulator */
size_t i, j, k, dx, dy, dz; /*counters */
size_t u, v, w;
unsigned ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
unsigned fill_value; /*fill value */
/*
* Dimensionality.
*/
2020-09-30 22:27:10 +08:00
if (0 == nz) {
if (0 == ny) {
ndims = 1;
ny = nz = 1;
HDsnprintf(dim, sizeof(dim), "%lu", (unsigned long)nx);
} /* end if */
else {
ndims = 2;
2020-09-30 22:27:10 +08:00
nz = 1;
HDsnprintf(dim, sizeof(dim), "%lux%lu", (unsigned long)nx, (unsigned long)ny);
} /* end else */
2020-09-30 22:27:10 +08:00
} /* end if */
else {
ndims = 3;
HDsnprintf(dim, sizeof(dim), "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
} /* end else */
HDsnprintf(s, sizeof(s), "Testing hyperslab fill %-11s variable hyperslab", dim);
2019-08-16 05:46:00 +08:00
HDprintf("%-70s", s);
HDfflush(stdout);
/* Allocate array */
2020-09-30 22:27:10 +08:00
if (NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR;
2018-02-15 00:08:09 +08:00
init_full(dst, nx, ny, nz);
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i += di) {
for (j = 0; j < ny; j += dj) {
for (k = 0; k < nz; k += dk) {
for (dx = 1; dx <= nx - i; dx += ddx) {
for (dy = 1; dy <= ny - j; dy += ddy) {
for (dz = 1; dz <= nz - k; dz += ddz) {
/* Describe the hyperslab */
2020-09-30 22:27:10 +08:00
dst_size[0] = nx;
dst_size[1] = ny;
dst_size[2] = nz;
dst_offset[0] = i;
dst_offset[1] = j;
dst_offset[2] = k;
2020-09-30 22:27:10 +08:00
hs_size[0] = dx;
hs_size[1] = dy;
hs_size[2] = dz;
2020-09-30 22:27:10 +08:00
for (fill_value = 0; fill_value < 256; fill_value += 64) {
/*
* Initialize the full array, then subtract the
* original * fill values and add the new ones.
*/
ref_value = init_full(dst, nx, ny, nz);
2020-09-30 22:27:10 +08:00
for (u = (size_t)dst_offset[0]; u < dst_offset[0] + dx; u++)
for (v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++)
for (w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++)
ref_value -= dst[u * ny * nz + v * nz + w];
ref_value += fill_value * (unsigned)dx * (unsigned)dy * (unsigned)dz;
/* Fill the hyperslab with some value */
H5VM_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value);
/*
* Sum the array and compare it to the
* reference value.
*/
acc = 0;
2020-09-30 22:27:10 +08:00
for (u = 0; u < nx; u++)
for (v = 0; v < ny; v++)
for (w = 0; w < nz; w++)
acc += dst[u * ny * nz + v * nz + w];
2020-09-30 22:27:10 +08:00
if (acc != ref_value) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
/*
* Print debugging info unless output
* is going directly to a terminal.
*/
AT();
2019-08-16 05:46:00 +08:00
HDprintf(" acc != ref_value\n");
HDprintf(" i=%lu, j=%lu, k=%lu, "
2020-09-30 22:27:10 +08:00
"dx=%lu, dy=%lu, dz=%lu, "
"fill=%d\n",
(unsigned long)i, (unsigned long)j, (unsigned long)k,
(unsigned long)dx, (unsigned long)dy, (unsigned long)dz,
fill_value);
print_ref(nx, ny, nz);
2019-08-16 05:46:00 +08:00
HDprintf("\n Result is:\n");
print_array(dst, nx, ny, nz);
} /* end if */
goto error;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
} /* end for */
} /* end for */
} /* end for */
} /* end for */
} /* end for */
} /* end for */
PASSED();
HDfree(dst);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (dst)
HDfree(dst);
return FAIL;
} /* end test_fill() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_copy
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Tests H5VM_hyper_copy().
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* The NX, NY, and NZ arguments are the size for the source and
* destination arrays. You may pass zero for NZ or for NY and
* NZ to test the 2-d and 1-d cases respectively.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* A hyperslab is copied from/to (depending on MODE) various
* places in SRC and DST beginning at 0,0,0 and increasing
* location by DI,DJ,DK in the x, y, and z directions.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* For each hyperslab location, various sizes of hyperslabs are
* tried beginning with 1x1x1 and increasing the size in each
* dimension by DDX,DDY,DDZ.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Friday, October 10, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static herr_t
2020-09-30 22:27:10 +08:00
test_copy(int mode, size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size_t ddx, size_t ddy,
size_t ddz)
1997-10-21 07:22:19 +08:00
{
uint8_t *src = NULL; /*source array */
uint8_t *dst = NULL; /*destination array */
2020-09-30 22:27:10 +08:00
hsize_t hs_size[3]; /*hyperslab size */
hsize_t dst_size[3]; /*destination total size */
hsize_t src_size[3]; /*source total size */
hsize_t dst_offset[3]; /*offset of hyperslab in dest */
hsize_t src_offset[3]; /*offset of hyperslab in source */
unsigned ref_value; /*reference value */
unsigned acc; /*accumulator */
2018-02-15 00:08:09 +08:00
hsize_t i, j, k, dx, dy, dz; /*counters */
hsize_t u, v, w;
2020-09-30 22:27:10 +08:00
unsigned ndims; /*hyperslab dimensionality */
2018-02-15 00:08:09 +08:00
char dim[64], s[256]; /*temp string */
const char *sub;
/*
* Dimensionality.
*/
2020-09-30 22:27:10 +08:00
if (0 == nz) {
if (0 == ny) {
ndims = 1;
ny = nz = 1;
HDsnprintf(dim, sizeof(dim), "%lu", (unsigned long)nx);
} /* end if */
else {
ndims = 2;
2020-09-30 22:27:10 +08:00
nz = 1;
HDsnprintf(dim, sizeof(dim), "%lux%lu", (unsigned long)nx, (unsigned long)ny);
} /* end else */
2020-09-30 22:27:10 +08:00
} /* end if */
else {
ndims = 3;
HDsnprintf(dim, sizeof(dim), "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz);
} /* end else */
2020-09-30 22:27:10 +08:00
switch (mode) {
case VARIABLE_SRC:
/*
* The hyperslab "travels" through the source array but the
* destination hyperslab is always at the origin of the destination
* array.
*/
sub = "variable source";
break;
case VARIABLE_DST:
/*
* We always read a hyperslab from the origin of the source and copy it
* to a hyperslab at various locations in the destination.
*/
sub = "variable destination";
break;
case VARIABLE_BOTH:
/*
* We read the hyperslab from various locations in the source and copy
* it to the same location in the destination.
*/
sub = "sync source & dest ";
break;
default:
HDabort();
} /* end switch */
HDsnprintf(s, sizeof(s), "Testing hyperslab copy %-11s %s", dim, sub);
2019-08-16 05:46:00 +08:00
HDprintf("%-70s", s);
HDfflush(stdout);
/*
* Allocate arrays
*/
2020-09-30 22:27:10 +08:00
if (NULL == (src = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
if (NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz)))
TEST_ERROR;
init_full(src, nx, ny, nz);
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i += di) {
for (j = 0; j < ny; j += dj) {
for (k = 0; k < nz; k += dk) {
for (dx = 1; dx <= nx - i; dx += ddx) {
for (dy = 1; dy <= ny - j; dy += ddy) {
for (dz = 1; dz <= nz - k; dz += ddz) {
/*
* Describe the source and destination hyperslabs
* and the arrays to which they belong.
*/
2020-09-30 22:27:10 +08:00
hs_size[0] = dx;
hs_size[1] = dy;
hs_size[2] = dz;
dst_size[0] = src_size[0] = nx;
dst_size[1] = src_size[1] = ny;
dst_size[2] = src_size[2] = nz;
2020-09-30 22:27:10 +08:00
switch (mode) {
case VARIABLE_SRC:
dst_offset[0] = 0;
dst_offset[1] = 0;
dst_offset[2] = 0;
src_offset[0] = i;
src_offset[1] = j;
src_offset[2] = k;
break;
case VARIABLE_DST:
dst_offset[0] = i;
dst_offset[1] = j;
dst_offset[2] = k;
src_offset[0] = 0;
src_offset[1] = 0;
src_offset[2] = 0;
break;
case VARIABLE_BOTH:
dst_offset[0] = i;
dst_offset[1] = j;
dst_offset[2] = k;
src_offset[0] = i;
src_offset[1] = j;
src_offset[2] = k;
break;
default:
HDabort();
} /* end switch */
/*
* Sum the main array directly to get a reference
* value to compare against later.
*/
ref_value = 0;
2020-09-30 22:27:10 +08:00
for (u = src_offset[0]; u < src_offset[0] + dx; u++)
for (v = src_offset[1]; v < src_offset[1] + dy; v++)
for (w = src_offset[2]; w < src_offset[2] + dz; w++)
ref_value += src[u * ny * nz + v * nz + w];
/*
* Set all loc values to 1 so we can detect writing
* outside the hyperslab.
*/
2020-09-30 22:27:10 +08:00
for (u = 0; u < nx; u++)
for (v = 0; v < ny; v++)
for (w = 0; w < nz; w++)
dst[u * ny * nz + v * nz + w] = 1;
/*
* Copy a hyperslab from the global array to the
* local array.
*/
2020-09-30 22:27:10 +08:00
H5VM_hyper_copy(ndims, hs_size, dst_size, dst_offset, dst, src_size, src_offset,
src);
/*
* Sum the destination hyperslab. It should be
* the same as the reference value.
*/
acc = 0;
2020-09-30 22:27:10 +08:00
for (u = dst_offset[0]; u < dst_offset[0] + dx; u++)
for (v = dst_offset[1]; v < dst_offset[1] + dy; v++)
for (w = dst_offset[2]; w < dst_offset[2] + dz; w++)
acc += dst[u * ny * nz + v * nz + w];
2020-09-30 22:27:10 +08:00
if (acc != ref_value) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
/*
* Print debugging info unless output is
* going directly to a terminal.
*/
AT();
2019-08-16 05:46:00 +08:00
HDprintf(" acc != ref_value\n");
HDprintf(" i=%lu, j=%lu, k=%lu, "
2020-09-30 22:27:10 +08:00
"dx=%lu, dy=%lu, dz=%lu\n",
(unsigned long)i, (unsigned long)j, (unsigned long)k,
(unsigned long)dx, (unsigned long)dy, (unsigned long)dz);
print_ref(nx, ny, nz);
2019-08-16 05:46:00 +08:00
HDprintf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
} /* end if */
goto error;
} /* end if */
/*
* Sum the entire array. It should be a fixed
* amount larger than the reference value since
* we added the border of 1's to the hyperslab.
*/
acc = 0;
2020-09-30 22:27:10 +08:00
for (u = 0; u < nx; u++)
for (v = 0; v < ny; v++)
for (w = 0; w < nz; w++)
acc += dst[u * ny * nz + v * nz + w];
/*
* The following casts are to work around an
* optimization bug in the Mongoose 7.20 Irix64
* compiler.
*/
2020-09-30 22:27:10 +08:00
if (acc + (unsigned)dx * (unsigned)dy * (unsigned)dz !=
ref_value + nx * ny * nz) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
/*
* Print debugging info unless output is
* going directly to a terminal.
*/
AT();
2019-08-16 05:46:00 +08:00
HDprintf(" acc != ref_value + nx*ny*nz - "
2020-09-30 22:27:10 +08:00
"dx*dy*dz\n");
2019-08-16 05:46:00 +08:00
HDprintf(" i=%lu, j=%lu, k=%lu, "
2020-09-30 22:27:10 +08:00
"dx=%lu, dy=%lu, dz=%lu\n",
(unsigned long)i, (unsigned long)j, (unsigned long)k,
(unsigned long)dx, (unsigned long)dy, (unsigned long)dz);
print_ref(nx, ny, nz);
2019-08-16 05:46:00 +08:00
HDprintf("\n Destination array is:\n");
print_array(dst, nx, ny, nz);
} /* end if */
goto error;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
} /* end for */
} /* end for */
} /* end for */
} /* end for */
} /* end for */
PASSED();
HDfree(src);
HDfree(dst);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (src)
HDfree(src);
2020-09-30 22:27:10 +08:00
if (dst)
HDfree(dst);
return FAIL;
} /* end test_copy() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_multifill
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Tests the H5VM_stride_copy() function by using it to fill a
* hyperslab by replicating a multi-byte sequence. This might
* be useful to initialize an array of structs with a default
* struct value, or to initialize an array of floating-point
* values with a default bit-pattern.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Saturday, October 11, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static herr_t
test_multifill(size_t nx)
1997-10-21 07:22:19 +08:00
{
2020-09-30 22:27:10 +08:00
hsize_t size;
hsize_t src_stride;
hsize_t dst_stride;
char s[64];
struct a_struct {
2020-09-30 22:27:10 +08:00
int left;
double mid;
2020-09-30 22:27:10 +08:00
int right;
} fill, *src = NULL, *dst = NULL;
2020-09-30 22:27:10 +08:00
hsize_t i, j;
2019-08-16 05:46:00 +08:00
HDprintf("%-70s", "Testing multi-byte fill value");
HDfflush(stdout);
/* Initialize the source and destination */
2020-09-30 22:27:10 +08:00
if (NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src))))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
if (NULL == (dst = (struct a_struct *)HDmalloc(nx * sizeof(*dst))))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++) {
src[i].left = 1111111;
src[i].mid = 12345.6789;
src[i].right = 2222222;
2020-09-30 22:27:10 +08:00
dst[i].left = 3333333;
dst[i].mid = 98765.4321;
dst[i].right = 4444444;
} /* end for */
/*
2018-02-15 00:08:09 +08:00
* Describe the fill value. The zero stride says to read the same thing
* over and over again.
*/
2020-09-30 22:27:10 +08:00
fill.left = 55555555;
fill.mid = 3.1415927;
fill.right = 66666666;
src_stride = 0;
/*
* The destination stride says to fill in one value per array element
*/
dst_stride = sizeof(fill);
/*
* Copy the fill value into each element
*/
size = nx;
2020-09-30 22:27:10 +08:00
H5VM_stride_copy(1, (hsize_t)sizeof(double), &size, &dst_stride, &(dst[0].mid), &src_stride, &(fill.mid));
/*
* Check
*/
s[0] = '\0';
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++) {
if (dst[i].left != 3333333)
HDsnprintf(s, sizeof(s), "bad dst[%lu].left", (unsigned long)i);
2020-09-30 22:27:10 +08:00
else if (!H5_DBL_ABS_EQUAL(dst[i].mid, fill.mid))
/* Check if two DOUBLE values are equal. If their difference
* is smaller than the EPSILON value for double, they are
* considered equal. See the definition in h5test.h.
*/
HDsnprintf(s, sizeof(s), "bad dst[%lu].mid", (unsigned long)i);
2020-09-30 22:27:10 +08:00
else if (dst[i].right != 4444444)
HDsnprintf(s, sizeof(s), "bad dst[%lu].right", (unsigned long)i);
2020-09-30 22:27:10 +08:00
if (s[0]) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
AT();
2020-09-30 22:27:10 +08:00
HDprintf(" fill={%d,%g,%d}\n ", fill.left, fill.mid, fill.right);
for (j = 0; j < sizeof(fill); j++)
2019-08-16 05:46:00 +08:00
HDprintf(" %02x", ((uint8_t *)&fill)[j]);
2020-09-30 22:27:10 +08:00
HDprintf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i, dst[i].left, dst[i].mid,
dst[i].right);
for (j = 0; j < sizeof(dst[i]); j++)
2019-08-16 05:46:00 +08:00
HDprintf(" %02x", ((uint8_t *)(dst + i))[j]);
HDprintf("\n");
} /* end if */
goto error;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
PASSED();
HDfree(src);
HDfree(dst);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (src)
HDfree(src);
2020-09-30 22:27:10 +08:00
if (dst)
HDfree(dst);
return FAIL;
} /* end test_multifill() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_endian
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Tests the H5VM_stride_copy() function by using it to copy an
* array of integers and swap the byte ordering from little
* endian to big endian or vice versa depending on the hardware.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Saturday, October 11, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static herr_t
test_endian(size_t nx)
1997-10-21 07:22:19 +08:00
{
2020-09-30 22:27:10 +08:00
uint8_t *src = NULL; /*source array */
uint8_t *dst = NULL; /*destination array */
hssize_t src_stride[2]; /*source strides */
hssize_t dst_stride[2]; /*destination strides */
hsize_t size[2]; /*size vector */
hsize_t i, j;
2019-08-16 05:46:00 +08:00
HDprintf("%-70s", "Testing endian conversion by stride");
HDfflush(stdout);
/* Initialize arrays */
2020-09-30 22:27:10 +08:00
if (NULL == (src = (uint8_t *)HDmalloc(nx * 4)))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
if (NULL == (dst = (uint8_t *)HDcalloc(nx, (size_t)4)))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
init_full(src, nx, (size_t)4, (size_t)1);
/* Initialize strides */
src_stride[0] = 0;
src_stride[1] = 1;
dst_stride[0] = 8;
dst_stride[1] = -1;
2020-09-30 22:27:10 +08:00
size[0] = nx;
size[1] = 4;
/* Copy the array */
H5VM_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src);
/* Compare */
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++) {
for (j = 0; j < 4; j++) {
if (src[i * 4 + j] != dst[i * 4 + 3 - j]) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
/*
* Print debugging info unless output is going directly
* to a terminal.
*/
AT();
2019-08-16 05:46:00 +08:00
HDprintf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j);
HDprintf(" Source array is:\n");
print_array(src, nx, (size_t)4, (size_t)1);
2019-08-16 05:46:00 +08:00
HDprintf("\n Result is:\n");
print_array(dst, nx, (size_t)4, (size_t)1);
} /* end if */
goto error;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
} /* end for */
PASSED();
HDfree(src);
HDfree(dst);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (src)
HDfree(src);
2020-09-30 22:27:10 +08:00
if (dst)
HDfree(dst);
return FAIL;
} /* end test_endian() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_transpose
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Copy a 2d array from here to there and transpose the elements
* as it's copied.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Saturday, October 11, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static herr_t
test_transpose(size_t nx, size_t ny)
1997-10-21 07:22:19 +08:00
{
int *src = NULL;
int *dst = NULL;
2020-09-30 22:27:10 +08:00
hsize_t src_stride[2], dst_stride[2];
hsize_t size[2];
2018-02-15 00:08:09 +08:00
char s[256];
2020-09-30 22:27:10 +08:00
hsize_t i, j;
HDsnprintf(s, sizeof(s), "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx,
(unsigned long)ny);
2019-08-16 05:46:00 +08:00
HDprintf("%-70s", s);
HDfflush(stdout);
/* Initialize */
2020-09-30 22:27:10 +08:00
if (NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src))))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
if (NULL == (dst = (int *)HDcalloc(nx * ny, sizeof(*dst))))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++)
for (j = 0; j < ny; j++)
src[i * ny + j] = (int)(i * ny + j);
/* Build stride info */
2020-09-30 22:27:10 +08:00
size[0] = nx;
size[1] = ny;
src_stride[0] = 0;
src_stride[1] = sizeof(*src);
dst_stride[0] = (hsize_t)((1 - nx * ny) * sizeof(*src));
dst_stride[1] = (hsize_t)(nx * sizeof(*src));
/* Copy and transpose */
2020-09-30 22:27:10 +08:00
H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, src_stride, src);
/* Check */
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++) {
for (j = 0; j < ny; j++) {
if (src[i * ny + j] != dst[j * nx + i]) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
AT();
2019-08-16 05:46:00 +08:00
HDprintf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j);
HDprintf(" Source is:\n");
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++) {
2019-08-16 05:46:00 +08:00
HDprintf("%3lu:", (unsigned long)i);
2020-09-30 22:27:10 +08:00
for (j = 0; j < ny; j++)
2019-08-16 05:46:00 +08:00
HDprintf(" %6d", src[i * ny + j]);
HDprintf("\n");
} /* end for */
2019-08-16 05:46:00 +08:00
HDprintf("\n Destination is:\n");
for (i = 0; i < ny; i++) {
2019-08-16 05:46:00 +08:00
HDprintf("%3lu:", (unsigned long)i);
2020-09-30 22:27:10 +08:00
for (j = 0; j < nx; j++)
2019-08-16 05:46:00 +08:00
HDprintf(" %6d", dst[i * nx + j]);
HDprintf("\n");
} /* end for */
2020-09-30 22:27:10 +08:00
} /* end if */
goto error;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
} /* end for */
PASSED();
HDfree(src);
HDfree(dst);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (src)
HDfree(src);
2020-09-30 22:27:10 +08:00
if (dst)
HDfree(dst);
return FAIL;
} /* end test_transpose() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_sub_super
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Purpose: Tests H5VM_stride_copy() to reduce the resolution of an image
* by copying half the pixels in the X and Y directions. Then
* we use the small image and duplicate every pixel to result in
* a 2x2 square.
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Monday, October 13, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
static herr_t
test_sub_super(size_t nx, size_t ny)
1997-10-21 07:22:19 +08:00
{
2020-09-30 22:27:10 +08:00
uint8_t *full = NULL; /*original image */
uint8_t *half = NULL; /*image at 1/2 resolution */
uint8_t *twice = NULL; /*2x2 pixels */
hsize_t src_stride[4]; /*source stride info */
hsize_t dst_stride[4]; /*destination stride info */
hsize_t size[4]; /*number of sample points */
hsize_t i, j;
char s[256];
HDsnprintf(s, sizeof(s), "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx),
(unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny);
2019-08-16 05:46:00 +08:00
HDprintf("%-70s", s);
HDfflush(stdout);
/* Initialize */
2020-09-30 22:27:10 +08:00
if (NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny)))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
if (NULL == (half = (uint8_t *)HDcalloc((size_t)1, nx * ny)))
TEST_ERROR;
2020-09-30 22:27:10 +08:00
if (NULL == (twice = (uint8_t *)HDcalloc((size_t)4, nx * ny)))
TEST_ERROR;
init_full(full, 2 * nx, 2 * ny, (size_t)1);
/* Setup */
2020-09-30 22:27:10 +08:00
size[0] = nx;
size[1] = ny;
src_stride[0] = (hsize_t)(2 * ny);
src_stride[1] = 2;
dst_stride[0] = 0;
dst_stride[1] = 1;
/* Copy */
2020-09-30 22:27:10 +08:00
H5VM_stride_copy(2, (hsize_t)sizeof(uint8_t), size, dst_stride, half, src_stride, full);
/* Check */
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++) {
for (j = 0; j < ny; j++) {
if (full[4 * i * ny + 2 * j] != half[i * ny + j]) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
AT();
2020-09-30 22:27:10 +08:00
HDprintf(" full[%lu][%lu] != half[%lu][%lu]\n", (unsigned long)i * 2,
(unsigned long)j * 2, (unsigned long)i, (unsigned long)j);
2019-08-16 05:46:00 +08:00
HDprintf(" full is:\n");
print_array(full, 2 * nx, 2 * ny, (size_t)1);
2019-08-16 05:46:00 +08:00
HDprintf("\n half is:\n");
print_array(half, nx, ny, (size_t)1);
} /* end if */
goto error;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
} /* end for */
PASSED();
/*
* Test replicating pixels to produce an image twice as large in each
* dimension.
*/
HDsnprintf(s, sizeof(s), "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx,
(unsigned long)ny, (unsigned long)(2 * nx), (unsigned long)(2 * ny));
2019-08-16 05:46:00 +08:00
HDprintf("%-70s", s);
HDfflush(stdout);
/* Setup stride */
2020-09-30 22:27:10 +08:00
size[0] = nx;
size[1] = ny;
size[2] = 2;
size[3] = 2;
src_stride[0] = 0;
src_stride[1] = 1;
src_stride[2] = 0;
src_stride[3] = 0;
dst_stride[0] = (hsize_t)(2 * ny);
dst_stride[1] = (hsize_t)(2 * sizeof(uint8_t) - 4 * ny);
dst_stride[2] = (hsize_t)(2 * ny - 2 * sizeof(uint8_t));
[svn-r925] Changes since 19981116 ---------------------- ./INSTALL.parallel [NEW] We're beginning to unify some of the parallel installation steps. This file will contain general information for installing the parallel library. It's not complete yet. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Check for xdr_int() in libnsl required on Solaris when linking with hdf4. It's found on the Irix system I tested which complains that `-lnsl' didn't resolve any symbols. Oh well. Fixed the order of searching for libdf and libmfhdf for hdf4 linking. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5Z.c Check for compress() in libz in order to find older versions of the library that will still work for hdf4. Added a separate check for compress2() that hdf5 will use. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5R.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./test/bittests.c ./test/gheap.c ./test/hyperslab.c ./test/istore.c ./test/tmeta.c ./test/trefer.c ./test/tselect.c ./tools/h5debug.c ./tools/h5tols.c Added checks for Posix.1g types like `int8_t'. If not defined then H5private.h defines them. Changed all `int8' etc. to `int8_t'. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Calling H5*_term_interface() resets interface_initialize_g to FALSE so a subsequent call to H5open() (implied or explicit) reinitializes global variables properly. ./src/H5private.h ./src/H5Oefl.c ./src/H5S.c Changed MAX_SIZET, MAX_SSIZET, MAX_HSIZET, and MAX_HSSIZET to SIZET_MAX, SSIZET_MAX, HSIZET_MAX, and HSSIZE_MAX to they match the Posix.1 constants in <limits.h>. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5detect.c Added 36 more integer hardware conversion functions to the type conversion table for conversions to/from `long long' and `unsigned long long'. The `long long' names will be changed shortly to make them portable to Win32. Changed H5T_init() to H5T_native_open() and added an H5T_native_close() to open and close the predefined native data types. Increased the initial size of the type conversion table from 64 to 128 entries. Reordered the 90 new integer conversion functions so the names that are printed favor `int' over `short' or `long' when two of them are the same. ./test/dtypes.c Added hardware and software integer conversion tests for the 56 functions I added recently but not the additional 36 checked in this time. That will come next. Call H5close() after each test so type conversion statistics are easier to follow. Try this: $ HDF5_DEBUG=t ./dtypes Added more debugging output for when things go wrong. ./src/H5private.h Removed trailing carriage-returns inserted by broken operating system ;-)
1998-11-19 02:40:09 +08:00
dst_stride[3] = sizeof(uint8_t);
/* Copy */
2020-09-30 22:27:10 +08:00
H5VM_stride_copy(4, (hsize_t)sizeof(uint8_t), size, dst_stride, twice, src_stride, half);
/* Check */
s[0] = '\0';
2020-09-30 22:27:10 +08:00
for (i = 0; i < nx; i++) {
for (j = 0; j < ny; j++) {
if (half[i * ny + j] != twice[4 * i * ny + 2 * j])
HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i,
(unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2);
2020-09-30 22:27:10 +08:00
else if (half[i * ny + j] != twice[4 * i * ny + 2 * j + 1])
HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i,
(unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2 + 1);
2020-09-30 22:27:10 +08:00
else if (half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j])
HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i,
(unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2);
2020-09-30 22:27:10 +08:00
else if (half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j + 1])
HDsnprintf(s, sizeof(s), "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i,
(unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1);
2020-09-30 22:27:10 +08:00
if (s[0]) {
H5_FAILED();
2020-09-30 22:27:10 +08:00
if (!HDisatty(1)) {
AT();
2019-08-16 05:46:00 +08:00
HDprintf(" %s\n Half is:\n", s);
print_array(half, nx, ny, (size_t)1);
2019-08-16 05:46:00 +08:00
HDprintf("\n Twice is:\n");
print_array(twice, 2 * nx, 2 * ny, (size_t)1);
} /* end if */
goto error;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
} /* end for */
PASSED();
HDfree(full);
HDfree(half);
HDfree(twice);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (full)
HDfree(full);
2020-09-30 22:27:10 +08:00
if (half)
HDfree(half);
2020-09-30 22:27:10 +08:00
if (twice)
HDfree(twice);
return FAIL;
} /* test_sub_super() */
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_array_fill
*
2018-02-15 00:08:09 +08:00
* Purpose: Tests H5VM_array_fill routine by copying a multibyte value
* (an array of ints, in our case) into all the elements of an
* array.
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
*
2018-02-15 00:08:09 +08:00
* Programmer: Quincey Koziol
* Monday, April 21, 2003
*
*-------------------------------------------------------------------------
*/
static herr_t
test_array_fill(size_t lo, size_t hi)
{
int *dst = NULL; /* Destination */
2020-09-30 22:27:10 +08:00
int src[ARRAY_FILL_SIZE]; /* Source to duplicate */
size_t u, v, w; /* Local index variables */
char s[256];
HDsnprintf(s, sizeof(s), "array filling %4lu-%-4lu elements", (unsigned long)lo, (unsigned long)hi);
TESTING(s);
/* Initialize */
2020-09-30 22:27:10 +08:00
if (NULL == (dst = (int *)HDcalloc(sizeof(int), ARRAY_FILL_SIZE * hi)))
TEST_ERROR;
/* Setup */
2020-09-30 22:27:10 +08:00
for (u = 0; u < ARRAY_FILL_SIZE; u++)
src[u] = (char)u;
/* Fill */
2020-09-30 22:27:10 +08:00
for (w = lo; w <= hi; w++) {
H5VM_array_fill(dst, src, sizeof(src), w);
/* Check */
2020-09-30 22:27:10 +08:00
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();
HDfree(dst);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (dst)
HDfree(dst);
return FAIL;
} /* end test_array_fill() */
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: test_array_offset_n_calc
*
2018-02-15 00:08:09 +08:00
* Purpose: Tests H5VM_array_offset and H5VM_array_calc routines by comparing
* computed array offsets against calculated ones and then going
* back to the coordinates from the offset and checking those.
*
2018-02-15 00:08:09 +08:00
* Return: Success: SUCCEED
*
2018-02-15 00:08:09 +08:00
* Failure: FAIL
*
2018-02-15 00:08:09 +08:00
* Programmer: Quincey Koziol
* Monday, April 21, 2003
*
*-------------------------------------------------------------------------
*/
static herr_t
test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
{
2020-09-30 22:27:10 +08:00
hsize_t *a = NULL;
hsize_t *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 */
hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */
hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */
char s[256];
HDsnprintf(s, sizeof(s), "array offset %4lux%4lux%4lu elements", (unsigned long)z, (unsigned long)y,
(unsigned long)x);
TESTING(s);
/* Initialize */
2020-09-30 22:27:10 +08:00
if (NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y * z)))
TEST_ERROR;
dims[0] = z;
dims[1] = y;
dims[2] = x;
/* Setup */
2020-09-30 22:27:10 +08:00
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 */
2020-09-30 22:27:10 +08:00
for (u = 0; u < n; u++) {
/* Get random coordinate */
coords[0] = (hsize_t)((size_t)HDrandom() % z);
coords[1] = (hsize_t)((size_t)HDrandom() % y);
coords[2] = (hsize_t)((size_t)HDrandom() % x);
/* Get offset of coordinate */
off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords);
/* Check offset of coordinate */
2020-09-30 22:27:10 +08:00
if (a[off] != off)
TEST_ERROR;
/* Get coordinates of offset */
2020-09-30 22:27:10 +08:00
if (H5VM_array_calc(off, ARRAY_OFFSET_NDIMS, dims, new_coords) < 0)
TEST_ERROR;
/* Check computed coordinates */
2020-09-30 22:27:10 +08:00
for (v = 0; v < ARRAY_OFFSET_NDIMS; v++)
if (coords[v] != new_coords[v]) {
HDfprintf(stderr, "coords[%zu]=%" PRIuHSIZE ", new_coords[%zu]=%" PRIuHSIZE "\n", v,
coords[v], v, new_coords[v]);
TEST_ERROR;
} /* end if */
2020-09-30 22:27:10 +08:00
} /* end for */
PASSED();
HDfree(a);
return SUCCEED;
error:
2020-09-30 22:27:10 +08:00
if (a)
HDfree(a);
return FAIL;
} /* end test_array_offset_n_calc() */
1997-10-21 07:22:19 +08:00
/*-------------------------------------------------------------------------
2018-02-15 00:08:09 +08:00
* Function: main
1997-10-21 07:22:19 +08:00
*
2019-09-07 09:06:26 +08:00
* Purpose: Test various hyperslab operations. Give the words
* 'small' and/or 'medium' on the command line or only 'small'
* is assumed.
1997-10-21 07:22:19 +08:00
*
2019-09-07 09:06:26 +08:00
* Return: EXIT_SUCCESS/EXIT_FAILURE
1997-10-21 07:22:19 +08:00
*
2018-02-15 00:08:09 +08:00
* Programmer: Robb Matzke
* Friday, October 10, 1997
1997-10-21 07:22:19 +08:00
*
*-------------------------------------------------------------------------
*/
int
main(int argc, char *argv[])
1997-10-21 07:22:19 +08:00
{
2020-09-30 22:27:10 +08:00
herr_t status;
int nerrors = 0;
unsigned size_of_test;
/* Parse arguments or assume `small' & `medium' */
2020-09-30 22:27:10 +08:00
if (1 == argc)
size_of_test = TEST_SMALL | TEST_MEDIUM;
else {
int i;
2020-09-30 22:27:10 +08:00
for (i = 1, size_of_test = 0; i < argc; i++) {
if (!HDstrcmp(argv[i], "small"))
size_of_test |= TEST_SMALL;
2020-09-30 22:27:10 +08:00
else if (!HDstrcmp(argv[i], "medium"))
size_of_test |= TEST_MEDIUM;
else {
2019-08-16 05:46:00 +08:00
HDprintf("unrecognized argument: %s\n", argv[i]);
HDexit(EXIT_FAILURE);
} /* end else */
2020-09-30 22:27:10 +08:00
} /* end for */
} /* end else */
2019-08-16 05:46:00 +08:00
HDprintf("Test sizes: ");
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL)
2019-08-16 05:46:00 +08:00
HDprintf(" SMALL");
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM)
2019-08-16 05:46:00 +08:00
HDprintf(" MEDIUM");
HDprintf("\n");
/* Set the random # seed */
[svn-r17980] Description: Bring Coverity changes into the trunk: (also other minor cleanups) r17955: Fix Coverity item 24. Add missing error condition to H5AC_ext_config_2_int_config. r17956: Fix Coverity item 24. Improve error checking in H5A_compact_build_table_cb. r17957: Fix Coverity item 150. Fix warning in H5A_compact_build_table_cb. r17958: Fix Coverity item 117. Fix error handling in H5B_shared_new. r17959: Fix Coverity item 209. Added an assertion for leaf->shared in H5B2_cache_leaf_dest. r17960: Fix Coverity item 208. Added an assertion for internal->shared in H5B2_cache_internal_dest. r17961: Fix Coverity item 89. Reworked the code to avoid array overrun in H5C__autoadjust__ageout__insert_new_marker. r17962: Fix for coverity Resource_leak 195,203,204,205. r17963: Fix Coverity item 44. Prevented potential NULL dereference in H5D_btree_debug. r17964: Fix Coverity issues #197, 198 & 199: memory not being released. (Also clean up other resource leaks in nearby and/or similar code). r17965: Fix Coverity issue #151: release resources on error r17966: Fix Coverity issue #187: Remove leftover code remnant from prior bugfix which was causing resource leak of open files. r17967: Fixed Coverity issues # 193 & 194. Removed unnecessary memory allocation and added comparison of length of path parameter to the size of the destination buffer in h5import.h/h5import.c. r17968: Fix Coverity item 144. Fixed memory leak on error in H5D_chunk_copy. r17969: Fix for coverity Resource_leak #196. r17970: Coverity 167-173: Initialized pointer of buffers. In error handling, closed types and free memory. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
2009-12-10 20:36:56 +08:00
HDsrandom((unsigned)HDtime(NULL));
/*
* Open the library explicitly for thread-safe builds, so per-thread
* things are initialized correctly.
*/
#ifdef H5_HAVE_THREADSAFE
H5open();
2020-09-30 22:27:10 +08:00
#endif /* H5_HAVE_THREADSAFE */
/*
*------------------------------
* TEST HYPERSLAB FILL OPERATION
*------------------------------
*/
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_fill((size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_fill((size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_fill((size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_fill((size_t)113, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_fill((size_t)15, (size_t)11, (size_t)0, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_fill((size_t)5, (size_t)7, (size_t)7, (size_t)1, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*------------------------------
* TEST HYPERSLAB COPY OPERATION
*------------------------------
*/
1997-10-21 07:22:19 +08:00
/* exhaustive, one-dimensional test */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_DST, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_copy(VARIABLE_SRC, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_DST, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_BOTH, (size_t)179, (size_t)0, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/* exhaustive, two-dimensional test */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_copy(VARIABLE_SRC, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_DST, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_BOTH, (size_t)11, (size_t)10, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_copy(VARIABLE_SRC, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_DST, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_BOTH, (size_t)13, (size_t)19, (size_t)0, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/* sparse, two-dimensional test */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_copy(VARIABLE_SRC, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1,
(size_t)13, (size_t)11, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_DST, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1,
(size_t)13, (size_t)11, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_BOTH, (size_t)73, (size_t)67, (size_t)0, (size_t)7, (size_t)11, (size_t)1,
(size_t)13, (size_t)11, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/* exhaustive, three-dimensional test */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_copy(VARIABLE_SRC, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_DST, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_BOTH, (size_t)3, (size_t)5, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_copy(VARIABLE_SRC, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_DST, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
2020-09-30 22:27:10 +08:00
status = test_copy(VARIABLE_BOTH, (size_t)7, (size_t)9, (size_t)5, (size_t)1, (size_t)1, (size_t)1,
(size_t)1, (size_t)1, (size_t)1);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*---------------------
* TEST MULTI-BYTE FILL
*---------------------
*/
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_multifill((size_t)10);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_multifill((size_t)500000);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*---------------------------
* TEST TRANSLATION OPERATORS
*---------------------------
*/
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_endian((size_t)10);
nerrors += status < 0 ? 1 : 0;
status = test_transpose((size_t)9, (size_t)9);
nerrors += status < 0 ? 1 : 0;
status = test_transpose((size_t)3, (size_t)11);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_endian((size_t)800000);
nerrors += status < 0 ? 1 : 0;
status = test_transpose((size_t)1200, (size_t)1200);
nerrors += status < 0 ? 1 : 0;
status = test_transpose((size_t)800, (size_t)1800);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*-------------------------
* TEST SAMPLING OPERATIONS
*-------------------------
*/
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_sub_super((size_t)5, (size_t)10);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_sub_super((size_t)480, (size_t)640);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*-------------------------
* TEST ARRAY FILL OPERATIONS
*-------------------------
*/
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_array_fill((size_t)1, (size_t)9);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_array_fill((size_t)9, (size_t)257);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*-------------------------
* TEST ARRAY OFFSET OPERATIONS
*-------------------------
*/
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_SMALL) {
status = test_array_offset_n_calc((size_t)20, (size_t)7, (size_t)11, (size_t)13);
nerrors += status < 0 ? 1 : 0;
} /* end if */
2020-09-30 22:27:10 +08:00
if (size_of_test & TEST_MEDIUM) {
status = test_array_offset_n_calc((size_t)500, (size_t)71, (size_t)193, (size_t)347);
nerrors += status < 0 ? 1 : 0;
} /* end if */
/*--- END OF TESTS ---*/
2020-09-30 22:27:10 +08:00
if (nerrors) {
HDprintf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
if (HDisatty(1))
2019-08-16 05:46:00 +08:00
HDprintf("(Redirect output to a pager or a file to see debug output)\n");
HDexit(EXIT_FAILURE);
} /* end if */
2019-08-16 05:46:00 +08:00
HDprintf("All hyperslab tests passed.\n");
#ifdef H5_HAVE_THREADSAFE
H5close();
2020-09-30 22:27:10 +08:00
#endif /* H5_HAVE_THREADSAFE */
2019-09-07 09:06:26 +08:00
HDexit(EXIT_SUCCESS);
1997-10-21 07:22:19 +08:00
}