summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2020-01-04 04:16:38 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2020-01-04 04:16:38 (GMT)
commit0225e6d59698c9a720177766794619c7ad273f4a (patch)
tree7abfb57ae22f1b886bafb18294054386cdaba134 /test
parent041b14c876cc7466da7868ef563563c879951ad6 (diff)
downloadhdf5-0225e6d59698c9a720177766794619c7ad273f4a.zip
hdf5-0225e6d59698c9a720177766794619c7ad273f4a.tar.gz
hdf5-0225e6d59698c9a720177766794619c7ad273f4a.tar.bz2
Small changes from the token_refactoring branch, to reduce the delta to develop
Diffstat (limited to 'test')
-rw-r--r--test/cork.c86
-rw-r--r--test/dsets.c17
-rw-r--r--test/getname.c8
-rw-r--r--test/links.c385
-rw-r--r--test/mount.c48
-rw-r--r--test/mtime.c10
-rw-r--r--test/null_vol_connector.c148
-rw-r--r--test/objcopy.c47
-rw-r--r--test/objcopy_ref.c61
-rw-r--r--test/ohdr.c11
-rw-r--r--test/titerate.c6
-rw-r--r--test/trefer.c2
-rw-r--r--test/trefer_deprec.c2
-rw-r--r--test/unlink.c4
14 files changed, 476 insertions, 359 deletions
diff --git a/test/cork.c b/test/cork.c
index 06a520d..78b6b01 100644
--- a/test/cork.c
+++ b/test/cork.c
@@ -99,8 +99,9 @@ verify_old_dset_cork(void)
hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
- int buf[100][20]; /* Data buffer */
- int i = 0, j = 0; /* Local index variable */
+ int **buf = NULL; /* Data bufer (pointers to fake 2D array) */
+ int *buf_data = NULL; /* Data buffer (actual data) */
+ int i = 0, j = 0; /* Local index variables */
H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */
hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */
@@ -137,13 +138,21 @@ verify_old_dset_cork(void)
if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < 100; i++)
+ buf[i] = buf_data + (i * 20);
+
/* Initialize data buffer */
for(i = 0; i < (int)dims[0]; i++)
for(j = 0; j < (int)dims[1]; j++)
buf[i][j] = (i + 1) * (j + 1);
/* Write to the dataset: DSET_BT1 */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT1 */
@@ -196,11 +205,6 @@ verify_old_dset_cork(void)
if((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
TEST_ERROR
- /* Initialize data buffer */
- for(i = 0; i < (int)dims[0]; i++)
- for(j = 0; j < (int)dims[1]; j++)
- buf[i][j] = (i + 1) * (j + 1);
-
/* Open and write to the dataset: DSET_BT1 */
if((did = H5Dopen2(fid, DSET_BT1, H5P_DEFAULT)) < 0)
TEST_ERROR
@@ -249,6 +253,9 @@ verify_old_dset_cork(void)
if(H5Fclose(fid) < 0)
TEST_ERROR
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return 0;
@@ -265,6 +272,10 @@ error:
H5Pclose(dcpl3);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(buf);
+ HDfree(buf_data);
+
return 1;
} /* verify_old_dset_cork */
@@ -496,7 +507,9 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
- int buf[100][20]; int i = 0, j = 0; /* Data buffer */
+ int **buf = NULL; /* Data bufer (pointers to fake 2D array) */
+ int *buf_data = NULL; /* Data buffer (actual data) */
+ int i = 0, j = 0; /* Local index variables */
H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */
unsigned flags; /* File access flags */
@@ -630,6 +643,14 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
if((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < 100; i++)
+ buf[i] = buf_data + (i * 20);
+
/* Initialize data buffer */
for(i = 0; i < (int)dims[0]; i++)
for(j = 0; j < (int)dims[1]; j++)
@@ -638,7 +659,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
/* Open and write to the dataset: DSET_EA */
if((did = H5Dopen2(fid, DSET_EA, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_EA */
@@ -648,7 +669,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
/* Open and write to the dataset: DSET_FA */
if((did2 = H5Dopen2(fid, DSET_FA, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Cork the dataset: DSET_FA */
@@ -662,7 +683,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
/* Open and write to the dataset: DSET_BT2 */
if((did3 = H5Dopen2(fid, DSET_BT2, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT2 */
@@ -689,6 +710,9 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
if(H5Fclose(fid) < 0)
TEST_ERROR
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return 0;
@@ -704,6 +728,10 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(buf);
+ HDfree(buf_data);
+
return 1;
} /* verify_dset_cork */
@@ -1826,8 +1854,9 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
hsize_t cdims[RANK] = {2,2}; /* Chunk dimensions */
int fillval = 0; /* Fill value */
int i, j, k = 0; /* Local index variables */
- int data[DIMS0][DIMS1]; /* Data buffer */
- int rbuf[DIMS0][DIMS1]; /* Data buffer */
+ int **wbuf = NULL; /* Data buffer for writes (pointers to fake 2D array) */
+ int *wbuf_data = NULL; /* Data buffer for writes (real data) */
+ int *rbuf_data = NULL; /* Data buffer for reads (real data) */
hbool_t corked; /* Cork status of an object */
unsigned flags; /* File access flags */
@@ -1923,13 +1952,21 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
if(corked)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (wbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (wbuf = (int **)HDcalloc(DIMS0, sizeof(wbuf_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIMS0; i++)
+ wbuf[i] = wbuf_data + (i * DIMS1);
+
/* Initialize the buffer */
for(i = 0; i < DIMS0;i++)
for(j = 0;j < DIMS1;j++)
- data[i][j] = k++;
+ wbuf[i][j] = k++;
/* Write to the dataset */
- if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
TEST_ERROR
/* Flush the dataset */
@@ -1962,8 +1999,12 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
if(corked)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (rbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
+ TEST_ERROR;
+
/* Read from the dataset */
- if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_data) < 0)
TEST_ERROR
/* Cork the dataset */
@@ -1993,7 +2034,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Write to the dataset */
- if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
TEST_ERROR
/* Refresh the dataset */
@@ -2106,6 +2147,10 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
if(H5Pclose(dcpl) < 0)
TEST_ERROR
+ HDfree(wbuf);
+ HDfree(wbuf_data);
+ HDfree(rbuf_data);
+
PASSED();
return 0;
@@ -2121,6 +2166,11 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(wbuf);
+ HDfree(wbuf_data);
+ HDfree(rbuf_data);
+
return 1;
} /* test_dset_cork() */
diff --git a/test/dsets.c b/test/dsets.c
index 26a47f0..b866dfe 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -12776,20 +12776,23 @@ error:
} /* end dls_01_write_data() */
static herr_t
-dls_01_read_stuff( hid_t fid )
+dls_01_read_stuff(hid_t fid)
{
int status = 0;
hid_t did = 0;
H5O_info_t info;
- did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT );
- if ( did <= 0 ) TEST_ERROR
+ did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT);
+ if(did <= 0)
+ TEST_ERROR
- status = H5Oget_info2( did, &info, H5O_INFO_BASIC );
- if ( status != 0 ) TEST_ERROR
+ status = H5Oget_info2(did, &info, H5O_INFO_BASIC );
+ if(status != 0)
+ TEST_ERROR
- status = H5Dclose( did );
- if ( status != 0 ) TEST_ERROR
+ status = H5Dclose(did);
+ if(status != 0)
+ TEST_ERROR
return SUCCEED;
diff --git a/test/getname.c b/test/getname.c
index 873ceb9..399f364 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -2380,7 +2380,7 @@ test_main(hid_t file_id, hid_t fapl)
if((size = H5Iget_name(dtype, NULL, 0)) != 0) TEST_ERROR
/* Create a link to the object */
- if( H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Commit a second datatype with no links to it and commit it */
if((dtype_anon = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
@@ -2405,17 +2405,17 @@ test_main(hid_t file_id, hid_t fapl)
/* Check the H5Iget_name does not return an error for anon committed datatypes */
if((dtype_anon = H5Oopen_by_addr(file2_id, oinfo.addr)) < 0) TEST_ERROR
- if((size = H5Iget_name(dtype_anon,NULL,0)) != 0) TEST_ERROR
+ if((size = H5Iget_name(dtype_anon, NULL, 0)) != 0) TEST_ERROR
if(H5Tclose(dtype_anon) < 0) TEST_ERROR
if(H5Fclose(file2_id) < 0) TEST_ERROR
PASSED();
- return(0);
+ return 0;
error:
- return(1);
+ return 1;
}
static int
diff --git a/test/links.c b/test/links.c
index 5774f97..4dff1cf 100644
--- a/test/links.c
+++ b/test/links.c
@@ -31,10 +31,10 @@
#include "h5test.h"
#include "H5srcdir.h"
-#include "H5FDpkg.h" /* File drivers */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
+#include "H5FDpkg.h" /* File drivers */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
@@ -537,9 +537,9 @@ cklinks(hid_t fapl, hbool_t new_format)
status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs(" H5Lexists() should have failed for a path with missing components.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
} /* end if */
H5E_BEGIN_TRY {
status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
@@ -635,7 +635,7 @@ cklinks(hid_t fapl, hbool_t new_format)
error:
return FAIL;
-}
+} /* end cklinks() */
/*-------------------------------------------------------------------------
@@ -686,11 +686,11 @@ ck_new_links(hid_t fapl, hbool_t new_format)
if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
- return SUCCEED;
+ return 0;
error:
- return FAIL;
-}
+ return -1;
+} /* end ck_new_links() */
/*-------------------------------------------------------------------------
@@ -3456,33 +3456,58 @@ error:
static int
external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
- hsize_t dims[2];
- int points[NUM40][NUM40];
- int i, j, n;
- h5_stat_size_t filesize, new_filesize;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t core_fapl = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t dapl_id = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ char *filename1 = NULL;
+ char *filename2 = NULL;
+ char *tmpname = NULL;
+ char *cwdpath = NULL;
+ hsize_t dims[2];
+ int **points = NULL;
+ int *points_data = NULL;
+ int i, j, n;
+ h5_stat_size_t filesize;
+ h5_stat_size_t new_filesize;
if(new_format)
TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)")
else
TESTING("H5Pset/get_elink_fapl() with same physical layout")
+ /* Set up file names and paths */
+ if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename2 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (points_data = (int *)HDcalloc(NUM40 * NUM40, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (points = (int **)HDcalloc(NUM40, sizeof(points_data))))
+ TEST_ERROR;
+ for (i = 0; i < NUM40; i++)
+ points[i] = points_data + (i * NUM40);
+
/*
* set up name for main file:
* Linux: "/CWD/tmp_links/extlinks0"
* Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
- h5_fixname(tmpname, fapl, filename1, sizeof filename1);
+ h5_fixname(tmpname, fapl, filename1, NAME_BUF_SIZE);
/* create fapl for the target file to be a "core" file */
core_fapl = h5_fileaccess();
@@ -3490,7 +3515,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file: "extlinks17" */
/* set up name for target file: "extlinks17" */
- h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[39], core_fapl, filename2, NAME_BUF_SIZE);
/* Create the target file to be a "core" file */
if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR
@@ -3505,7 +3530,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
else
dcpl = H5Pcopy(dcpl_g);
- if (0 > dcpl) TEST_ERROR;
+ if (0 > dcpl)
+ TEST_ERROR;
if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR;
/* create "Dataset" in group "A" of target file */
@@ -3548,7 +3574,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
points[i][j] = n++;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) TEST_ERROR
if(H5Pclose(dapl_id) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -3561,6 +3587,14 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if(H5Pclose(core_fapl) < 0) TEST_ERROR
+ HDfree(points);
+ HDfree(points_data);
+
+ HDfree(filename1);
+ HDfree(filename2);
+ HDfree(tmpname);
+ HDfree(cwdpath);
+
PASSED();
return SUCCEED;
@@ -3575,6 +3609,15 @@ error:
H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(points);
+ HDfree(points_data);
+
+ HDfree(filename1);
+ HDfree(filename2);
+ HDfree(tmpname);
+ HDfree(cwdpath);
+
return FAIL;
} /* end external_set_elink_fapl2() */
@@ -6059,19 +6102,26 @@ static int
external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
#ifdef H5_HAVE_SYMLINK
- hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1;
- hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1;
- char filename1[NAME_BUF_SIZE],
- filename2a[NAME_BUF_SIZE],
- filename2b[NAME_BUF_SIZE],
- filename3a[NAME_BUF_SIZE],
- filename3b[NAME_BUF_SIZE],
- filename4a[NAME_BUF_SIZE],
- filename4b[NAME_BUF_SIZE],
- filename5a[NAME_BUF_SIZE],
- filename5b[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t file1 = H5I_INVALID_HID;
+ hid_t file2 = H5I_INVALID_HID;
+ hid_t file3 = H5I_INVALID_HID;
+ hid_t file4 = H5I_INVALID_HID;
+ hid_t file5 = H5I_INVALID_HID;
+ hid_t group2 = H5I_INVALID_HID;
+ hid_t group3 = H5I_INVALID_HID;
+ hid_t group4 = H5I_INVALID_HID;
+ hid_t group5 = H5I_INVALID_HID;
+ char *filename1 = NULL;
+ char *filename2a = NULL;
+ char *filename2b = NULL;
+ char *filename3a = NULL;
+ char *filename3b = NULL;
+ char *filename4a = NULL;
+ char *filename4b = NULL;
+ char *filename5a = NULL;
+ char *filename5b = NULL;
+ char *tmpname = NULL;
+ char *cwdpath = NULL;
hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */
#endif /* H5_HAVE_SYMLINK */
@@ -6087,144 +6137,179 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2")
|| !HDstrcmp(env_h5_drvr, "core")
|| !HDstrcmp(env_h5_drvr, "nomatch"));
- if(have_posix_compat_vfd) {
- /* set up name for main file: "extlinks21A" */
- h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1));
+ if(!have_posix_compat_vfd) {
+ SKIPPED();
+ HDputs(" Current VFD doesn't support POSIX I/O calls");
+ return SUCCEED;
+ }
- /* create tmp_links directory and get current working directory path */
- if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
- if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
- TEST_ERROR
+ if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename2a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename2b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename3a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename3b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename4a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename4b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename5a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename5b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+
+ /* set up name for main file: "extlinks21A" */
+ h5_fixname(FILENAME[45], fapl, filename1, NAME_BUF_SIZE);
+
+ /* create tmp_links directory and get current working directory path */
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
+ if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ TEST_ERROR
- /* Set up names for files in the subdirectories */
+ /* Set up names for files in the subdirectories */
- /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */
- h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a));
- fix_ext_filename(tmpname, cwdpath, FILENAME[46]);
- h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b));
+ /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */
+ h5_fixname(FILENAME[46], fapl, filename2a, NAME_BUF_SIZE);
+ fix_ext_filename(tmpname, cwdpath, FILENAME[46]);
+ h5_fixname(tmpname, fapl, filename2b, NAME_BUF_SIZE);
- /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */
- /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */
- if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR
+ /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */
+ /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */
+ if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */
- h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a));
- h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b));
+ /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */
+ h5_fixname(FILENAME[47], fapl, filename3a, NAME_BUF_SIZE);
+ h5_fixname(FILENAME[48], fapl, filename3b, NAME_BUF_SIZE);
- /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */
- h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a));
- fix_ext_filename(tmpname, cwdpath, FILENAME[49]);
- h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b));
+ /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */
+ h5_fixname(FILENAME[49], fapl, filename4a, NAME_BUF_SIZE);
+ fix_ext_filename(tmpname, cwdpath, FILENAME[49]);
+ h5_fixname(tmpname, fapl, filename4b, NAME_BUF_SIZE);
- /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */
- /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */
- if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR
+ /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */
+ /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */
+ if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */
- h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a));
- h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b));
+ /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */
+ h5_fixname(FILENAME[50], fapl, filename5a, NAME_BUF_SIZE);
+ h5_fixname(FILENAME[51], fapl, filename5b, NAME_BUF_SIZE);
- /* Create file #1 in current directory */
- if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create file #1 in current directory */
+ if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create external link to file & object in temporary directory #2, using symlink #1 name */
- if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create external link to file & object in temporary directory #2, using symlink #1 name */
+ if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Close file #1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ /* Close file #1 */
+ if(H5Fclose(file1) < 0) TEST_ERROR
+
+ /* Create file #2 in tmp_links directory #2 */
+ if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if(H5Fclose(file2) < 0) TEST_ERROR
- /* Create file #2 in tmp_links directory #2 */
- if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(H5Fclose(file2) < 0) TEST_ERROR
+ /* Re-open file #2 in tmp_links directory through symlink */
+ if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- /* Re-open file #2 in tmp_links directory through symlink */
- if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Create group in file #2 in temporary directory */
+ if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Create group in file #2 in temporary directory */
- if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create external link to file #3 & object in temporary directory #2 */
+ if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Create external link to file #3 & object in temporary directory #2 */
- if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Close group in file #2 */
+ if(H5Gclose(group2) < 0) TEST_ERROR
- /* Close group in file #2 */
- if(H5Gclose(group2) < 0) TEST_ERROR
+ /* Close file #2 */
+ if(H5Fclose(file2) < 0) TEST_ERROR
- /* Close file #2 */
- if(H5Fclose(file2) < 0) TEST_ERROR
+ /* Create file #3 in temp. directory #2 */
+ if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create file #3 in temp. directory #2 */
- if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create group in file #3 */
+ if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Create group in file #3 */
- if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create external link to file & object in temporary directory #1, using symlink #2 name */
+ if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Create external link to file & object in temporary directory #1, using symlink #2 name */
- if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Close group in file #3 */
+ if(H5Gclose(group3) < 0) TEST_ERROR
- /* Close group in file #3 */
- if(H5Gclose(group3) < 0) TEST_ERROR
+ /* Close file #3 */
+ if(H5Fclose(file3) < 0) TEST_ERROR
- /* Close file #3 */
- if(H5Fclose(file3) < 0) TEST_ERROR
+ /* Create file #4 in temporary directory #1 */
+ if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create file #4 in temporary directory #1 */
- if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create group in file #4 in 'temporary' directory */
+ if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Create group in file #4 in 'temporary' directory */
- if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create external link to file #5 & object in temporary directory #1 */
+ if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Create external link to file #5 & object in temporary directory #1 */
- if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Close group in file #4 */
+ if(H5Gclose(group4) < 0) TEST_ERROR
- /* Close group in file #4 */
- if(H5Gclose(group4) < 0) TEST_ERROR
+ /* Close file #4 */
+ if(H5Fclose(file4) < 0) TEST_ERROR
- /* Close file #4 */
- if(H5Fclose(file4) < 0) TEST_ERROR
+ /* Create file #5 in temporary directory #1 */
+ if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create file #5 in temporary directory #1 */
- if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Create group in file #5 in 'temporary' directory #1 */
+ if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group5) < 0) TEST_ERROR
- /* Create group in file #5 in 'temporary' directory #1 */
- if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group5) < 0) TEST_ERROR
+ /* Close file #5 */
+ if(H5Fclose(file5) < 0) TEST_ERROR
- /* Close file #5 */
- if(H5Fclose(file5) < 0) TEST_ERROR
+ /* Actual tests... */
- /* Actual tests... */
+ /* Reopen file #1 */
+ if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- /* Reopen file #1 */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Open group in file #2, through external link w/symlink */
+ if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group2) < 0) TEST_ERROR
- /* Open group in file #2, through external link w/symlink */
- if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2) < 0) TEST_ERROR
+ /* Open group in file #3, through external link w/symlink to external link */
+ if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group3) < 0) TEST_ERROR
- /* Open group in file #3, through external link w/symlink to external link */
- if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3) < 0) TEST_ERROR
+ /* Open group in file #4, through external link w/symlink to external link w/symlink */
+ if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group4) < 0) TEST_ERROR
- /* Open group in file #4, through external link w/symlink to external link w/symlink */
- if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4) < 0) TEST_ERROR
+ /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */
+ if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group5) < 0) TEST_ERROR
- /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */
- if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5) < 0) TEST_ERROR
+ /* Close file #1 */
+ if(H5Fclose(file1) < 0) TEST_ERROR
- /* Close file #1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ HDfree(filename1);
+ HDfree(filename2a);
+ HDfree(filename2b);
+ HDfree(filename3a);
+ HDfree(filename3b);
+ HDfree(filename4a);
+ HDfree(filename4b);
+ HDfree(filename5a);
+ HDfree(filename5b);
+ HDfree(tmpname);
+ HDfree(cwdpath);
- PASSED();
- } /* end if */
- else {
- SKIPPED();
- HDputs(" Current VFD doesn't support POSIX I/O calls");
- } /* end else */
+ PASSED();
return SUCCEED;
@@ -6240,7 +6325,21 @@ error:
H5Fclose(file2);
H5Fclose(file1);
} H5E_END_TRY;
+
+ HDfree(filename1);
+ HDfree(filename2a);
+ HDfree(filename2b);
+ HDfree(filename3a);
+ HDfree(filename3b);
+ HDfree(filename4a);
+ HDfree(filename4b);
+ HDfree(filename5a);
+ HDfree(filename5b);
+ HDfree(tmpname);
+ HDfree(cwdpath);
+
return FAIL;
+
#else /* H5_HAVE_SYMLINK */
SKIPPED();
HDputs(" Current file system or operating system doesn't support symbolic links");
@@ -7081,7 +7180,7 @@ UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const voi
addr = *((const haddr_t *)udata);
/* Open the object this link points to */
- target_obj= H5Oopen_by_addr(loc_group, addr);
+ target_obj = H5Oopen_by_addr(loc_group, addr);
if(target_obj < 0) {
ret_value = -1;
goto done;
@@ -7173,7 +7272,7 @@ UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *ud
addr = *((const haddr_t *) udata);
/* Open the object this link points to */
- target_obj= H5Oopen_by_addr(file, addr);
+ target_obj = H5Oopen_by_addr(file, addr);
if(target_obj < 0) {
ret_value = -1;
goto done;
@@ -7371,7 +7470,7 @@ error:
* Failure: -1
*-------------------------------------------------------------------------
*/
- /* A traversal function that ignores any udata and simply opens an object
+/* A traversal function that ignores any udata and simply opens an object
* in the current group named REREG_TARGET_NAME
*/
static hid_t
@@ -7723,7 +7822,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
/* Query the link to test its query callback */
- if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.val_size != 16) TEST_ERROR
if (UD_CB_TYPE != li.type) {
H5_FAILED();
diff --git a/test/mount.c b/test/mount.c
index b7d2858..72973ad 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -404,38 +404,41 @@ test_hide(hid_t fapl)
char filename1[1024], filename2[1024];
TESTING("name hiding under mount point");
- h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1));
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2));
if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get information about file1:/mnt1/file1 for later */
- if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Build the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Original names under file1:/mnt1 should not be accessible */
H5E_BEGIN_TRY {
- grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
+ grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
} H5E_END_TRY;
if(grp >= 0) {
- H5_FAILED();
- HDputs(" Name is still accessible under mount point.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Name is still accessible under mount point.");
+ TEST_ERROR
} /* end if */
/*
* The original objects under file1:/mnt1 are still accessible by their
* other names. This is a rather stupid test but demonstrates a point.
*/
- if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
- H5_FAILED();
- HDputs(" Hard link failed for hidden object.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Hard link failed for hidden object.");
+ TEST_ERROR
} /* end if */
/* Unmount and close objects */
@@ -448,9 +451,9 @@ test_hide(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Fclose(file1);
- H5Fclose(file2);
+ H5Gclose(grp);
+ H5Fclose(file1);
+ H5Fclose(file2);
} H5E_END_TRY;
return 1;
} /* end test_hide() */
@@ -490,20 +493,23 @@ test_assoc(hid_t fapl)
FAIL_STACK_ERROR
/* Get information about the root of file2 */
- if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
/* Create the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/*
* Get info about the mount point -- should be the same as the root group
* of file2.
*/
- if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
H5_FAILED();
- HDputs(" Association failed.");
+ HDputs(" Association failed.");
TEST_ERROR
} /* end if */
@@ -517,8 +523,8 @@ test_assoc(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Fclose(file2);
- H5Fclose(file1);
+ H5Fclose(file2);
+ H5Fclose(file1);
} H5E_END_TRY;
return 1;
} /* end test_assoc() */
diff --git a/test/mtime.c b/test/mtime.c
index f7a441d..06f576b 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -39,9 +39,7 @@ const char *FILENAME[] = {
*
* Purpose: H5O_mtime_decode() test.
*
- * Return: Success:
- *
- * Failure:
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Robb Matzke
* Thursday, July 30, 1998
@@ -188,10 +186,10 @@ main(void)
/* All looks good */
HDputs("All modification time tests passed.");
h5_cleanup(FILENAME, fapl);
- return 0;
+ return EXIT_SUCCESS;
/* Something broke */
error:
- return 1;
-}
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index 884bc65..985b576 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -28,105 +28,105 @@
/* The VOL class struct */
static const H5VL_class_t null_vol_g = {
- 0, /* version */
- NULL_VOL_CONNECTOR_VALUE, /* value */
- NULL_VOL_CONNECTOR_NAME, /* name */
+ 0, /* version */
+ NULL_VOL_CONNECTOR_VALUE, /* value */
+ NULL_VOL_CONNECTOR_NAME, /* name */
0, /* capability flags */
- NULL, /* initialize */
- NULL, /* terminate */
+ NULL, /* initialize */
+ NULL, /* terminate */
{ /* info_cls */
- (size_t)0, /* size */
- NULL, /* copy */
- NULL, /* compare */
- NULL, /* free */
- NULL, /* to_str */
- NULL, /* from_str */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
},
{ /* wrap_cls */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* unwrap_object */
- NULL, /* free_wrap_ctx */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
},
{ /* attribute_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* dataset_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* datatype_cls */
- NULL, /* commit */
- NULL, /* open */
- NULL, /* get_size */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* commit */
+ NULL, /* open */
+ NULL, /* get_size */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* file_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* group_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* link_cls */
- NULL, /* create */
- NULL, /* copy */
- NULL, /* move */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ NULL, /* create */
+ NULL, /* copy */
+ NULL, /* move */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
{ /* object_cls */
- NULL, /* open */
- NULL, /* copy */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ NULL, /* open */
+ NULL, /* copy */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
{ /* introspect_cls */
- NULL, /* get_conn_cls */
- NULL, /* opt_query */
+ NULL, /* get_conn_cls */
+ NULL, /* opt_query */
},
{ /* request_cls */
- NULL, /* wait */
- NULL, /* notify */
- NULL, /* cancel */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* free */
+ NULL, /* wait */
+ NULL, /* notify */
+ NULL, /* cancel */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* free */
},
{ /* blob_cls */
- NULL, /* put */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ NULL, /* put */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
- NULL /* optional */
+ NULL /* optional */
};
/* These two functions are necessary to load this plugin using
diff --git a/test/objcopy.c b/test/objcopy.c
index 751fe72..cabdbfd 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -157,6 +157,7 @@ const char *FILENAME[] = {
#define NUM_SUB_GROUPS 20
#define NUM_WIDE_LOOP_GROUPS 10
#define NUM_DATASETS 10
+#define ATTR_CMPD_STRING "ThisIsAString"
char src_obj_full_name[215]; /* the full path + name of the object to be copied */
@@ -194,9 +195,9 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2);
*
* Purpose: Add an address to the table.
*
- * Return: void
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
@@ -228,11 +229,10 @@ addr_insert(H5O_info_t *oi)
*
* Purpose: Check if address has already been encountered
*
- * Return: Success: TRUE/FALSE
- *
- * Failure: (can't fail)
+ * Return: Success: TRUE/FALSE
+ * Failure: (can't fail)
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
@@ -257,9 +257,9 @@ addr_lookup(H5O_info_t *oi)
*
* Purpose: Reset the address tracking data structures
*
- * Return: void
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
@@ -5784,7 +5784,8 @@ attach_attribute_compound_vlstr(hid_t loc_id)
int i;
char *v;
} s1;
- s1 buf; /* Buffer */
+ size_t len;
+ s1 buf = {0, NULL}; /* Buffer */
int ret_value = -1; /* Return value */
/* Create dataspace */
@@ -5814,8 +5815,11 @@ attach_attribute_compound_vlstr(hid_t loc_id)
goto done;
/* Write to the attribute */
+ len = HDstrlen(ATTR_CMPD_STRING) + 1;
buf.i = 9;
- buf.v = "ThisIsAString";
+ if(NULL == (buf.v = (char *)HDcalloc(len, sizeof(char))))
+ goto done;
+ HDstrncpy(buf.v, ATTR_CMPD_STRING, len);
if(H5Awrite(aid, cmpd_tid, &buf) < 0)
goto done;
@@ -5832,6 +5836,9 @@ done:
H5Tclose(cmpd_tid);
if(aid > 0)
H5Aclose(aid);
+
+ HDfree(buf.v);
+
return ret_value;
} /* attach_attribute_compound_vlstr */
@@ -11464,8 +11471,8 @@ error:
H5Tclose(f_tid);
H5Tclose(g_tid);
H5Tclose(anon_tid);
- H5Pclose(ocpypl_id);
- H5Aclose(aid);
+ H5Pclose(ocpypl_id);
+ H5Aclose(aid);
H5Dclose(did);
H5Sclose(sid);
H5Gclose(gid);
@@ -11704,14 +11711,14 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
error:
H5E_BEGIN_TRY {
- H5Pclose(ocpypl_id);
- H5Tclose(tid);
- H5Tclose(tid1);
- H5Tclose(tid2);
- H5Tclose(tid3);
- H5Tclose(tid4);
- H5Tclose(tid5);
- H5Aclose(aid);
+ H5Pclose(ocpypl_id);
+ H5Tclose(tid);
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+ H5Tclose(tid3);
+ H5Tclose(tid4);
+ H5Tclose(tid5);
+ H5Aclose(aid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c
index b539b8a..4637f23 100644
--- a/test/objcopy_ref.c
+++ b/test/objcopy_ref.c
@@ -44,53 +44,15 @@ const char *FILENAME[] = {
#define CONFIG_DENSE 16
#define MAX_CONFIGURATION 31
-#define NAME_DATATYPE_SIMPLE "H5T_NATIVE_INT"
-#define NAME_DATATYPE_SIMPLE2 "H5T_NATIVE_INT-2"
-#define NAME_DATATYPE_VL "vlen of int"
-#define NAME_DATATYPE_VL_VL "vlen of vlen of int"
#define NAME_DATASET_SIMPLE "dataset_simple"
-#define NAME_DATASET_SIMPLE2 "dataset_simple_copy"
-#define NAME_DATASET_SIMPLE3 "dataset_simple_another_copy"
-#define NAME_DATASET_COMPOUND "dataset_compound"
-#define NAME_DATASET_CHUNKED "dataset_chunked"
-#define NAME_DATASET_CHUNKED_SINGLE "dataset_chunked_single"
-#define NAME_DATASET_CHUNKED2 "dataset_chunked2"
-#define NAME_DATASET_CHUNKED2_SINGLE "dataset_chunked2_single"
-#define NAME_DATASET_CHUNKED3 "dataset_chunked3"
-#define NAME_DATASET_CHUNKED3_SINGLE "dataset_chunked3_single"
-#define NAME_DATASET_CHUNKED4 "dataset_chunked4"
-#define NAME_DATASET_CHUNKED4_SINGLE "dataset_chunked4_single"
-#define NAME_DATASET_COMPACT "dataset_compact"
-#define NAME_DATASET_EXTERNAL "dataset_ext"
-#define NAME_DATASET_NAMED_DTYPE "dataset_named_dtype"
-#define NAME_DATASET_NAMED_DTYPE2 "dataset_named_dtype2"
-#define NAME_DATASET_MULTI_OHDR "dataset_multi_ohdr"
-#define NAME_DATASET_MULTI_OHDR2 "dataset_multi_ohdr2"
-#define NAME_DATASET_VL "dataset_vl"
-#define NAME_DATASET_VL2 "dataset_vl2"
-#define NAME_DATASET_VL_VL "dataset_vl_vl"
-#define NAME_DATASET_VL_VL2 "dataset_vl_vl2"
-#define NAME_DATASET_CMPD_VL "dataset_cmpd_vl"
#define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple"
#define NAME_GROUP_UNCOPIED "/uncopied"
-#define NAME_GROUP_EMPTY "/empty"
#define NAME_GROUP_TOP "/g0"
-#define NAME_GROUP_TOP2 "/g1"
-#define NAME_GROUP_TOP3 "/g2"
-#define NAME_GROUP_TOP4 "/g3"
#define NAME_GROUP_SUB "/g0/g00"
-#define NAME_GROUP_SUB_2 "/g0/g01"
-#define NAME_GROUP_SUB_SUB "/g0/g00/g000"
#define NAME_GROUP_SUB_SUB2 "g000"
-#define NAME_GROUP_DATASET "/g0/dataset_simple"
#define NAME_GROUP_LINK "/g_links"
#define NAME_GROUP_LINK2 "/g_links2"
-#define NAME_GROUP_LOOP "g_loop"
-#define NAME_GROUP_LOOP2 "g_loop2"
-#define NAME_GROUP_LOOP3 "g_loop3"
#define NAME_GROUP_REF "ref_grp"
-#define NAME_LINK_DATASET "/g_links/dataset_simple"
-#define NAME_LINK_HARD "/g_links/hard_link_to_dataset_simple"
#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
#define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple"
#define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple"
@@ -99,19 +61,11 @@ const char *FILENAME[] = {
#define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere"
#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
-#define NAME_OLD_FORMAT "/dset1"
#define NAME_BUF_SIZE 1024
#define ATTR_NAME_LEN 80
#define DIM_SIZE_1 12
#define DIM_SIZE_2 6
-#define MAX_DIM_SIZE_1 100
-#define MAX_DIM_SIZE_2 80
-#define CHUNK_SIZE_1 5 /* Not an even fraction of dimension sizes, so we test copying partial chunks */
-#define CHUNK_SIZE_2 5
-#define NUM_SUB_GROUPS 20
-#define NUM_WIDE_LOOP_GROUPS 10
-#define NUM_DATASETS 10
unsigned num_attributes_g; /* Number of attributes created */
@@ -137,9 +91,9 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
*
* Purpose: Add an address to the table.
*
- * Return: void
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
@@ -171,11 +125,10 @@ addr_insert(H5O_info_t *oi)
*
* Purpose: Check if address has already been encountered
*
- * Return: Success: TRUE/FALSE
- *
- * Failure: (can't fail)
+ * Return: Success: TRUE/FALSE
+ * Failure: (can't fail)
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
@@ -200,9 +153,9 @@ addr_lookup(H5O_info_t *oi)
*
* Purpose: Reset the address tracking data structures
*
- * Return: void
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
diff --git a/test/ohdr.c b/test/ohdr.c
index 9d2d414..53d2f59 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -50,7 +50,8 @@ const char *FILENAME[] = {
* To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild
* the library and simply compile gen_bogus.c with that HDF5 library and run it.
*/
-#define FILE_BOGUS "tbogus.h5"
+#define FILE_BOGUS "tbogus.h5"
+#define TESTFILE_LEN 256
/* */
#define FILE_OHDR_SWMR "ohdr_swmr.h5"
@@ -473,13 +474,13 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
hid_t fid_bogus = -1; /* bogus file ID */
hid_t gid_bogus = -1; /* bogus group ID */
hid_t loc_bogus = -1; /* location: bogus file or group ID */
- char testfile[256];
+ char testfile[TESTFILE_LEN];
/* create a different name for a local copy of the data file to be
opened with rd/wr file permissions in case build and test are
done in the source directory. */
- HDstrncpy(testfile, FILE_BOGUS, HDstrlen(FILE_BOGUS));
- testfile[HDstrlen(FILE_BOGUS)]='\0';
+ HDstrncpy(testfile, FILE_BOGUS, TESTFILE_LEN);
+ testfile[TESTFILE_LEN - 1]='\0';
HDstrncat(testfile, ".copy", 5);
/* Make a copy of the data file from svn. */
@@ -759,7 +760,7 @@ count_attributes(hid_t dset_id)
{
H5O_info_t info;
- if(H5Oget_info2(dset_id, &info, H5O_INFO_ALL) < 0)
+ if(H5Oget_info2(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0)
return -1;
else
return (int)info.num_attrs; /* should never exceed int bounds */
diff --git a/test/titerate.c b/test/titerate.c
index 289a46c..669a094 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -1045,10 +1045,10 @@ test_iterate(void)
/* These next tests use the same file */
for(new_format = FALSE; new_format <= TRUE; new_format++) {
test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */
- test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
+ test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */
- test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
- test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
+ test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
+ test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
} /* end for */
/* Test the fix for issue HDFFV-10588 */
diff --git a/test/trefer.c b/test/trefer.c
index 04b34eb..dec049e 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -568,7 +568,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
hsize_t high[SPACE2_RANK]; /* Selection bounds */
H5R_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
- H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */
+ H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c
index 272b866..6322894 100644
--- a/test/trefer_deprec.c
+++ b/test/trefer_deprec.c
@@ -517,7 +517,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
hsize_t high[SPACE2_RANK]; /* Selection bounds */
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
- hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */
+ hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */
uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
*drbuf; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
diff --git a/test/unlink.c b/test/unlink.c
index 6825dec..5199dcf 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -441,7 +441,7 @@ check_new_move(hid_t fapl)
TESTING("check new move function");
/* Open file */
- h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
@@ -458,7 +458,7 @@ check_new_move(hid_t fapl)
FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.")
/* Check soft links */
- if(H5Lget_val(file, "group2/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file, "group2/soft", linkval, sizeof(linkval), H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
if(HDstrcmp(linkval, "/group1/group_move"))
FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value")