summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2008-04-30 19:23:26 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2008-04-30 19:23:26 (GMT)
commit5773fd34bc5adf59b4530d95ac9f0c0585902803 (patch)
tree456ad239799382e1f083fb7fc74399e43b471912 /test
parent0138995d1ce2068db1f790503435a2121132d3ad (diff)
downloadhdf5-5773fd34bc5adf59b4530d95ac9f0c0585902803.zip
hdf5-5773fd34bc5adf59b4530d95ac9f0c0585902803.tar.gz
hdf5-5773fd34bc5adf59b4530d95ac9f0c0585902803.tar.bz2
[svn-r14902] Merged fortran_1_8 branch changes r14505:14901 into the trunk. New fortran wrappers added.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.in4
-rw-r--r--test/chunk_info.c153
-rw-r--r--test/cmpd_dset.c46
-rw-r--r--test/dtypes.c108
-rw-r--r--test/links.c1494
-rwxr-xr-xtest/objcopy.c2
-rw-r--r--test/tattr.c4
-rw-r--r--test/tcoords.c306
-rw-r--r--test/th5s.c6
10 files changed, 93 insertions, 2033 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index b0f80cb..53df8bb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -105,8 +105,7 @@ flush2.chkexe_: flush1.chkexe_
CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5\
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \
extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2]\
- links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
- big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
+ links.h5 links[0-6]*.h5 big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
stdio.h5 sec2.h5 dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 \
tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 64d0e0a..7e47249 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -595,8 +595,8 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
compact_dataset.h5 dataset.h5 extend.h5 istore.h5 \
tfile[1-4].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 \
extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
- dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
- big.data big[0-9][0-9][0-9][0-9][0-9].h5 stdio.h5 sec2.h5 \
+ dt_arith[1-2] links.h5 links[0-6]*.h5 big.data \
+ big[0-9][0-9][0-9][0-9][0-9].h5 stdio.h5 sec2.h5 \
dtypes[1-8].h5 dt_arith[1-2].h5 tattr.h5 tselect.h5 mtime.h5 \
unlink.h5 unicode.h5 coord.h5 fillval_[0-9].h5 fillval.raw \
mount_[0-9].h5 testmeta.h5 ttime.h5 trefer[1-3].h5 tvltypes.h5 \
diff --git a/test/chunk_info.c b/test/chunk_info.c
deleted file mode 100644
index 48db292..0000000
--- a/test/chunk_info.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Programmer: Pedro Vicente <pvn@hdfgroup.edu>
- * April 7, 2008
- *
- * Purpose: Tests the H5Dget_chunk_info API function
- * This program writes a 4x4 dataset by iterating on 2x2 chunks
- * at a time
- */
-
-
-#include "hdf5.h"
-#include "h5test.h"
-
-#define PRINT_DATA
-#define H5FILE_NAME "chunk_info.h5"
-#define DATASETNAME "2d"
-#define RANK 2
-
-
-int main( void )
-{
-
- hid_t fid; /* file ID */
- hid_t did; /* dataset ID */
- hid_t f_sid; /* file space ID */
- hid_t m_sid; /* memory space ID */
- hid_t pid; /* property list ID */
- hsize_t start[2]; /* chunk location to start writing */
- hsize_t dims[2] = { 4, 4};
- hsize_t chunk_dims[2] = { 2, 2 };
- int chunk_data[2][2] = { {1, 1}, {1, 1} };
- int buf[4][4];
- int fillvalue = 0;
- int i, j, ii, jj;
-
- /* create a new file using default properties. */
- if ((fid = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
- /* create the file space */
- if ((f_sid = H5Screate_simple(RANK, dims, dims)) < 0) TEST_ERROR;
- /* create the memory space with chunk dimensions */
- if ((m_sid = H5Screate_simple(RANK, chunk_dims, chunk_dims)) < 0) TEST_ERROR;
- start[0] = 0;
- start[1] = 0;
- if (H5Sselect_hyperslab(m_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR;
-
- TESTING("chunk info");
-
- /*-------------------------------------------------------------------------
- * create a dataset
- *-------------------------------------------------------------------------
- */
-
- /* modify dataset creation properties, i.e. enable chunking. */
- if ((pid = H5Pcreate (H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if (H5Pset_chunk(pid, RANK, chunk_dims) < 0) TEST_ERROR;
- if (H5Pset_fill_value(pid, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR;
-
- /* create a new dataset */
- if((did = H5Dcreate2(fid , DATASETNAME, H5T_NATIVE_INT, f_sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR;
-
-
- /*-------------------------------------------------------------------------
- * write the dataset in 2x2 chunks
- *-------------------------------------------------------------------------
- */
-
- /* iterate in dim 0 */
- for (j = 0; j < chunk_dims[0]; j++)
- {
-
- /* reset start in dim 1 */
- start[1] = 0;
-
- /* iterate in dim 1 */
- for (i = 0; i < chunk_dims[1]; i++)
- {
-
- /* select file hyperslab to save a 2x2 chunk */
- if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR;
-
- /* write the data to the hyperslab. */
- if (H5Dwrite(did, H5T_NATIVE_INT, m_sid, f_sid, H5P_DEFAULT, chunk_data) < 0) TEST_ERROR;
-
- /* read back and display complete dataset 4x4 */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
-
-
-#if defined (PRINT_DATA)
- printf("\n");
- printf("dataset: \n");
- for (jj = 0; jj < dims[0]; jj++) {
- for (ii = 0; ii < dims[1]; ii++) printf("%d ", buf[jj][ii]);
- printf("\n");
- }
-#endif
-
-
- /* increment start in dim 1 */
- start[1] += 2;
-
-
- }
-
- /* increment start in dim 0 */
- start[0] += 2;
- }
-
-
-
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
-
- if (H5Dclose(did) < 0) TEST_ERROR
- if (H5Sclose(f_sid) < 0) TEST_ERROR
- if (H5Sclose(m_sid) < 0) TEST_ERROR
- if (H5Pclose(pid) < 0) TEST_ERROR
- if (H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
-
- puts("All chunk info tests passed.");
- return 0;
-
-
-error:
- H5Dclose( did );
- H5Sclose( f_sid );
- H5Sclose( m_sid );
- H5Pclose( pid );
- H5Fclose( fid );
- H5_FAILED();
- return 1;
-}
-
-
-
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index a03d37e..66993e0 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1421,32 +1421,32 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
/* Create xfer properties to preserve initialized data */
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Pset_preserve(dxpl, TRUE) < 0)
- FAIL_STACK_ERROR
+ goto error;
/* Rewrite contiguous data set */
if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ goto error;
/* Write the data to the dataset */
if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Dclose(dataset) < 0)
- FAIL_STACK_ERROR
+ goto error;
/* Rewrite chunked data set */
if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ goto error;
/* Write the data to the dataset */
if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Dclose(dataset) < 0)
- FAIL_STACK_ERROR
+ goto error;
PASSED();
@@ -1458,48 +1458,48 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
/* Check contiguous data set */
if((dataset = H5Dopen2(file, DSET_NAME[0], H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(compare_data(orig, rbuf, TRUE) < 0)
- TEST_ERROR
+ goto error;
if(H5Dclose(dataset) < 0)
- FAIL_STACK_ERROR
+ goto error;
/* Check chunked data set */
if((dataset = H5Dopen2(file, DSET_NAME[1], H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(compare_data(orig, rbuf, TRUE) < 0)
- TEST_ERROR
+ goto error;
if(H5Dclose(dataset) < 0)
- FAIL_STACK_ERROR
+ goto error;
/* Finishing test and release resources */
if(H5Sclose(space) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Pclose(dxpl) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Tclose(src_tid) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Tclose(dst_tid) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Tclose(rew_tid) < 0)
- FAIL_STACK_ERROR
+ goto error;
if(H5Fclose(file) < 0)
- FAIL_STACK_ERROR
+ goto error;
free(orig);
free(rbuf);
diff --git a/test/dtypes.c b/test/dtypes.c
index 6707d2e..0388003 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -90,10 +90,6 @@ typedef enum dtype_t {
/* Constant for size of conversion buffer for int <-> float exception test */
#define CONVERT_SIZE 4
-/* Constants for compound_13 test */
-#define COMPOUND13_ARRAY_SIZE 256
-#define COMPOUND13_ATTR_NAME "attr"
-
/* Count opaque conversions */
static int num_opaque_conversions_g = 0;
@@ -2178,107 +2174,6 @@ test_compound_12(void)
/*-------------------------------------------------------------------------
- * Function: test_compound_12
- *
- * Purpose: Tests compound datatypes whose size is at the boundary for
- * needing 2 bytes for the datatype size and "use the latest
- * format" flag is enabled so that the size of the offsets uses
- * the smallest # of bytes possible.
- *
- * Return: Success: 0
- * Failure: number of errors
- *
- * Programmer: Quincey Koziol
- * Thursday, March 13, 2008
- *
- *-------------------------------------------------------------------------
- */
-static int
-test_compound_13(void)
-{
- struct s1 {
- unsigned char x[COMPOUND13_ARRAY_SIZE + 1];
- float y;
- };
- struct s1 data_out, data_in;
- hid_t fileid, grpid, typeid, array1_tid, spaceid, attid;
- hid_t fapl_id;
- hsize_t dims[1] = {COMPOUND13_ARRAY_SIZE + 1};
- char filename[1024];
- unsigned u;
-
- TESTING("compound datatypes of boundary size with latest format");
-
- /* Create some phony data. */
- for(u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
- data_out.x[u] = u;
- data_out.y = 99.99;
-
- /* Set latest_format in access propertly list to enable the latest
- * compound datatype format.
- */
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR
- if(H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR
-
- /* Open file and get root group. */
- h5_fixname(FILENAME[4], H5P_DEFAULT, filename, sizeof filename);
- if((fileid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR
- if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- /* Create a compound type. */
- if((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) FAIL_STACK_ERROR
- if((array1_tid = H5Tarray_create2(H5T_NATIVE_UCHAR, 1, dims)) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "x", HOFFSET(struct s1, x), array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tinsert(typeid, "y", HOFFSET(struct s1, y), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR
-
- /* Create a space. */
- if((spaceid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR
-
- /* Create an attribute of this compound type. */
- if((attid = H5Acreate2(grpid, COMPOUND13_ATTR_NAME, typeid, spaceid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- /* Write some data. */
- if(H5Awrite(attid, typeid, &data_out) < 0) FAIL_STACK_ERROR
-
- /* Release all resources. */
- if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(array1_tid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
- if(H5Sclose(spaceid) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(fapl_id) < 0) FAIL_STACK_ERROR
-
- /* Now open the file and read it. */
- if((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((attid = H5Aopen(grpid, COMPOUND13_ATTR_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if((typeid = H5Aget_type(attid)) < 0) FAIL_STACK_ERROR
- if(H5Tget_class(typeid) != H5T_COMPOUND) FAIL_STACK_ERROR
- if(HOFFSET(struct s1, x) != H5Tget_member_offset(typeid, 0)) TEST_ERROR
- if(HOFFSET(struct s1, y) != H5Tget_member_offset(typeid, 1)) TEST_ERROR
- if(H5Aread(attid, typeid, &data_in) < 0) FAIL_STACK_ERROR
-
- /* Check the data. */
- for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
- if(data_out.x[u] != data_in.x[u]) TEST_ERROR
- if(data_out.y != data_in.y) TEST_ERROR
-
- /* Release all resources. */
- if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
- if(H5Tclose(typeid) < 0) FAIL_STACK_ERROR
- if(H5Gclose(grpid) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fileid) < 0) FAIL_STACK_ERROR
-
- PASSED();
- return 0;
-
-error:
- return 1;
-} /* end test_compound_13() */
-
-
-/*-------------------------------------------------------------------------
* Function: test_query
*
* Purpose: Tests query functions of compound and enumeration types.
@@ -4808,7 +4703,7 @@ test_deprec(hid_t fapl)
/* Create an array datatype with an atomic base type */
/* (dimension permutations allowed, but not stored) */
- if((type = H5Tarray_create1(H5T_NATIVE_INT, (int)rank, dims, perm)) < 0)
+ if((type = H5Tarray_create1(H5T_NATIVE_INT, rank, dims, perm)) < 0)
FAIL_STACK_ERROR
/* Make certain that the correct classes can be detected */
@@ -4967,7 +4862,6 @@ main(void)
nerrors += test_compound_10();
nerrors += test_compound_11();
nerrors += test_compound_12();
- nerrors += test_compound_13();
nerrors += test_conv_enum_1();
nerrors += test_conv_enum_2();
nerrors += test_conv_bitfield();
diff --git a/test/links.c b/test/links.c
index ed60748..1bff4c6 100644
--- a/test/links.c
+++ b/test/links.c
@@ -20,6 +20,10 @@
* Purpose: Tests hard, soft (symbolic) & external links.
*/
+#include "h5test.h"
+
+#include "H5Lprivate.h"
+
/*
* This file needs to access private information from the H5G package.
* This file also needs to access the group testing code.
@@ -28,9 +32,6 @@
#define H5G_TESTING
#include "H5Gpkg.h" /* Groups */
-#include "h5test.h"
-#include "H5Lprivate.h"
-
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
@@ -39,47 +40,15 @@ const char *FILENAME[] = {
"links1",
"links2",
"links3",
- "links4a", /* 4 */
- "links4b", /* 5 */
- "links4c", /* 6 */
- "links4d", /* 7 */
- "links5", /* 8 */
- "links6", /* 9 */
- "links7", /* 10 */
- "links8", /* 11 */
- "extlinks0", /* 12: main files */
- "tmp/extlinks0", /* 13: */
- "extlinks1", /* 14: target files */
- "tmp/extlinks1", /* 15: */
- "extlinks2", /* 16: */
- "tmp/extlinks2", /* 17: */
- "extlinks3", /* 18: */
- "tmp/extlinks3", /* 19: */
- "extlinks4", /* 20: */
- "tmp/extlinks4", /* 21: */
- "extlinks5", /* 22: */
- "tmp/extlinks6", /* 23: */
- "extlinks7", /* 24: */
- "tmp/extlinks7", /* 25: */
- "tmp/extlinks8", /* 26: */
- "extlinks9", /* 27: */
- "tmp/extlinks9", /* 28: */
- "extlinks10", /* 29: */ /* TESTS for windows */
- "tmp/extlinks10", /* 30: */
- "tmp/extlinks11", /* 31: */
- "tmp/extlinks12", /* 32: */
- "extlinks13", /* 33: */
- "tmp/extlinks13", /* 34: */
- "extlinks14", /* 35: */
- "tmp/extlinks14", /* 36: */
- "tmp/extlinks15", /* 37: */
+ "links4a",
+ "links4b",
+ "links4c",
+ "links4d",
+ "links5",
+ "links6",
NULL
};
-#define TMPDIR "tmp"
-/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
-#define EXTSTOP 12
-
#define LINK_BUF_SIZE 1024
#define NAME_BUF_SIZE 1024
#define MAX_NAME_LEN ((64*1024)+1024)
@@ -2583,1418 +2552,6 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
return -1;
} /* end external_link_dangling() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_env: test 1
- *
- * Purpose:
- * 1. target link: "extlinks1"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks1"
- * 4. The environment variable "HDF5_EXT_PREFIX" should be set to ".:tmp"
- * Should be able to access the target file in tmp directory through searching
- * the pathnames set in HDF5_EXT_PREFIX.
- * This test will be skipped if HDF5_EXT_PREFIX is not set as expected.
- *
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_env(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- const char *envval = NULL;
-
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via environment variable (w/new group format)")
- else
- TESTING("external links via environment variable")
-
- if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL)
- envval = "nomatch";
- if (HDstrcmp(envval, ".:tmp")) {
- SKIPPED();
- return(0);
- }
-
- /* set up name for main file:"extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* set up name for external linked target file: "extlinks1" */
- h5_fixname(FILENAME[14], fapl, filename2, sizeof filename2);
-
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
-
- /* set up name for target file: "tmp/extlinks1" */
- h5_fixname(FILENAME[15], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file from pathnames set via environment variable */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_env() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_prefix: test 2
- *
- * Purpose: 1. target link: "extlinks2"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks2"
- * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp"
- * Should be able to access the target file in tmp directory via the prefix set
- * by H5Pset_elink_prefix()
- *
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_prefix(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- hid_t gapl_id = (-1);
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via H5Pset_elink_prefix()(w/new group format)")
- else
- TESTING("external links via H5Pset_elink_prefix()")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* set up name for external linked target file: "extlinks2" */
- h5_fixname(FILENAME[16], fapl, filename2, sizeof filename2);
-
- /* create tmp directory and get current working directory path */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
-
- /* set up name for target file: "tmp/extlinks2" */
- h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file (without the absolute path) */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* set up prefix for external link */
- if((gapl_id = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
- if(H5Pset_elink_prefix(gapl_id, TMPDIR) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", gapl_id);
- } H5E_END_TRY;
-
- /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_prefix() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_abs_mainpath: test 3
- *
- * Purpose: 1. target link: "extlinks3"
- * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: "<cur drive>:/CWD/tmp/extlinks0"
- * 3. target file: "tmp/extlinks3"
- * Should be able to access the target file via the main file's absolute path
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's absolute path (w/new group format)")
- else
- TESTING("external links via main file's absolute path")
-
- /* set up name for external linked target file: "extlinks3" */
- h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks3" */
- h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3);
-
- /* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
- TEST_ERROR
-
- /*
- * set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Window: "<cur drive>:/CWD/tmp/extlinks0"
- */
- HDstrcpy(tmpname, cwdpath);
- HDstrcat(tmpname, "/");
- HDstrcat(tmpname, FILENAME[13]);
- h5_fixname(tmpname, fapl, filename1, sizeof filename1);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file from absolute path set for main file */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_abs_mainpath() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_rel_mainpath: test 4
- *
- * Purpose: 1. target link: "extlinks4"
- * 2. main file: "tmp/extlinks0"
- * 3. target file: "tmp/extlinks4"
- * Should be able to access the target file via the main file's CWD+relative path
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's CWD + relative path(w/new group format)")
- else
- TESTING("external links via main file's CWD + relative path")
-
- /* set up name for external linked target file: "extlinks4" */
- h5_fixname(FILENAME[20], fapl, filename2, sizeof filename2);
-
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
-
- /* set up name for main file: "tmp/extlinks0" */
- h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1);
- /* set up name for target file: "tmp/extlinks4" */
- h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file from the main file's relative pathname */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in current working directory");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_rel_mainpath() */
-
-/*-------------------------------------------------------------------------
- * Function: external_link_cwd: test 5
- *
- * Purpose: 1. target link: "extlinks5"
- * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/CWD/tmp/extlinks0"
- * 2. target file: "extlinks5"
- * Should be able to access the target file in the current working directory
- *
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb 19, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_cwd(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
-
- if(new_format)
- TESTING("external links via current working directory(w/new group format)")
- else
- TESTING("external links via current working directory")
-
- /* set up name for external linked target file: "extlinks5" */
- /* set up name for target file: "extlinks5" */
- h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2);
-
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
- TEST_ERROR
-
- /*
- * set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Windows: "<cur drive>:/CWD/tmp/extlinks0"
- */
- HDstrcpy(tmpname, cwdpath);
- HDstrcat(tmpname, "/");
- HDstrcat(tmpname, FILENAME[13]);
- h5_fixname(tmpname, fapl, filename1, sizeof filename1);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file from the current working directory */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in current working directory");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_cwd() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_abstar: test 6
- *
- * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:"<cur drive>:/CWD/tmp/extlinks6"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks6"
- * Should be able to access the target file's absolute path
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_abstar(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via target's absolute path (w/new group format)")
- else
- TESTING("external links via target's absolute path")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
-
- /* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
- TEST_ERROR
-
- /*
- * set up name for external linked target file:
- * Linux: "/CWD/tmp/extlinks6"
- * Windows: "<cur drive>:/CWD/tmp/extlinks6"
- */
- HDstrcpy(tmpname, cwdpath);
- HDstrcat(tmpname, "/");
- HDstrcat(tmpname, FILENAME[23]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* set up name for target file: "tmp/extlinks6" */
- h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file with abolute path */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_abstar() */
-
-/*-------------------------------------------------------------------------
- * Function: external_link_abstar_cur: test 7
- *
- * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: "<cur drive>:/CWD/tmp/extlinks7"
- * 2. main file: "extlinks0"
- * 3. target file: "extlinks7"
- * Should be able to access the target file via the main file's CWD.
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_abstar_cur(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's CWD (w/new group format)")
- else
- TESTING("external links via main file's CWD")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
-
- /* set up name for target file name: "extlinks7" */
- h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3);
-
- /* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
- TEST_ERROR
-
- /*
- * set up name for external linked target file:
- * Linux: "/CWD/tmp/extlinks7"
- * Windows: "<cur drive>:/CWD/tmp/extlinks7"
- */
- HDstrcpy(tmpname, cwdpath);
- HDstrcat(tmpname, "/");
- HDstrcat(tmpname, FILENAME[25]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file from main file's current working directory */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in current working directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_abstar_cur() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_reltar: test 8
- *
- * Purpose: 1. target link: Linux:"tmp/extlinks8"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks8"
- * Should be able to access the target file via the main file's CWD+ target's relative path
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_reltar(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's CWD + target's relative path(w/new group format)")
- else
- TESTING("external links via main file's CWD + target's relative path")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
-
- /* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
-
- /* set up name for target file name: "tmp/extlinks8" */
- /* set up name for external linked target file: "tmp/extlinks8" */
- h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /*
- * Should be able to find the target file from:
- * main file's current working directory + pathname of external linked targetfile
- */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_reltar() */
-
-/*-------------------------------------------------------------------------
- * Function: external_link_chdir: test 9
- *
- * Purpose:
- * 1. target link: "extlinks9"
- * 2. main file: "extlinks0"
- * 3. target file" "tmp/extlinks9"
- * 3. chdir "tmp"
- * Should be able to access the target file in current working directory
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * Feb. 20, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_chdir(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via chdir and found in current working directory (w/new group format)")
- else
- TESTING("external links via chdir and found in current working directory")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* set up name for external linked target file ("extlinks9") */
- h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2);
-
- /* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
-
- /* set up name for target file name ("tmp/extlinks9") */
- h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
-
- if (HDchdir(TMPDIR) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- if (HDchdir("..") < 0) TEST_ERROR
-
- /*
- * Should be able to find the target file from:
- * main file's current working directory + pathname of external linked targetfile
- */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp directory.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_chdir() */
-
-
-
-#ifdef H5_HAVE_WINDOW_PATH
-
-/*-------------------------------------------------------------------------
- * Function: external_link_win1
- *
- * Purpose:
- * 1. target link: "/CWD/tmp/extlinks10"
- * 2. main file: "extlinks0"
- * 3. target file: "extlinks10"
- * Should be able to find the target file via main file's CWD
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_win1(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's CWD (windows)(w/new group format)")
- else
- TESTING("external links via main file's CWD (windows)")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
-
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
- TEST_ERROR
-
- /* set up name for target link: "/CWD/tmp/extlinks10" */
- HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */
- HDstrcat(tmpname, "/");
- HDstrcat(tmpname, FILENAME[30]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* set up name for target file: "extlinks10" */
- h5_fixname(FILENAME[29], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file via main file's CWD*/
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in CWD.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_win2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_win2
- *
- * Purpose:
- * 1. target link: "/CWD/tmp/extlinks11"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks11"
- * Should be able to access the target file directly
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_win2(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via target's rel drive/abs path (windows)(w/new group format)")
- else
- TESTING("external links via target's rel drive/abs path (windows)")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
-
- /* create tmp directory and get current working directory path */
- if ((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL))
- TEST_ERROR
-
- /* set up name for target link: "/CWD/tmp/extlinks11" */
- HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */
- HDstrcat(tmpname, "/");
- HDstrcat(tmpname, FILENAME[31]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* set up name for target file: "tmp/extlinks11" */
- h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file directly */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_win2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_win3
- *
- * Purpose:
- * 1. target link: "<cur drive>:tmp/extlinks12"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks12"
- * Should be able to access the target file directly
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * April i15 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_win3(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via target's abs drive/rel path (windows)(w/new group format)")
- else
- TESTING("external links via target's abs drive/rel path (windows)")
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
-
- /* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
-
- /* set up name for target link: "<drive-letter>:tmp/extlinks12" */
- drive = HDgetdrive();
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[32]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* set up name for target file: "tmp/extlinks12" */
- h5_fixname(FILENAME[32], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file directly */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_win3() */
-
-/*-------------------------------------------------------------------------
- * Function: external_link_win4
- *
- * Purpose:
- * 1. target link: "<cur drive>:tmp/extlinks13"
- * 2. main file: "<cur-drive>:extlinks0"
- * 3. target file: extlinks13
- * Should be able to access the target file via main file's CWD
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_win4(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)")
- else
- TESTING("external links via main file's abs drive/rel path (windows)")
-
- /* set up name for main file: "<drive-letter>:extlinks0" */
- drive = HDgetdrive();
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[12]);
- h5_fixname(tmpname, fapl, filename1, sizeof filename1);
-
- /* set up name for target link: "<drive-letter>:tmp/extlinks13" */
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[34]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* set up name for target file: "extlinks13" */
- h5_fixname(FILENAME[33], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file via main file's absolute drive/relative path */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in CWD.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_win4() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_win5
- *
- * Purpose:
- * 1. target link: "<cur drive>:tmp/extlinks14"
- * 2. main file: "/CWD/extlinks0"
- * 3. target file: "extlinks14"
- * Should be able to access the target file via main file's relative drive/absolute path
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_win5(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)")
- else
- TESTING("external links via main file's rel drive/abs path (windows)")
-
- if (HDgetcwd(cwdpath, NAME_BUF_SIZE)==NULL)
- TEST_ERROR
- drive = HDgetdrive();
-
- /* set up name for main file: "/CWD/extlinks0" */
- HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */
- HDstrcat(tmpname, "/");
- HDstrcat(tmpname, FILENAME[12]);
- h5_fixname(tmpname, fapl, filename1, sizeof filename1);
-
- /* set up name for target link: "<drive-letter>:tmp/extlinks14" */
- sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[36]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* set up name for target file: "extlinks14" */
- h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file via main file's rel drive/abs path */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in CWD.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_win5() */
-
-
-/*-------------------------------------------------------------------------
- * Function: external_link_win6
- *
- * Purpose:
- * 1. target link: "<cur drive+1>:tmp/extlinks15"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks15"
- * Should be able to access the target file via target's rel path in the current drive
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Vailin Choi
- * April 15, 2008
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static int
-external_link_win6(hid_t fapl, hbool_t new_format)
-{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- int drive=0;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- filename3[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE];
-
- if(new_format)
- TESTING("external links via target's rel path in current drive(windows)(w/new group format)")
- else
- TESTING("external links via target's rel path in current drive(windows)")
-
- /* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
- drive = HDgetdrive();
-
- /* set up name for main file: "extlinks0" */
- h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
-
- /* set up name for target link: "<drive-letter+1>:tmp/extlinks15" */
- sprintf(tmpname, "%c:%s", ((drive+1)+'A'-1), FILENAME[37]);
- h5_fixname(tmpname, fapl, filename2, sizeof filename2);
-
- /* set up name for target file: "tmp/extlinks15" */
- h5_fixname(FILENAME[37], fapl, filename3, sizeof filename3);
-
- /* Create the target file */
- if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* closing for target file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
-
- /* Create the main file */
- if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
-
- /* Create external link to target file */
- if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
-
- /* Open object through external link */
- H5E_BEGIN_TRY {
- gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT);
- } H5E_END_TRY;
-
- /* should be able to find the target file via target file's rel path in current drive */
- if (gid < 0) {
- H5_FAILED();
- puts(" Should have found the file in tmp.");
- goto error;
- }
-
- /* closing for main file */
- if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Fclose(fid) < 0) TEST_ERROR
-
- PASSED();
- return 0;
-
- error:
- H5E_BEGIN_TRY {
- H5Gclose (gid);
- H5Fclose (fid);
- } H5E_END_TRY;
- return -1;
-} /* end external_link_win6() */
-
-#endif /* H5_HAVE_WINDOW_PATH */
-
/*-------------------------------------------------------------------------
* Function: external_link_recursive
@@ -6727,7 +5284,7 @@ linkinfo(hid_t fapl, hbool_t new_format)
*-------------------------------------------------------------------------
*/
static int
-check_all_closed(hid_t fapl, hbool_t new_format, int stopat)
+check_all_closed(hid_t fapl, hbool_t new_format)
{
hid_t fid=-1;
char filename[NAME_BUF_SIZE];
@@ -6743,7 +5300,7 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat)
* To check this, try to create every file used in this test. If
* a file is already open, creating it will fail.
*/
- for(x=0; FILENAME[x] != NULL && x < stopat; x++)
+ for(x=0; FILENAME[x] != NULL; x++)
{
h5_fixname(FILENAME[x], fapl, filename, sizeof filename);
@@ -11668,8 +10225,6 @@ main(void)
my_fapl = fapl;
/* General tests... (on both old & new format groups */
-
-
nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
@@ -11708,26 +10263,6 @@ main(void)
nerrors += external_link_endian(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
- /* tests for external link */
- nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0;
-
-#ifdef H5_HAVE_WINDOW_PATH
- nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0;
- // nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0;
- // nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0;
-#endif
-
/* These tests assume that external links are a form of UD links,
* so assume that everything that passed for external links
* above has already been tested for UD links.
@@ -11749,8 +10284,7 @@ main(void)
nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
/* Keep this test last, it's testing files that are used above */
- /* do not do this for files used by external link tests */
- nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0;
+ nerrors += check_all_closed(my_fapl, new_format) < 0 ? 1 : 0;
} /* end for */
/* New group revision feature tests */
@@ -11790,8 +10324,6 @@ main(void)
}
printf("All link tests passed.\n");
h5_cleanup(FILENAME, fapl);
- /* clean up tmp directory created by external link tests */
- HDrmdir(TMPDIR);
}
else
puts("All link tests skipped - Incompatible with current Virtual File Driver");
diff --git a/test/objcopy.c b/test/objcopy.c
index 2196794..5fdbdba 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -273,7 +273,7 @@ error:
H5Sclose(sid_ref);
H5Dclose(did1);
H5Dclose(did2);
- H5Aclose(aid);
+ H5Pclose(aid);
} H5E_END_TRY;
return(-1);
diff --git a/test/tattr.c b/test/tattr.c
index 12350c3..d448397 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -3303,10 +3303,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
- /* Get number of attributes with bad ID */
- ret = H5Aget_num_attrs(-1);
- VERIFY(ret, FAIL, "H5Aget_num_attrs");
-
/* Get number of attributes */
ret = H5Aget_num_attrs(dataset);
VERIFY(ret, 1, "H5Aget_num_attrs");
diff --git a/test/tcoords.c b/test/tcoords.c
index 998a598..ab921d8 100644
--- a/test/tcoords.c
+++ b/test/tcoords.c
@@ -29,31 +29,21 @@
#define FILENAME "coord.h5"
-#define SINGLE_END_DSET "single_end_dset"
-#define MULTI_ENDS_SEL_HYPER_DSET "multiple_ends_dset"
-
-#define NAME_LEN 128
-
-/* Data written to the dataset for single block test. Global variable
- * for convenience. */
-int da_buffer[2][3][6][2];
-
/***********************************************************
**
-** test_singleEnd_selElements(): Test element selection of only
+** test_single_end(): Test full hyperslab selection of only
** one block.
**
*************************************************************/
-static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
+static void test_single_end(hid_t file)
{
hid_t sid, plid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- size_t elmts_numb;
herr_t ret; /* Generic error return */
int i, j, k;
hsize_t da_dims[4] = { 2, 3, 6, 2 };
hsize_t da_chunksize[4] = { 1, 3, 3, 2 };
-
+ int da_buffer[2][3][6][2];
+
/* For testing the full selection in the fastest-growing end */
int mem1_buffer[1][1][6][2];
hsize_t mem1_dims[4] = { 1, 1, 6, 2 };
@@ -83,24 +73,10 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
/* For testing the full selection in the middle dimensions */
int mem3_buffer[1][3][6][1];
hsize_t mem3_dims[4] = { 1, 3, 6, 1 };
- hsize_t da_elmts3[18][4] = { {0, 0, 0, 0},
- {0, 0, 1, 0},
- {0, 0, 2, 0},
- {0, 0, 3, 0},
- {0, 0, 4, 0},
- {0, 0, 5, 0},
- {0, 1, 0, 0},
- {0, 1, 1, 0},
- {0, 1, 2, 0},
- {0, 1, 3, 0},
- {0, 1, 4, 0},
- {0, 1, 5, 0},
- {0, 2, 0, 0},
- {0, 2, 1, 0},
- {0, 2, 2, 0},
- {0, 2, 3, 0},
- {0, 2, 4, 0},
- {0, 2, 5, 0} };
+ hsize_t mem3_start[4] = { 0, 0, 0, 0 };
+ hsize_t mem3_count[4] = { 1, 1, 1, 1 };
+ hsize_t mem3_stride[4] = { 1, 1, 1, 1 };
+ hsize_t mem3_block[4] = { 1, 3, 6, 1 };
/* Create and write the dataset */
sid = H5Screate_simple(4, da_dims, da_dims);
@@ -109,26 +85,17 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
plid = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plid, FAIL, "H5Pcreate");
- if(is_chunked) {
- ret = H5Pset_chunk(plid, 4, da_chunksize);
- CHECK(ret, FAIL, "H5Pset_chunk");
- }
-
- /* Construct dataset's name */
- memset(dset_name, 0, (size_t)NAME_LEN);
- strcat(dset_name, SINGLE_END_DSET);
- if(is_chunked)
- strcat(dset_name, "_chunked");
+ ret = H5Pset_chunk(plid, 4, da_chunksize);
+ CHECK(ret, FAIL, "H5Pset_chunk");
- did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
+ did = H5Dcreate2(file, "single_end", H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
- /* Initialize the data to be written to file */
for(i=0; i<2; i++) {
for(j=0; j<3; j++) {
for(k=0; k<6; k++) {
da_buffer[i][j][k][0] = i*100 + j*10 + k;
- da_buffer[i][j][k][1] = i*100 + j*10 + k + 1;
+ da_buffer[i][j][k][0] = i*100 + j*10 + k + 1;
}
}
}
@@ -142,16 +109,13 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
/* ****** Case 1: ******
* Testing the full selection in the fastest-growing end */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "single_end", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
- elmts_numb = 12;
-
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, elmts_numb, (const hsize_t *)da_elmts1);
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, 12, da_elmts1);
CHECK(ret, FAIL, "H5Sselect_elements");
- /* Dataspace for memory buffer */
msid = H5Screate_simple(4, mem1_dims, mem1_dims);
CHECK(msid, FAIL, "H5Screate_simple");
@@ -170,21 +134,18 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
for(i=0; i<6; i++)
for(j=0; j<2; j++)
if(da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
- TestErrPrintf("%u: Read different values than written at index 0,0,%d,%d\n", __LINE__, i, j);
+ TestErrPrintf("Read different values than written at index 0,0,%d,%d\n", i, j);
}
/* ****** Case 2: ******
* Testing the full selection in the slowest-growing end */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "single_end", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
- elmts_numb = 6;
-
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, elmts_numb, (const hsize_t *)da_elmts2);
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, 6, da_elmts2);
CHECK(ret, FAIL, "H5Sselect_elements");
- /* Dataspace for memory buffer */
msid = H5Screate_simple(4, mem2_dims, mem2_dims);
CHECK(msid, FAIL, "H5Screate_simple");
@@ -203,21 +164,18 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
for(i=0; i<2; i++)
for(j=0; j<3; j++)
if(da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,0, da_buffer = %d, mem2_buffer = %d\n", __LINE__, i, j, da_buffer[i][j][0][0], mem2_buffer[i][j][0][0]);
+ TestErrPrintf("Read different values than written at index %d,%d,0,0\n", i, j);
}
/* ****** Case 3: ******
* Testing the full selection in the middle dimensions */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "single_end", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
- elmts_numb = 18;
-
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, elmts_numb, (const hsize_t *)da_elmts3);
- CHECK(ret, FAIL, "H5Sselect_elements");
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem3_start, mem3_stride, mem3_count, mem3_block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
- /* Dataspace for memory buffer */
msid = H5Screate_simple(4, mem3_dims, mem3_dims);
CHECK(msid, FAIL, "H5Screate_simple");
@@ -236,7 +194,7 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
for(i=0; i<3; i++)
for(j=0; j<6; j++)
if(da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
- TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0\n", __LINE__, i, j);
+ TestErrPrintf("Read different values than written at index 0,%d,%d,0\n", i, j);
}
@@ -247,153 +205,6 @@ static void test_singleEnd_selElements(hid_t file, hbool_t is_chunked)
CHECK(ret, FAIL, "H5Pclose");
}
-/***********************************************************
-**
-** test_singleEnd_selHyperslab(): Test full hyperslab selection
-** of only one block.
-**
-*************************************************************/
-static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
-{
- hid_t sid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
- herr_t ret; /* Generic error return */
- int i, j;
- hsize_t da_dims[4] = { 2, 3, 6, 2 };
-
- /* For testing the full selection in the fastest-growing end */
- int mem1_buffer[1][1][6][2];
- hsize_t mem1_dims[4] = { 1, 1, 6, 2 };
- hsize_t mem1_start[4] = { 0, 0, 0, 0 };
- hsize_t mem1_count[4] = { 1, 1, 1, 1 };
- hsize_t mem1_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem1_block[4] = { 1, 1, 6, 2 };
-
- /* For testing the full selection in the slowest-growing end */
- int mem2_buffer[2][3][1][1];
- hsize_t mem2_dims[4] = { 2, 3, 1, 1 };
- hsize_t mem2_start[4] = { 0, 0, 0, 0 };
- hsize_t mem2_count[4] = { 1, 1, 1, 1 };
- hsize_t mem2_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem2_block[4] = { 2, 3, 1, 1 };
-
- /* For testing the full selection in the middle dimensions */
- int mem3_buffer[1][3][6][1];
- hsize_t mem3_dims[4] = { 1, 3, 6, 1 };
- hsize_t mem3_start[4] = { 0, 0, 0, 0 };
- hsize_t mem3_count[4] = { 1, 1, 1, 1 };
- hsize_t mem3_stride[4] = { 1, 1, 1, 1 };
- hsize_t mem3_block[4] = { 1, 3, 6, 1 };
-
- /* Construct dataset's name */
- memset(dset_name, 0, NAME_LEN);
- strcat(dset_name, SINGLE_END_DSET);
- if(is_chunked)
- strcat(dset_name, "_chunked");
-
- /* Dataspace for the dataset in file */
- sid = H5Screate_simple(4, da_dims, da_dims);
- CHECK(sid, FAIL, "H5Screate_simple");
-
- /* ****** Case 1: ******
- * Testing the full selection in the fastest-growing end */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
- CHECK(did, FAIL, "H5Dopen");
-
- /* Select the elements in the dataset */
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem1_start, mem1_stride, mem1_count, mem1_block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Dataspace for memory buffer */
- msid = H5Screate_simple(4, mem1_dims, mem1_dims);
- CHECK(msid, FAIL, "H5Screate_simple");
-
- ret = H5Sselect_all(msid);
- CHECK(ret, FAIL, "H5Sselect_all");
-
- ret = H5Dread(did, H5T_NATIVE_INT, msid, sid, H5P_DEFAULT, mem1_buffer);
- CHECK(ret, FAIL, "H5Dread");
-
- ret = H5Dclose(did);
- CHECK(ret, FAIL, "H5Dclose");
-
- ret = H5Sclose(msid);
- CHECK(ret, FAIL, "H5Sclose");
-
- for(i=0; i<6; i++)
- for(j=0; j<2; j++)
- if(da_buffer[0][0][i][j] != mem1_buffer[0][0][i][j]) {
- TestErrPrintf("%u: Read different values than written at index 0,0,%d,%d\n", __LINE__, i, j);
- }
-
- /* ****** Case 2: ******
- * Testing the full selection in the slowest-growing end */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
- CHECK(did, FAIL, "H5Dopen");
-
- /* Select the elements in the dataset */
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem2_start, mem2_stride, mem2_count, mem2_block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Dataspace for memory buffer */
- msid = H5Screate_simple(4, mem2_dims, mem2_dims);
- CHECK(msid, FAIL, "H5Screate_simple");
-
- ret = H5Sselect_all(msid);
- CHECK(ret, FAIL, "H5Sselect_all");
-
- ret = H5Dread(did, H5T_NATIVE_INT, msid, sid, H5P_DEFAULT, mem2_buffer);
- CHECK(ret, FAIL, "H5Dread");
-
- ret = H5Dclose(did);
- CHECK(ret, FAIL, "H5Dclose");
-
- ret = H5Sclose(msid);
- CHECK(ret, FAIL, "H5Sclose");
-
- for(i=0; i<2; i++)
- for(j=0; j<3; j++)
- if(da_buffer[i][j][0][0] != mem2_buffer[i][j][0][0]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,0\n", __LINE__, i, j);
- }
-
- /* ****** Case 3: ******
- * Testing the full selection in the middle dimensions */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
- CHECK(did, FAIL, "H5Dopen");
-
- /* Select the elements in the dataset */
- ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, mem3_start, mem3_stride, mem3_count, mem3_block);
- CHECK(ret, FAIL, "H5Sselect_hyperslab");
-
- /* Dataspace for memory buffer */
- msid = H5Screate_simple(4, mem3_dims, mem3_dims);
- CHECK(msid, FAIL, "H5Screate_simple");
-
- ret = H5Sselect_all(msid);
- CHECK(ret, FAIL, "H5Sselect_all");
-
- ret = H5Dread(did, H5T_NATIVE_INT, msid, sid, H5P_DEFAULT, mem3_buffer);
- CHECK(ret, FAIL, "H5Dread");
-
- ret = H5Dclose(did);
- CHECK(ret, FAIL, "H5Dclose");
-
- ret = H5Sclose(msid);
- CHECK(ret, FAIL, "H5Sclose");
-
- for(i=0; i<3; i++)
- for(j=0; j<6; j++)
- if(da_buffer[0][i][j][0] != mem3_buffer[0][i][j][0]) {
- TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0\n", __LINE__, i, j);
- }
-
-
- ret = H5Sclose(sid);
- CHECK(ret, FAIL, "H5Sclose");
-}
-
-
/***********************************************************
**
@@ -401,15 +212,14 @@ static void test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked)
** multiple blocks.
**
*************************************************************/
-static void test_multiple_ends(hid_t file, hbool_t is_chunked)
+static void test_multiple_ends(hid_t file)
{
hid_t sid, plid, did, msid;
- char dset_name[NAME_LEN]; /* Dataset name */
herr_t ret; /* Generic error return */
int i, j, k, l, m, n, p;
hsize_t da_dims[8] = { 4, 5, 3, 4, 2, 3, 6, 2 };
hsize_t da_chunksize[8] = { 1, 5, 3, 2, 2, 3, 3, 2 };
- int data_buf[4][5][3][4][2][3][6][2];
+ int da_buffer[4][5][3][4][2][3][6][2];
/* For testing the full selections in the fastest-growing end and in the middle dimensions */
int mem1_buffer[1][1][1][4][2][1][6][2];
@@ -459,18 +269,10 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
plid = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plid, FAIL, "H5Pcreate");
- if(is_chunked) {
- ret = H5Pset_chunk(plid, 8, da_chunksize);
- CHECK(ret, FAIL, "H5Pset_chunk");
- }
+ ret = H5Pset_chunk(plid, 8, da_chunksize);
+ CHECK(ret, FAIL, "H5Pset_chunk");
- /* Construct dataset's name */
- memset(dset_name, 0, NAME_LEN);
- strcat(dset_name, MULTI_ENDS_SEL_HYPER_DSET);
- if(is_chunked)
- strcat(dset_name, "_chunked");
-
- did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
+ did = H5Dcreate2(file, "multiple_ends", H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
for(i=0; i<4; i++)
@@ -480,11 +282,11 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
for(m=0; m<2; m++)
for(n=0; n<3; n++)
for(p=0; p<6; p++) {
- data_buf[i][j][k][l][m][n][p][0] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p;
- data_buf[i][j][k][l][m][n][p][1] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p + 1;
+ da_buffer[i][j][k][l][m][n][p][0] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p;
+ da_buffer[i][j][k][l][m][n][p][1] = i*1000000 + j*100000 + k*10000 + l*1000 + m*100 + n*10 + p + 1;
}
- ret = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data_buf);
+ ret = H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, da_buffer);
CHECK(ret, FAIL, "H5Dwrite");
ret = H5Dclose(did);
@@ -492,7 +294,7 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
/* ****** Case 1: ******
* Testing the full selections in the fastest-growing end and in the middle dimensions*/
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "multiple_ends", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
@@ -518,13 +320,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
for(j=0; j<2; j++)
for(k=0; k<6; k++)
for(l=0; l<2; l++)
- if(data_buf[0][0][0][i][j][0][k][l] != mem1_buffer[0][0][0][i][j][0][k][l]) {
- TestErrPrintf("%u: Read different values than written at index 0,0,0,%d,%d,0,%d,%d\n", __LINE__, i, j, k, l);
+ if(da_buffer[0][0][0][i][j][0][k][l] != mem1_buffer[0][0][0][i][j][0][k][l]) {
+ TestErrPrintf("Read different values than written at index 0,0,0,%d,%d,0,%d,%d\n", i, j, k, l);
}
/* ****** Case 2: ******
* Testing the full selections in the slowest-growing end and in the middle dimensions*/
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "multiple_ends", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
@@ -550,13 +352,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
for(j=0; j<5; j++)
for(k=0; k<4; k++)
for(l=0; l<2; l++)
- if(data_buf[i][j][0][k][l][0][0][0] != mem2_buffer[i][j][0][k][l][0][0][0]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,0,0\n", __LINE__, i, j, k, l);
+ if(da_buffer[i][j][0][k][l][0][0][0] != mem2_buffer[i][j][0][k][l][0][0][0]) {
+ TestErrPrintf("Read different values than written at index %d,%d,0,%d,%d,0,0,0\n", i, j, k, l);
}
/* ****** Case 3: ******
* Testing two unadjacent full selections in the middle dimensions */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "multiple_ends", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
@@ -582,13 +384,13 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
for(j=0; j<3; j++)
for(k=0; k<3; k++)
for(l=0; l<6; l++)
- if(data_buf[0][i][j][0][0][k][l][0] != mem3_buffer[0][i][j][0][0][k][l][0]) {
- TestErrPrintf("%u: Read different values than written at index 0,%d,%d,0,0,%d,%d,0\n", __LINE__, i, j, k, l);
+ if(da_buffer[0][i][j][0][0][k][l][0] != mem3_buffer[0][i][j][0][0][k][l][0]) {
+ TestErrPrintf("Read different values than written at index 0,%d,%d,0,0,%d,%d,0\n", i, j, k, l);
}
/* ****** Case 4: ******
* Testing the full selections in the fastest-growing end and the slowest-growing end */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "multiple_ends", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
@@ -614,15 +416,15 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
for(j=0; j<5; j++)
for(k=0; k<6; k++)
for(l=0; l<2; l++)
- if(data_buf[i][j][0][0][0][0][k][l] != mem4_buffer[i][j][0][0][0][0][k][l]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,0,0,0,%d,%d\n", __LINE__, i, j, k, l);
+ if(da_buffer[i][j][0][0][0][0][k][l] != mem4_buffer[i][j][0][0][0][0][k][l]) {
+ TestErrPrintf("Read different values than written at index %d,%d,0,0,0,0,%d,%d\n", i, j, k, l);
}
/* ****** Case 5: ******
* Testing the full selections in the fastest-growing end and the slowest-growing end,
* and also in the middle dimensions */
- did = H5Dopen2(file, dset_name, H5P_DEFAULT);
+ did = H5Dopen2(file, "multiple_ends", H5P_DEFAULT);
CHECK(did, FAIL, "H5Dopen");
/* Select the elements in the dataset */
@@ -650,8 +452,8 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
for(l=0; l<2; l++)
for(m=0; m<6; m++)
for(n=0; n<2; n++)
- if(data_buf[i][j][0][k][l][0][m][n] != mem5_buffer[i][j][0][k][l][0][m][n]) {
- TestErrPrintf("%u: Read different values than written at index %d,%d,0,%d,%d,0,%d,%d\n", __LINE__, i, j, k, l, m, n);
+ if(da_buffer[i][j][0][k][l][0][m][n] != mem5_buffer[i][j][0][k][l][0][m][n]) {
+ TestErrPrintf("Read different values than written at index %d,%d,0,%d,%d,0,%d,%d\n", i, j, k, l, m, n);
}
@@ -670,24 +472,14 @@ static void test_multiple_ends(hid_t file, hbool_t is_chunked)
****************************************************************/
void test_coords(void)
{
- hid_t fid;
- int i;
- hbool_t is_chunk;
- herr_t ret; /* Generic error return */
+ hid_t fid;
+ herr_t ret; /* Generic error return */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fcreate");
- for(i=0, is_chunk=FALSE; i<2; i++, is_chunk++) {
- /* Test H5Sselect_elements with selection of one block of data */
- test_singleEnd_selElements(fid, is_chunk);
-
- /* Test H5Sselect_hyperslab with selection of one block of data */
- test_singleEnd_selHyperslab(fid, is_chunk);
-
- /* Test H5Sselect_hyperslab with selection of multiple blocks of data */
- test_multiple_ends(fid, is_chunk);
- }
+ test_single_end(fid);
+ test_multiple_ends(fid);
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
diff --git a/test/th5s.c b/test/th5s.c
index 5bf7845..983838e 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -378,7 +378,7 @@ test_h5s_null(void)
hsize_t coord[1][1]; /* Coordinates for point selection */
coord[0][0]=0;
- ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord);
+ ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)1, coord);
} H5E_END_TRY;
VERIFY(ret, FAIL, "H5Sselect_elements");
@@ -1055,8 +1055,8 @@ test_h5s_chunk(void)
for(i=0; i<50000; i++) {
for(j=0; j<3; j++) {
/* Check if the two values are within 0.001% range. */
- if(!DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001))
- TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, chunk_data_flt[i][j]);
+ if(!DBL_REL_EQUAL(chunk_data_dbl[i][j],chunk_data_flt[i][j], 0.00001))
+ TestErrPrintf("chunk_data_dbl[%d][%d]=%f, chunk_data_flt[%d][%d]=%f\n",i,j,chunk_data_dbl[i][j],i,j,chunk_data_flt[i][j]);
} /* end for */
} /* end for */
} /* test_h5s_chunk() */