[svn-r949] Changes since 19981124

----------------------

./src/H5T.c
	Fixed a typo in the registration of the `unsigned char' to
	`unsigned long long' type conversion that caused it to not be
	registered, falling back to software whenever that conversion
	path was taken.

./MANIFEST
./test/Makefile.in
./test/testhdf5.c
./test/testhdf5.h
./test/theap.c		[REMOVED]
./test/lheap.c		[NEW]
./test/tohdr.c		[REMOVED]
./test/ohdr.c		[NEW]
./test/tstab.c		[REMOVED]
./test/stab.c		[NEW]
	Removed the `t' from the front of these names and made each
	test a stand-alone program following the format of most of the
	other tests.

./test/big.c
	Uses libh5test.a but always sets the low-level driver to 1GB
	file family.

	The `#if' near the top to set the data space to 8GB has been
	simplified now that `long_long' is always defined and the
	error message is improved when `long_long' isn't wide enough.

	Cleanup code was added to the error handling.

./test/gheap.c
./test/istore.c
	Uses libh5test.a.  Added error cleanup code.

./test/dtypes.c
./test/h5test.c
	Added 68 new tests that check hardware and software
	conversions between `long long' and `unsigned long long' and
	the other integer types.  The tests only run on machines where
	sizeof(long_long)!=sizeof(long).  We test a total of 180
	different integer conversions, half in hardware and half in
	software.

	Cut down the number of times each test is run from 5 to 1 so
	it doesn't take so long.  If you want to run more times
	there's a constant that can be changed at the top of the file.

./test/extend.c
	Removed unused variable.

./test/h5test.c
./test/h5test.h
./test/external.c
./test/fillval.c
	The h5_cleanup() returns true/false so it can be used in an `if'
	statement to clean up additional files.

./doc/html/Environment.html
	Indented.  Added HDF5_PREFIX and HDF5_DRIVER descriptions.

./src/H5P.c
	Changed the trace type for the second argument from `Iu' to
	`x' since it's an output parameter.

./INSTALL
	Added a warning that the GNU zlib that comes with the latest
	version of HDF4 is too old to use with HDF5 and must be
	renamed so configure doesn't see it when `--enable-hdf4' is
	used.
This commit is contained in:
Robb Matzke 1998-11-25 09:58:22 -05:00
parent 49ca76e303
commit 4354606d1e
24 changed files with 2122 additions and 1754 deletions

12
INSTALL
View File

@ -92,11 +92,13 @@ Step 2. Configure.
with `--with-zlib=INCDIR,LIBDIR' for the include file and/or
library. To prevent detection of zlib use `--without-zlib'.
* The HDF5-to-HDF4 conversion tool requires the HDF4 library and
header files which are auto-detected by configure. If they are
in a non-standard place then absolute path names can be specified
with `--with-hdf4=INCDIR,LIBDIR' for the include file and/or
library. To prevent detection of hdf4 use `--without-hdf4'.
* The HDF5-to-HDF4 conversion tool requires the HDF4 library and header
files which are auto-detected by configure. If they are in a
non-standard place then absolute path names can be specified with
`--with-hdf4=INCDIR,LIBDIR' for the include file and/or library. To
prevent detection of hdf4 use `--without-hdf4'. Beware of the GNU zlib
that comes with hdf4 -- it's too old to use with hdf5 (hdf4 tools can be
linked with the newer versions of zlib).
* Old versions of gcc (<2.8.0) may experience register allocation
problems on some architectures. If this happens then the

View File

@ -322,24 +322,24 @@
./test/hyperslab.c
./test/iopipe.c
./test/istore.c
./test/lheap.c
./test/links.c
./test/mount.c
./test/mtime.c
./test/overhead.c
./test/ragged.c
./test/space_overflow.c _DO_NOT_DISTRIBUTE_
./test/stab.c
./test/testhdf5.c
./test/testhdf5.h
./test/tattr.c
./test/tfile.c
./test/th5s.c
./test/th5s.h5
./test/theap.c
./test/tmeta.c
./test/tohdr.c
./test/trefer.c
./test/tselect.c
./test/tstab.c
./test/unlink.c
./testpar/Makefile.in

View File

@ -1,66 +1,102 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>HDF5 Library Environment Variables and Configuration Parameters</title>
</head>
<head>
<title>HDF5 Library Environment Variables
and Configuration Parameters</title>
</head>
<body>
<body>
<h1>HDF5 Library Environment Variables and Configuration Parameters</h1>
<h1>HDF5 Library Environment Variables and Configuration Parameters</h1>
<h2>1. Environment Variables</h2>
<h2>1. Environment Variables</h2>
The HDF5 library uses UNIX environment variables to control
or adjust certain library features at runtime. The variables and
their defined effects are as follows:
The HDF5 library uses UNIX environment variables to control
or adjust certain library features at runtime. The variables and
their defined effects are as follows:
<dir>
<dl>
<dt><tt>HDF5_DEBUG</tt>
<dd>Defines a list of debugging switches documented in the
<a href="Debugging.html">Debugging</a> section of the
<cite>HDF5 User's Guide</cite>.
<center>
<table width="90%">
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
<dt><tt>HDF5_NOCLEANUP</tt>
<dd>When set to a non-empty value, the programs in the test
directory do not remove temporary HDF5 data files.
The default is for each test to remove the files before exit.
<tr valign=top>
<td><code>HDF5_DEBUG</code></td>
<td>Defines a list of debugging switches documented in the
<a href="Debugging.html">Debugging</a> section of the
<cite>HDF5 User's Guide</cite>.</td>
</tr>
<dt><tt>HDF5_MPI_OPT_TYPES</tt>
&nbsp;&nbsp;(for parallel beta version only)
<dd>When set to <code>1</code>, PHDF5 will use the MPI optimized
code to perform parallel read/write accesses to datasets.
Currently, this optimization fails when accessing extendable
datasets. The default is not to use the optimized code.
<tr valign=top>
<td><code>HDF5_NOCLEANUP</code></td>
<td>If set then programs in the test directories do not
remove temporary files. The default is for each test to
remove the files before exit if the test succeeds but to
leave the files if the test fails.</td>
</tr>
<dt><tt>HDF5_MPI_1_METAWRITE</tt>
&nbsp;&nbsp;(for parallel beta version only)
<dd>When set to <code>1</code>, PHDF5 will write the metadata
via process 0 of each opened parallel HDF5 file. This should
improve I/O throughput. The default is not to use this
optimization.
<tr valign=top>
<td><code>HDF5_PREFIX</code></td>
<td>The value of this variable is prepended to all temporary
file names created by the test programs and separated from
the base name of the file by a slash. The default is no
prefix.</td>
</tr>
</dl>
</dir>
<tr valign=top>
<td><ode>HDF5_DRIVER</code></td>
<td>This variable should hold the name of a low-level HDF5
file driver such as <code>sec2</code>, <code>stdio</code>,
<code>core</code>, <code>split</code>, or
<code>family</code>. The family driver also takes an
optional real-valued family member size in MB which
defaults to 1. If this variable is not set or empty then
the library-defined default file driver is used (which can
be set at configuration time with the H5F_LOW_DFLT cpp
constant, usually <code>sec2</code>).</td>
</tr>
<h2>2. Configuration Parameters</h2>
<tr valign=top>
<td><code>HDF5_MPI_OPT_TYPES</code></td>
<td>When set to <code>1</code>, parallel HDF5 will use the
MPI-optimized code to perform parallel read/write accesses
to datasets. Currently, this optimization fails when
accessing extendable datasets. The default is not to use
the optimized code.</td>
</tr>
The HDF5 configuration script accepts a list of parameters to control
configuration features when creating the Makefiles for the library.
The command
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;configure --help </code>
<br>
will display the current list of parameters and their effects.
<tr valign=top>
<td><code>HDF5_MPI_1_METAWRITE</code></td>
<td>When set to <code>1</code>, parallel HDF5 will write the
metadata via process 0 of each opened parallel HDF5 file.
This should improve I/O throughput. The default is not to
use this optimization.</td>
</tr>
<hr>
</table>
</center>
<address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a>
</address>
Last modified: 9 September 1998
<h2>2. Configuration Parameters</h2>
</body>
The HDF5 configuration script accepts a list of parameters to control
configuration features when creating the Makefiles for the library.
The command
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;configure --help </code>
<br>
will display the current list of parameters and their effects.
<hr>
<address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a>
</address>
Last modified: 9 September 1998
</body>
</html>

View File

@ -1826,8 +1826,8 @@ H5Pget_family(hid_t plist_id, hsize_t *memb_size/*out*/,
if (memb_plist_id) {
assert (plist->u.fam.memb_access);
*memb_plist_id = H5P_create (H5P_FILE_ACCESS,
H5P_copy (H5P_FILE_ACCESS,
plist->u.fam.memb_access));
H5P_copy (H5P_FILE_ACCESS,
plist->u.fam.memb_access));
}
FUNC_LEAVE (SUCCEED);
@ -3008,6 +3008,7 @@ H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref)
H5F_access_t *fapl = NULL;
FUNC_ENTER (H5Pset_gc_references, FAIL);
H5TRACE2("e","iIu",fapl_id,gc_ref);
/* Check args */
if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) || NULL == (fapl = H5I_object (fapl_id))) {
@ -3042,6 +3043,7 @@ H5Pget_gc_reference(hid_t fapl_id, unsigned *gc_ref/*out*/)
H5F_access_t *fapl = NULL;
FUNC_ENTER (H5Pget_alignment, FAIL);
H5TRACE2("e","ix",fapl_id,gc_ref);
/* Check args */
if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) || NULL == (fapl = H5I_object (fapl_id))) {

View File

@ -1088,8 +1088,8 @@ H5T_init_interface(void)
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to register conversion function");
}
if (H5Tregister_hard("uchar_llong", H5T_NATIVE_UCHAR, H5T_NATIVE_LLONG,
H5T_conv_uchar_llong)<0) {
if (H5Tregister_hard("uchar_ullong", H5T_NATIVE_UCHAR, H5T_NATIVE_ULLONG,
H5T_conv_uchar_ullong)<0) {
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to register conversion function");
}

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,9 @@ LIBS=libh5test.a ../src/libhdf5.a @LIBS@
# These are our main targets. They should be listed in the order to be
# executed, generally most specific tests to least specific tests.
TEST_PROGS=testhdf5 gheap hyperslab istore bittests dtypes dsets cmpd_dset \
extend external links unlink big mtime fillval mount flush1 flush2
TEST_PROGS=testhdf5 lheap ohdr stab gheap hyperslab istore bittests dtypes \
dsets cmpd_dset extend external links unlink big mtime fillval mount \
flush1 flush2
TIMINGS=iopipe chunk ragged overhead
# The libh5test.a library provides common support code for the tests.
@ -22,27 +23,31 @@ LIB=libh5test.a
LIB_SRC=h5test.c
LIB_OBJ=$(LIB_SRC:.c=.o)
# Temporary files
# Temporary files. These files are the ones created by setting the
# HDF5_NOCLEANUP environment variable and running `make test' without
# specifying a file prefix or low-level driver. Changing the file
# prefix or low-level driver with environment variables will influence
# the temporary file name in ways that the makefile is not aware of.
MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \
tfile3.h5 th5s1.h5 theap.h5 tohdr.h5 tstab1.h5 tstab2.h5 \
extern_1.h5 extern_2.h5 extern_3.h5 extern_1.raw extern_1b.raw \
extern_2.raw extern_2b.raw extern_3.raw extern_3b.raw \
extern_4.raw extern_4b.raw iopipe.raw iopipe.h5 gheap0.h5 \
tfile3.h5 th5s1.h5 lheap.h5 ohdr.h5 stab1.h5 stab2.h5 \
extern_1.h5 extern_2.h5 extern_3.h5 extern_1a.raw extern_1b.raw \
extern_2a.raw extern_2b.raw extern_3a.raw extern_3b.raw \
extern_4a.raw extern_4b.raw iopipe.raw iopipe.h5 gheap0.h5 \
gheap1.h5 gheap2.h5 gheap3.h5 gheap4.h5 links.h5 chunk.h5 \
big.data big[0-9][0-9][0-9][0-9][0-9].h5 dtypes1.h5 dtypes2.h5 \
tattr.h5 tselect.h5 mtime.h5 ragged.h5 grptime.h5 unlink.h5 \
overhead.h5 fillval_[0-9].h5 mount_[0-9].h5 trefer.h5 flush.h5
tattr.h5 tselect.h5 mtime.h5 ragged.h5 unlink.h5 overhead.h5 \
fillval_[0-9].h5 fillval.raw mount_[0-9].h5 trefer.h5 flush.h5
CLEAN=$(TIMINGS)
# 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
# other source lists are for the individual tests, the files of which may
# overlap with other tests.
TEST_SRC=testhdf5.c tattr.c tfile.c theap.c tmeta.c tohdr.c trefer.c \
tselect.c tstab.c th5s.c dtypes.c hyperslab.c istore.c dsets.c \
cmpd_dset.c extend.c external.c iopipe.c gheap.c big.c links.c chunk.c \
bittests.c mtime.c ragged.c unlink.c overhead.c fillval.c mount.c \
flush1.c flush2.c
TEST_SRC=big.c bittests.c chunk.c cmpd_dset.c dsets.c dtypes.c extend.c \
external.c fillval.c flush1.c flush2.c gheap.c h5test.c hyperslab.c \
iopipe.c istore.c lheap.c links.c mount.c mtime.c ohdr.c overhead.c \
ragged.c space_overflow.c stab.c tattr.c testhdf5.c tfile.c th5s.c \
tmeta.c trefer.c tselect.c unlink.c
TEST_OBJ=$(TEST_SRC:.c=.o)
# Private header files (not to be installed)...
@ -60,10 +65,19 @@ timings _timings: $(TIMINGS)
# How to build the tests... They all depend on the test and hdf5 libraries.
$(TEST_PROGS): libh5test.a ../src/libhdf5.a
TESTHDF5_OBJ=testhdf5.o tattr.o tfile.o theap.o tmeta.o tohdr.o trefer.o tselect.o tstab.o th5s.o
TESTHDF5_OBJ=testhdf5.o tattr.o tfile.o tmeta.o trefer.o tselect.o th5s.o
testhdf5: $(TESTHDF5_OBJ)
$(CC) $(CFLAGS) -o $@ $(TESTHDF5_OBJ) $(LDFLAGS) $(LIBS)
lheap: lheap.o
$(CC) $(CFLAGS) -o $@ lheap.o $(LDFLAGS) $(LIBS)
ohdr: ohdr.o
$(CC) $(CFLAGS) -o $@ ohdr.o $(LDFLAGS) $(LIBS)
stab: stab.o
$(CC) $(CFLAGS) -o $@ stab.o $(LDFLAGS) $(LIBS)
gheap: gheap.o
$(CC) $(CFLAGS) -o $@ gheap.o $(LDFLAGS) $(LIBS)
@ -94,9 +108,6 @@ external: external.o
iopipe: iopipe.o
$(CC) $(CFLAGS) -o $@ iopipe.o $(LDFLAGS) $(LIBS)
grptime: grptime.o
$(CC) $(CFLAGS) -o $@ grptime.o $(LDFLAGS) $(LIBS)
big: big.o
$(CC) $(CFLAGS) -o $@ big.o $(LDFLAGS) $(LIBS)

View File

@ -5,60 +5,50 @@
* Programmer: Robb Matzke <matzke@llnl.gov>
* Wednesday, April 8, 1998
*/
#include <h5test.h>
/* See H5private.h for how to include headers */
#undef NDEBUG
#include <hdf5.h>
#include <H5private.h> /*needed for HDfprintf() and long_long*/
const char *FILENAME[] = {
"big",
NULL
};
#define FNAME "big%05d.h5"
#define DNAME "big.data"
#define WRT_N 50
#define WRT_SIZE 4*1024
#define FAMILY_SIZE 1024*1024*1024
#if SIZEOF_LONG_LONG > SIZEOF_LONG
#define GB8LL ((unsigned long_long)8*1024*1024*1024)
#elif SIZEOF___INT64 > SIZEOF_LONG
#define GB8LL ((unsigned __int64)8*1024*1024*1024)
#elif SIZEOF_LONG >= 8
#define GB8LL ((unsigned long)8*1024*1024*1024)
#if SIZEOF_LONG_LONG >= 8
# define GB8LL ((unsigned long_long)8*1024*1024*1024)
#else
#define GB8LL ((unsigned long)0) /* cannot do the test */
# define GB8LL ((unsigned long_long)0) /*cannot do the test*/
#endif
static hsize_t
randll (hsize_t limit)
{
hsize_t acc = rand ();
acc *= rand ();
return acc % limit;
}
/*-------------------------------------------------------------------------
* Function: display_error_cb
* Function: randll
*
* Purpose: Displays the error stack after printing "*FAILED*".
* Purpose: Create a random long_long value.
*
* Return: Success: 0
* Return: Success: Random value
*
* Failure: -1
* Failure: never fails
*
* Programmer: Robb Matzke
* Wednesday, March 4, 1998
* Tuesday, November 24, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
display_error_cb (void __unused__ *client_data)
static hsize_t
randll(hsize_t limit)
{
puts ("*FAILED*");
H5Eprint (stdout);
return 0;
hsize_t acc = rand ();
acc *= rand ();
return acc % limit;
}
@ -118,23 +108,23 @@ is_sparse(void)
*-------------------------------------------------------------------------
*/
static int
enough_room(void)
enough_room(hid_t fapl)
{
int ret_value=0;
int fd[68];
size_t i, size = (size_t)1 << 30;
char name[32];
/* verify if this machine supports 8GB sizes */
if (GB8LL==0)
goto done;
char filename[1024], name[1024];
/* Initialize file descriptors */
for (i=0; i<NELMTS(fd); i++) fd[i] = -1;
/* Get file name template */
assert(H5F_LOW_FAMILY==H5Pget_driver(fapl));
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Create files */
for (i=0; i<NELMTS(fd); i++) {
sprintf(name, FNAME, i);
HDsnprintf(name, sizeof name, filename, i);
if ((fd[i]=open(name, O_RDWR|O_CREAT|O_TRUNC, 0666))<0) {
goto done;
}
@ -149,7 +139,7 @@ enough_room(void)
done:
for (i=0; i<NELMTS(fd) && fd[i]>=0; i++) {
sprintf(name, FNAME, i);
HDsnprintf(name, sizeof name, filename, i);
close(fd[i]);
unlink(name);
}
@ -177,29 +167,27 @@ enough_room(void)
*-------------------------------------------------------------------------
*/
static int
writer (int wrt_n)
writer (hid_t fapl, int wrt_n)
{
hsize_t size1[4] = {8, 1024, 1024, 1024};
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;
hid_t file=-1, space1=-1, space2=-1, mem_space=-1, d1=-1, d2=-1;
int *buf = malloc (sizeof(int) * WRT_SIZE);
int i, j;
FILE *out = fopen(DNAME, "w");
char filename[1024];
printf("%-70s", "Writing large dataset");
fflush(stdout);
TESTING("large dataset write");
/*
* 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
*/
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);
if (file<0) goto error;
if (H5Pclose (plist)<0) goto error;
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_DEBUG, H5P_DEFAULT,
fapl))<0) goto error;
/* Create simple data spaces according to the size specified above. */
if ((space1 = H5Screate_simple (4, size1, size1))<0 ||
@ -237,10 +225,20 @@ writer (int wrt_n)
if (H5Fclose (file)<0) goto error;
free (buf);
fclose(out);
puts(" PASSED");
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(d1);
H5Dclose(d2);
H5Sclose(space1);
H5Sclose(space2);
H5Sclose(mem_space);
H5Fclose(file);
} H5E_END_TRY;
if (buf) free(buf);
if (out) fclose(out);
return 1;
}
@ -262,26 +260,25 @@ writer (int wrt_n)
*-------------------------------------------------------------------------
*/
static int
reader (void)
reader (hid_t fapl)
{
FILE *script;
hid_t plist, file, mspace, fspace, d2;
FILE *script = NULL;
hid_t file=-1, mspace=-1, fspace=-1, d2=-1;
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, nerrors=0;
char filename[1024];
/* Open script file */
script = fopen (DNAME, "r");
/* Open HDF5 file */
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) {
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_DEBUG, fapl))<0) {
goto error;
}
if (H5Pclose (plist)<0) goto error;
/* Open the dataset */
if ((d2 = H5Dopen (file, "d2"))<0) goto error;
@ -310,14 +307,14 @@ reader (void)
else if (buf[j]!=i+1) wrong++;
}
if (zero) {
puts("*FAILED*");
printf(" %d zero%s\n", zero, 1==zero?"":"s");
FAILED();
printf(" %d zero%s\n", zero, 1==zero?"":"s");
} else if (wrong) {
puts("--SKIP--");
puts(" Possible overlap with another region.");
SKIPPED();
puts(" Possible overlap with another region.");
nerrors++;
} else {
puts(" PASSED");
PASSED();
}
}
@ -330,39 +327,17 @@ reader (void)
return nerrors;
error:
H5E_BEGIN_TRY {
H5Dclose(d2);
H5Sclose(mspace);
H5Sclose(fspace);
H5Fclose(file);
} H5E_END_TRY;
if (buf) free(buf);
if (script) fclose(script);
return 1;
}
/*-------------------------------------------------------------------------
* Function: cleanup
*
* Purpose: Removes test files
*
* Return: void
*
* Programmer: Robb Matzke
* Thursday, June 4, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
cleanup (void)
{
int i;
char buf[256];
if (!getenv ("HDF5_NOCLEANUP")) {
for (i=0; i<512; i++) {
sprintf(buf, FNAME, i);
remove(buf);
}
remove(DNAME);
}
}
/*-------------------------------------------------------------------------
* Function: main
@ -383,18 +358,41 @@ cleanup (void)
int
main (void)
{
int nerrors = 0;
hid_t fapl=-1;
hsize_t family_size;
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
/* The file driver must be the family driver */
if (H5F_LOW_FAMILY!=H5Pget_driver(fapl)) {
printf("Changing file drivers to the family driver, %lu bytes each\n",
(unsigned long)FAMILY_SIZE);
if (H5Pset_family(fapl, FAMILY_SIZE, H5P_DEFAULT)<0) goto error;
} else if (H5Pget_family(fapl, &family_size, NULL)<0) {
goto error;
} else if (family_size!=FAMILY_SIZE) {
printf("Changing family member size from %lu to %lu\n",
(unsigned long)family_size, (unsigned long)FAMILY_SIZE);
if (H5Pset_family(fapl, FAMILY_SIZE, H5P_DEFAULT)<0) goto error;
}
/*
* We shouldn't run this test if the file system doesn't support holes
* because we would generate multi-gigabyte files.
*/
puts("Checking if file system is adequate for this test...");
if (sizeof(long_long)<8 || 0==GB8LL) {
puts("Test skipped because sizeof(long_long) is too small. This");
puts("hardware apparently doesn't support 64-bit integer types.");
exit(0);
}
if (!is_sparse()) {
puts("Test skipped because file system does not support holes.");
exit(0);
}
if (!enough_room()) {
if (!enough_room(fapl)) {
puts("Test skipped because of quota (file size or num open files).");
exit(0);
}
@ -403,13 +401,15 @@ main (void)
puts("--disable-hsizet flag in order to work around a compiler bug.");
exit(0);
}
/* Set the error handler */
H5Eset_auto (display_error_cb, NULL);
/* Do the test */
if (writer(fapl, WRT_N)) goto error;
if (reader(fapl)) goto error;
puts("All big tests passed.");
if (h5_cleanup(fapl)) remove(DNAME);
return 0;
if ((nerrors=writer(WRT_N))>0) exit(nerrors);
nerrors = reader();
cleanup();
return nerrors;
error:
puts("*** TEST FAILED ***");
return 1;
}

View File

@ -10,9 +10,12 @@
#include <h5test.h>
#if SIZEOF_DOUBLE != SIZEOF_LONG_DOUBLE
# define USE_LDOUBLE
#endif
/* Number of times to run each test */
#define NTESTS 1
/* Define if you want to see a count of overflows */
#undef SHOW_OVERFLOWS
const char *FILENAME[] = {
"dtypes1",
@ -38,7 +41,7 @@ typedef enum flt_t {
typedef enum int_t {
INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT,
INT_LONG, INT_ULONG, INT_OTHER
INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER
} int_t;
/* Count the number of overflows */
@ -217,7 +220,9 @@ static void
reset_hdf5(void)
{
h5_reset();
#ifdef SHOW_OVERFLOWS
H5Tset_overflow(overflow_handler);
#endif
if (without_hardware_g) h5_no_hwconv();
}
@ -958,7 +963,7 @@ test_conv_str_2(void)
{
char *buf=NULL, s[80];
hid_t c_type, f_type;
const size_t nelmts = 200000, ntests=5;
const size_t nelmts = 200000, ntests=NTESTS;
size_t i, j, nchars;
herr_t ret_value = -1;
@ -978,8 +983,12 @@ test_conv_str_2(void)
/* Do the conversions */
for (i=0; i<ntests; i++) {
sprintf(s, "Testing random string conversion speed (test %d/%d)",
(int)(i+1), (int)ntests);
if (ntests>1) {
sprintf(s, "Testing random string conversion speed (test %d/%d)",
(int)(i+1), (int)ntests);
} else {
sprintf(s, "Testing random string conversion speed");
}
printf("%-70s", s);
fflush(stdout);
if (H5Tconvert(c_type, f_type, nelmts, buf, NULL)<0) goto error;
@ -1141,7 +1150,7 @@ test_conv_int (void)
static int
test_conv_int_1(const char *name, hid_t src, hid_t dst)
{
const size_t ntests=5; /*number of tests */
const size_t ntests=NTESTS; /*number of tests */
const size_t nelmts=200000; /*num values per test */
const size_t max_fails=8; /*max number of failures*/
size_t fails_all_tests=0; /*number of failures */
@ -1168,6 +1177,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
unsigned hw_uint;
long hw_long;
unsigned long hw_ulong;
long_long hw_llong;
unsigned long_long hw_ullong;
/* What are the names of the source and destination types */
@ -1195,6 +1206,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
} else if (H5Tequal(src, H5T_NATIVE_ULONG)) {
src_type_name = "unsigned long";
src_type = INT_ULONG;
} else if (H5Tequal(src, H5T_NATIVE_LLONG)) {
src_type_name = "long long";
src_type = INT_LLONG;
} else if (H5Tequal(src, H5T_NATIVE_ULLONG)) {
src_type_name = "unsigned long long";
src_type = INT_ULLONG;
} else {
src_type_name = "UNKNOWN";
src_type = INT_OTHER;
@ -1224,6 +1241,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
} else if (H5Tequal(dst, H5T_NATIVE_ULONG)) {
dst_type_name = "unsigned long";
dst_type = INT_ULONG;
} else if (H5Tequal(dst, H5T_NATIVE_LLONG)) {
dst_type_name = "long long";
dst_type = INT_LLONG;
} else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) {
dst_type_name = "unsigned long long";
dst_type = INT_ULLONG;
} else {
dst_type_name = "UNKNOWN";
dst_type = INT_OTHER;
@ -1249,8 +1272,13 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
/* The tests */
for (i=0; i<ntests; i++) {
sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)",
name, src_type_name, dst_type_name, (int)i+1, (int)ntests);
if (ntests>1) {
sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)",
name, src_type_name, dst_type_name, (int)i+1, (int)ntests);
} else {
sprintf(str, "Testing random %s %s -> %s conversions",
name, src_type_name, dst_type_name);
}
printf("%-70s", str);
fflush(stdout);
fails_this_test=0;
@ -1294,6 +1322,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_char = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_char = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_char = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1324,6 +1358,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_uchar = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_uchar = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_uchar = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1354,6 +1394,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_short = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_short = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_short = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1384,6 +1430,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_ushort = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_ushort = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_ushort = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1414,6 +1466,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_int = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_int = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_int = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1444,6 +1502,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_uint = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_uint = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_uint = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1474,6 +1538,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_long = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_long = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_long = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1504,6 +1574,84 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
hw_ulong = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_ulong = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_ulong = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
} else if (INT_LLONG==dst_type) {
hw = (unsigned char*)&hw_llong;
switch (src_type) {
case INT_CHAR:
hw_llong = ((signed char*)saved)[j];
break;
case INT_UCHAR:
hw_llong = ((unsigned char*)saved)[j];
break;
case INT_SHORT:
hw_llong = ((short*)saved)[j];
break;
case INT_USHORT:
hw_llong = ((unsigned short*)saved)[j];
break;
case INT_INT:
hw_llong = ((int*)saved)[j];
break;
case INT_UINT:
hw_llong = ((unsigned*)saved)[j];
break;
case INT_LONG:
hw_llong = ((long*)saved)[j];
break;
case INT_ULONG:
hw_llong = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_llong = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_llong = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
} else if (INT_ULLONG==dst_type) {
hw = (unsigned char*)&hw_ullong;
switch (src_type) {
case INT_CHAR:
hw_ullong = ((signed char*)saved)[j];
break;
case INT_UCHAR:
hw_ullong = ((unsigned char*)saved)[j];
break;
case INT_SHORT:
hw_ullong = ((short*)saved)[j];
break;
case INT_USHORT:
hw_ullong = ((unsigned short*)saved)[j];
break;
case INT_INT:
hw_ullong = ((int*)saved)[j];
break;
case INT_UINT:
hw_ullong = ((unsigned*)saved)[j];
break;
case INT_LONG:
hw_ullong = ((long*)saved)[j];
break;
case INT_ULONG:
hw_ullong = ((unsigned long*)saved)[j];
break;
case INT_LLONG:
hw_ullong = ((long_long*)saved)[j];
break;
case INT_ULLONG:
hw_ullong = ((unsigned long_long*)saved)[j];
break;
case INT_OTHER:
break;
}
@ -1663,6 +1811,13 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
printf(" %29lu\n", ((unsigned long*)saved)[j]);
break;
case INT_LLONG:
printf(" %29"PRINTF_LL_WIDTH"d\n", ((long_long*)saved)[j]);
break;
case INT_ULLONG:
printf(" %29"PRINTF_LL_WIDTH"u\n",
((unsigned long_long*)saved)[j]);
break;
case INT_OTHER:
break;
}
@ -1697,6 +1852,13 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
printf(" %29lu\n", ((unsigned long*)buf)[j]);
break;
case INT_LLONG:
printf(" %29"PRINTF_LL_WIDTH"d\n", ((long_long*)buf)[j]);
break;
case INT_ULLONG:
printf(" %29"PRINTF_LL_WIDTH"u\n",
((unsigned long_long*)buf)[j]);
break;
case INT_OTHER:
break;
}
@ -1731,6 +1893,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
case INT_ULONG:
printf(" %29lu\n", *((unsigned long*)hw));
break;
case INT_LLONG:
printf(" %29"PRINTF_LL_WIDTH"d\n", *((long_long*)hw));
break;
case INT_ULLONG:
printf(" %29"PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw));
break;
case INT_OTHER:
break;
}
@ -1742,9 +1910,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
}
PASSED();
}
#ifdef SHOW_OVERFLOWS
if (noverflows_g>0) {
printf(" %d overflow%s\n", noverflows_g, 1==noverflows_g?"":"s");
printf(" %d overflow%s in previous test\n",
noverflows_g, 1==noverflows_g?"":"s");
}
#endif
done:
if (buf) free(buf);
@ -1791,7 +1962,7 @@ my_isnan(flt_t type, void *val)
retval = (*((double*)val)!=*((double*)val));
break;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
case FLT_LDOUBLE:
retval = (*((long double*)val)!=*((long double*)val));
break;
@ -1815,7 +1986,7 @@ my_isnan(flt_t type, void *val)
sprintf(s, "%g", *((double*)val));
break;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
case FLT_LDOUBLE:
sprintf(s, "%Lg", *((long double*)val));
break;
@ -1856,7 +2027,7 @@ static int
test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
{
flt_t src_type, dst_type; /*data types */
const size_t ntests=5; /*number of tests */
const size_t ntests=NTESTS; /*number of tests */
const size_t nelmts=200000; /*num values per test */
const size_t max_fails=8; /*max number of failures*/
size_t fails_all_tests=0; /*number of failures */
@ -1869,7 +2040,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
char str[256]; /*hello string */
float hw_f; /*hardware-converted */
double hw_d; /*hardware-converted */
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
long double hw_ld; /*hardware-converted */
#endif
unsigned char *hw=NULL; /*ptr to hardware-conv'd*/
@ -1917,7 +2088,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) {
src_type_name = "double";
src_type = FLT_DOUBLE;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) {
src_type_name = "long double";
src_type = FLT_LDOUBLE;
@ -1933,7 +2104,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) {
dst_type_name = "double";
dst_type = FLT_DOUBLE;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) {
dst_type_name = "long double";
dst_type = FLT_LDOUBLE;
@ -1968,8 +2139,13 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
* If it looks like it might take a long time then print a progress
* report between each test.
*/
sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)",
name, src_type_name, dst_type_name, (int)i+1, (int)ntests);
if (ntests>1) {
sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)",
name, src_type_name, dst_type_name, (int)i+1, (int)ntests);
} else {
sprintf(str, "Testing random %s %s -> %s conversions",
name, src_type_name, dst_type_name);
}
printf("%-70s", str);
fflush(stdout);
fails_this_test = 0;
@ -1984,7 +2160,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else {
for (j=0; j<nelmts; j++) {
/* Do it this way for alignment reasons */
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
long double temp[1];
#else
double temp[1];
@ -1998,7 +2174,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
if (FLT_DOUBLE==src_type && FLT_FLOAT==dst_type) {
hw_d = *((float*)temp);
memcpy(buf+j*src_size, &hw_d, src_size);
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else if (FLT_LDOUBLE==src_type && FLT_FLOAT==dst_type) {
hw_ld = *((float*)temp);
memcpy(buf+j*src_size, &hw_ld, src_size);
@ -2019,7 +2195,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
for (j=0; j<nelmts; j++) {
hw_f = 911.0;
hw_d = 911.0;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
hw_ld = 911.0;
#endif
@ -2031,7 +2207,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else if (FLT_DOUBLE==dst_type) {
hw_d = ((float*)saved)[j];
hw = (unsigned char*)&hw_d;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else {
hw_ld = ((float*)saved)[j];
hw = (unsigned char*)&hw_ld;
@ -2044,13 +2220,13 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else if (FLT_DOUBLE==dst_type) {
hw_d = ((double*)saved)[j];
hw = (unsigned char*)&hw_d;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else {
hw_ld = ((double*)saved)[j];
hw = (unsigned char*)&hw_ld;
#endif
}
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else {
if (FLT_FLOAT==dst_type) {
hw_f = ((long double*)saved)[j];
@ -2086,7 +2262,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
my_isnan(dst_type, (double*)buf+j) &&
my_isnan(dst_type, hw)) {
continue;
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else if (FLT_LDOUBLE==dst_type &&
my_isnan(dst_type, (long double*)buf+j) &&
my_isnan(dst_type, hw)) {
@ -2121,7 +2297,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
} else if (FLT_DOUBLE==dst_type) {
check_mant[0] = frexp(((double*)buf)[j], check_expo+0);
check_mant[1] = frexp(((double*)hw)[0], check_expo+1);
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else {
check_mant[0] = frexp(((long double*)buf)[j],check_expo+0);
check_mant[1] = frexp(((long double*)hw)[0],check_expo+1);
@ -2146,7 +2322,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
printf(" %29.20e\n", ((float*)saved)[j]);
} else if (FLT_DOUBLE==src_type) {
printf(" %29.20e\n", ((double*)saved)[j]);
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else {
printf(" %29.20Le\n", ((long double*)saved)[j]);
#endif
@ -2161,7 +2337,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
printf(" %29.20e\n", ((float*)buf)[j]);
} else if (FLT_DOUBLE==dst_type) {
printf(" %29.20e\n", ((double*)buf)[j]);
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else {
printf(" %29.20Le\n", ((long double*)buf)[j]);
#endif
@ -2176,7 +2352,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
printf(" %29.20e\n", hw_f);
} else if (FLT_DOUBLE==dst_type) {
printf(" %29.20e\n", hw_d);
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
} else {
printf(" %29.20Le\n", hw_ld);
#endif
@ -2189,9 +2365,12 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
}
PASSED();
}
#ifdef SHOW_OVERFLOWS
if (noverflows_g>0) {
printf(" %d overflow%s\n", noverflows_g, 1==noverflows_g?"":"s");
printf(" %d overflow%s in previous test\n",
noverflows_g, 1==noverflows_g?"":"s");
}
#endif
done:
if (buf) free (buf);
@ -2216,6 +2395,169 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
#endif
}
/*-------------------------------------------------------------------------
* Function: run_integer_tests
*
* Purpose: Runs all integer tests.
*
* Return: Number of errors
*
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
run_integer_tests(const char *name)
{
int nerrors = 0;
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_UINT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_CHAR, H5T_NATIVE_ULLONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_UINT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UCHAR, H5T_NATIVE_ULLONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_UINT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_SHORT, H5T_NATIVE_ULLONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_UINT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_USHORT, H5T_NATIVE_ULLONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_UINT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_INT, H5T_NATIVE_ULLONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_INT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_UINT, H5T_NATIVE_ULLONG);
#endif
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_ULONG);
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_LONG, H5T_NATIVE_ULLONG);
#endif
#endif
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_LONG);
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_LLONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULONG, H5T_NATIVE_ULLONG);
#endif
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_UINT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_LLONG, H5T_NATIVE_ULLONG);
#endif
#if SIZEOF_LONG_LONG!=SIZEOF_LONG
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_UINT);
#if SIZEOF_LONG!=SIZEOF_INT
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_LONG);
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1(name, H5T_NATIVE_ULLONG, H5T_NATIVE_LLONG);
#endif
return nerrors;
}
/*-------------------------------------------------------------------------
* Function: main
@ -2248,6 +2590,7 @@ main(void)
nerrors += test_compound()<0 ? 1 : 0;
nerrors += test_transient (fapl)<0 ? 1 : 0;
nerrors += test_named (fapl)<0 ? 1 : 0;
h5_cleanup (fapl); /*must happen before first reset*/
reset_hdf5();
nerrors += test_conv_str_1()<0 ? 1 : 0;
@ -2262,182 +2605,26 @@ main(void)
nerrors += test_conv_flt_1("noop", H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE);
/* Test hardware integer conversion functions */
nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("hw", H5T_NATIVE_CHAR, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UCHAR, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("hw", H5T_NATIVE_SHORT, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("hw", H5T_NATIVE_USHORT, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("hw", H5T_NATIVE_INT, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_INT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("hw", H5T_NATIVE_UINT, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_LONG, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1("hw", H5T_NATIVE_ULONG, H5T_NATIVE_LONG);
#endif
nerrors += run_integer_tests("hw");
/* Test hardware floating-point conversion functions */
nerrors += test_conv_flt_1("hw", H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1("hw", H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT);
/*----------------------------------------------------------------------
* Software tests follow
* Software tests
*----------------------------------------------------------------------
*/
without_hardware_g = TRUE;
reset_hdf5();
/* Test software integer conversion functions */
nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("sw", H5T_NATIVE_CHAR, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_INT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UCHAR, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("sw", H5T_NATIVE_SHORT, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_INT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("sw", H5T_NATIVE_USHORT, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_UINT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("sw", H5T_NATIVE_INT, H5T_NATIVE_ULONG);
#endif
nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_INT);
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_LONG);
nerrors += test_conv_int_1("sw", H5T_NATIVE_UINT, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_LONG, H5T_NATIVE_ULONG);
#endif
#if SIZEOF_INT != SIZEOF_LONG
nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_CHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_UCHAR);
nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_SHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_USHORT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_INT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_UINT);
nerrors += test_conv_int_1("sw", H5T_NATIVE_ULONG, H5T_NATIVE_LONG);
#endif
nerrors += run_integer_tests("sw");
/* Test software floating-point conversion functions */
nerrors += test_conv_flt_1("sw", H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE);
nerrors += test_conv_flt_1("sw", H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT);
#ifdef USE_LDOUBLE
#if SIZEOF_LDOUBLE!=SIZEOF_DOUBLE
nerrors += test_conv_flt_1("sw", H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1("sw", H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1("sw", H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
@ -2450,6 +2637,5 @@ main(void)
exit(1);
}
printf("All data type tests passed.\n");
h5_cleanup (fapl);
return 0;
}

View File

@ -40,7 +40,6 @@ main (void)
{
hid_t file, dataset, mem_space, file_space, cparms;
hid_t fapl;
herr_t status;
int i, j, k, m;
static int buf1[NY][NX], buf2[NX/2][NY/2];
static const hsize_t dims[2] = {NX, NY};

View File

@ -824,10 +824,7 @@ main (void)
if (H5Fclose(file)<0) goto error;
puts("All external storage tests passed.");
h5_cleanup(fapl);
/* cleanup external files */
if (!getenv("HDF5_NOCLEANUP")) {
if (h5_cleanup(fapl)) {
remove("extern_1a.raw");
remove("extern_1b.raw");
remove("extern_2a.raw");

View File

@ -726,8 +726,7 @@ main(int argc, char *argv[])
if (nerrors) goto error;
puts("All fill value tests passed.");
h5_cleanup(fapl);
if (!getenv("HDF5_NOCLEANUP")) remove(FILE_NAME_RAW);
if (h5_cleanup(fapl)) remove(FILE_NAME_RAW);
return 0;
error:

View File

@ -9,59 +9,22 @@
* collections but the collections are not related to one
* another by anything that appears in the file format.
*/
#include <h5test.h>
#include <H5private.h>
#include <H5Eprivate.h>
#include <H5Fprivate.h>
#include <H5Gprivate.h>
#include <H5HGprivate.h>
#include <H5Iprivate.h>
#include <H5Pprivate.h>
#ifndef HAVE_FUNCTION
# undef __FUNCTION__
# define __FUNCTION__ ""
#endif
#define TEST_FILE_NAME0 "gheap0.h5"
#define TEST_FILE_NAME1 "gheap1.h5"
#define TEST_FILE_NAME2 "gheap2.h5"
#define TEST_FILE_NAME3 "gheap3.h5"
#define TEST_FILE_NAME4 "gheap4.h5"
#define FAILED(S) { \
puts ("*FAILED*"); \
printf (" Failed at %s:%d in %s()%s%s\n", \
__FILE__, __LINE__, __FUNCTION__, \
(S)&&*(S)?": ":"", (S)?(S):""); \
H5Eprint (stdout); \
}
/*-------------------------------------------------------------------------
* Function: emit_diagnostics
*
* Purpose: If debugging is turned on then this function will cause the
* library to emit its diagnostic messages now instead of when
* we're trying to make the output look nice.
*
* Return: void
*
* Programmer: Robb Matzke
* Tuesday, March 31, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
emit_diagnostics (void)
{
H5F_t *f = H5F_open (TEST_FILE_NAME0,
H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC,
NULL, NULL);
H5G_t *g = H5G_create (H5G_entof(f->shared->root_grp), "emit", 0);
H5G_close (g);
H5F_close (f);
}
const char *FILENAME[] = {
"gheap1",
"gheap2",
"gheap3",
"gheap4",
NULL
};
/*-------------------------------------------------------------------------
@ -72,7 +35,7 @@ emit_diagnostics (void)
*
* Return: Success: 0
*
* Failure: -1
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, March 31, 1998
@ -82,28 +45,29 @@ emit_diagnostics (void)
*-------------------------------------------------------------------------
*/
static int
test_1 (void)
test_1 (hid_t fapl)
{
H5F_t *f;
hid_t file=-1;
H5F_t *f=NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
herr_t status;
int retval = 0;
int nerrors=0;
char filename[1024];
printf ("%-70s", "...monotonically increasing lengths");
fflush (stdout);
TESTING("monotonically increasing lengths");
/* Open a clean file */
H5Eclear ();
f = H5F_open (TEST_FILE_NAME1,
H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC|H5F_ACC_DEBUG,
NULL, NULL);
if (!f) {
FAILED ("unable to create file");
return -1;
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if (NULL==(f=H5I_object(file))) {
FAILED();
puts(" Unable to create file");
goto error;
}
/*
@ -117,11 +81,13 @@ test_1 (void)
H5Eclear ();
status = H5HG_insert (f, size, out, obj+i);
if (status<0) {
FAILED ("unable to insert object into global heap");
--retval;
FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
} else if (i && H5F_addr_gt (&(obj[i-1].addr), &(obj[i].addr))) {
FAILED ("collection addresses are not monotonically increasing");
--retval;
FAILED();
puts(" Collection addresses are not monotonically increasing");
nerrors++;
}
}
@ -133,17 +99,26 @@ test_1 (void)
memset (out, 'A'+i%26, size);
H5Eclear ();
if (NULL==H5HG_read (f, obj+i, in)) {
FAILED ("unable to read object");
--retval;
FAILED();
puts(" Unable to read object");
nerrors++;
} else if (memcmp (in, out, size)) {
FAILED ("value read doesn't match value written");
--retval;
FAILED();
puts(" Value read doesn't match value written");
nerrors++;
}
}
puts (" PASSED");
H5F_close (f);
return retval;
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
return MAX(1, nerrors);
}
@ -155,7 +130,7 @@ test_1 (void)
*
* Return: Success: 0
*
* Failure: -1
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, March 31, 1998
@ -165,28 +140,28 @@ test_1 (void)
*-------------------------------------------------------------------------
*/
static int
test_2 (void)
test_2 (hid_t fapl)
{
H5F_t *f;
hid_t file=-1;
H5F_t *f=NULL;
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
int i;
size_t size;
herr_t status;
int retval = 0;
int nerrors=0;
char filename[1024];
printf ("%-70s", "...monotonically decreasing lengths");
fflush (stdout);
TESTING("monotonically decreasing lengths");
/* Open a clean file */
H5Eclear ();
f = H5F_open (TEST_FILE_NAME2,
H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC|H5F_ACC_DEBUG,
NULL, NULL);
if (!f) {
FAILED ("unable to create file");
return -1;
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if (NULL==(f=H5I_object(file))) {
FAILED();
puts(" Unable to create file");
goto error;
}
/*
@ -196,10 +171,10 @@ test_2 (void)
size = 1024-i;
memset (out, 'A'+i%26, size);
H5Eclear ();
status = H5HG_insert (f, size, out, obj+i);
if (status<0) {
FAILED ("unable to insert object into global heap");
--retval;
if (H5HG_insert (f, size, out, obj+i)<0) {
FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
}
}
@ -211,17 +186,26 @@ test_2 (void)
memset (out, 'A'+i%26, size);
H5Eclear ();
if (NULL==H5HG_read (f, obj+i, in)) {
FAILED ("unable to read object");
--retval;
FAILED();
puts(" Unable to read object");
nerrors++;
} else if (memcmp (in, out, size)) {
FAILED ("value read doesn't match value written");
--retval;
FAILED();
puts(" Value read doesn't match value written");
nerrors++;
}
}
puts (" PASSED");
H5F_close (f);
return retval;
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
return MAX(1, nerrors);
}
@ -233,7 +217,7 @@ test_2 (void)
*
* Return: Success: 0
*
* Failure: -1
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, March 31, 1998
@ -243,27 +227,28 @@ test_2 (void)
*-------------------------------------------------------------------------
*/
static int
test_3 (void)
test_3 (hid_t fapl)
{
H5F_t *f;
hid_t file=-1;
H5F_t *f=NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
int retval = 0;
int nerrors=0;
char filename[1024];
printf ("%-70s", "...complete object removal");
fflush (stdout);
TESTING("complete object removal");
/* Open a clean file */
H5Eclear ();
f = H5F_open (TEST_FILE_NAME3,
H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC|H5F_ACC_DEBUG,
NULL, NULL);
if (!f) {
FAILED ("unable to create file");
return -1;
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if (NULL==(f=H5I_object(file))) {
FAILED();
puts(" Unable to create file");
goto error;
}
/* Create some stuff */
@ -273,8 +258,9 @@ test_3 (void)
H5Eclear ();
status = H5HG_insert (f, size, out, obj+i);
if (status<0) {
FAILED ("unable to insert object into global heap");
--retval;
FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
}
}
@ -282,14 +268,22 @@ test_3 (void)
for (i=0; i<1024; i++) {
status = H5HG_remove (f, obj+i);
if (status<0) {
FAILED ("unable to remove object");
--retval;
FAILED();
puts(" Unable to remove object");
nerrors++;
}
}
puts (" PASSED");
H5F_close (f);
return retval;
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
return MAX(1, nerrors);
}
@ -302,7 +296,7 @@ test_3 (void)
*
* Return: Success: 0
*
* Failure: -1
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, March 31, 1998
@ -312,30 +306,30 @@ test_3 (void)
*-------------------------------------------------------------------------
*/
static int
test_4 (void)
test_4 (hid_t fapl)
{
H5F_t *f;
hid_t file=-1;
H5F_t *f=NULL;
H5HG_t obj[1024];
uint8_t out[1024];
int i;
size_t size;
herr_t status;
int retval = 0;
int nerrors=0;
char filename[1024];
printf ("%-70s", "...partial object removal");
fflush (stdout);
TESTING("partial object removal");
/* Open a clean file */
H5Eclear ();
f = H5F_open (TEST_FILE_NAME4,
H5F_ACC_CREAT|H5F_ACC_RDWR|H5F_ACC_TRUNC|H5F_ACC_DEBUG,
NULL, NULL);
if (!f) {
FAILED ("unable to create file");
return -1;
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if (NULL==(f=H5I_object(file))) {
FAILED();
puts(" Unable to create file");
goto error;
}
for (i=0; i<1024; i++) {
/* Insert */
size = i%30+100;
@ -343,8 +337,9 @@ test_4 (void)
H5Eclear ();
status = H5HG_insert (f, size, out, obj+i);
if (status<0) {
FAILED ("unable to insert object into global heap");
--retval;
FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
}
/*
@ -356,46 +351,26 @@ test_4 (void)
H5Eclear ();
status = H5HG_remove (f, obj+i-1);
if (status<0) {
FAILED ("unable to remove object");
--retval;
FAILED();
puts(" Unable to remove object");
nerrors++;
}
memset (obj+i-1, 0, sizeof *obj);
}
}
puts (" PASSED");
H5F_close (f);
return retval;
if (H5Fclose(file)<0) goto error;
if (nerrors) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
return MAX(1, nerrors);
}
/*-------------------------------------------------------------------------
* Function: cleanup
*
* Purpose: Cleanup temporary test files
*
* Return: none
*
* Programmer: Albert Cheng
* May 28, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
cleanup(void)
{
if (!getenv ("HDF5_NOCLEANUP")) {
remove(TEST_FILE_NAME0);
remove(TEST_FILE_NAME1);
remove(TEST_FILE_NAME2);
remove(TEST_FILE_NAME3);
remove(TEST_FILE_NAME4);
}
}
/*-------------------------------------------------------------------------
* Function: main
@ -416,22 +391,23 @@ cleanup(void)
int
main (void)
{
int nfailed=0;
int nerrors=0;
hid_t fapl;
emit_diagnostics ();
h5_reset();
fapl = h5_fileaccess();
nfailed += test_1()<0 ? 1 : 0;
nfailed += test_2()<0 ? 1 : 0;
nfailed += test_3()<0 ? 1 : 0;
nfailed += test_4()<0 ? 1 : 0;
nerrors += test_1(fapl);
nerrors += test_2(fapl);
nerrors += test_3(fapl);
nerrors += test_4(fapl);
if (nerrors) goto error;
if (nfailed) {
printf ("*** %d global heap test%s failed ***\n",
nfailed, 1==nfailed?"":"s");
} else {
printf ("All global heap tests passed.\n");
cleanup();
}
return nfailed?-1:0;
puts("All global heap tests passed.");
h5_cleanup(fapl);
return 0;
error:
puts("*** TESTS FAILED ***");
return 1;
}

View File

@ -66,7 +66,7 @@ h5_errors(void __unused__ *client_data)
* `extern const char *FILENAMES[]' -- these are only the base
* names. The file access property list is also closed.
*
* Return: none
* Return: Non-zero if cleanup actions were performed; zero otherwise.
*
* Programmer: Albert Cheng
* May 28, 1998
@ -75,12 +75,13 @@ h5_errors(void __unused__ *client_data)
*
*-------------------------------------------------------------------------
*/
void
int
h5_cleanup(hid_t fapl)
{
char filename[1024];
char temp[2048];
int i, j;
int retval=0;
if (!getenv("HDF5_NOCLEANUP")) {
for (i=0; FILENAME[i]; i++) {
@ -113,8 +114,10 @@ h5_cleanup(hid_t fapl)
break;
}
}
retval=1;
}
H5Pclose(fapl);
return retval;
}
@ -135,10 +138,27 @@ h5_cleanup(hid_t fapl)
void
h5_reset(void)
{
char filename[1024];
fflush(stdout);
fflush(stderr);
H5close();
H5Eset_auto (h5_errors, NULL);}
H5Eset_auto (h5_errors, NULL);
/*
* Cause the library to emit some diagnostics early so they don't
* interfere with other formatted output.
*/
sprintf(filename, "/tmp/h5emit-%05d.h5", getpid());
H5E_BEGIN_TRY {
hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
H5P_DEFAULT);
hid_t grp = H5Gcreate(file, "emit", 0);
H5Gclose(grp);
H5Fclose(file);
unlink(filename);
} H5E_END_TRY;
}
/*-------------------------------------------------------------------------
@ -304,6 +324,8 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_char_uint);
H5Tunregister(H5T_conv_char_long);
H5Tunregister(H5T_conv_char_ulong);
H5Tunregister(H5T_conv_char_llong);
H5Tunregister(H5T_conv_char_ullong);
H5Tunregister(H5T_conv_uchar_char);
H5Tunregister(H5T_conv_uchar_short);
@ -312,6 +334,8 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_uchar_uint);
H5Tunregister(H5T_conv_uchar_long);
H5Tunregister(H5T_conv_uchar_ulong);
H5Tunregister(H5T_conv_uchar_llong);
H5Tunregister(H5T_conv_uchar_ullong);
H5Tunregister(H5T_conv_short_char);
H5Tunregister(H5T_conv_short_uchar);
@ -320,6 +344,8 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_short_uint);
H5Tunregister(H5T_conv_short_long);
H5Tunregister(H5T_conv_short_ulong);
H5Tunregister(H5T_conv_short_llong);
H5Tunregister(H5T_conv_short_ullong);
H5Tunregister(H5T_conv_ushort_char);
H5Tunregister(H5T_conv_ushort_uchar);
@ -328,6 +354,8 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_ushort_uint);
H5Tunregister(H5T_conv_ushort_long);
H5Tunregister(H5T_conv_ushort_ulong);
H5Tunregister(H5T_conv_ushort_llong);
H5Tunregister(H5T_conv_ushort_ullong);
H5Tunregister(H5T_conv_int_char);
H5Tunregister(H5T_conv_int_uchar);
@ -336,6 +364,8 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_int_uint);
H5Tunregister(H5T_conv_int_long);
H5Tunregister(H5T_conv_int_ulong);
H5Tunregister(H5T_conv_int_llong);
H5Tunregister(H5T_conv_int_ullong);
H5Tunregister(H5T_conv_uint_char);
H5Tunregister(H5T_conv_uint_uchar);
@ -344,6 +374,8 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_uint_int);
H5Tunregister(H5T_conv_uint_long);
H5Tunregister(H5T_conv_uint_ulong);
H5Tunregister(H5T_conv_uint_llong);
H5Tunregister(H5T_conv_uint_ullong);
H5Tunregister(H5T_conv_long_char);
H5Tunregister(H5T_conv_long_uchar);
@ -352,6 +384,8 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_long_int);
H5Tunregister(H5T_conv_long_uint);
H5Tunregister(H5T_conv_long_ulong);
H5Tunregister(H5T_conv_long_llong);
H5Tunregister(H5T_conv_long_ullong);
H5Tunregister(H5T_conv_ulong_char);
H5Tunregister(H5T_conv_ulong_uchar);
@ -360,6 +394,28 @@ h5_no_hwconv(void)
H5Tunregister(H5T_conv_ulong_int);
H5Tunregister(H5T_conv_ulong_uint);
H5Tunregister(H5T_conv_ulong_long);
H5Tunregister(H5T_conv_ulong_llong);
H5Tunregister(H5T_conv_ulong_ullong);
H5Tunregister(H5T_conv_llong_char);
H5Tunregister(H5T_conv_llong_uchar);
H5Tunregister(H5T_conv_llong_short);
H5Tunregister(H5T_conv_llong_ushort);
H5Tunregister(H5T_conv_llong_int);
H5Tunregister(H5T_conv_llong_uint);
H5Tunregister(H5T_conv_llong_long);
H5Tunregister(H5T_conv_llong_ulong);
H5Tunregister(H5T_conv_llong_ullong);
H5Tunregister(H5T_conv_ullong_char);
H5Tunregister(H5T_conv_ullong_uchar);
H5Tunregister(H5T_conv_ullong_short);
H5Tunregister(H5T_conv_ullong_ushort);
H5Tunregister(H5T_conv_ullong_int);
H5Tunregister(H5T_conv_ullong_uint);
H5Tunregister(H5T_conv_ullong_long);
H5Tunregister(H5T_conv_ullong_ulong);
H5Tunregister(H5T_conv_ullong_llong);
H5Tunregister(H5T_conv_float_double);
H5Tunregister(H5T_conv_double_float);

View File

@ -54,8 +54,7 @@ extern const char *FILENAME[];
extern "C" {
#endif
void h5_cleanup(hid_t fapl);
void h5_cleanup(hid_t fapl);
int h5_cleanup(hid_t fapl);
herr_t h5_errors(void __unused__ *client_data);
char *h5_fixname(const char *basename, hid_t fapl, char *fullname,
size_t size);

View File

@ -7,6 +7,7 @@
*
* Purpose: Tests various aspects of indexed raw data storage.
*/
#include <h5test.h>
#include <H5private.h>
#include <H5Dprivate.h>
#include <H5Iprivate.h>
@ -17,29 +18,16 @@
#include <H5Oprivate.h>
#include <H5Vprivate.h>
#if 1
# define FILETYPE H5F_LOW_DFLT
# define FILENAME "istore.h5"
#elif 0
# define FILETYPE H5F_LOW_FAM
# define FILENAME "istore-%05d.h5"
# define TEST_FAMILY 1
#else
# define FILETYPE H5F_LOW_SPLIT
# define FILENAME "istore-split"
#endif
const char *FILENAME[] = {
"istore",
NULL
};
#define TEST_SMALL 0x0001
#define TEST_MEDIUM 0x0002
#define TEST_LARGE 0x0004
#ifndef HAVE_FUNCTION
#undef __FUNCTION__
#define __FUNCTION__ ""
#endif
#define AT() printf (" at %s:%d in %s()...\n", \
__FILE__, __LINE__, __FUNCTION__);
hsize_t align_g[3] = {50, 50, 50};
hssize_t zero[H5O_LAYOUT_NDIMS];
@ -82,6 +70,7 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
printf("\n");
}
}
/*-------------------------------------------------------------------------
* Function: new_object
@ -89,9 +78,9 @@ 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: Handle to a new open object.
* Return: Success: 0
*
* Failure: NULL, error message printed.
* Failure: -1
*
* Programmer: Robb Matzke
* Wednesday, October 15, 1997
@ -108,13 +97,11 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
/* Create the object header */
if (H5O_create(f, 64, ent)) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" H5O_create() = NULL\n");
}
return -1;
FAILED();
puts(" H5O_create() = NULL");
goto error;
}
/* create chunked storage */
layout.type = H5D_CHUNKED;
layout.ndims = ndims;
@ -127,27 +114,26 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
}
H5F_arr_create(f, &layout/*in,out*/);
if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, &layout) < 0) {
printf("*FAILED*\n");
if (!isatty(1)) {
AT();
printf(" H5O_modify istore message failure\n");
}
return -1;
FAILED();
puts(" H5O_modify istore message failure.");
goto error;
}
/* Give the object header a name */
if (H5G_insert(H5G_entof(H5G_rootof(f)), name, ent) < 0) {
printf("*FAILED*\n");
if (!isatty(1)) {
AT();
printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name);
}
return -1;
FAILED();
printf(" H5G_insert(f, name=\"%s\", ent) failed\n", name);
goto error;
}
/* Close the header */
H5O_close(ent);
return 0;
error:
return -1;
}
/*-------------------------------------------------------------------------
* Function: test_create
@ -173,17 +159,18 @@ test_create(H5F_t *f, const char *prefix)
intn i;
char name[256];
printf("%-70s", "Testing istore create");
TESTING("istore create");
for (i = 1; i <= H5O_LAYOUT_NDIMS; i++) {
sprintf(name, "%s_%02d", prefix, i);
HDsnprintf(name, sizeof name, "%s_%02d", prefix, i);
if (new_object(f, name, i, &handle) < 0)
return FAIL;
}
puts(" PASSED");
PASSED();
return SUCCEED;
}
/*-------------------------------------------------------------------------
* Function: test_extend
@ -244,26 +231,17 @@ test_extend(H5F_t *f, const char *prefix,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
if (!isatty(1)) {
AT();
printf(" Cannot create %d-d object `%s'\n", ndims, name);
}
printf(" Cannot create %d-d object `%s'\n", ndims, name);
goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Unable to read istore message\n");
}
FAILED();
puts(" Unable to read istore message.");
goto error;
}
if (ndims != layout.ndims) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Header read error: istore.ndims != %d\n", ndims);
}
FAILED();
printf(" Header read error: istore.ndims != %d\n", ndims);
goto error;
}
whole_size[0] = nx;
@ -298,7 +276,7 @@ test_extend(H5F_t *f, const char *prefix,
#if 0
if (0 == ctr)
printf("\n");
printf(" Insert: ctr=%d, corner=(%d", ctr, offset[0]);
printf(" Insert: ctr=%d, corner=(%d", ctr, offset[0]);
if (ndims > 1)
printf(",%d", offset[1]);
if (ndims > 2)
@ -321,42 +299,35 @@ test_extend(H5F_t *f, const char *prefix,
/* Write to disk */
if (H5F_arr_write(f, &H5D_xfer_dflt, &layout, NULL, NULL, NULL, size,
size, zero, offset, buf)<0) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
}
FAILED();
printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
goto error;
}
/* Read from disk */
memset(check, 0xff, (size_t)nelmts);
if (H5F_arr_read(f, &H5D_xfer_dflt, &layout, NULL, NULL, NULL, size,
size, zero, offset, check)<0) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Read failed: ctr=%lu\n", (unsigned long)ctr);
}
FAILED();
printf(" Read failed: ctr=%lu\n", (unsigned long)ctr);
goto error;
}
if (memcmp(buf, check, (size_t)nelmts)) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Read check failed: ctr=%lu\n", (unsigned long)ctr);
printf(" Wrote:\n");
print_array(buf, (size_t)size[0], (size_t)size[1],
(size_t)size[2]);
printf(" Read:\n");
print_array(check, (size_t)size[0], (size_t)size[1],
(size_t)size[2]);
}
FAILED();
printf(" Read check failed: ctr=%lu\n", (unsigned long)ctr);
printf(" Wrote:\n");
print_array(buf, (size_t)size[0], (size_t)size[1],
(size_t)size[2]);
printf(" Read:\n");
print_array(check, (size_t)size[0], (size_t)size[1],
(size_t)size[2]);
goto error;
}
/* Write to `whole' buffer for later checking */
H5V_hyper_copy(ndims, size,
whole_size, offset, whole, /*dst */
size, H5V_ZERO, buf); /*src */
whole_size, offset, whole, /*dst*/
size, H5V_ZERO, buf); /*src*/
/* Update max corner */
for (i=0; i<(size_t)ndims; i++) {
@ -368,42 +339,36 @@ test_extend(H5F_t *f, const char *prefix,
memset(buf, 0xff, nx * ny * nz);
if (H5F_arr_read(f, &H5D_xfer_dflt, &layout, NULL, NULL, NULL, whole_size,
whole_size, zero, zero, buf)<0) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Read failed for whole array\n");
}
FAILED();
puts(" Read failed for whole array.");
goto error;
}
for (i = 0; i < nx; i++) {
for (j = 0; j < ny; j++) {
for (k = 0; k < nz; k++) {
if (whole[i * ny * nz + j * nz + k] != buf[i * ny * nz + j * nz + k]) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Check failed at i=%lu", (unsigned long)i);
if (ndims > 1) {
printf(", j=%lu", (unsigned long)j);
}
if (ndims > 2) {
printf(", k=%lu", (unsigned long)k);
}
printf("\n Check array is:\n");
print_array(whole, nx, ny, nz);
printf(" Value read is:\n");
print_array(buf, nx, ny, nz);
for (i=0; i<nx; i++) {
for (j=0; j<ny; j++) {
for (k=0; k<nz; k++) {
if (whole[i*ny*nz + j*nz + k] != buf[i*ny*nz + j*nz + k]) {
FAILED();
printf(" Check failed at i=%lu", (unsigned long)i);
if (ndims > 1) {
printf(", j=%lu", (unsigned long)j);
}
if (ndims > 2) {
printf(", k=%lu", (unsigned long)k);
}
printf("\n Check array is:\n");
print_array(whole, nx, ny, nz);
printf(" Value read is:\n");
print_array(buf, nx, ny, nz);
goto error;
}
}
}
}
puts(" PASSED");
H5MM_xfree(buf);
H5MM_xfree(check);
H5MM_xfree(whole);
PASSED();
return SUCCEED;
error:
@ -412,6 +377,7 @@ test_extend(H5F_t *f, const char *prefix,
H5MM_xfree(whole);
return FAIL;
}
/*-------------------------------------------------------------------------
* Function: test_sparse
@ -466,18 +432,12 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
if (!isatty(1)) {
AT();
printf(" Cannot create %d-d object `%s'\n", ndims, name);
}
printf(" Cannot create %d-d object `%s'\n", ndims, name);
goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Unable to read istore message\n");
}
FAILED();
printf(" Unable to read istore message\n");
goto error;
}
for (ctr=0; ctr<nblocks; ctr++) {
@ -492,22 +452,19 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
/* write to disk */
if (H5F_arr_write(f, &H5D_xfer_dflt, &layout, NULL, NULL, NULL, size,
size, zero, offset, buf)<0) {
puts("*FAILED*");
if (!isatty(1)) {
AT();
printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
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");
}
FAILED();
printf(" Write failed: ctr=%lu\n", (unsigned long)ctr);
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;
@ -518,36 +475,14 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
/* We don't test reading yet.... */
}
puts(" PASSED");
H5MM_xfree(buf);
PASSED();
return SUCCEED;
error:
H5MM_xfree(buf);
return FAIL;
}
/*-------------------------------------------------------------------------
* Function: cleanup
*
* Purpose: Cleanup temporary test files
*
* Return: none
*
* Programmer: Albert Cheng
* May 28, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
cleanup(void)
{
if (!getenv ("HDF5_NOCLEANUP")) {
remove(FILENAME);
}
}
/*-------------------------------------------------------------------------
@ -569,15 +504,12 @@ cleanup(void)
int
main(int argc, char *argv[])
{
H5F_t *f;
herr_t status;
int nerrors = 0;
uintn size_of_test;
hid_t template_id;
H5F_create_t *creation_template = NULL;
H5G_t *dir = NULL;
setbuf(stdout, NULL);
hid_t fapl=-1, file=-1, fcpl=-1;
H5F_t *f;
herr_t status;
int nerrors = 0;
uintn size_of_test;
char filename[1024];
/* Parse arguments or assume `small' */
if (1 == argc) {
@ -608,40 +540,31 @@ main(int argc, char *argv[])
printf(" LARGE");
printf("\n");
/*
* Use larger file addresses...
*/
template_id = H5Pcreate(H5P_FILE_CREATE);
H5Pset_sizes(template_id, 8, 0);
creation_template = H5I_object(template_id);
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
/* Use larger file addresses... */
fcpl = H5Pcreate(H5P_FILE_CREATE);
H5Pset_sizes(fcpl, 8, 0);
/* Create the test file */
if (NULL == (f = H5F_open(FILENAME,
(H5F_ACC_CREAT | H5F_ACC_RDWR | H5F_ACC_TRUNC |
H5F_ACC_DEBUG),
creation_template, NULL))) {
printf("Cannot create file %s; test aborted\n", FILENAME);
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl))<0 ||
NULL==(f=H5I_object(file))) {
printf("Cannot create file %s; test aborted\n", filename);
exit(1);
}
#ifdef TEST_FAMILY
{
/*
* For testing file families, fool the library into thinking it already
* allocated a whole bunch of data.
*/
haddr_t addr;
addr.offset = 8 * ((uint64) 1 << 30); /*8 GB */
/*
* For testing file families, fool the library into thinking it already
* allocated a whole bunch of data.
*/
if (H5F_LOW_FAMILY==H5Pget_driver(fapl)) {
haddr_t addr;
addr.offset = 8 * ((uint64_t)1<<30); /*8 GB */
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...
*/
dir = H5G_create(H5G_entof(H5G_rootof(f)), "flushing_diagnostics", 0);
H5G_close(dir);
dir = NULL;
/*
* Creation test: Creates empty objects with various raw data sizes
@ -686,19 +609,17 @@ main(int argc, char *argv[])
status = test_sparse(f, "sparse", 800, 50, 50, 50);
nerrors += status < 0 ? 1 : 0;
}
/* Close the test file and exit */
H5F_close(f);
H5Fclose(file);
if (nerrors) {
printf("***** %d I-STORE TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
if (isatty(1)) {
printf("(Redirect output to a pager or a file to see "
"debug output)\n");
}
exit(1);
}
H5Pclose (template_id);
printf("All i-store tests passed.\n");
cleanup();
h5_cleanup(fapl);
return 0;
}

131
test/lheap.c Normal file
View File

@ -0,0 +1,131 @@
/*
* Copyright © 1998 NCSA
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Tuesday, November 24, 1998
*
* Purpose: Test local heaps used by symbol tables (groups).
*/
#include <h5test.h>
#include <H5HLprivate.h>
#include <H5Iprivate.h>
const char *FILENAME[] = {
"lheap",
NULL
};
#define NOBJS 40
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Create a file, create a local heap, write data into the local
* heap, close the file, open the file, read data out of the
* local heap, close the file.
*
* Return: Success: zero
*
* Failure: non-zero
*
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
hid_t fapl=-1; /*file access properties */
hid_t file=-1; /*hdf5 file */
H5F_t *f=NULL; /*hdf5 file pointer */
char filename[1024]; /*file name */
haddr_t heap_addr; /*local heap address */
size_t obj[NOBJS]; /*offsets within the heap */
int i, j; /*miscellaneous counters */
char buf[1024]; /*the value to store */
const char *s; /*value to read */
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
/*
* Test writing to the heap...
*/
TESTING("local heap write");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if (NULL==(f=H5I_object(file))) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5HL_create(f, 0, &heap_addr/*out*/)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
for (i = 0; i < NOBJS; i++) {
sprintf(buf, "%03d-", i);
for (j=4; j<i; j++) buf[j] = '0' + j%10;
if (j>4) buf[j] = '\0';
if ((size_t)(-1)==(obj[i]=H5HL_insert(f, &heap_addr, strlen(buf)+1,
buf))) {
FAILED();
H5Eprint(stdout);
goto error;
}
}
if (H5Fclose(file)<0) goto error;
PASSED();
/*
* Test reading from the heap...
*/
TESTING("local heap read");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error;
if (NULL==(f=H5I_object(file))) {
FAILED();
H5Eprint(stdout);
goto error;
}
for (i=0; i<NOBJS; i++) {
sprintf(buf, "%03d-", i);
for (j=4; j<i; j++) buf[j] = '0' + j%10;
if (j>4) buf[j] = '\0';
if (NULL==(s=H5HL_peek(f, &heap_addr, obj[i]))) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (strcmp(s, buf)) {
FAILED();
printf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i]));
printf(" got: \"%s\"\n", s);
printf(" ans: \"%s\"\n", buf);
goto error;
}
}
if (H5Fclose(file)<0) goto error;
PASSED();
puts("All local heap tests passed.");
h5_cleanup(fapl);
return 0;
error:
puts("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
return 1;
}

278
test/ohdr.c Normal file
View File

@ -0,0 +1,278 @@
/*
* Copyright © 1998 NCSA
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Tuesday, November 24, 1998
*/
#include <h5test.h>
#include <H5Iprivate.h>
#include <H5Oprivate.h>
/*
* This file needs to access private datatypes from the H5G package.
*/
#define H5G_PACKAGE
#include <H5Gpkg.h>
const char *FILENAME[] = {
"ohdr",
NULL
};
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose:
*
* Return: Success:
*
* Failure:
*
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
hid_t fapl=-1, file=-1;
H5F_t *f=NULL;
char filename[1024];
H5G_entry_t oh_ent;
H5O_stab_t stab, ro, *ptr=NULL;
int i;
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if (NULL==(f=H5I_object(file))) {
H5Eprint(stdout);
goto error;
}
/*
* Test object header creation
*/
TESTING("object header creation");
if (H5O_create(f, 64, &oh_ent/*out*/)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
PASSED();
/* create a new message */
TESTING("message creation");
stab.btree_addr.offset = 11111111;
stab.heap_addr.offset = 22222222;
if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5AC_flush(f, NULL, 0, TRUE)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (NULL==(ptr=H5O_read(&oh_ent, H5O_STAB, 0, &ro))) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5F_addr_ne(&(ro.btree_addr), &(stab.btree_addr)) ||
H5F_addr_ne(&(ro.heap_addr), &(stab.heap_addr))) {
FAILED();
HDfprintf(stdout, " got: {%a, %a}\n",
&(ro.btree_addr), &(ro.heap_addr));
HDfprintf(stdout, " ans: {%a, %a}\n",
&(stab.btree_addr), &(stab.heap_addr));
goto error;
}
PASSED();
/*
* Test modification of an existing message.
*/
TESTING("message modification");
stab.btree_addr.offset = 33333333;
stab.heap_addr.offset = 44444444;
if (H5O_modify(&oh_ent, H5O_STAB, 0, 0, &stab)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5AC_flush(f, NULL, 0, TRUE)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (NULL==(ptr=H5O_read(&oh_ent, H5O_STAB, 0, &ro))) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5F_addr_ne(&(ro.btree_addr), &(stab.btree_addr)) ||
H5F_addr_ne(&(ro.heap_addr), &(stab.heap_addr))) {
FAILED();
HDfprintf(stdout, " got: {%a, %a}\n",
&(ro.btree_addr), &(ro.heap_addr));
HDfprintf(stdout, " ans: {%a, %a}\n",
&(stab.btree_addr), &(stab.heap_addr));
goto error;
}
PASSED();
/*
* Test creation of a second message of the same type.
*/
TESTING("duplicate message creation");
stab.btree_addr.offset = 55555555;
stab.heap_addr.offset = 66666666;
if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5AC_flush(f, NULL, 0, TRUE)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (NULL==(ptr=H5O_read(&oh_ent, H5O_STAB, 1, &ro))) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5F_addr_ne(&(ro.btree_addr), &(stab.btree_addr)) ||
H5F_addr_ne(&(ro.heap_addr), &(stab.heap_addr))) {
FAILED();
HDfprintf(stdout, " got: {%a, %a}\n",
&(ro.btree_addr), &(ro.heap_addr));
HDfprintf(stdout, " ans: {%a, %a}\n",
&(stab.btree_addr), &(stab.heap_addr));
goto error;
}
PASSED();
/*
* Test modification of the second message with a symbol table.
*/
TESTING("duplicate message modification");
stab.btree_addr.offset = 77777777;
stab.heap_addr.offset = 88888888;
if (H5O_modify(&oh_ent, H5O_STAB, 1, 0, &stab)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5AC_flush(f, NULL, 0, TRUE)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (NULL==(ptr=H5O_read(&oh_ent, H5O_STAB, 1, &ro))) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5F_addr_ne(&(ro.btree_addr), &(stab.btree_addr)) ||
H5F_addr_ne(&(ro.heap_addr), &(stab.heap_addr))) {
FAILED();
HDfprintf(stdout, " got: {%a, %a}\n",
&(ro.btree_addr), &(ro.heap_addr));
HDfprintf(stdout, " ans: {%a, %a}\n",
&(stab.btree_addr), &(stab.heap_addr));
goto error;
}
PASSED();
/*
* Test creation of a bunch of messages one after another to see
* what happens when the object header overflows in core.
*/
TESTING("object header overflow in memory");
for (i=0; i<40; i++) {
stab.btree_addr.offset = (i+1)*1000+1;
stab.heap_addr.offset = (i+1)*1000+2;
if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
}
if (H5AC_flush(f, NULL, 0, TRUE)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
PASSED();
/*
* Test creation of a bunch of messages one after another to see
* what happens when the object header overflows on disk.
*/
TESTING("object header overflow on disk");
for (i=0; i<10; i++) {
stab.btree_addr.offset = (i + 1) * 1000 + 10;
stab.heap_addr.offset = (i + 1) * 1000 + 20;
if (H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5AC_flush(f, NULL, 0, TRUE)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
}
PASSED();
/*
* Delete all symbol table messages.
*/
TESTING("message deletion");
if (H5O_remove(&oh_ent, H5O_STAB, H5O_ALL)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5O_read(&oh_ent, H5O_STAB, 0, &ro)) {
FAILED();
puts(" H5O_read() should have failed but didn't");
H5Eclear();
goto error;
}
PASSED();
/* release resources */
TESTING("object header closing");
if (H5O_close(&oh_ent)<0) {
FAILED();
H5Eprint(stdout);
goto error;
}
if (H5Fclose(file)<0) goto error;
PASSED();
puts("All object header tests passed.");
h5_cleanup(fapl);
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
return 1;
}

199
test/stab.c Normal file
View File

@ -0,0 +1,199 @@
/*
* Copyright © 1998 NCSA
* All rights reserved.
*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Tuesday, November 24, 1998
*/
#include <h5test.h>
/*
* This file needs to access private datatypes from the H5G package.
*/
#define H5G_PACKAGE
#include <H5Gpkg.h>
const char *FILENAME[] = {
"stab1",
"stab2",
NULL
};
/*-------------------------------------------------------------------------
* Function: test_misc
*
* Purpose: Test miscellaneous group stuff.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
test_misc(hid_t fapl)
{
hid_t file=-1;
hid_t g1=-1, g2=-1, g3=-1;
char comment[64], filename[1024];
/* Test current working groups */
TESTING("miscellaneous group tests");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if ((g1=H5Gcreate(file, "test_1a", 0))<0) goto error;
if ((g2=H5Gcreate(g1, "sub_1", 0))<0) goto error;
if ((g3=H5Gcreate(file, "test_1b", 0))<0) goto error;
if (H5Gset_comment(g3, ".", "hello world")<0) goto error;
/* Close all groups */
if (H5Gclose(g1)<0) goto error;
if (H5Gclose(g2)<0) goto error;
if (H5Gclose(g3)<0) goto error;
/* Open all groups with absolute names to check for exsistence */
if ((g1=H5Gopen(file, "/test_1a"))<0) goto error;
if ((g2=H5Gopen(file, "/test_1a/sub_1"))<0) goto error;
if ((g3=H5Gopen(file, "/test_1b"))<0) goto error;
if (H5Gget_comment(g3, "././.", sizeof comment, comment)<0) goto error;
if (strcmp(comment, "hello world")) {
FAILED();
puts(" Read the wrong comment string from the group.");
printf(" got: \"%s\"\n ans: \"hello world\"\n", comment);
goto error;
}
/* Close everything */
if (H5Gclose(g1)<0) goto error;
if (H5Gclose(g2)<0) goto error;
if (H5Gclose(g3)<0) goto error;
if (H5Fclose(file)<0) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Gclose(g1);
H5Gclose(g2);
H5Gclose(g3);
H5Fclose(file);
} H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
* Function: test_large
*
* Purpose: Creates a really large directory.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
* Aug 29 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
test_large(hid_t fapl)
{
hid_t file=-1, cwg=-1, fcpl=-1, dir=-1;
int i;
char name[1024];
int nsyms = 5000;
TESTING("large directories");
/*
* Use larger symbol table data structures to be more efficient, use
* defaults to bang harder on the library for testing.
*/
fcpl = H5Pcreate(H5P_FILE_CREATE);
H5Pset_sym_k(fcpl, 16, 16);
h5_fixname(FILENAME[1], fapl, name, sizeof name);
if ((file=H5Fcreate(name, H5F_ACC_TRUNC, fcpl, fapl))<0) goto error;
/*
* Create a directory that has so many entries that the root
* of the B-tree ends up splitting.
*/
if ((cwg=H5Gcreate(file, "/big", (size_t)nsyms*16+2))<0) goto error;
for (i=0; i<nsyms; i++) {
sprintf(name, "%05d%05d", rand()%100000, i);
if ((dir=H5Gcreate(cwg, name, 0))<0) goto error;
if (H5Gclose(dir)<0) goto error;
}
if (H5Gclose(cwg)<0) goto error;
/* Close everything */
if (H5Pclose(fcpl)<0) goto error;
if (H5Fclose(file)<0) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Pclose(fcpl);
H5Gclose(dir);
H5Gclose(cwg);
H5Fclose(file);
} H5E_END_TRY;
return 1;
}
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Test groups
*
* Return: Success: zero
*
* Failure: non-zero
*
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
hid_t fapl;
int nerrors=0;
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
/* Perform tests */
nerrors += test_misc(fapl);
nerrors += test_large(fapl);
if (nerrors) goto error;
/* Cleanup */
puts("All symbol table tests passed.");
h5_cleanup(fapl);
return 0;
error:
puts("*** TESTS FAILED ***");
return 1;
}

View File

@ -164,9 +164,6 @@ main(int argc, char *argv[])
/* Tests are generally arranged from least to most complexity... */
InitTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code");
InitTest("file", test_file, cleanup_file, "Low-Level File I/O");
InitTest("heap", test_heap, cleanup_heap, "Object and Name Heaps");
InitTest("ohdr", test_ohdr, cleanup_ohdr, "Object Headers");
InitTest("stab", test_stab, cleanup_stab, "Symbol Tables");
InitTest("h5s", test_h5s, cleanup_h5s, "Dataspaces");
InitTest("attr", test_attr, cleanup_attr, "Attributes");
InitTest("select", test_select, cleanup_select, "Selections");

View File

@ -119,9 +119,6 @@ int print_func(const char *,...);
/* Prototypes for the test routines */
void test_metadata(void);
void test_file(void);
void test_heap(void);
void test_ohdr(void);
void test_stab(void);
void test_h5t(void);
void test_h5s(void);
void test_h5d(void);
@ -132,9 +129,6 @@ void test_reference(void);
/* Prototypes for the cleanup routines */
void cleanup_metadata(void);
void cleanup_file(void);
void cleanup_heap(void);
void cleanup_ohdr(void);
void cleanup_stab(void);
void cleanup_h5s(void);
void cleanup_attr(void);
void cleanup_select(void);

View File

@ -1,113 +0,0 @@
/*-------------------------------------------------------------------------
* Copyright (C) 1997 National Center for Supercomputing Applications.
* All rights reserved.
*
*-------------------------------------------------------------------------
*
* Created: theap.c
* Jul 17 1997
* Robb Matzke <robb@maya.nuance.com>
*
* Purpose:
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
#include <testhdf5.h>
#include <H5private.h>
#include <H5Iprivate.h>
#include <H5ACprivate.h>
#include <H5Pprivate.h>
#include <H5Fprivate.h>
#include <H5HLprivate.h>
#define FILE "theap.h5"
#define NOBJS 40
/*-------------------------------------------------------------------------
* Function: test_heap
*
* Purpose: Test name and object heaps.
*
* Return: void
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
* Jul 17 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
test_heap(void)
{
int i, j;
hid_t fid;
H5F_t *f;
haddr_t heap_addr;
char buf[NOBJS + 8];
const char *s;
size_t obj[NOBJS];
herr_t status;
MESSAGE(5, ("Testing Heaps\n"));
/* Create the file */
fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
f = H5I_object(fid);
CHECK(f, NULL, "H5I_object");
/* Create a new heap */
status = H5HL_create(f, 0, &heap_addr /*out */ );
CHECK_I(status, "H5HL_create");
/* Add stuff to the heap */
for (i = 0; i < NOBJS; i++) {
sprintf(buf, "%03d-", i);
for (j = 4; j < i; j++)
buf[j] = '0' + j % 10;
if (j > 4)
buf[j] = '\0';
obj[i] = H5HL_insert(f, &heap_addr, strlen(buf) + 1, buf);
assert ((size_t)(-1)!=obj[i]);
}
/* Flush the cache and invalidate everything */
H5AC_flush(f, NULL, 0, TRUE);
/* Read the objects back out */
for (i = 0; i < NOBJS; i++) {
s = H5HL_peek(f, &heap_addr, obj[i]);
MESSAGE(8, ("object is `%s'\n", s));
}
/* Close the file */
H5Fclose(fid);
}
/*-------------------------------------------------------------------------
* Function: cleanup_heap
*
* Purpose: Cleanup temporary test files
*
* Return: none
*
* Programmer: Albert Cheng
* July 2, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
cleanup_heap(void)
{
remove(FILE);
}

View File

@ -1,197 +0,0 @@
/*-------------------------------------------------------------------------
* Copyright (C) 1997 National Center for Supercomputing Applications.
* All rights reserved.
*
*-------------------------------------------------------------------------
*
* Created: tohdr.c
* Aug 6 1997
* Robb Matzke <robb@maya.nuance.com>
*
* Purpose:
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
#include <testhdf5.h>
#include <H5private.h>
#include <H5Iprivate.h>
#include <H5ACprivate.h>
#include <H5Pprivate.h>
#include <H5Fprivate.h>
#include <H5Gprivate.h>
#include <H5Oprivate.h>
#define TEST_FILE "tohdr.h5"
/*
* This file needs to access private datatypes from the H5G package.
*/
#define H5G_PACKAGE
#include <H5Gpkg.h>
/*-------------------------------------------------------------------------
* Function: test_ohdr
*
* Purpose: Test object headers.
*
* Return: void
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
* Aug 6 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
test_ohdr(void)
{
hid_t fid;
H5F_t *f;
H5G_entry_t oh_ent;
H5O_stab_t stab, ro;
herr_t status;
void *ptr;
int i;
MESSAGE(5, ("Testing Object Headers\n"));
/* create the file */
fid = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
f = H5I_object(fid);
CHECK(f, NULL, "H5I_object");
/* the new object header */
MESSAGE(8, ("Creating new object header...\n"));
status = H5O_create(f, 64, &oh_ent /*out */ );
CHECK_I(status, "H5O_new");
/*
* Test creation of a new message.
*/
MESSAGE(8, ("Creating new message...\n"));
stab.btree_addr.offset = 11111111;
stab.heap_addr.offset = 22222222;
status = H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab);
VERIFY(status, 0, "H5O_modify");
H5AC_flush(f, NULL, 0, TRUE);
ptr = H5O_read(&oh_ent, H5O_STAB, 0, &ro);
CHECK_PTR(ptr, "H5O_read");
VERIFY(ptr, &ro, "H5O_read");
VERIFY(ro.btree_addr.offset, stab.btree_addr.offset, "H5O_read");
VERIFY(ro.heap_addr.offset, stab.heap_addr.offset, "H5O_read");
/*
* Test modification of an existing message.
*/
MESSAGE(8, ("Modifying message...\n"));
stab.btree_addr.offset = 33333333;
stab.heap_addr.offset = 44444444;
status = H5O_modify(&oh_ent, H5O_STAB, 0, 0, &stab);
VERIFY(status, 0, "H5O_modify");
H5AC_flush(f, NULL, 0, TRUE);
ptr = H5O_read(&oh_ent, H5O_STAB, 0, &ro);
CHECK_PTR(ptr, "H5O_read");
VERIFY(ptr, &ro, "H5O_read");
VERIFY(ro.btree_addr.offset, stab.btree_addr.offset, "H5O_read");
VERIFY(ro.heap_addr.offset, stab.heap_addr.offset, "H5O_read");
/*
* Test creation of a second message of the same type with a symbol
* table.
*/
MESSAGE(8, ("Creating a duplicate message...\n"));
stab.btree_addr.offset = 55555555;
stab.heap_addr.offset = 66666666;
status = H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab);
VERIFY(status, 1, "H5O_modify");
H5AC_flush(f, NULL, 0, TRUE);
ptr = H5O_read(&oh_ent, H5O_STAB, 1, &ro);
CHECK_PTR(ptr, "H5O_read");
VERIFY(ptr, &ro, "H5O_read");
VERIFY(ro.btree_addr.offset, stab.btree_addr.offset, "H5O_read");
VERIFY(ro.heap_addr.offset, stab.heap_addr.offset, "H5O_read");
/*
* Test modification of the second message with a symbol table.
*/
MESSAGE(8, ("Modifying the duplicate message...\n"));
stab.btree_addr.offset = 77777777;
stab.heap_addr.offset = 88888888;
status = H5O_modify(&oh_ent, H5O_STAB, 1, 0, &stab);
VERIFY(status, 1, "H5O_modify");
H5AC_flush(f, NULL, 0, TRUE);
ptr = H5O_read(&oh_ent, H5O_STAB, 1, &ro);
CHECK_PTR(ptr, "H5O_read");
VERIFY(ptr, &ro, "H5O_read");
VERIFY(ro.btree_addr.offset, stab.btree_addr.offset, "H5O_read");
VERIFY(ro.heap_addr.offset, stab.heap_addr.offset, "H5O_read");
/*
* Test creation of a bunch of messages one after another to see
* what happens when the object header overflows in core.
*/
MESSAGE(8, ("Overflowing header in core...\n"));
for (i = 0; i < 40; i++) {
stab.btree_addr.offset = (i + 1) * 1000 + 1;
stab.heap_addr.offset = (i + 1) * 1000 + 2;
status = H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab);
VERIFY(status, 2 + i, "H5O_modify");
}
H5AC_flush(f, NULL, 0, TRUE);
/*
* Test creation of a bunch of messages one after another to see
* what happens when the object header overflows on disk.
*/
MESSAGE(8, ("Overflowing header on disk...\n"));
for (i = 0; i < 10; i++) {
stab.btree_addr.offset = (i + 1) * 1000 + 10;
stab.heap_addr.offset = (i + 1) * 1000 + 20;
status = H5O_modify(&oh_ent, H5O_STAB, H5O_NEW_MESG, 0, &stab);
VERIFY(status, 42 + i, "H5O_modify");
H5AC_flush(f, NULL, 0, TRUE);
}
/*
* Delete all symbol table messages.
*/
status = H5O_remove(&oh_ent, H5O_STAB, H5O_ALL);
CHECK_I(status, "H5O_remove");
/* release resources */
H5O_close(&oh_ent);
H5Fclose(fid);
}
/*-------------------------------------------------------------------------
* Function: cleanup_ohdr
*
* Purpose: Cleanup temporary test files
*
* Return: none
*
* Programmer: Albert Cheng
* July 2, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
cleanup_ohdr(void)
{
remove(TEST_FILE);
}

View File

@ -1,251 +0,0 @@
/*-------------------------------------------------------------------------
* Copyright (C) 1997 National Center for Supercomputing Applications.
* All rights reserved.
*
*-------------------------------------------------------------------------
*
* Created: tstab.c
* Aug 7 1997
* Robb Matzke <matzke@llnl.gov>
*
* Purpose:
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
#include <testhdf5.h>
#include <H5private.h>
#include <H5Iprivate.h>
#include <H5ACprivate.h>
#include <H5Pprivate.h>
#include <H5Fprivate.h>
#include <H5Gprivate.h>
#include <H5Oprivate.h>
#define TEST_FILE_1 "tstab1.h5"
#define TEST_FILE_2 "tstab2.h5"
/*
* This file needs to access private datatypes from the H5G package.
*/
#define H5G_PACKAGE
#include <H5Gpkg.h>
/*-------------------------------------------------------------------------
* Function: test_1
*
* Purpose: Miscellaneous group tests
*
* Return: void
*
* Programmer: Robb Matzke
* Friday, September 11, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
test_1(void)
{
hid_t file;
hid_t g1, g2, g3;
herr_t status;
char comment[64];
int cmp;
/* Test current working groups */
MESSAGE(2, ("........current working groups\n"));
file = H5Fcreate(TEST_FILE_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(file, "H5Fcreate");
g1 = H5Gcreate(file, "test_1a", 0);
CHECK_I(g1, "H5Gcreate");
g2 = H5Gcreate(g1, "sub_1", 0);
CHECK_I(g2, "H5Gcreate");
g3 = H5Gcreate(file, "test_1b", 0);
CHECK_I(g3, "H5Gcreate");
status = H5Gset_comment(g3, ".", "hello world");
CHECK_I(status, "H5Gset_comment");
/* Close all groups */
status = H5Gclose(g1);
CHECK_I(status, "H5Gclose");
status = H5Gclose(g2);
CHECK_I(status, "H5Gclose");
status = H5Gclose(g3);
CHECK_I(status, "H5Gclose");
/* Open all groups with absolute names to check for exsistence */
g1 = H5Gopen(file, "/test_1a");
CHECK_I(g1, "H5Gopen");
g2 = H5Gopen(file, "/test_1a/sub_1");
CHECK_I(g2, "H5Gopen");
g3 = H5Gopen(file, "/test_1b");
CHECK_I(g3, "H5Gopen");
status = H5Gget_comment(g3, "././.", sizeof comment, comment);
CHECK_I(status, "H5Gget_comment");
cmp = strcmp(comment, "hello world");
VERIFY(cmp, 0, "strcmp");
/* Close all groups */
status = H5Gclose(g1);
CHECK_I(status, "H5Gclose");
status = H5Gclose(g2);
CHECK_I(status, "H5Gclose");
status = H5Gclose(g3);
CHECK_I(status, "H5Gclose");
/* Close file */
status = H5Fclose(file);
CHECK_I(status, "H5Fclose");
}
/*-------------------------------------------------------------------------
* Function: test_2
*
* Purpose: Creates a really large directory.
*
* Return: void
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
* Aug 29 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static void
test_2(void)
{
hid_t fid, cwg, create_plist, access_plist, dir;
H5F_t *f;
int i;
char name[256];
herr_t status;
int nsyms = 5000;
MESSAGE(2, ("........large directories\n"));
/*
* Use larger symbol table data structures to be more efficient, use
* defaults to bang harder on the library for testing.
*/
create_plist = H5Pcreate(H5P_FILE_CREATE);
H5Pset_sym_k(create_plist, 16, 16);
/*
* File access property list.
*/
access_plist = H5Pcreate (H5P_FILE_ACCESS);
#if 0
/* Try temporary core files */
H5Cset_core (access_plist, 3000000);
#elif 0
/* Try a default split file but with our own name extensions */
H5Cset_split (access_plist, ".XX1", H5C_DEFAULT, ".XX2", H5C_DEFAULT);
#elif 0
{
/* Try a split file with an in-core meta data part */
hid_t meta_access = H5Ccreate (H5C_FILE_ACCESS);
H5Cset_core (meta_access, 1024*1024);
H5Cset_split (access_plist, NULL, meta_access, NULL, H5C_DEFAULT);
}
#elif 0
{
/* Try a split file with an in-core raw data part */
hid_t raw_access = H5Ccreate (H5C_FILE_ACCESS);
H5Cset_core (raw_access, 1024*1024);
H5Cset_split (access_plist, NULL, H5C_DEFAULT, NULL, raw_access);
}
#endif
/* create the file */
fid = H5Fcreate(TEST_FILE_2, H5F_ACC_TRUNC, create_plist, access_plist);
CHECK(fid, FAIL, "H5Fcreate");
f = H5I_object(fid);
CHECK(f, NULL, "H5I_object");
f->intent |= H5F_ACC_DEBUG;
/*
* Create a directory that has so many entries that the root
* of the B-tree ends up splitting.
*/
cwg = H5Gcreate(fid, "/big", (size_t)nsyms*16+2);
CHECK_I(cwg, "H5Gcreate");
for (i = 0; i < nsyms; i++) {
sprintf(name, "%05d%05d", rand() % 100000, i);
MESSAGE(8, ("%s\n", name));
dir = H5Gcreate(cwg, name, 0);
CHECK_I(dir, "H5Gcreate");
status = H5Gclose(dir);
CHECK_I(status, "H5Gclose");
}
status = H5Gclose(cwg);
CHECK_I(status, "H5Gclose");
/* close the property lists */
status = H5Pclose(create_plist);
CHECK_I(status, "H5Pclose");
status = H5Pclose(access_plist);
CHECK_I(status, "H5Pclose");
/* close the file */
status = H5Fclose(fid);
CHECK_I(status, "H5Fclose");
}
/*-------------------------------------------------------------------------
* Function: test_stab
*
* Purpose: Test symbol tables
*
* Return: void
*
* Programmer: Robb Matzke
* matzke@viper.llnl.gov
* Aug 7 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
test_stab(void)
{
test_1();
test_2();
}
/*-------------------------------------------------------------------------
* Function: cleanup_stab
*
* Purpose: Cleanup temporary test files
*
* Return: none
*
* Programmer: Albert Cheng
* July 2, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
void
cleanup_stab(void)
{
remove(TEST_FILE_1);
remove(TEST_FILE_2);
}