summaryrefslogtreecommitdiffstats
path: root/test/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/mount.c')
-rw-r--r--test/mount.c327
1 files changed, 170 insertions, 157 deletions
diff --git a/test/mount.c b/test/mount.c
index e418b25..bc619b1 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -41,7 +41,7 @@ static int bm[NX][NY]; /* Data buffers */
static int
setup(hid_t fapl)
{
- hid_t file = -1;
+ hid_t file = H5I_INVALID_HID;
char filename[1024];
/* file 1 */
@@ -111,7 +111,7 @@ error:
static int
test_basic(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
char filename1[1024], filename2[1024];
TESTING("basic functionality");
@@ -162,7 +162,8 @@ error:
static int
test_illegal(hid_t fapl)
{
- hid_t file1 = -1, file1b = -1, file2 = -1, file3 = -1, file3b = -1, mnt = -1;
+ hid_t file1 = H5I_INVALID_HID, file1b = H5I_INVALID_HID, file2 = H5I_INVALID_HID, file3 = H5I_INVALID_HID,
+ file3b = H5I_INVALID_HID, mnt = H5I_INVALID_HID;
char filename1[1024], filename2[1024], filename3[1024];
herr_t status;
@@ -189,7 +190,7 @@ test_illegal(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Mounting a file on itself should have failed.");
+ puts(" Mounting a file on itself should have failed.");
TEST_ERROR;
} /* end if */
@@ -209,7 +210,7 @@ test_illegal(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Mounting two files at one mount point should have failed.");
+ puts(" Mounting two files at one mount point should have failed.");
TEST_ERROR;
} /* end if */
if (H5Funmount(mnt, ".") < 0)
@@ -234,7 +235,7 @@ test_illegal(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Mounting same file opened twice at one mount point should have failed.");
+ puts(" Mounting same file opened twice at one mount point should have failed.");
TEST_ERROR;
} /* end if */
if (H5Funmount(mnt, ".") < 0)
@@ -252,7 +253,7 @@ test_illegal(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Creating a cycle with mount points should have failed.");
+ puts(" Creating a cycle with mount points should have failed.");
TEST_ERROR;
} /* end if */
if (H5Funmount(file1, "/mnt1") < 0)
@@ -301,8 +302,9 @@ error:
static int
test_samefile(hid_t fapl)
{
- hid_t file1a = -1, file1b = -1, file2 = -1, file3 = -1;
- hid_t mnt1a = -1, mnt1b = -1;
+ hid_t file1a = H5I_INVALID_HID, file1b = H5I_INVALID_HID, file2 = H5I_INVALID_HID,
+ file3 = H5I_INVALID_HID;
+ hid_t mnt1a = H5I_INVALID_HID, mnt1b = H5I_INVALID_HID;
char filename1[1024], filename2[1024], filename3[1024];
H5G_info_t grp_info;
herr_t status;
@@ -443,10 +445,10 @@ error:
static int
test_hide(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
H5O_info2_t oi1, oi2;
char filename1[1024], filename2[1024];
- hbool_t same_obj;
+ bool same_obj;
TESTING("name hiding under mount point");
h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1));
@@ -472,7 +474,7 @@ test_hide(hid_t fapl)
H5E_END_TRY
if (grp >= 0) {
H5_FAILED();
- HDputs(" Name is still accessible under mount point.");
+ puts(" Name is still accessible under mount point.");
TEST_ERROR;
}
@@ -483,21 +485,21 @@ test_hide(hid_t fapl)
if (H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- same_obj = TRUE;
+ same_obj = true;
if (oi1.fileno == oi2.fileno) {
int token_cmp;
if (H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
FAIL_STACK_ERROR;
if (token_cmp)
- same_obj = FALSE;
+ same_obj = false;
}
else
- same_obj = FALSE;
+ same_obj = false;
if (!same_obj) {
H5_FAILED();
- HDputs(" Hard link failed for hidden object.");
+ puts(" Hard link failed for hidden object.");
TEST_ERROR;
}
@@ -538,10 +540,10 @@ error:
static int
test_assoc(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
H5O_info2_t oi1, oi2;
char filename1[1024], filename2[1024];
- hbool_t same_obj;
+ bool same_obj;
TESTING("mount point open");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
@@ -567,21 +569,21 @@ test_assoc(hid_t fapl)
if (H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- same_obj = TRUE;
+ same_obj = true;
if (oi1.fileno == oi2.fileno) {
int token_cmp;
if (H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
FAIL_STACK_ERROR;
if (token_cmp)
- same_obj = FALSE;
+ same_obj = false;
}
else
- same_obj = FALSE;
+ same_obj = false;
if (!same_obj) {
H5_FAILED();
- HDputs(" Association failed.");
+ puts(" Association failed.");
TEST_ERROR;
} /* end if */
@@ -622,7 +624,7 @@ error:
static int
test_mntlnk(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
char filename1[1024], filename2[1024];
TESTING("multi-linked mount point");
@@ -687,7 +689,7 @@ error:
static int
test_move(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
herr_t status;
char filename1[1024], filename2[1024];
@@ -712,7 +714,7 @@ test_move(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Moving an object across files shouldn't have been possible");
+ puts(" Moving an object across files shouldn't have been possible");
TEST_ERROR;
} /* end if */
@@ -752,7 +754,7 @@ error:
static int
test_preopen(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
@@ -817,7 +819,7 @@ static int
test_postopen(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, grp = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
@@ -886,7 +888,7 @@ error:
static int
test_unlink(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1, mnt = -1, root = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, mnt = H5I_INVALID_HID, root = H5I_INVALID_HID;
H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
herr_t status;
@@ -933,7 +935,7 @@ test_unlink(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Incorrect traversal from mount point!");
+ puts(" Incorrect traversal from mount point!");
TEST_ERROR;
} /* end if */
@@ -954,7 +956,7 @@ test_unlink(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Traversal through mount point should not have worked!");
+ puts(" Traversal through mount point should not have worked!");
TEST_ERROR;
} /* end if */
H5E_BEGIN_TRY
@@ -964,7 +966,7 @@ test_unlink(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Traversal through mount point should not have worked!");
+ puts(" Traversal through mount point should not have worked!");
TEST_ERROR;
} /* end if */
@@ -1035,7 +1037,7 @@ error:
static int
test_mvmpt(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
@@ -1093,9 +1095,9 @@ error:
static int
test_interlink(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
#ifdef NOT_NOW
- hid_t type = -1, space = -1, dset = -1;
+ hid_t type = H5I_INVALID_HID, space = H5I_INVALID_HID, dset = H5I_INVALID_HID;
hsize_t cur_dims[1] = {2};
#endif /* NOT_NOW */
char filename1[1024], filename2[1024];
@@ -1120,7 +1122,7 @@ test_interlink(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Interfile hard link should not have been allowed!");
+ puts(" Interfile hard link should not have been allowed!");
TEST_ERROR;
} /* end if */
@@ -1132,7 +1134,7 @@ test_interlink(hid_t fapl)
H5E_END_TRY
if (status >= 0) {
H5_FAILED();
- HDputs(" Interfile renaming should not have been allowed!");
+ puts(" Interfile renaming should not have been allowed!");
TEST_ERROR;
} /* end if */
@@ -1155,7 +1157,7 @@ test_interlink(hid_t fapl)
H5E_END_TRY
if (dset >= 0) {
H5_FAILED();
- HDputs(" Dataset and shared type must be in the same file!");
+ puts(" Dataset and shared type must be in the same file!");
TEST_ERROR;
} /* end if */
@@ -1166,7 +1168,7 @@ test_interlink(hid_t fapl)
FAIL_STACK_ERROR;
#else /* NOT_NOW */
SKIPPED();
- HDputs(" Test skipped due file pointer sharing issue (Jira 7638).");
+ puts(" Test skipped due file pointer sharing issue (Jira 7638).");
#endif /* NOT_NOW */
/* Shut down */
@@ -1210,7 +1212,7 @@ error:
static int
test_uniformity(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
@@ -1284,7 +1286,7 @@ error:
static int
test_close(hid_t fapl)
{
- hid_t file1 = -1, file2 = -1;
+ hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
@@ -1307,7 +1309,7 @@ test_close(hid_t fapl)
FAIL_STACK_ERROR;
if (H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
H5_FAILED();
- HDputs(" File1 contents are not accessible!");
+ puts(" File1 contents are not accessible!");
TEST_ERROR;
} /* end if */
if (H5Fclose(file2) < 0)
@@ -1369,15 +1371,17 @@ error:
static int
test_mount_after_close(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidAB = -1, gidABM = -1, gidX = -1, gidXY = -1; /* Group identifiers */
- hid_t gidABMX = -1, gidABC = -1, gidABT = -1; /* Group IDs for testing */
- hid_t didABMXYD = -1; /* Dataset ID for testing */
- hid_t did = -1, sid = -1; /* Dataset and dataspace identifiers */
- char filename1[1024], filename2[1024]; /* Name of files to mount */
- char objname[NAME_BUF_SIZE]; /* Name of object opened */
- hsize_t dims[] = {NX, NY}; /* Dataset dimensions */
- int i, j; /* Local index variable */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidAB = H5I_INVALID_HID, gidABM = H5I_INVALID_HID, gidX = H5I_INVALID_HID,
+ gidXY = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidABMX = H5I_INVALID_HID, gidABC = H5I_INVALID_HID,
+ gidABT = H5I_INVALID_HID; /* Group IDs for testing */
+ hid_t didABMXYD = H5I_INVALID_HID; /* Dataset ID for testing */
+ hid_t did = H5I_INVALID_HID, sid = H5I_INVALID_HID; /* Dataset and dataspace identifiers */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
+ char objname[NAME_BUF_SIZE]; /* Name of object opened */
+ hsize_t dims[] = {NX, NY}; /* Dataset dimensions */
+ int i, j; /* Local index variable */
TESTING("mounting on group after file is closed");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
@@ -1502,7 +1506,7 @@ test_mount_after_close(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidABMX, objname, (size_t)NAME_BUF_SIZE) < 0)
FAIL_STACK_ERROR;
- if (HDstrcmp(objname, "/A/B/M/X") != 0)
+ if (strcmp(objname, "/A/B/M/X") != 0)
TEST_ERROR;
/* Close object in mounted file */
@@ -1517,7 +1521,7 @@ test_mount_after_close(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidABC, objname, (size_t)NAME_BUF_SIZE) < 0)
FAIL_STACK_ERROR;
- if (HDstrcmp(objname, "/A/B/C") != 0)
+ if (strcmp(objname, "/A/B/C") != 0)
TEST_ERROR;
/* Close object in mounted file */
@@ -1532,7 +1536,7 @@ test_mount_after_close(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidABT, objname, (size_t)NAME_BUF_SIZE) < 0)
FAIL_STACK_ERROR;
- if (HDstrcmp(objname, "/A/B/T") != 0)
+ if (strcmp(objname, "/A/B/T") != 0)
TEST_ERROR;
/* Close object in original file */
@@ -1547,7 +1551,7 @@ test_mount_after_close(hid_t fapl)
*objname = '\0';
if (H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0)
FAIL_STACK_ERROR;
- if (HDstrcmp(objname, "/A/B/M/X/Y/D") != 0)
+ if (strcmp(objname, "/A/B/M/X/Y/D") != 0)
TEST_ERROR;
/* Close object in mounted file */
@@ -1599,16 +1603,18 @@ error:
static int
test_mount_after_unmount(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1, fid4 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1, gidX = -1, gidY = -1, gidZ = -1; /* Group identifiers */
- hid_t gidBM = -1; /* Group identifiers */
- hid_t gidBMZ = -1; /* Group identifiers */
- hid_t gidAM = -1; /* Group identifiers */
- hid_t gidAMX = -1; /* Group identifiers */
- hid_t gidAMXX = -1; /* Group identifiers */
- hid_t gidAMXMY = -1; /* Group identifiers */
- hid_t gidXM = -1; /* Group identifiers */
- hid_t gidXX = -1; /* Group identifiers */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = H5I_INVALID_HID,
+ fid4 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidB = H5I_INVALID_HID, gidX = H5I_INVALID_HID, gidY = H5I_INVALID_HID,
+ gidZ = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidBM = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidBMZ = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidAM = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidAMX = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidAMXX = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidAMXMY = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidXM = H5I_INVALID_HID; /* Group identifiers */
+ hid_t gidXX = H5I_INVALID_HID; /* Group identifiers */
char filename1[1024], filename2[1024], filename3[1024], filename4[1024]; /* Name of files to mount */
char objname[NAME_BUF_SIZE]; /* Name of object opened */
@@ -1715,7 +1721,7 @@ test_mount_after_unmount(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidAMXX, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(objname, "/A/M/X/X") != 0)
+ if (strcmp(objname, "/A/M/X/X") != 0)
TEST_ERROR;
/* Open group in mounted file #2 */
@@ -1735,7 +1741,7 @@ test_mount_after_unmount(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(objname, "/A/M/X/M/Y") != 0)
+ if (strcmp(objname, "/A/M/X/M/Y") != 0)
TEST_ERROR;
/* Unmount second file */
@@ -1746,7 +1752,7 @@ test_mount_after_unmount(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(objname, "/X/M/Y") != 0)
+ if (strcmp(objname, "/X/M/Y") != 0)
TEST_ERROR;
/* Rename object in file #3 that is "disconnected" from name hierarchy */
@@ -1766,7 +1772,7 @@ test_mount_after_unmount(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(objname, "/X/M/Z") != 0)
+ if (strcmp(objname, "/X/M/Z") != 0)
TEST_ERROR;
/* Mount fourth file */
@@ -1782,7 +1788,7 @@ test_mount_after_unmount(hid_t fapl)
*objname = '\0';
if (H5Iget_name(gidBMZ, objname, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(objname, "/B/M/Z") != 0)
+ if (strcmp(objname, "/B/M/Z") != 0)
TEST_ERROR;
/* Unmount third file */
@@ -1863,10 +1869,10 @@ error:
static int
test_missing_unmount(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t gidA = -1, gidE = -1, gidM = -1; /* Group IDs */
- hid_t gidAE = -1, gidAEM = -1; /* Group IDs */
- char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidE = H5I_INVALID_HID, gidM = H5I_INVALID_HID; /* Group IDs */
+ hid_t gidAE = H5I_INVALID_HID, gidAEM = H5I_INVALID_HID; /* Group IDs */
+ char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
TESTING("missing unmount");
@@ -2010,8 +2016,8 @@ error:
static int
test_hold_open_file(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidM = H5I_INVALID_HID, gidAM = H5I_INVALID_HID; /* Group IDs */
char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("hold open w/file");
@@ -2135,9 +2141,10 @@ error:
static int
test_hold_open_group(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gid = -1, gidA = -1, gidM = -1, gidAM = -1, gidAM2 = -1; /* Group IDs */
- char filename1[1024], filename2[1024]; /* Name of files to mount */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gid = H5I_INVALID_HID, gidA = H5I_INVALID_HID, gidM = H5I_INVALID_HID, gidAM = H5I_INVALID_HID,
+ gidAM2 = H5I_INVALID_HID; /* Group IDs */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("hold open w/group");
@@ -2286,10 +2293,10 @@ error:
static int
test_fcdegree_same(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
- hid_t fapl_id = -1; /* FAPL IDs */
- herr_t ret; /* Generic return value */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidM = H5I_INVALID_HID, gidAM = H5I_INVALID_HID; /* Group IDs */
+ hid_t fapl_id = H5I_INVALID_HID; /* FAPL IDs */
+ herr_t ret; /* Generic return value */
char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("file close degrees must be same");
@@ -2425,10 +2432,10 @@ error:
static int
test_fcdegree_semi(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
- hid_t fapl_id = -1; /* FAPL IDs */
- herr_t ret; /* Generic return value */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidM = H5I_INVALID_HID, gidAM = H5I_INVALID_HID; /* Group IDs */
+ hid_t fapl_id = H5I_INVALID_HID; /* FAPL IDs */
+ herr_t ret; /* Generic return value */
char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("'semi' file close degree");
@@ -2563,9 +2570,9 @@ error:
static int
test_fcdegree_strong(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
- hid_t fapl_id = -1; /* FAPL IDs */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidM = H5I_INVALID_HID, gidAM = H5I_INVALID_HID; /* Group IDs */
+ hid_t fapl_id = H5I_INVALID_HID; /* FAPL IDs */
H5O_info2_t oinfo;
char filename1[1024], filename2[1024]; /* Name of files to mount */
herr_t ret; /* Generic return value */
@@ -2700,9 +2707,10 @@ error:
static int
test_acc_perm(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1, gidC = -1, gidM = -1, gidAM = -1, gidAMZ = -1; /* Group IDs */
- hid_t bad_id = -1; /* Bad ID from object create */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidB = H5I_INVALID_HID, gidC = H5I_INVALID_HID, gidM = H5I_INVALID_HID,
+ gidAM = H5I_INVALID_HID, gidAMZ = H5I_INVALID_HID; /* Group IDs */
+ hid_t bad_id = H5I_INVALID_HID; /* Bad ID from object create */
char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
@@ -2748,7 +2756,7 @@ test_acc_perm(hid_t fapl)
/* Get and verify file name */
if (H5Fget_name(gidA, name, NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, filename1) != 0)
+ if (strcmp(name, filename1) != 0)
TEST_ERROR;
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
@@ -2757,7 +2765,7 @@ test_acc_perm(hid_t fapl)
/* Get and verify file name */
if (H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, filename2) != 0)
+ if (strcmp(name, filename2) != 0)
TEST_ERROR;
/* Mount files together */
@@ -2767,7 +2775,7 @@ test_acc_perm(hid_t fapl)
/* Get and verify file name */
if (H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, filename2) != 0)
+ if (strcmp(name, filename2) != 0)
TEST_ERROR;
/* Open group in mounted file */
@@ -2777,7 +2785,7 @@ test_acc_perm(hid_t fapl)
/* Get and verify file name */
if (H5Fget_name(gidAM, name, NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, filename2) != 0)
+ if (strcmp(name, filename2) != 0)
TEST_ERROR;
/* Attempt to create objects in read only file (should fail) */
@@ -2823,7 +2831,7 @@ test_acc_perm(hid_t fapl)
/* Get and verify file name */
if (H5Fget_name(gidAMZ, name, NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, filename3) != 0)
+ if (strcmp(name, filename3) != 0)
TEST_ERROR;
/* Close object in file #3 */
@@ -2899,12 +2907,14 @@ error:
static int
test_mult_mount(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1, fid3_2 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
- hid_t gidM = -1, gidN = -1, gidAM = -1; /* Group IDs in file #2 */
- hid_t gidS = -1, gidT = -1, gidU = -1, gidBS = -1, gidAMT = -1; /* Group IDs in file #3 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = H5I_INVALID_HID,
+ fid3_2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidB = H5I_INVALID_HID; /* Group IDs in file #1 */
+ hid_t gidM = H5I_INVALID_HID, gidN = H5I_INVALID_HID, gidAM = H5I_INVALID_HID; /* Group IDs in file #2 */
+ hid_t gidS = H5I_INVALID_HID, gidT = H5I_INVALID_HID, gidU = H5I_INVALID_HID, gidBS = H5I_INVALID_HID,
+ gidAMT = H5I_INVALID_HID; /* Group IDs in file #3 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
TESTING("multiple mounts");
@@ -3014,7 +3024,7 @@ test_mult_mount(hid_t fapl)
*name = '\0';
if (H5Iget_name(gidAMT, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, "/A/M/T") != 0)
+ if (strcmp(name, "/A/M/T") != 0)
TEST_ERROR;
/* Create object in file #3 */
@@ -3032,7 +3042,7 @@ test_mult_mount(hid_t fapl)
*name = '\0';
if (H5Iget_name(gidBS, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, "/B/S") != 0)
+ if (strcmp(name, "/B/S") != 0)
TEST_ERROR;
/* Re-open object created in file #3 through file #1 mount path */
@@ -3117,10 +3127,11 @@ error:
static int
test_nested_survive(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t gidA = -1; /* Group IDs in file #1 */
- hid_t gidM = -1, gidAM = -1; /* Group IDs in file #2 */
- hid_t gidS = -1, gidMS = -1, gidAMS = -1; /* Group IDs in file #3 */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID; /* Group IDs in file #1 */
+ hid_t gidM = H5I_INVALID_HID, gidAM = H5I_INVALID_HID; /* Group IDs in file #2 */
+ hid_t gidS = H5I_INVALID_HID, gidMS = H5I_INVALID_HID,
+ gidAMS = H5I_INVALID_HID; /* Group IDs in file #3 */
char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
ssize_t name_len; /* Filename length */
char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
@@ -3208,7 +3219,7 @@ test_nested_survive(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/A/M") != 0)
+ if (name_len == 0 || strcmp(name, "/A/M") != 0)
TEST_ERROR;
/* Unmount file #2 from file #1 */
@@ -3219,7 +3230,7 @@ test_nested_survive(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len != 0 || HDstrcmp(name, "") != 0)
+ if (name_len != 0 || strcmp(name, "") != 0)
TEST_ERROR;
/* Open object in file #3 through file #1 mount path (should fail) */
@@ -3239,7 +3250,7 @@ test_nested_survive(hid_t fapl)
*name = '\0';
if (H5Iget_name(gidMS, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, "/M/S") != 0)
+ if (strcmp(name, "/M/S") != 0)
TEST_ERROR;
/* Close group in file #3 */
@@ -3258,7 +3269,7 @@ test_nested_survive(hid_t fapl)
*name = '\0';
if (H5Iget_name(gidAMS, name, (size_t)NAME_BUF_SIZE) < 0)
TEST_ERROR;
- if (HDstrcmp(name, "/A/M/S") != 0)
+ if (strcmp(name, "/A/M/S") != 0)
TEST_ERROR;
/* Close group in file #3 */
@@ -3325,12 +3336,12 @@ error:
static int
test_close_parent(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gidA = -1; /* Group IDs in file #1 */
- hid_t gidM = -1; /* Group IDs in file #2 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- ssize_t name_len; /* Filename length */
- char filename1[1024], filename2[1024]; /* Name of files to mount */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID; /* Group IDs in file #1 */
+ hid_t gidM = H5I_INVALID_HID; /* Group IDs in file #2 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ ssize_t name_len; /* Filename length */
+ char filename1[1024], filename2[1024]; /* Name of files to mount */
TESTING("close parent");
@@ -3402,7 +3413,7 @@ test_close_parent(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/A/M") != 0)
+ if (name_len == 0 || strcmp(name, "/A/M") != 0)
TEST_ERROR;
/* Unmount file #2 from file #1, closing file #1 */
@@ -3413,7 +3424,7 @@ test_close_parent(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/M") != 0)
+ if (name_len == 0 || strcmp(name, "/M") != 0)
TEST_ERROR;
/* Just file #2's underlying shared file should be open still */
@@ -3491,17 +3502,18 @@ error:
static int
test_cut_graph(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1, fid4 = -1, fid5 = -1, fid6 = -1, fid7 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
- hid_t gidD = -1, gidE = -1; /* Group IDs in file #2 */
- hid_t gidH = -1, gidI = -1; /* Group IDs in file #3 */
- hid_t gidK = -1; /* Group IDs in file #4 */
- hid_t gidM = -1; /* Group IDs in file #5 */
- hid_t gidO = -1; /* Group IDs in file #6 */
- hid_t gidQ = -1; /* Group IDs in file #7 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- ssize_t name_len; /* Filename length */
- ssize_t obj_count; /* Number of objects open */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = H5I_INVALID_HID, fid4 = H5I_INVALID_HID,
+ fid5 = H5I_INVALID_HID, fid6 = H5I_INVALID_HID, fid7 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidB = H5I_INVALID_HID; /* Group IDs in file #1 */
+ hid_t gidD = H5I_INVALID_HID, gidE = H5I_INVALID_HID; /* Group IDs in file #2 */
+ hid_t gidH = H5I_INVALID_HID, gidI = H5I_INVALID_HID; /* Group IDs in file #3 */
+ hid_t gidK = H5I_INVALID_HID; /* Group IDs in file #4 */
+ hid_t gidM = H5I_INVALID_HID; /* Group IDs in file #5 */
+ hid_t gidO = H5I_INVALID_HID; /* Group IDs in file #6 */
+ hid_t gidQ = H5I_INVALID_HID; /* Group IDs in file #7 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ ssize_t name_len; /* Filename length */
+ ssize_t obj_count; /* Number of objects open */
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
filename4[NAME_BUF_SIZE], filename5[NAME_BUF_SIZE], filename6[NAME_BUF_SIZE],
filename7[NAME_BUF_SIZE]; /* Name of files to mount */
@@ -3675,7 +3687,7 @@ test_cut_graph(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/A/E/M") != 0)
+ if (name_len == 0 || strcmp(name, "/A/E/M") != 0)
TEST_ERROR;
/* Open object in file #7 */
@@ -3686,7 +3698,7 @@ test_cut_graph(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/B/I/Q") != 0)
+ if (name_len == 0 || strcmp(name, "/B/I/Q") != 0)
TEST_ERROR;
/* Close file #1 */
@@ -3746,7 +3758,7 @@ test_cut_graph(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidK, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/D/K") != 0)
+ if (name_len == 0 || strcmp(name, "/D/K") != 0)
TEST_ERROR;
if (H5Gclose(gidK) < 0)
@@ -3769,7 +3781,7 @@ test_cut_graph(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/B/H/O") != 0)
+ if (name_len == 0 || strcmp(name, "/B/H/O") != 0)
TEST_ERROR;
if (H5Gclose(gidO) < 0)
@@ -3779,14 +3791,14 @@ test_cut_graph(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/E/M") != 0)
+ if (name_len == 0 || strcmp(name, "/E/M") != 0)
TEST_ERROR;
/* Check the name of "Q" is still defined */
*name = '\0';
if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/B/I/Q") != 0)
+ if (name_len == 0 || strcmp(name, "/B/I/Q") != 0)
TEST_ERROR;
/* Check that all seven underlying files are still opened */
@@ -3811,7 +3823,7 @@ test_cut_graph(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/I/Q") != 0)
+ if (name_len == 0 || strcmp(name, "/I/Q") != 0)
TEST_ERROR;
/* Open object in file #6 from file #7 */
@@ -3822,7 +3834,7 @@ test_cut_graph(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/H/O") != 0)
+ if (name_len == 0 || strcmp(name, "/H/O") != 0)
TEST_ERROR;
if (H5Gclose(gidO) < 0)
@@ -3878,13 +3890,13 @@ error:
static int
test_symlink(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t gidA = -1, gidB = -1; /* Group IDs in file #1 */
- hid_t gidD = -1, gidE = -1; /* Group IDs in file #2 */
- hid_t gidH = -1, gidI = -1; /* Group IDs in file #3 */
- hid_t gidL = -1; /* Group IDs through soft link to file #3 */
- char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
- ssize_t name_len; /* Filename length */
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = H5I_INVALID_HID; /* File IDs */
+ hid_t gidA = H5I_INVALID_HID, gidB = H5I_INVALID_HID; /* Group IDs in file #1 */
+ hid_t gidD = H5I_INVALID_HID, gidE = H5I_INVALID_HID; /* Group IDs in file #2 */
+ hid_t gidH = H5I_INVALID_HID, gidI = H5I_INVALID_HID; /* Group IDs in file #3 */
+ hid_t gidL = H5I_INVALID_HID; /* Group IDs through soft link to file #3 */
+ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
+ ssize_t name_len; /* Filename length */
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
filename3[NAME_BUF_SIZE]; /* Name of files to mount */
@@ -3986,7 +3998,7 @@ test_symlink(hid_t fapl)
*name = '\0';
if ((name_len = H5Iget_name(gidL, name, (size_t)NAME_BUF_SIZE)) < 0)
TEST_ERROR;
- if (name_len == 0 || HDstrcmp(name, "/L") != 0)
+ if (name_len == 0 || strcmp(name, "/L") != 0)
TEST_ERROR;
/* Close file #1 */
@@ -4038,8 +4050,9 @@ error:
static int
test_sharedacc(hid_t fapl)
{
- hid_t fid1[2] = {-1, -1}, fid2[2] = {-1, -1}; /* File IDs */
- hid_t gid = -1;
+ hid_t fid1[2] = {H5I_INVALID_HID, H5I_INVALID_HID},
+ fid2[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* File IDs */
+ hid_t gid = H5I_INVALID_HID;
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
filename3[NAME_BUF_SIZE]; /* Name of files to mount */
int i, j, k; /* Counters */
@@ -4139,8 +4152,8 @@ error:
static int
test_sharedclose(hid_t fapl)
{
- hid_t fid1a = -1, fid1b = -1, fid2 = -1, fid3 = -2; /* File IDs */
- hid_t gid1 = -1, gid2 = -1, gid3 = -1;
+ hid_t fid1a = H5I_INVALID_HID, fid1b = H5I_INVALID_HID, fid2 = H5I_INVALID_HID, fid3 = -2; /* File IDs */
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID;
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
filename3[NAME_BUF_SIZE]; /* Name of files to mount */
@@ -4293,8 +4306,8 @@ error:
static int
test_multisharedclose(hid_t fapl)
{
- hid_t fid1 = -1, fid2 = -1; /* File IDs */
- hid_t gid1 = -1, gid2 = -1, gid3 = -1;
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; /* File IDs */
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID;
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
filename4[NAME_BUF_SIZE]; /* Name of files to mount */
@@ -4443,7 +4456,7 @@ int
main(void)
{
int nerrors = 0;
- hid_t fapl = -1;
+ hid_t fapl = H5I_INVALID_HID;
h5_reset();
fapl = h5_fileaccess();
@@ -4488,12 +4501,12 @@ main(void)
if (nerrors)
goto error;
- HDputs("All mount tests passed.");
+ puts("All mount tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
error:
- HDputs("***** MOUNT ERRORS *****");
+ puts("***** MOUNT ERRORS *****");
return 1;
}