diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/Makefile.in | 55 | ||||
-rw-r--r-- | test/srb_append.c | 196 | ||||
-rw-r--r-- | test/srb_read.c | 225 | ||||
-rw-r--r-- | test/srb_write.c | 193 |
5 files changed, 10 insertions, 666 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 21c9b80..ed903c8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -26,10 +26,6 @@ INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src TEST_SCRIPT = $(top_srcdir)/test/testerror.sh check_SCRIPTS = $(TEST_SCRIPT) -# Build and run SRB tests only if SRB driver is enabled. -if BUILD_SRB_CONDITIONAL - SRB_TESTS=srb_write srb_append srb_read -endif # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. @@ -38,8 +34,7 @@ TEST_PROG=testhdf5 lheap ohdr stab gheap cache btree2 blocktrack sheap \ dtypes dsets cmpd_dset extend external links unlink big mtime \ fillval mount flush1 flush2 enum \ set_extent ttsafe stream_test \ - getname file_handle ntypes dangle dtransform filename reserved \ - $(SRB_TESTS) + getname file_handle ntypes dangle dtransform filename reserved # 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. diff --git a/test/Makefile.in b/test/Makefile.in index 51a550c..c6623ff 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -29,7 +29,7 @@ # # HDF5 Library Test Makefile(.in) # -SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_atomic.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c sheap.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c +SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_atomic.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -56,7 +56,7 @@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am -check_PROGRAMS = $(am__EXEEXT_2) error_test$(EXEEXT) \ +check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \ err_compat$(EXEEXT) testmeta$(EXEEXT) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -70,10 +70,7 @@ am__DEPENDENCIES_1 = $(top_builddir)/src/libhdf5.la libh5test_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libh5test_la_OBJECTS = h5test.lo testframe.lo libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS) -@BUILD_SRB_CONDITIONAL_TRUE@am__EXEEXT_1 = srb_write$(EXEEXT) \ -@BUILD_SRB_CONDITIONAL_TRUE@ srb_append$(EXEEXT) \ -@BUILD_SRB_CONDITIONAL_TRUE@ srb_read$(EXEEXT) -am__EXEEXT_2 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ +am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) btree2$(EXEEXT) \ blocktrack$(EXEEXT) sheap$(EXEEXT) hyperslab$(EXEEXT) \ istore$(EXEEXT) bittests$(EXEEXT) dt_atomic$(EXEEXT) \ @@ -84,7 +81,7 @@ am__EXEEXT_2 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ set_extent$(EXEEXT) ttsafe$(EXEEXT) stream_test$(EXEEXT) \ getname$(EXEEXT) file_handle$(EXEEXT) ntypes$(EXEEXT) \ dangle$(EXEEXT) dtransform$(EXEEXT) filename$(EXEEXT) \ - reserved$(EXEEXT) $(am__EXEEXT_1) + reserved$(EXEEXT) big_SOURCES = big.c big_OBJECTS = big.$(OBJEXT) big_LDADD = $(LDADD) @@ -221,18 +218,6 @@ sheap_SOURCES = sheap.c sheap_OBJECTS = sheap.$(OBJEXT) sheap_LDADD = $(LDADD) sheap_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) -srb_append_SOURCES = srb_append.c -srb_append_OBJECTS = srb_append.$(OBJEXT) -srb_append_LDADD = $(LDADD) -srb_append_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) -srb_read_SOURCES = srb_read.c -srb_read_OBJECTS = srb_read.$(OBJEXT) -srb_read_LDADD = $(LDADD) -srb_read_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) -srb_write_SOURCES = srb_write.c -srb_write_OBJECTS = srb_write.$(OBJEXT) -srb_write_LDADD = $(LDADD) -srb_write_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1) stab_SOURCES = stab.c stab_OBJECTS = stab.$(OBJEXT) stab_LDADD = $(LDADD) @@ -282,18 +267,16 @@ SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \ extend.c external.c file_handle.c filename.c fillval.c \ flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c \ lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c \ - set_extent.c sheap.c srb_append.c srb_read.c srb_write.c \ - stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c \ - $(ttsafe_SOURCES) unlink.c + set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) \ + testmeta.c $(ttsafe_SOURCES) unlink.c DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c blocktrack.c \ btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_atomic.c \ dtransform.c dtypes.c enum.c err_compat.c error_test.c \ extend.c external.c file_handle.c filename.c fillval.c \ flush1.c flush2.c getname.c gheap.c hyperslab.c istore.c \ lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c \ - set_extent.c sheap.c srb_append.c srb_read.c srb_write.c \ - stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c \ - $(ttsafe_SOURCES) unlink.c + set_extent.c sheap.c stab.c stream_test.c $(testhdf5_SOURCES) \ + testmeta.c $(ttsafe_SOURCES) unlink.c ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -324,8 +307,6 @@ BUILD_PARALLEL_CONDITIONAL_TRUE = @BUILD_PARALLEL_CONDITIONAL_TRUE@ BUILD_PDB2HDF = @BUILD_PDB2HDF@ BUILD_PDB2HDF_CONDITIONAL_FALSE = @BUILD_PDB2HDF_CONDITIONAL_FALSE@ BUILD_PDB2HDF_CONDITIONAL_TRUE = @BUILD_PDB2HDF_CONDITIONAL_TRUE@ -BUILD_SRB_CONDITIONAL_FALSE = @BUILD_SRB_CONDITIONAL_FALSE@ -BUILD_SRB_CONDITIONAL_TRUE = @BUILD_SRB_CONDITIONAL_TRUE@ BYTESEX = @BYTESEX@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ @@ -417,11 +398,9 @@ SET_MAKE = @SET_MAKE@ # configure's automatic SHELL detection may not work on the build machine. SHELL = /bin/sh SIZE_T = @SIZE_T@ -SRB = @SRB@ STATIC_SHARED = @STATIC_SHARED@ STRIP = @STRIP@ TESTPARALLEL = @TESTPARALLEL@ -TESTSRB = @TESTSRB@ TRACE_API = @TRACE_API@ USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ USE_FILTER_FLETCHER32 = @USE_FILTER_FLETCHER32@ @@ -513,9 +492,6 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src TEST_SCRIPT = $(top_srcdir)/test/testerror.sh check_SCRIPTS = $(TEST_SCRIPT) -# Build and run SRB tests only if SRB driver is enabled. -@BUILD_SRB_CONDITIONAL_TRUE@SRB_TESTS = srb_write srb_append srb_read - # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. TEST_PROG = testhdf5 lheap ohdr stab gheap cache btree2 blocktrack sheap \ @@ -523,8 +499,7 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache btree2 blocktrack sheap \ dtypes dsets cmpd_dset extend external links unlink big mtime \ fillval mount flush1 flush2 enum \ set_extent ttsafe stream_test \ - getname file_handle ntypes dangle dtransform filename reserved \ - $(SRB_TESTS) + getname file_handle ntypes dangle dtransform filename reserved # The libh5test.a library provides common support code for the tests. @@ -738,15 +713,6 @@ set_extent$(EXEEXT): $(set_extent_OBJECTS) $(set_extent_DEPENDENCIES) sheap$(EXEEXT): $(sheap_OBJECTS) $(sheap_DEPENDENCIES) @rm -f sheap$(EXEEXT) $(LINK) $(sheap_LDFLAGS) $(sheap_OBJECTS) $(sheap_LDADD) $(LIBS) -srb_append$(EXEEXT): $(srb_append_OBJECTS) $(srb_append_DEPENDENCIES) - @rm -f srb_append$(EXEEXT) - $(LINK) $(srb_append_LDFLAGS) $(srb_append_OBJECTS) $(srb_append_LDADD) $(LIBS) -srb_read$(EXEEXT): $(srb_read_OBJECTS) $(srb_read_DEPENDENCIES) - @rm -f srb_read$(EXEEXT) - $(LINK) $(srb_read_LDFLAGS) $(srb_read_OBJECTS) $(srb_read_LDADD) $(LIBS) -srb_write$(EXEEXT): $(srb_write_OBJECTS) $(srb_write_DEPENDENCIES) - @rm -f srb_write$(EXEEXT) - $(LINK) $(srb_write_LDFLAGS) $(srb_write_OBJECTS) $(srb_write_LDADD) $(LIBS) stab$(EXEEXT): $(stab_OBJECTS) $(stab_DEPENDENCIES) @rm -f stab$(EXEEXT) $(LINK) $(stab_LDFLAGS) $(stab_OBJECTS) $(stab_LDADD) $(LIBS) @@ -807,9 +773,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reserved.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set_extent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sheap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srb_append.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srb_read.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srb_write.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tarray.Po@am__quote@ diff --git a/test/srb_append.c b/test/srb_append.c deleted file mode 100644 index e752b4a..0000000 --- a/test/srb_append.c +++ /dev/null @@ -1,196 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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> - * April 14, 2000 - * - * Purpose: Test HDF-SRB if it is configured and compiled. Append an - * integer dataset to an existent HDF5 file with an integer array - * on SRB server. - * - * Usage: The HDF5 is built on the top of SRB. So you just need to - * activate a connection to SRB server by calling function - * H5Pset_fapl_srb()(after creating file property list by calling - * H5Pcreate()). All server information is passed in through its - * parameter SRB_Info(a structure). Its fields are - * char *srbHost: SRB host address of server. If the input is - * NULL, it will use the environment varible "srbHost" if - * it is defined. If it is not defined, the - * ~/.srb/.MdasEnd file will be checked next. If not, it - * will use the hostname of the client machine. - * char *srbPort: SRB host port number of server. If the - * input value is NULL, it will use the env variable - * "srbPort" if it is defined. If not, it defaults to - * 5558. - * char *srbAuth: SRB Authentication-password. It is used to - * define password for MDAS or SEA authentication. - * For SEA authentication, this is the password used by - * the SEA library to decrypt the encrypted private key - * stored in the file ~/.SEAuuuuu@ddddd(where uuuuu is - * the user ID and ddddd is the user domain name). This - * input is not needed if an unencrypted private key is - * available in the /tmp directory(generated using the - * 'seaauth auto' command). To provide additional - * flexibility, a client may also use the environment - * variable "srbAuth" to specify the password. A client - * may also supply the password in the ~/.srb/.MdasAuth - * file. If a client uses more than one method to specfy - * the password, the value given in this function call - * will take precedent, then the environment variable - * "srbAuth", and lastly, the ~/.srb/.MdasAuth file. - * int storSysType: Storage system type on SRB server. - * 0=Unix, 1=UniTree, 2=HPSS, 3=FTP, 4=HTTP - * int mode: File access mode, same definition with Unix. - * int size: File Size, only valid for HPSS, -1 is default - * - * Then you can open an HDF5 file by calling H5Fopen(). When - * you pass in the file name, it has to be file name with an - * absolute path. It you use SDSC server(ghidorah.sdsc.edu), your - * home directory is possibly in /projects/mdas/srb/SRBVault/. - */ -#include "h5test.h" - -#ifndef H5_HAVE_SRB -int main(void) -{ - printf("Test skipped because SRB driver not available\n"); - return 0; -} -#else - -#define fileName "/projects/mdas/srb/SRBVault/slu.ncsa/a.h5" -#define DATASETNAME "Int1Array" -#define NX 5 /* dataset dimensions */ -#define NY 6 -#define RANK 2 - -int main(void) -{ - SRB_Info srb_info={ NULL, /* Use the server name in ~/.srb/MdasEnv */ - NULL, /* Use the server port number in - * ~/.srb/MdasEnv */ - NULL, /* Use the password in ~/.srb/MdasAuth */ - 0, /* Using Unix storage system. */ - 0600, /* Open file for read and write for owner */ - -1 /* default */ - }; - hid_t fapl =-1, file; - hid_t dataspace, datatype, dataset; - hsize_t dimsf[2]; - - herr_t status = 0; - int 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*i + j*j; - } - /* - * 0 1 4 9 16 25 - * 1 2 5 10 17 26 - * 4 5 8 13 20 29 - * 9 10 13 18 25 34 - * 16 17 20 25 32 41 - */ - - /* Create access property list and set the driver to SRB */ - fapl = H5Pcreate (H5P_FILE_ACCESS); - if (fapl < 0) { - printf (" H5Pcreate failed. \n"); - return -1; - } - status = H5Pset_fapl_srb (fapl, srb_info); - if (status < 0) { - printf ("H5Pset_fapl_srb failed. \n"); - return -1; - } - - /* - * Open an existing file using H5F_ACC_RDWR access, - * and srb file access properties. - */ - file = H5Fopen(fileName, H5F_ACC_RDWR, fapl); - if (file < 0) { - printf ("H5Fopen failed. \n"); - return -1; - } - - /* - * 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); - if (dataspace < 0) { - printf ("H5Screate failed. \n"); - return -1; - } - - /* - * Define datatype for the data in the file. - * We will store little endian INT numbers. - */ - datatype = H5Tcopy(H5T_NATIVE_INT); - if (datatype < 0) { - printf ("H5Tcopy failed. \n"); - return -1; - } - - status = H5Tset_order(datatype, H5T_ORDER_LE); - if (status < 0) { - printf ("H5Tset_order failed. \n"); - return -1; - } - - /* - * 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); - if (dataset < 0) { - printf ("H5Dcreate failed. \n"); - return -1; - } - - /* - * Write the data to the dataset using default transfer properties. - */ - status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data); - if (status < 0) { - printf ("H5Dwrite failed. \n"); - return -1; - } - - /* - * Close/release resources. - */ - H5Sclose(dataspace); - H5Tclose(datatype); - H5Dclose(dataset); - H5Fclose(file); - H5Pclose(fapl); - - printf("Test finished!\n"); - return 0; -} - -#endif diff --git a/test/srb_read.c b/test/srb_read.c deleted file mode 100644 index 767812c..0000000 --- a/test/srb_read.c +++ /dev/null @@ -1,225 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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> - * April 14, 2000 - * - * Purpose: Test HDF-SRB if it is configured and compiled. Read a chunk of - * dataset of an HDF5 file with an integer array on SRB server, - * using hyperslab. - * Usage: The HDF5 is built on the top of SRB. So you just need to - * activate a connection to SRB server by calling function - * H5Pset_fapl_srb()(after creating file property list by calling - * H5Pcreate()). All server information is passed in through its - * parameter SRB_Info(a structure). Its fields are - * char *srbHost: SRB host address of server. If the input is - * NULL, it will use the environment varible "srbHost" if - * it is defined. If it is not defined, the - * ~/.srb/.MdasEnd file will be checked next. If not, it - * will use the hostname of the client machine. - * char *srbPort: SRB host port number of server. If the - * input value is NULL, it will use the env variable - * "srbPort" if it is defined. If not, it defaults to - * 5558. - * char *srbAuth: SRB Authentication-password. It is used to - * define password for MDAS or SEA authentication. - * For SEA authentication, this is the password used by - * the SEA library to decrypt the encrypted private key - * stored in the file ~/.SEAuuuuu@ddddd(where uuuuu is - * the user ID and ddddd is the user domain name). This - * input is not needed if an unencrypted private key is - * available in the /tmp directory(generated using the - * 'seaauth auto' command). To provide additional - * flexibility, a client may also use the environment - * variable "srbAuth" to specify the password. A client - * may also supply the password in the ~/.srb/.MdasAuth - * file. If a client uses more than one method to specfy - * the password, the value given in this function call - * will take precedent, then the environment variable - * "srbAuth", and lastly, the ~/.srb/.MdasAuth file. - * int storSysType: Storage system type on SRB server. - * 0=Unix, 1=UniTree, 2=HPSS, 3=FTP, 4=HTTP - * int mode: File access mode, same definition with Unix. - * int size: File Size, only valid for HPSS, -1 is default - * - * Then you can open an HDF5 file by calling H5Fopen(). When - * you pass in the file name, it has to be file name with an - * absolute path. It you use SDSC server(ghidorah.sdsc.edu), your - * home directory is possibly in /projects/mdas/srb/SRBVault/. - */ -#include "h5test.h" - -#ifndef H5_HAVE_SRB -int main(void) -{ - printf("Test skipped because SRB driver not available\n"); - return 0; -} -#else - -#define fileName "/projects/mdas/srb/SRBVault/slu.ncsa/a.h5" -#define DATASETNAME "IntArray" -#define NX_SUB 3 /* hyperslab dimensions */ -#define NY_SUB 4 -#define NX 7 /* output buffer dimensions */ -#define NY 7 -#define NZ 3 -#define RANK 2 -#define RANK_OUT 3 - -int main(void) -{ - hid_t fapl=-1, fid = -1, dataset; - hid_t datatype, dataspace; - hid_t memspace; - H5T_class_t class; /* data type class */ - H5T_order_t order; /* data order */ - size_t size; /* - * size of the data element - * stored in file - */ - hsize_t dimsm[3]; /* memory space dimensions */ - hsize_t dims_out[2]; /* dataset dimensions */ - herr_t status; - - int data_out[NX][NY][NZ ]; /* output buffer */ - - hsize_t count[2]; /* size of the hyperslab in the file */ - hssize_t offset[2]; /* hyperslab offset in the file */ - hsize_t count_out[3]; /* size of the hyperslab in memory */ - hssize_t offset_out[3]; /* hyperslab offset in memory */ - int i, j, k, status_n, rank; - SRB_Info srb_info={ NULL, /* Use host name in ~/.srb/.MdasEnv */ - NULL, /* Use environment variable "srbPort" */ - NULL, /* Use password in ~/.srb/.MdasEnv */ - 0, /* Use Unix storage system. */ - 0600, /* File was created for read and write for - * owner */ - -1 /* default */ - }; - - for (j = 0; j < NX; j++) { - for (i = 0; i < NY; i++) { - for (k = 0; k < NZ ; k++) - data_out[j][i][k] = 0; - } - } - - fapl = H5Pcreate(H5P_FILE_ACCESS); - if (fapl < 0) { - printf (" H5Pcreate failed. \n"); - return -1; - } - - status = H5Pset_fapl_srb(fapl, srb_info); - if (status < 0) { - printf ("H5Pset_fapl_srb failed. \n"); - return -1; - } - - fid = H5Fopen(fileName, H5F_ACC_RDONLY, fapl); - if (fid < 0) { - printf ("H5Fopen failed. \n"); - return -1; - } - dataset = H5Dopen(fid, DATASETNAME); - if(dataset<0) { - printf ("H5Dopen failed. \n"); - return -1; - } - /* - * Get datatype and dataspace handles and then query - * dataset class, order, size, rank and dimensions. - */ - datatype = H5Dget_type(dataset); /* datatype handle */ - class = H5Tget_class(datatype); - if (class == H5T_INTEGER) printf("Data set has INTEGER type \n"); - order = H5Tget_order(datatype); - if (order == H5T_ORDER_LE) printf("Little endian order \n"); - - size = H5Tget_size(datatype); - printf(" Data size is %d \n", size); - - dataspace = H5Dget_space(dataset); /* dataspace handle */ - rank = H5Sget_simple_extent_ndims(dataspace); - status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL); - printf("rank %d, dimensions %lu x %lu \n", rank, - (unsigned long)(dims_out[0]), (unsigned long)(dims_out[1])); - - /* - * Define hyperslab in the dataset. - */ - offset[0] = 1; - offset[1] = 2; - count[0] = NX_SUB; - count[1] = NY_SUB; - status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, - count, NULL); - - /* - * Define the memory dataspace. - */ - dimsm[0] = NX; - dimsm[1] = NY; - dimsm[2] = NZ ; - memspace = H5Screate_simple(RANK_OUT,dimsm,NULL); - - /* - * Define memory hyperslab. - */ - offset_out[0] = 3; - offset_out[1] = 0; - offset_out[2] = 0; - count_out[0] = NX_SUB; - count_out[1] = NY_SUB; - count_out[2] = 1; - status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, - count_out, NULL); - - /* - * Read data from hyperslab in the file into the hyperslab in - * memory and display. - */ - status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace, - H5P_DEFAULT, data_out); - for (j = 0; j < NX; j++) { - for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]); - printf("\n"); - } - /* - * 0 0 0 0 0 0 0 - * 0 0 0 0 0 0 0 - * 0 0 0 0 0 0 0 - * 3 4 5 6 0 0 0 - * 4 5 6 7 0 0 0 - * 5 6 7 8 0 0 0 - * 0 0 0 0 0 0 0 - */ - - /* - * Close/release resources. - */ - H5Tclose(datatype); - H5Dclose(dataset); - H5Sclose(dataspace); - H5Sclose(memspace); - H5Fclose(fid); - H5Pclose(fapl); - - printf("Test finished!\n"); - return 0; -} - -#endif diff --git a/test/srb_write.c b/test/srb_write.c deleted file mode 100644 index b0629a8..0000000 --- a/test/srb_write.c +++ /dev/null @@ -1,193 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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> - * April 14, 2000 - * - * Purpose: Test HDF-SRB if it is configured and compiled. Write an HDF5 - * file with an integer array to SRB server. - * - * Usage: The HDF5 is built on the top of SRB. So you just need to - * activate a connection to SRB server by calling function - * H5Pset_fapl_srb()(after creating file property list by calling - * H5Pcreate()). All server information is passed in through its - * parameter SRB_Info(a structure). Its fields are - * char *srbHost: SRB host address of server. If the input is - * NULL, it will use the environment varible "srbHost" if - * it is defined. If it is not defined, the - * ~/.srb/.MdasEnd file will be checked next. If not, it - * will use the hostname of the client machine. - * char *srbPort: SRB host port number of server. If the - * input value is NULL, it will use the env variable - * "srbPort" if it is defined. If not, it defaults to - * 5558. - * char *srbAuth: SRB Authentication-password. It is used to - * define password for MDAS or SEA authentication. - * For SEA authentication, this is the password used by - * the SEA library to decrypt the encrypted private key - * stored in the file ~/.SEAuuuuu@ddddd(where uuuuu is - * the user ID and ddddd is the user domain name). This - * input is not needed if an unencrypted private key is - * available in the /tmp directory(generated using the - * 'seaauth auto' command). To provide additional - * flexibility, a client may also use the environment - * variable "srbAuth" to specify the password. A client - * may also supply the password in the ~/.srb/.MdasAuth - * file. If a client uses more than one method to specfy - * the password, the value given in this function call - * will take precedent, then the environment variable - * "srbAuth", and lastly, the ~/.srb/.MdasAuth file. - * int storSysType: Storage system type on SRB server. - * 0=Unix, 1=UniTree, 2=HPSS, 3=FTP, 4=HTTP - * int mode: File access mode, same definition with Unix. - * int size: File Size, only valid for HPSS, -1 is default - * - * Then you can create an HDF5 file by calling H5Fcreate(). When - * you pass in the file name, it has to be file name with an - * absolute path. It you use SDSC server(ghidorah.sdsc.edu), your - * home directory is possibly in /projects/mdas/srb/SRBVault/. - */ - -#include "h5test.h" - -#ifndef H5_HAVE_SRB -int main(void) -{ - printf("Test skipped because SRB driver not available\n"); - return 0; -} -#else - -#define fileName "/projects/mdas/srb/SRBVault/slu.ncsa/a.h5" -#define DATASETNAME "IntArray" -#define NX 5 /* dataset dimensions */ -#define NY 6 -#define RANK 2 - - -int main(void) -{ - hid_t fapl=-1, fid = -1; - hid_t dataspace, datatype, dataset; - hsize_t dimsf[2]; - herr_t status = 0; - int data[NX][NY]; /* data to write */ - int i, j; - SRB_Info srb_info={ "ghidorah.sdsc.edu", /* Using SDSC SRB server, - * don't append port number. */ - NULL, /* SRB host default port number*/ - NULL, /* SRB Authentication-password, - * using the one in - * ~/.srb/.MdasAuth */ - 0, /* Unix storage system. */ - 0600, /* Read and write only for - * owner */ - -1 /* -1 is default. */ - }; - - /* - * 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 - */ - - fapl = H5Pcreate(H5P_FILE_ACCESS); - if (fapl < 0) { - printf (" H5Pcreate failed. \n"); - return -1; - } - - status = H5Pset_fapl_srb(fapl, srb_info); - if (status < 0) { - printf ("H5Pset_fapl_srb failed. \n"); - return -1; - } - - fid = H5Fcreate(fileName, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - /*fid = H5Fcreate(fileName, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);*/ - if (fid < 0) { - printf ("H5Fcreate failed. \n"); - return -1; - } - - /* - * 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); - if (dataspace < 0) { - printf ("H5Screate failed. \n"); - return -1; - } - - /* - * Define datatype for the data in the file. - * We will store little endian INT numbers. - */ - datatype = H5Tcopy(H5T_NATIVE_INT); - if (datatype < 0) { - printf ("H5Tcopy failed. \n"); - return -1; - } - - status = H5Tset_order(datatype, H5T_ORDER_LE); - if (status < 0) { - printf ("H5Tset_order failed. \n"); - return -1; - } - /* - * Create a new dataset within the file using defined dataspace and - * datatype and default dataset creation properties. - */ - dataset = H5Dcreate(fid, DATASETNAME, datatype, dataspace, - H5P_DEFAULT); - if (dataset < 0) { - printf ("H5Dcreate failed. \n"); - return -1; - } - - - /* - * Write the data to the dataset using default transfer properties. - */ - status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data); - if (status < 0) { - printf ("H5Dwrite failed. \n"); - return -1; - } - - H5Sclose(dataspace); - H5Tclose(datatype); - H5Dclose(dataset); - H5Fclose(fid); - H5Pclose(fapl); - - printf("Test finished!\n"); - return 0; -} - -#endif |