diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 67 | ||||
-rw-r--r-- | test/be_data.h5 | bin | 0 -> 2288 bytes | |||
-rwxr-xr-x | test/cross_read.c | 163 | ||||
-rwxr-xr-x | test/gen_cross.c | 102 | ||||
-rw-r--r-- | test/le_data.h5 | bin | 0 -> 2288 bytes | |||
-rw-r--r-- | test/vms_data.h5 | bin | 0 -> 2288 bytes |
7 files changed, 309 insertions, 27 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index c924995..60d05c9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -37,7 +37,7 @@ TEST_PROG=testhdf5 lheap fheap ohdr stab gheap btree2 cache cache_api \ dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \ fillval mount flush1 flush2 enum \ set_extent ttsafe stream_test \ - getname vfd ntypes dangle dtransform reserved + getname vfd ntypes dangle dtransform reserved cross_read # List programs to be built when testing here. error_test and err_compat are # built at the same time as the other tests, but executed by testerror.sh. @@ -57,7 +57,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat testmeta if BUILD_ALL_CONDITIONAL BUILD_ALL_PROGS=gen_deflate gen_filters gen_new_array gen_new_fill \ gen_new_group gen_new_mtime gen_new_super gen_noencoder \ - gen_nullspace space_overflow + gen_nullspace space_overflow gen_cross else BUILD_ALL_PROGS= endif diff --git a/test/Makefile.in b/test/Makefile.in index 2754b43..af9dbbc 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -31,7 +31,7 @@ # -SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fheap.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c +SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c cache_api.c cmpd_dset.c cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fheap.c fillval.c flush1.c flush2.c gen_cross.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -84,7 +84,7 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) fheap$(EXEEXT) \ flush2$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \ vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ - dtransform$(EXEEXT) reserved$(EXEEXT) + dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) @BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = gen_deflate$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_filters$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_new_array$(EXEEXT) \ @@ -94,7 +94,8 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) fheap$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_new_super$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_noencoder$(EXEEXT) \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_nullspace$(EXEEXT) \ -@BUILD_ALL_CONDITIONAL_TRUE@ space_overflow$(EXEEXT) +@BUILD_ALL_CONDITIONAL_TRUE@ space_overflow$(EXEEXT) \ +@BUILD_ALL_CONDITIONAL_TRUE@ gen_cross$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) big_SOURCES = big.c big_OBJECTS = big.$(OBJEXT) @@ -121,6 +122,10 @@ cmpd_dset_SOURCES = cmpd_dset.c cmpd_dset_OBJECTS = cmpd_dset.$(OBJEXT) cmpd_dset_LDADD = $(LDADD) cmpd_dset_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) +cross_read_SOURCES = cross_read.c +cross_read_OBJECTS = cross_read.$(OBJEXT) +cross_read_LDADD = $(LDADD) +cross_read_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) dangle_SOURCES = dangle.c dangle_OBJECTS = dangle.$(OBJEXT) dangle_LDADD = $(LDADD) @@ -177,6 +182,10 @@ flush2_SOURCES = flush2.c flush2_OBJECTS = flush2.$(OBJEXT) flush2_LDADD = $(LDADD) flush2_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) +gen_cross_SOURCES = gen_cross.c +gen_cross_OBJECTS = gen_cross.$(OBJEXT) +gen_cross_LDADD = $(LDADD) +gen_cross_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) gen_deflate_SOURCES = gen_deflate.c gen_deflate_OBJECTS = gen_deflate.$(OBJEXT) gen_deflate_LDADD = $(LDADD) @@ -322,27 +331,27 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c \ - cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c \ - dtransform.c dtypes.c enum.c err_compat.c error_test.c \ - extend.c external.c fheap.c fillval.c flush1.c flush2.c \ - gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \ - gen_new_group.c gen_new_mtime.c gen_new_super.c \ - gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c \ - istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c \ - ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c \ - stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) \ - unlink.c vfd.c + cache_api.c cmpd_dset.c cross_read.c dangle.c dsets.c \ + dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ + error_test.c extend.c external.c fheap.c fillval.c flush1.c \ + flush2.c gen_cross.c gen_deflate.c gen_filters.c \ + gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \ + gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c \ + gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c \ + ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \ + space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) \ + testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c \ - cache.c cache_api.c cmpd_dset.c dangle.c dsets.c dt_arith.c \ - dtransform.c dtypes.c enum.c err_compat.c error_test.c \ - extend.c external.c fheap.c fillval.c flush1.c flush2.c \ - gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \ - gen_new_group.c gen_new_mtime.c gen_new_super.c \ - gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c \ - istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c \ - ohdr.c pool.c reserved.c set_extent.c space_overflow.c stab.c \ - stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) \ - unlink.c vfd.c + cache.c cache_api.c cmpd_dset.c cross_read.c dangle.c dsets.c \ + dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \ + error_test.c extend.c external.c fheap.c fillval.c flush1.c \ + flush2.c gen_cross.c gen_deflate.c gen_filters.c \ + gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \ + gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c \ + gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c \ + ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \ + space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) \ + testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -621,7 +630,7 @@ TEST_PROG = testhdf5 lheap fheap ohdr stab gheap btree2 cache cache_api \ dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \ fillval mount flush1 flush2 enum \ set_extent ttsafe stream_test \ - getname vfd ntypes dangle dtransform reserved + getname vfd ntypes dangle dtransform reserved cross_read @BUILD_ALL_CONDITIONAL_FALSE@BUILD_ALL_PROGS = @@ -634,7 +643,7 @@ TEST_PROG = testhdf5 lheap fheap ohdr stab gheap btree2 cache cache_api \ # so do not appear in this list. @BUILD_ALL_CONDITIONAL_TRUE@BUILD_ALL_PROGS = gen_deflate gen_filters gen_new_array gen_new_fill \ @BUILD_ALL_CONDITIONAL_TRUE@ gen_new_group gen_new_mtime gen_new_super gen_noencoder \ -@BUILD_ALL_CONDITIONAL_TRUE@ gen_nullspace space_overflow +@BUILD_ALL_CONDITIONAL_TRUE@ gen_nullspace space_overflow gen_cross # The libh5test library provides common support code for the tests. @@ -747,6 +756,9 @@ cache_api$(EXEEXT): $(cache_api_OBJECTS) $(cache_api_DEPENDENCIES) cmpd_dset$(EXEEXT): $(cmpd_dset_OBJECTS) $(cmpd_dset_DEPENDENCIES) @rm -f cmpd_dset$(EXEEXT) $(LINK) $(cmpd_dset_LDFLAGS) $(cmpd_dset_OBJECTS) $(cmpd_dset_LDADD) $(LIBS) +cross_read$(EXEEXT): $(cross_read_OBJECTS) $(cross_read_DEPENDENCIES) + @rm -f cross_read$(EXEEXT) + $(LINK) $(cross_read_LDFLAGS) $(cross_read_OBJECTS) $(cross_read_LDADD) $(LIBS) dangle$(EXEEXT): $(dangle_OBJECTS) $(dangle_DEPENDENCIES) @rm -f dangle$(EXEEXT) $(LINK) $(dangle_LDFLAGS) $(dangle_OBJECTS) $(dangle_LDADD) $(LIBS) @@ -789,6 +801,9 @@ flush1$(EXEEXT): $(flush1_OBJECTS) $(flush1_DEPENDENCIES) flush2$(EXEEXT): $(flush2_OBJECTS) $(flush2_DEPENDENCIES) @rm -f flush2$(EXEEXT) $(LINK) $(flush2_LDFLAGS) $(flush2_OBJECTS) $(flush2_LDADD) $(LIBS) +gen_cross$(EXEEXT): $(gen_cross_OBJECTS) $(gen_cross_DEPENDENCIES) + @rm -f gen_cross$(EXEEXT) + $(LINK) $(gen_cross_LDFLAGS) $(gen_cross_OBJECTS) $(gen_cross_LDADD) $(LIBS) gen_deflate$(EXEEXT): $(gen_deflate_OBJECTS) $(gen_deflate_DEPENDENCIES) @rm -f gen_deflate$(EXEEXT) $(LINK) $(gen_deflate_LDFLAGS) $(gen_deflate_OBJECTS) $(gen_deflate_LDADD) $(LIBS) @@ -896,6 +911,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_api.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_common.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cross_read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsets.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dt_arith.Po@am__quote@ @@ -910,6 +926,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fillval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flush1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flush2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_cross.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_deflate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_filters.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen_new_array.Po@am__quote@ diff --git a/test/be_data.h5 b/test/be_data.h5 Binary files differnew file mode 100644 index 0000000..26bc782 --- /dev/null +++ b/test/be_data.h5 diff --git a/test/cross_read.c b/test/cross_read.c new file mode 100755 index 0000000..7d05417 --- /dev/null +++ b/test/cross_read.c @@ -0,0 +1,163 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> + * Thursday, March 23, 2006 + * + * Purpose: Check if floating-point data created on OpenVMS (VAX type), Solaris, + * and Linux machines can be read on the machine running this test. + */ + +#include "h5test.h" + +const char *FILENAME[] = { + "vms_data", + "le_data", + "be_data", + NULL +}; + +#define DATASETNAME "IntArray" +#define NX 5 /* output buffer dimensions */ +#define NY 6 +#define RANK 2 + +static int read_data(char *fname) +{ + char pathname[1024]; + char *srcdir = getenv("srcdir"); /*where the src code is located*/ + hid_t file, dataset; /* handles */ + hid_t datatype; + hid_t dt; + double data_in[NX][NY]; /* input buffer */ + double data_out[NX][NY]; /* output buffer */ + int i, j, rank; + herr_t status; + unsigned nerrors = 0; + + pathname[0] = '\0'; + /* Generate correct name for test file by prepending the source path */ + if(srcdir && ((strlen(srcdir) + strlen(fname) + 1) < sizeof(pathname))) { + strcpy(pathname, srcdir); + strcat(pathname, "/"); + } + strcat(pathname, fname); + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + data_in[j][i] = i + j; + data_out[j][i] = 0; + } + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + */ + + /* + * Open the file and the dataset. + */ + if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT))<0) + TEST_ERROR; + if((dataset = H5Dopen(file, DATASETNAME))<0) + TEST_ERROR; + + /* + * Get datatype and dataspace handles and then query + * dataset class, order, size, rank and dimensions. + */ + if((dt = H5Dget_type(dataset))<0) /* datatype handle */ + TEST_ERROR; + if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT))<0) + TEST_ERROR; + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out)<0) + TEST_ERROR; + + /* Check results */ + for (j=0; j<NX; j++) { + for (i=0; i<NY; i++) { + if (data_out[j][i] != data_in[j][i]) { + if (!nerrors++) { + H5_FAILED(); + printf("element [%d][%d] is %g but should have been %g\n", + j, i, data_out[j][i], data_in[j][i]); + } + } + } + } + + /* + * Close/release resources. + */ + H5Tclose(dt); + H5Tclose(datatype); + H5Dclose(dataset); + H5Fclose(file); + + /* Failure */ + if (nerrors) { + printf("total of %d errors out of %d elements\n", nerrors, NX*NY); + return 1; + } + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + return 1; +} + +int main(void) +{ + char filename[1024]; + unsigned nerrors = 0; + + h5_reset(); + + TESTING("reading data created on OpenVMS"); + h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename); + nerrors += read_data(filename); + + TESTING("reading data created on Linux"); + h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename); + nerrors += read_data(filename); + + TESTING("reading data created on Solaris"); + h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename); + nerrors += read_data(filename); + + if (nerrors) { + printf("***** %lu FAILURE%s! *****\n", + nerrors, 1==nerrors?"":"S"); + HDexit(1); + } + + printf("All data type tests passed.\n"); + return 0; +} diff --git a/test/gen_cross.c b/test/gen_cross.c new file mode 100755 index 0000000..4159dc2 --- /dev/null +++ b/test/gen_cross.c @@ -0,0 +1,102 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> + * Thursday, March 23, 2006 + * + * This program writes floating-point data to the HDF5 file. It generates + * the file to be read by cross_read.c, to test reading data from cross-systems. + * Run it on an OpenVMS, a little-endian, and a big-endian machine. Change the + * output file names to vms_data.h5, le_data.h5, and be_data.h5, and put them + * under hdf5/test/ directory. + */ + +#include "h5test.h" + +#define H5FILE_NAME "data.h5" +#define DATASETNAME "IntArray" +#define NX 5 /* dataset dimensions */ +#define NY 6 +#define RANK 2 + +int +main (void) +{ + hid_t file, dataset; /* file and dataset handles */ + hid_t datatype, dataspace; /* handles */ + hsize_t dimsf[2]; /* dataset dimensions */ + herr_t status; + float data[NX][NY]; /* data to write */ + int i, j; + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + */ + + /* + * Create a new file using H5F_ACC_TRUNC access, + * default file creation properties, and default file + * access properties. + */ + file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Describe the size of the array and create the data space for fixed + * size dataset. + */ + dimsf[0] = NX; + dimsf[1] = NY; + dataspace = H5Screate_simple(RANK, dimsf, NULL); + + /* + * Define datatype for the data in the file. + * We will store little endian INT numbers. + */ + datatype = H5Tcopy(H5T_NATIVE_DOUBLE); + + /* + * Create a new dataset within the file using defined dataspace and + * datatype and default dataset creation properties. + */ + dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, + H5P_DEFAULT); + + /* + * Write the data to the dataset using default transfer properties. + */ + status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data); + + /* + * Close/release resources. + */ + H5Sclose(dataspace); + H5Tclose(datatype); + H5Dclose(dataset); + H5Fclose(file); + + return 0; +} diff --git a/test/le_data.h5 b/test/le_data.h5 Binary files differnew file mode 100644 index 0000000..c2ca149 --- /dev/null +++ b/test/le_data.h5 diff --git a/test/vms_data.h5 b/test/vms_data.h5 Binary files differnew file mode 100644 index 0000000..a8712ab --- /dev/null +++ b/test/vms_data.h5 |