2003-04-01 01:59:04 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
2017-04-18 03:32:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:04 +08:00
|
|
|
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/*
|
|
|
|
* Purpose: Tests file mounting.
|
|
|
|
*/
|
2001-04-04 02:09:16 +08:00
|
|
|
#include "h5test.h"
|
2020-09-30 22:27:10 +08:00
|
|
|
#include "H5Fprivate.h" /* File access */
|
|
|
|
#include "H5Iprivate.h" /* IDs */
|
|
|
|
|
2023-06-19 13:13:38 +08:00
|
|
|
static const char *FILENAME[] = {"mount_1", "mount_2", "mount_3", "mount_4",
|
|
|
|
"mount_5", "mount_6", "mount_7", NULL};
|
1998-10-15 03:35:08 +08:00
|
|
|
|
2005-05-08 03:34:25 +08:00
|
|
|
/* For "mount_after_close" test */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define RANK 2
|
|
|
|
#define NX 4
|
|
|
|
#define NY 5
|
|
|
|
#define NAME_BUF_SIZE 40
|
2023-06-19 13:13:38 +08:00
|
|
|
static int bm[NX][NY]; /* Data buffers */
|
2005-05-08 03:34:25 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: setup
|
|
|
|
*
|
|
|
|
* Purpose: Create some files and populate them with a few groups.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: -1
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
setup(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename[1024];
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* file 1 */
|
1998-11-24 04:40:35 +08:00
|
|
|
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/mnt1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/mnt1/file1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/mnt_unlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/mnt_move_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lcreate_hard(file, "/mnt1/file1", H5L_SAME_LOC, "/file1", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lcreate_hard(file, "/mnt1", H5L_SAME_LOC, "/mnt1_link", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* file 2 */
|
1998-11-24 04:40:35 +08:00
|
|
|
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/file2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/rename_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/rename_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(file, "/rename_a/x", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* file 3 */
|
1998-11-24 04:40:35 +08:00
|
|
|
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
return 0;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2007-08-24 04:25:25 +08:00
|
|
|
error:
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Fclose(file);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return -1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end setup() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_basic
|
|
|
|
*
|
|
|
|
* Purpose: Mount file1 at file2:/mnt1 and try accessing an object in
|
|
|
|
* file2. Then unmount.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_basic(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("basic functionality");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
1998-10-15 03:35:08 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(grp) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_basic() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_illegal
|
|
|
|
*
|
|
|
|
* Purpose: Test things that are illegal to do. We should get a failure
|
|
|
|
* from the library for each of them.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_illegal(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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;
|
2024-08-24 00:44:48 +08:00
|
|
|
hid_t dtype = H5I_INVALID_HID; /* To test invalid ID */
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024], filename3[1024];
|
|
|
|
herr_t status;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("illegal mount operations");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Open the files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file3 = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1b = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file3b = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Try mounting a file on itself */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Fmount(file1, "/mnt1", file1, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Mounting a file on itself should have failed.");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Try mounting two files at the same place. We have to open the mount
|
|
|
|
* point before we mount the first file or we'll end up mounting file3 at
|
|
|
|
* the root of file2 and the mount will succeed.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mnt = H5Gopen2(file1, "/mnt1", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(mnt, ".", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Fmount(mnt, ".", file3, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Mounting two files at one mount point should have failed.");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(mnt, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(mnt) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2008-07-16 05:00:15 +08:00
|
|
|
/*
|
|
|
|
* Try mounting the same file opened twice at the same place.
|
|
|
|
*
|
|
|
|
* We have to open the mount point before we mount the first file or we'll
|
2008-08-08 05:49:05 +08:00
|
|
|
* end up mounting file3b at the root of file3 and the mount will succeed.
|
2008-07-16 05:00:15 +08:00
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mnt = H5Gopen2(file1, "/mnt1", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(mnt, ".", file3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Fmount(mnt, ".", file3b, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Mounting same file opened twice at one mount point should have failed.");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-07-16 05:00:15 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(mnt, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(mnt) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2008-07-16 05:00:15 +08:00
|
|
|
|
2008-08-08 05:49:05 +08:00
|
|
|
/* Try to create a "weak" cycle */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Fmount(file2, "/mnt1/file2", file1b, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Creating a cycle with mount points should have failed.");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
2024-08-24 00:44:48 +08:00
|
|
|
/* Try passing in IDs that are not a file or group ID */
|
|
|
|
if ((dtype = H5Tcopy(H5T_C_S1)) < 0)
|
|
|
|
FAIL_STACK_ERROR;
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Fmount(dtype, "/mnt1", file1b, H5P_DEFAULT);
|
|
|
|
}
|
|
|
|
H5E_END_TRY
|
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
|
|
|
puts(" Passing in an ID other than file or group ID should have failed.");
|
|
|
|
TEST_ERROR;
|
|
|
|
} /* end if */
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Funmount(dtype, "/mnt1");
|
|
|
|
}
|
|
|
|
H5E_END_TRY
|
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
|
|
|
puts(" Passing in an ID other than file or group ID should have failed.");
|
|
|
|
TEST_ERROR;
|
|
|
|
} /* end if */
|
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Close everything and return */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1b) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file3b) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(mnt);
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file1b);
|
|
|
|
H5Fclose(file2);
|
|
|
|
H5Fclose(file3);
|
|
|
|
H5Fclose(file3b);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_illegal() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
2008-07-16 05:00:15 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_samefile
|
|
|
|
*
|
|
|
|
* Purpose: Test opening the same file twice and then mounting another
|
|
|
|
* file on each.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_samefile(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024], filename3[1024];
|
|
|
|
H5G_info_t grp_info;
|
|
|
|
herr_t status;
|
2008-07-16 05:00:15 +08:00
|
|
|
|
|
|
|
TESTING("same file mount operations");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
|
|
|
|
|
|
|
/* Open the files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1a = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1b = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file3 = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2008-07-16 05:00:15 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Try mounting different files at the same place in each of the "top"
|
|
|
|
* files.
|
|
|
|
*
|
|
|
|
* We have to open the mount point before we mount the first file or we'll
|
|
|
|
* end up mounting file4 at the root of file3 and the mount will succeed.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mnt1a = H5Gopen2(file1a, "/mnt1", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gget_info(mnt1a, &grp_info) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (grp_info.mounted)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.");
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mnt1b = H5Gopen2(file1b, "/mnt1", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gget_info(mnt1b, &grp_info) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (grp_info.mounted)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(mnt1a, ".", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gget_info(mnt1a, &grp_info) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!grp_info.mounted)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.");
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Fmount(mnt1b, ".", file3, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Mounting different files at one mount point should have failed.");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(mnt1a, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(mnt1a) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(mnt1b) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2008-07-16 05:00:15 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Try mounting same files at the same place in each of the "top"
|
|
|
|
* files.
|
|
|
|
*
|
|
|
|
* We have to open the mount point before we mount the first file or we'll
|
|
|
|
* end up mounting file4 at the root of file3 and the mount will succeed.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mnt1a = H5Gopen2(file1a, "/mnt1", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gget_info(mnt1a, &grp_info) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (grp_info.mounted)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.");
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mnt1b = H5Gopen2(file1b, "/mnt1", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gget_info(mnt1b, &grp_info) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (grp_info.mounted)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Group shouldn't have 'mounted' flag set.");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(mnt1a, ".", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gget_info(mnt1a, &grp_info) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!grp_info.mounted)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Group should have 'mounted' flag set.");
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Fmount(mnt1b, ".", file2, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_PUTS_ERROR(" Mounting same files at one mount point should have failed.");
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(mnt1a, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(mnt1a) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(mnt1b) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2008-07-16 05:00:15 +08:00
|
|
|
|
|
|
|
/* Close everything and return */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1a) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1b) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2008-07-16 05:00:15 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(mnt1a);
|
|
|
|
H5Gclose(mnt1b);
|
|
|
|
H5Fclose(file1a);
|
|
|
|
H5Fclose(file1b);
|
|
|
|
H5Fclose(file2);
|
|
|
|
H5Fclose(file3);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2008-07-16 05:00:15 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_samefile() */
|
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_hide
|
|
|
|
*
|
|
|
|
* Purpose: The previous contents of the mount point is temporarily
|
|
|
|
* hidden. If objects in that group had names from other groups
|
|
|
|
* then the objects will still be visible by those other names.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_hide(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5O_info2_t oi1, oi2;
|
|
|
|
char filename1[1024], filename2[1024];
|
2023-09-06 04:11:52 +08:00
|
|
|
bool same_obj;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("name hiding under mount point");
|
2020-01-04 12:16:38 +08:00
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1));
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2));
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Get information about file1:/mnt1/file1 for later */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Original names under file1:/mnt1 should not be accessible */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (grp >= 0) {
|
2020-01-04 12:16:38 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Name is still accessible under mount point.");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-01-17 05:29:34 +08:00
|
|
|
}
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The original objects under file1:/mnt1 are still accessible by their
|
|
|
|
* other names. This is a rather stupid test but demonstrates a point.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-01-17 05:29:34 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
same_obj = true;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (oi1.fileno == oi2.fileno) {
|
2020-01-17 05:29:34 +08:00
|
|
|
int token_cmp;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (token_cmp)
|
2023-09-06 04:11:52 +08:00
|
|
|
same_obj = false;
|
2020-01-17 05:29:34 +08:00
|
|
|
}
|
|
|
|
else
|
2023-09-06 04:11:52 +08:00
|
|
|
same_obj = false;
|
2020-01-17 05:29:34 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!same_obj) {
|
2020-01-04 12:16:38 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Hard link failed for hidden object.");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-01-17 05:29:34 +08:00
|
|
|
}
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Unmount and close objects */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2020-01-04 12:16:38 +08:00
|
|
|
H5Gclose(grp);
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_hide() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_assoc
|
|
|
|
*
|
|
|
|
* Purpose: Opening the mount point is the same as opening the root group
|
|
|
|
* of the mounted file before the file was mounted.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_assoc(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5O_info2_t oi1, oi2;
|
|
|
|
char filename1[1024], filename2[1024];
|
2023-09-06 04:11:52 +08:00
|
|
|
bool same_obj;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("mount point open");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Open the files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Get information about the root of file2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info3(file2, &oi1, H5O_INFO_BASIC) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Create the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get info about the mount point -- should be the same as the root group
|
|
|
|
* of file2.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2009-03-25 06:06:07 +08:00
|
|
|
|
2023-09-06 04:11:52 +08:00
|
|
|
same_obj = true;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (oi1.fileno == oi2.fileno) {
|
2020-01-17 05:29:34 +08:00
|
|
|
int token_cmp;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (token_cmp)
|
2023-09-06 04:11:52 +08:00
|
|
|
same_obj = false;
|
2020-01-17 05:29:34 +08:00
|
|
|
}
|
|
|
|
else
|
2023-09-06 04:11:52 +08:00
|
|
|
same_obj = false;
|
2020-01-17 05:29:34 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (!same_obj) {
|
2020-01-17 05:29:34 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Association failed.");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Shut down */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1_link") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2005-11-15 10:55:39 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2020-01-04 12:16:38 +08:00
|
|
|
H5Fclose(file2);
|
|
|
|
H5Fclose(file1);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_assoc() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_mntlnk
|
|
|
|
*
|
|
|
|
* Purpose: The mount point is actually an OID (not a name) so if there
|
|
|
|
* are other names for that group then the root group of the
|
|
|
|
* child will be visible in all those names.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_mntlnk(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
1998-11-24 04:40:35 +08:00
|
|
|
|
|
|
|
TESTING("multi-linked mount point");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Can we see file2:/file2 as both file1:/mnt1/file2 and
|
|
|
|
* file1:/mnt1_link/file2?
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(grp) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((grp = H5Gopen2(file1, "/mnt1_link/file2", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(grp) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Unlink using second name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1_link") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(grp);
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_mntlnk() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_move
|
|
|
|
*
|
2007-08-29 06:30:13 +08:00
|
|
|
* Purpose: An object cannot be moved or renamed with H5Lmove() in such a
|
1998-10-15 03:35:08 +08:00
|
|
|
* way that the new location would be in a different file than
|
|
|
|
* the original location.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_move(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
herr_t status;
|
|
|
|
char filename1[1024], filename2[1024];
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("object renaming");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* First rename an object in the mounted file, then try it across files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lmove(file1, "/mnt1/rename_a/x", H5L_SAME_LOC, "/mnt1/rename_b/y", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Lmove(file1, "/mnt1/rename_b/y", H5L_SAME_LOC, "/y", H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Moving an object across files shouldn't have been possible");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Shut down */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_move() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_preopen
|
|
|
|
*
|
|
|
|
* Purpose: Objects that are opened under the mount point before the
|
|
|
|
* child is mounted will remain accessible.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_preopen(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
|
2020-01-17 05:29:34 +08:00
|
|
|
H5O_info2_t oinfo;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("preopening objects under the mount point");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Open something under the mount point */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Now access the thing we previously opened */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Shut down */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(grp) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(grp);
|
|
|
|
H5Fclose(file2);
|
|
|
|
H5Fclose(file1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_preopen() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_postopen
|
|
|
|
*
|
|
|
|
* Purpose: Objects that are open in a mounted file remain accessible
|
|
|
|
* after the file is unmounted. Unmounting the file doesn't
|
|
|
|
* close the file.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_postopen(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, grp = H5I_INVALID_HID;
|
2020-01-17 05:29:34 +08:00
|
|
|
H5O_info2_t oinfo;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("open object access after unmount");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Create the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Open some object in the mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Unmount the file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Now access the thing we previously opened */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Try accessing it from the file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Shut down */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(grp) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(grp);
|
|
|
|
H5Fclose(file2);
|
|
|
|
H5Fclose(file1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_postopen() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_unlink
|
|
|
|
*
|
|
|
|
* Purpose: Unlinking the mount point from its name doesn't affect its
|
|
|
|
* existence or the fact that there is a file that is mounted
|
|
|
|
* there.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_unlink(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, mnt = H5I_INVALID_HID, root = H5I_INVALID_HID;
|
2020-01-17 05:29:34 +08:00
|
|
|
H5O_info2_t oinfo;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
|
|
|
herr_t status;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("mount point unlinking");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Open files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Opening the mount point before mounting opens the group in the parent
|
|
|
|
* file, but opening the mount point after mounting is the same as
|
|
|
|
* opening the root group of the child file.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mnt = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt_unlink", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((root = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* "/file2" of file2 should be visible as an absolute name through either
|
|
|
|
* file handle but not from the `mnt' handle since that handle was opened
|
|
|
|
* before the H5Fmount() and thus refers to the mount point itself rather
|
|
|
|
* than the group mounted there.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Incorrect traversal from mount point!");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Unlink the mount point */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Ldelete(file1, "/mnt_unlink", H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We should still be able to get to "/file2" of file2 by starting at
|
|
|
|
* `root' which is still open, but not by name.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Traversal through mount point should not have worked!");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Oget_info_by_name3(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Traversal through mount point should not have worked!");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* It's no longer possible to unmount the child by supplying the name of
|
|
|
|
* the mount point because the name doesn't exist anymore. We must
|
|
|
|
* supply the mount point directly.
|
|
|
|
*/
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Funmount(file1, "/mnt_unlink");
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Unmount by name should not have been allowed!\n", __LINE__);
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Funmount(file2, "/");
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Unmount by name should not have been allowed!\n", __LINE__);
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(mnt, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Close files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(mnt) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(root) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(mnt);
|
|
|
|
H5Gclose(root);
|
|
|
|
H5Fclose(file2);
|
|
|
|
H5Fclose(file1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_unlink() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_mvmpt
|
|
|
|
*
|
|
|
|
* Purpose: Try renaming the mount point while a file is mounted there.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_mvmpt(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5O_info2_t oinfo;
|
|
|
|
char filename1[1024], filename2[1024];
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("mount point renaming");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Rename the mount point */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Access something under the new name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Shut down */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt_move_b") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-12-26 13:28:18 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_mvmpt() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_interlink
|
|
|
|
*
|
|
|
|
* Purpose: Hard links cannot cross file boundaries.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_interlink(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
|
[svn-r21131] Description:
Disable some test code that isn't going to work correctly again until
we've completely resolved Jira issue #7638.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
2011-07-21 03:09:08 +08:00
|
|
|
#ifdef NOT_NOW
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t type = H5I_INVALID_HID, space = H5I_INVALID_HID, dset = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t cur_dims[1] = {2};
|
[svn-r21131] Description:
Disable some test code that isn't going to work correctly again until
we've completely resolved Jira issue #7638.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
2011-07-21 03:09:08 +08:00
|
|
|
#endif /* NOT_NOW */
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
|
|
|
herr_t status;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("interfile hard links");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Try an interfile hard link directly */
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Lcreate_hard(file1, "/mnt1/file2", H5L_SAME_LOC, "/file2", H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Interfile hard link should not have been allowed!");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Try an interfile hard link by renaming something */
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
status = H5Lmove(file1, "/mnt1/file2", H5L_SAME_LOC, "/file2", H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (status >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Interfile renaming should not have been allowed!");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
[svn-r21131] Description:
Disable some test code that isn't going to work correctly again until
we've completely resolved Jira issue #7638.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
2011-07-21 03:09:08 +08:00
|
|
|
/* Commented this code out until Jira issue #7638 is resolved. Once that
|
|
|
|
* issue is resolved (hopefully by refactored the file code to use shared
|
|
|
|
* file pointers for all operations), this should be uncommented. -QAK
|
|
|
|
*/
|
|
|
|
#ifdef NOT_NOW
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Try an interfile hard link by sharing a data type */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((type = H5Tcopy(H5T_NATIVE_INT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tcommit2(file1, "/type1", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((space = H5Screate_simple(1, cur_dims, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
dset = H5Dcreate2(file1, "/mnt1/file2/dset", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (dset >= 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Dataset and shared type must be in the same file!");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
[svn-r21131] Description:
Disable some test code that isn't going to work correctly again until
we've completely resolved Jira issue #7638.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
2011-07-21 03:09:08 +08:00
|
|
|
/* Close IDs */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(space) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tclose(type) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2021-01-29 20:55:18 +08:00
|
|
|
#else /* NOT_NOW */
|
[svn-r21152] Description:
Further patches for Jira 7638, to ensure that H5D/Aget_type will
be attached to the correct top file. (This change to the library should
reverted when Jira 7638 is finally finished)
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
Mac OS X/32 10.6.8 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2011-07-29 05:22:44 +08:00
|
|
|
SKIPPED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Test skipped due file pointer sharing issue (Jira 7638).");
|
[svn-r21131] Description:
Disable some test code that isn't going to work correctly again until
we've completely resolved Jira issue #7638.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
2011-07-21 03:09:08 +08:00
|
|
|
#endif /* NOT_NOW */
|
|
|
|
|
|
|
|
/* Shut down */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
[svn-r21131] Description:
Disable some test code that isn't going to work correctly again until
we've completely resolved Jira issue #7638.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
2011-07-21 03:09:08 +08:00
|
|
|
#ifdef NOT_NOW
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Dclose(dset);
|
|
|
|
H5Sclose(space);
|
|
|
|
H5Tclose(type);
|
[svn-r21131] Description:
Disable some test code that isn't going to work correctly again until
we've completely resolved Jira issue #7638.
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
2011-07-21 03:09:08 +08:00
|
|
|
#endif /* NOT_NOW */
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_interlink() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_uniformity
|
|
|
|
*
|
|
|
|
* Purpose: Any file handle is equivalent to any other file handle in the
|
|
|
|
* same virtual file.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_uniformity(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
|
2020-01-17 05:29:34 +08:00
|
|
|
H5O_info2_t oinfo;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("file handle uniformity");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Access some things from the file1 handle */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Access the same things from the file2 handle */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/* Shut down */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(file1, "/mnt1") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-08-28 23:02:54 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_uniformity() */
|
1998-10-15 03:35:08 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_close
|
|
|
|
*
|
|
|
|
* Purpose: Closing any file handle closes the entire virtual file.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1998-11-24 04:40:35 +08:00
|
|
|
test_close(hid_t fapl)
|
1998-10-15 03:35:08 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID;
|
2020-01-17 05:29:34 +08:00
|
|
|
H5O_info2_t oinfo;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024];
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("file handle close");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Build the virtual file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-15 03:35:08 +08:00
|
|
|
|
1998-10-16 23:40:37 +08:00
|
|
|
/*
|
2005-07-21 22:48:26 +08:00
|
|
|
* Close file1 unmounting it from the virtual file. Objects in file1 are
|
|
|
|
* still accessible through the file2 handle.
|
1998-10-16 23:40:37 +08:00
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" File1 contents are not accessible!");
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-16 23:40:37 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-21 22:48:26 +08:00
|
|
|
|
1998-10-16 23:40:37 +08:00
|
|
|
/* Build the virtual file again */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 ||
|
|
|
|
(file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
1998-10-16 23:40:37 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Close file2. It is not actually closed because it's a child of file1.
|
2005-08-14 04:53:35 +08:00
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-21 22:48:26 +08:00
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/* Shut down */
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-15 03:35:08 +08:00
|
|
|
return 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Fclose(file1);
|
|
|
|
H5Fclose(file2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-15 03:35:08 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_close() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-05-08 03:34:25 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_mount_after_close
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library handles mounting a file on a group
|
|
|
|
* if the group is the only object holding the file open.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_mount_after_close(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-05-08 03:34:25 +08:00
|
|
|
TESTING("mounting on group after file is closed");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-05-08 03:34:25 +08:00
|
|
|
/*
|
2020-09-30 22:27:10 +08:00
|
|
|
* Initialization of buffer matrix "bm"
|
|
|
|
*/
|
|
|
|
for (i = 0; i < NX; i++)
|
|
|
|
for (j = 0; j < NY; j++)
|
2005-05-08 03:34:25 +08:00
|
|
|
bm[i][j] = i + j;
|
|
|
|
|
|
|
|
/* Create first file and a groups in it. */
|
|
|
|
/* h5ls -r shows: */
|
|
|
|
/* /A Group
|
|
|
|
/A/B Group
|
|
|
|
/A/B/C -> ./M/X/Y
|
|
|
|
/A/B/M Group
|
|
|
|
/A/B/T -> /A
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAB = H5Gcreate2(gidA, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
/* Mount point */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidABM = H5Gcreate2(gidAB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
/* Soft link */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lcreate_soft("./M/X/Y", gidAB, "C", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
/* Soft link */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lcreate_soft("/A", gidAB, "T", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Close groups and file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidABM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
|
|
|
|
/* Create second file and dataset "D" in it. */
|
|
|
|
/* h5ls shows: */
|
|
|
|
/* /X Group
|
|
|
|
/X/T -> ./Y
|
|
|
|
/X/Y Group
|
|
|
|
/X/Y/D Dataset {4, 5}
|
|
|
|
*/
|
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
dims[0] = NX;
|
|
|
|
dims[1] = NY;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidXY = H5Gcreate2(gidX, "Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((did = H5Dcreate2(gidXY, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2007-08-28 23:02:54 +08:00
|
|
|
/* Soft link */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lcreate_soft("./Y", gidX, "T", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Write data to the dataset. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Close all identifiers. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(sid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(did) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidXY) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidX) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* Beginning of the actual test code */
|
2005-05-08 03:34:25 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/*
|
|
|
|
* Reopen both files
|
|
|
|
*/
|
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
/*
|
|
|
|
* Open /A/B to use as a mount point
|
|
|
|
*/
|
|
|
|
if ((gidAB = H5Gopen2(fid1, "/A/B", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/*
|
|
|
|
* Close the parent file. This keeps the file open because of the other handle on the group within
|
|
|
|
*/
|
2007-08-28 23:02:54 +08:00
|
|
|
/* We close the file (it should stay open from the group) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/*
|
|
|
|
* Mount second file under G in the first file.
|
|
|
|
*/
|
|
|
|
if (H5Fmount(gidAB, "M", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Open "normal" group in mounted file */
|
|
|
|
/* (This shows we successfully mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidABMX = H5Gopen2(gidAB, "M/X", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidABMX, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/A/B/M/X") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Close object in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidABMX) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file through softlink */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidABC = H5Gopen2(gidAB, "C", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidABC, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/A/B/C") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Close object in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidABC) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Open group in original file through softlink */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidABT = H5Gopen2(gidAB, "T", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidABT, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/A/B/T") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Close object in original file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidABT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Open "normal" dataset in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((didABMXYD = H5Dopen2(gidAB, "M/X/Y/D", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/A/B/M/X/Y/D") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
|
|
|
/* Close object in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(didABMXYD) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-05-08 03:34:25 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
FAIL_STACK_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-05-08 03:34:25 +08:00
|
|
|
/* Shut down */
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Sclose(sid);
|
|
|
|
H5Dclose(did);
|
|
|
|
H5Gclose(didABMXYD);
|
|
|
|
H5Gclose(gidABT);
|
|
|
|
H5Gclose(gidABC);
|
|
|
|
H5Gclose(gidABMX);
|
|
|
|
H5Gclose(gidXY);
|
|
|
|
H5Gclose(gidX);
|
|
|
|
H5Gclose(gidABM);
|
|
|
|
H5Gclose(gidAB);
|
|
|
|
H5Gclose(gidA);
|
|
|
|
H5Fclose(fid1);
|
2005-05-08 03:34:25 +08:00
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-05-08 03:34:25 +08:00
|
|
|
return 1;
|
2007-08-28 23:02:54 +08:00
|
|
|
} /* end test_mount_after_close() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-06-08 13:22:28 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_mount_after_unmount
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library handles mounting a file while holding
|
|
|
|
* objects open in a file which has been unmounted.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_mount_after_unmount(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024], filename3[1024], filename4[1024]; /* Name of files to mount */
|
|
|
|
char objname[NAME_BUF_SIZE]; /* Name of object opened */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-06-08 13:22:28 +08:00
|
|
|
TESTING("mounting after file is unmounted");
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
|
|
|
h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-06-08 13:22:28 +08:00
|
|
|
/* Create first file and some groups in it. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gcreate2(gidA, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidBM = H5Gcreate2(gidB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidBM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* Create second file and a group in it. */
|
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidXM = H5Gcreate2(gidX, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidXM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidXX = H5Gcreate2(gidX, "X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidXX) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidX) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* Create third file and a group in it. */
|
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidY = H5Gcreate2(fid3, "/Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidY) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* Create fourth file and a group in it. */
|
|
|
|
if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidZ = H5Gcreate2(fid4, "/Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidZ) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid4) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* Beginning of the actual test code */
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/*
|
|
|
|
* Reopen all three files
|
|
|
|
*/
|
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/*
|
|
|
|
* Open /A & /B to use as a mount points
|
|
|
|
*/
|
|
|
|
if ((gidA = H5Gopen2(fid1, "/A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidB = H5Gopen2(fid1, "/B", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/*
|
|
|
|
* Mount second file on /A/M in the first file.
|
|
|
|
*/
|
|
|
|
if (H5Fmount(gidA, "M", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
|
|
|
/* (This shows we successfully mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMXX = H5Gopen2(gidA, "M/X/X", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidAMXX, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/A/M/X/X") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMX = H5Gopen2(gidA, "M/X", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Mount third file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidAMX, "M", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file #3 */
|
|
|
|
/* (This shows we successfully mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMXMY = H5Gopen2(gidAMX, "M/Y", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/A/M/X/M/Y") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Unmount second file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(fid1, "/A/M") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Check name */
|
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/X/M/Y") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
2021-12-07 22:27:29 +08:00
|
|
|
/* Rename object in file #3 that is "disconnected" from name hierarchy */
|
2005-06-08 13:22:28 +08:00
|
|
|
/* (It is "disconnected" because it's parent file has been unmounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lmove(gidAMX, "M/Y", gidAMX, "M/Z", H5P_DEFAULT, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Close group in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMXMY) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Re-open group in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMXMY = H5Gopen2(gidAMX, "M/Z", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Check name again */
|
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidAMXMY, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/X/M/Z") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Mount fourth file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidB, "M", fid4, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
|
|
|
/* (This shows we successfully mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidBMZ = H5Gopen2(gidB, "M/Z", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*objname = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidBMZ, objname, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(objname, "/B/M/Z") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Unmount third file */
|
2007-08-28 23:02:54 +08:00
|
|
|
if (H5Funmount(fid2, "/X/M") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Unmount fourth file */
|
2007-08-28 23:02:54 +08:00
|
|
|
if (H5Funmount(fid1, "/B/M") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Close objects in mounted files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidBMZ) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMXMY) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMXX) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMX) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Close objects in original file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-06-08 13:22:28 +08:00
|
|
|
|
|
|
|
/* Close files */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid4) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-06-08 13:22:28 +08:00
|
|
|
/* Shut down */
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidZ);
|
|
|
|
H5Gclose(gidY);
|
|
|
|
H5Gclose(gidXX);
|
|
|
|
H5Gclose(gidXM);
|
|
|
|
H5Gclose(gidX);
|
|
|
|
H5Gclose(gidBMZ);
|
|
|
|
H5Gclose(gidBM);
|
|
|
|
H5Gclose(gidB);
|
|
|
|
H5Gclose(gidAMXMY);
|
|
|
|
H5Gclose(gidAMXX);
|
|
|
|
H5Gclose(gidAMX);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidA);
|
2005-06-08 13:22:28 +08:00
|
|
|
H5Fclose(fid4);
|
|
|
|
H5Fclose(fid3);
|
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-06-08 13:22:28 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-01 13:35:29 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_missing_unmount
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly closes open files when they
|
|
|
|
* have child files that have not been unmounted.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_missing_unmount(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-01 13:35:29 +08:00
|
|
|
TESTING("missing unmount");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-01 13:35:29 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Create file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid3, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 and file #3 in file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAE = H5Gopen2(fid2, "A/E", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidAE, ".", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAEM = H5Gopen2(fid3, "A/E/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Close file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* (Still have all file #2 & #3 mounted and groups open in all three files) */
|
|
|
|
|
|
|
|
/* Unmount file #2 & #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(gidAE, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Skip unmounting file #2 from file #1 */
|
|
|
|
|
|
|
|
/* Close groups in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAEM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-01 13:35:29 +08:00
|
|
|
|
|
|
|
/* Close group in top file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2005-07-01 13:35:29 +08:00
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidE);
|
|
|
|
H5Gclose(gidAEM);
|
|
|
|
H5Gclose(gidAE);
|
|
|
|
H5Gclose(gidA);
|
2005-07-01 13:35:29 +08:00
|
|
|
H5Fclose(fid3);
|
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-07-01 13:35:29 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_missing_unmount() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-06 05:58:50 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2005-07-17 00:33:15 +08:00
|
|
|
* Function: test_hold_open_file
|
2005-07-06 05:58:50 +08:00
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly holds open files when they
|
|
|
|
* have child files that have not been unmounted.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2005-07-17 00:33:15 +08:00
|
|
|
test_hold_open_file(hid_t fapl)
|
2005-07-06 05:58:50 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024]; /* Name of files to mount */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-17 00:33:15 +08:00
|
|
|
TESTING("hold open w/file");
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-06 05:58:50 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Attempt to open group in mounted file */
|
|
|
|
/* (Should work because file is still mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Attempt to open group in mounted file */
|
|
|
|
/* (Should work because file is still mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(gidA, "/A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Unmount file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(gidA, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
|
|
|
/* Close group in top file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-06 05:58:50 +08:00
|
|
|
|
2005-07-17 00:33:15 +08:00
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidA);
|
2005-07-17 00:33:15 +08:00
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-07-17 00:33:15 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_hold_open_file() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-17 00:33:15 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_hold_open_group
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly holds open file mount
|
|
|
|
* hierarchies when they have objects open.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_hold_open_group(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-17 00:33:15 +08:00
|
|
|
TESTING("hold open w/group");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-17 00:33:15 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Close group in parent file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Keep fid1 & gidAM open, everything else closed */
|
|
|
|
|
|
|
|
/* Retry to opening group in mounted file */
|
|
|
|
/* (Should work because file is still mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM2 = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Close original group in mount file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
|
|
|
/* Attempt to open group in mounted file */
|
|
|
|
/* (Should work because file is still mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM2 = H5Gopen2(fid1, "/A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Get ID of file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Iget_file_id(gidAM2)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2005-07-17 00:33:15 +08:00
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Attempt to open group in mounted file */
|
|
|
|
/* (Should work because file is still mounted) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM2 = H5Gopen2(fid2, "/A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Attempt to open group in parent file */
|
|
|
|
/* (Should work because files should be mounted together) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid = H5Gopen2(gidAM2, "/", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close group in parent file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-17 00:33:15 +08:00
|
|
|
|
2005-07-06 05:58:50 +08:00
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidAM2);
|
|
|
|
H5Gclose(gidA);
|
|
|
|
H5Gclose(gid);
|
2005-07-06 05:58:50 +08:00
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-07-06 05:58:50 +08:00
|
|
|
return 1;
|
2005-07-17 00:33:15 +08:00
|
|
|
} /* end test_hold_open_group() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_fcdegree_same
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library will only allow files with same file
|
|
|
|
* close degree to be mounted together.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_fcdegree_same(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024]; /* Name of files to mount */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
TESTING("file close degrees must be same");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create FAPL & set file close degree for file #2 to be different */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Set file close mode to H5F_CLOSE_STRONG */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Try mounting file with different file close degree (should fail) */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Fmount(gidA, ".", fid2, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (ret >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Set file close mode to H5F_CLOSE_WEAK */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_WEAK) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #2 & re-open with same file close degree as file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Try mounting files again (should work now) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Verify opening group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close group in parent file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close FAPL ID */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(fapl_id) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2005-07-21 22:48:26 +08:00
|
|
|
H5Pclose(fapl_id);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidA);
|
2005-07-21 22:48:26 +08:00
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-07-21 22:48:26 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_fcdegree_same() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_fcdegree_semi
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library perform correct actions when using
|
|
|
|
* "semi" file close degree on mounted files
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_fcdegree_semi(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024]; /* Name of files to mount */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
TESTING("'semi' file close degree");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create FAPL & set file close degree to be "semi" */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Set file close mode to H5F_CLOSE_SEMI */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Mount files together */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Verify opening group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #1 (should succeed, since file #2 is open still) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Try closing file #2 (should fail, since there are still objects open) */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Fclose(fid2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (ret >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close group in parent file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Try closing file #2 (should still fail, since there are still objects open in child file) */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Fclose(fid2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (ret >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #2 (should succeed now) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close FAPL ID */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(fapl_id) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2005-07-21 22:48:26 +08:00
|
|
|
H5Pclose(fapl_id);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidA);
|
2005-07-21 22:48:26 +08:00
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-07-21 22:48:26 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_fcdegree_semi() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_fcdegree_strong
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library perform correct actions when using
|
|
|
|
* "strong" file close degree on mounted files
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_fcdegree_strong(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-01-17 05:29:34 +08:00
|
|
|
H5O_info2_t oinfo;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[1024], filename2[1024]; /* Name of files to mount */
|
|
|
|
herr_t ret; /* Generic return value */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
TESTING("'strong' file close degree");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create FAPL & set file close degree to be "strong" */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Set file close mode to H5F_CLOSE_STRONG */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Mount files together */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Check that objects are still open */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #2 (should close open objects also) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Check that objects are closed */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (ret >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (ret >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close FAPL ID */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(fapl_id) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2005-07-21 22:48:26 +08:00
|
|
|
H5Pclose(fapl_id);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidA);
|
2005-07-21 22:48:26 +08:00
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-07-21 22:48:26 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_fcdegree_strong() */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_acc_perm
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly segregates operations in
|
|
|
|
* parts of mounted file hierarchy with files that have different
|
|
|
|
* R/W access permissions.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_acc_perm(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */
|
|
|
|
char filename1[1024], filename2[1024], filename3[1024]; /* Name of files to mount */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
TESTING("access permissions");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Get and verify file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fget_name(gidA, name, NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, filename1) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Get and verify file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, filename2) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Mount files together */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Get and verify file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fget_name(fid2, name, NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, filename2) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Get and verify file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fget_name(gidAM, name, NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, filename2) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Attempt to create objects in read only file (should fail) */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
bad_id = H5Gcreate2(gidAM, "Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (bad_id >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (bad_id >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Attempt to create objects in read/write file (should succeed) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidB = H5Gcreate2(fid2, "/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* (Note that this object should get created in the "hidden" group for "A" in parent file) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidC = H5Gcreate2(gidA, "C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidC) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Create file #3 (it will have R/W permissions) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Mount file #3 on file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Attempt to create objects in read/write file (should succeed) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMZ = H5Gcreate2(fid1, "/A/M/Z", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Get and verify file name */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fget_name(gidAMZ, name, NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, filename3) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close object in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMZ) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Attempt to create objects in read only file again (should fail) */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
bad_id = H5Gcreate2(fid1, "/A/L", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (bad_id >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close group in parent file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-07-21 22:48:26 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidAMZ);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidC);
|
|
|
|
H5Gclose(gidB);
|
|
|
|
H5Gclose(gidA);
|
2005-07-21 22:48:26 +08:00
|
|
|
H5Fclose(fid3);
|
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-07-21 22:48:26 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_acc_perm() */
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_mult_mount
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly handles mounting a file
|
|
|
|
* multiple times at different locations in the parent file(s)
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_mult_mount(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
TESTING("multiple mounts");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidN = H5Gcreate2(fid2, "N", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidN) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidS = H5Gcreate2(fid3, "S", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidS) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidT = H5Gcreate2(fid3, "T", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidB = H5Gopen2(fid1, "B", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount files together */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open file #3 again */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fopen(filename3, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #3 on file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-open file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3_2 = H5Freopen(fid3)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #3 on file #1 also */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidB, ".", fid3_2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #3 through file #2 mount path */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMT = H5Gopen2(fid1, "A/M/T", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidAMT, name, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, "/A/M/T") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create object in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidU = H5Gcreate2(gidAMT, "U", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidU) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #3 through file #1 mount path */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidBS = H5Gopen2(fid1, "B/S", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidBS, name, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, "/B/S") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-open object created in file #3 through file #1 mount path */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidU = H5Gopen2(gidBS, "/B/T/U", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidU) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close groups in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidBS) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close group in file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close groups in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #3 IDs */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3_2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidU);
|
|
|
|
H5Gclose(gidAMT);
|
|
|
|
H5Gclose(gidT);
|
|
|
|
H5Gclose(gidBS);
|
|
|
|
H5Gclose(gidS);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidN);
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidB);
|
|
|
|
H5Gclose(gidA);
|
2005-08-09 02:41:35 +08:00
|
|
|
H5Fclose(fid3_2);
|
|
|
|
H5Fclose(fid3);
|
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-08-09 02:41:35 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_mult_mount() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_nested_survive
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly handles unmounting & remounting
|
|
|
|
* a file with files mounted on it
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_nested_survive(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
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 */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
TESTING("nested mounts survive");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidS = H5Gcreate2(fid3, "S", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidS) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount files together */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open file #3 again */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #3 on file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidAM, ".", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #3 through file #1 mount path */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close group in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMS) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/A/M") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Unmount file #2 from file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(gidA, ".") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2006-11-25 12:10:32 +08:00
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidAM, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len != 0 || strcmp(name, "") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #3 through file #1 mount path (should fail) */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (gidAMS >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #3 through file #2 mount path */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidMS = H5Gopen2(fid2, "M/S", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidMS, name, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, "/M/S") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close group in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidMS) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-mount file #2 on file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #3 through file #1 mount path again */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Iget_name(gidAMS, name, (size_t)NAME_BUF_SIZE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(name, "/A/M/S") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close group in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAMS) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close group in file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidAM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close groups in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #3 IDs */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidAMS);
|
|
|
|
H5Gclose(gidMS);
|
|
|
|
H5Gclose(gidS);
|
|
|
|
H5Gclose(gidAM);
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidA);
|
2005-08-09 02:41:35 +08:00
|
|
|
H5Fclose(fid3);
|
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-08-09 02:41:35 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_nested_survive() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_close_parent
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly handles holding open a child
|
|
|
|
* file while unmounting & closing parent.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_close_parent(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
TESTING("close parent");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
/* Create file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid2, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-open files and mount file #2 in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount files together */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open group in mounted file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close group in file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close files #1 & #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Both underlying shared files should be open still */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(2);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the name of "M" is still defined */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/A/M") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Unmount file #2 from file #1, closing file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(gidM, "/A") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2006-11-04 12:35:54 +08:00
|
|
|
/* Check the name of "M" is defined in its file */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/M") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Just file #2's underlying shared file should be open still */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(1);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close group in file #2, letting file #2 close */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* All underlying shared file structs should be closed */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidA);
|
2005-08-09 02:41:35 +08:00
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-08-09 02:41:35 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_close_parent() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_cut_graph
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly handles cutting a graph of
|
|
|
|
* mounted files.
|
|
|
|
*
|
|
|
|
* Initial file mounting graph is built up to this:
|
|
|
|
*
|
|
|
|
* [1]
|
|
|
|
* / \
|
|
|
|
* / \
|
|
|
|
* "A" "B"
|
|
|
|
* / \
|
|
|
|
* / \
|
|
|
|
* [2] [3]
|
|
|
|
* / \ / \
|
|
|
|
* "D" "E" "H" "I"
|
|
|
|
* / \ / \
|
|
|
|
* [4] [5] [6] [7]
|
|
|
|
* | | | |
|
|
|
|
* "K" "M" "O" "Q"
|
|
|
|
*
|
|
|
|
* ( where [n] is a file in mounting hierarchy and "X" is a group
|
|
|
|
* in a file )
|
|
|
|
*
|
|
|
|
* Objects in file #5 & file #7 are opened and all other
|
|
|
|
* file & object IDs to the hierarchy are closed.
|
|
|
|
*
|
|
|
|
* Then file #2 is unmounted from file #1, which should make a
|
|
|
|
* small tree of files 2, 4 & 5 and a larger tree of files 1, 3,
|
|
|
|
* 6 & 7.
|
|
|
|
*
|
|
|
|
* Then, the object in file #5 is closed, which should release its
|
|
|
|
* small tree of files.
|
|
|
|
*
|
|
|
|
* Then, file #3 is unmounted from file #1, making it's tree
|
|
|
|
* only 3, 6 & 7.
|
|
|
|
*
|
|
|
|
* Then, the object in file #7 is closed, which should release the
|
|
|
|
* remaining small tree of files.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_cut_graph(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
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 */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
TESTING("cutting mount graph");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
|
|
|
h5_fixname(FILENAME[3], fapl, filename4, sizeof filename3);
|
|
|
|
h5_fixname(FILENAME[4], fapl, filename5, sizeof filename3);
|
|
|
|
h5_fixname(FILENAME[5], fapl, filename6, sizeof filename3);
|
|
|
|
h5_fixname(FILENAME[6], fapl, filename7, sizeof filename3);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
/* Create file #1 & it's groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #2 & it's groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidD = H5Gcreate2(fid2, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidD) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #3 & it's groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidH = H5Gcreate2(fid3, "H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidH) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidI = H5Gcreate2(fid3, "I", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidI) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #4 & it's group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidK = H5Gcreate2(fid4, "K", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidK) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid4) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #5 & it's group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid5 = H5Fcreate(filename5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gcreate2(fid5, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid5) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #6 & it's group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid6 = H5Fcreate(filename6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidO = H5Gcreate2(fid6, "O", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidO) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid6) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #7 & it's group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid7 = H5Fcreate(filename7, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidQ = H5Gcreate2(fid7, "Q", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidQ) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid7) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-open files and build mount hierarchy */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #2 at /A */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/A", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #3 at /B */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/B", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #4 at /A/D */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid4 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/A/D", fid4, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid4) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #5 at /A/E */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid5 = H5Fopen(filename5, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/A/E", fid5, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid5) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #6 at /B/H */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid6 = H5Fopen(filename6, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/B/H", fid6, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid6) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #7 at /B/H */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid7 = H5Fopen(filename7, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/B/I", fid7, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid7) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #5 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidM = H5Gopen2(fid1, "A/E/M", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/A/E/M") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #7 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidQ = H5Gopen2(fid1, "B/I/Q", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check name */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/B/I/Q") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Get a new file ID for file #5 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid5 = H5Iget_file_id(gidM)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the number of objects currently open */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((obj_count = H5Fget_obj_count(fid5, H5F_OBJ_ALL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (obj_count != 2) /* one object and the file ID */
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close ID on file #5 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid5) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Get a new file ID for file #7 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid7 = H5Iget_file_id(gidQ)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the number of objects currently open */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((obj_count = H5Fget_obj_count(fid7, H5F_OBJ_ALL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (obj_count != 2) /* one object and the file ID */
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close ID on file #7 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid7) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Unmount file #2 from file #1, cutting the graph */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(gidM, "/A") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Attempt to open an object in file #4, from file #1 */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
gidK = H5Gopen2(gidQ, "/A/D/K", H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (gidK >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #4 from file #5 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidK = H5Gopen2(gidM, "/D/K", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the name of "K" is correct */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidK, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/D/K") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidK) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Attempt to open an object in file #6, from file #5 */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
gidO = H5Gopen2(gidM, "/B/H/O", H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (gidO >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #6 from file #7 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidO = H5Gopen2(gidQ, "/B/H/O", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the name of "O" is correct */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/B/H/O") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidO) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2006-11-04 12:35:54 +08:00
|
|
|
/* Check the name of "M" is defined in its file */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidM, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/E/M") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the name of "Q" is still defined */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/B/I/Q") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check that all seven underlying files are still opened */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(7);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close "M" in file #5, which should close files 2, 4 & 5 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidM) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check that only four underlying files are still opened */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(4);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Unmount file #3 from file #1, cutting the graph */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(gidQ, "/B") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check that only three underlying files are still opened */
|
|
|
|
/* (File #1 should close after being cut off from the graph) */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(3);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2006-11-04 12:35:54 +08:00
|
|
|
/* Check the name of "Q" is defined in its file */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidQ, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/I/Q") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open object in file #6 from file #7 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidO = H5Gopen2(gidQ, "/H/O", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the name of "O" is correct */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidO, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/H/O") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidO) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close last object and let files 3, 6 & 7 close */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidQ) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Verify that all underlying shared files have been closed now */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidQ);
|
|
|
|
H5Gclose(gidO);
|
|
|
|
H5Gclose(gidM);
|
|
|
|
H5Gclose(gidK);
|
|
|
|
H5Gclose(gidI);
|
|
|
|
H5Gclose(gidH);
|
|
|
|
H5Gclose(gidE);
|
|
|
|
H5Gclose(gidD);
|
|
|
|
H5Gclose(gidB);
|
|
|
|
H5Gclose(gidA);
|
2005-08-09 02:41:35 +08:00
|
|
|
H5Fclose(fid7);
|
|
|
|
H5Fclose(fid6);
|
|
|
|
H5Fclose(fid5);
|
|
|
|
H5Fclose(fid4);
|
|
|
|
H5Fclose(fid3);
|
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-08-09 02:41:35 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_cut_graph() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_symlink
|
|
|
|
*
|
|
|
|
* Purpose: Test that the library correctly handles symlinks across
|
|
|
|
* mounted files.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_symlink(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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 */
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
|
|
|
|
filename3[NAME_BUF_SIZE]; /* Name of files to mount */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
TESTING("symlinks");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-08-09 02:41:35 +08:00
|
|
|
/* Create file #1 & it's groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidA) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidB = H5Gcreate2(fid1, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidB) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create soft link to mounted object */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Lcreate_soft("./A/D/H", fid1, "L", H5P_DEFAULT, H5P_DEFAULT) < 0) /* Soft link */
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #2 & it's groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidD = H5Gcreate2(fid2, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidD) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidE = H5Gcreate2(fid2, "E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Create file #3 & it's groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidH = H5Gcreate2(fid3, "H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidH) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidI = H5Gcreate2(fid3, "I", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidI) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Re-open files and build mount hierarchy */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #2 at /A */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/A", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Attempt to open an object in file #3 (should fail) */
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
gidL = H5Gopen2(fid1, "L", H5P_DEFAULT);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (gidL >= 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Mount file #3 at /A/D */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "/A/D", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Open soft link to object in file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gidL = H5Gopen2(fid1, "L", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Check the name of "L" is correct */
|
[svn-r14284] Description:
Add H5Lvisit_by_name() API routine to library.
Eliminated all (five!) other group traversal routines and changed them
all to use the new API routine.
Cleaned up output of h5ls & h5stat:
- Issue error when requesting recursive traversal of a file
with the "group info" flag, but no group given
- Print info about root group in all(?) appropriate situations
- Don't print "verbose" information about root group until the
root group is in the list of objects to display
(mostly because h5ls & h5stat had a different twist on traversing the
groups in a file that the other utilities)
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2007-11-25 00:49:36 +08:00
|
|
|
*name = '\0';
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((name_len = H5Iget_name(gidL, name, (size_t)NAME_BUF_SIZE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2023-09-16 06:13:18 +08:00
|
|
|
if (name_len == 0 || strcmp(name, "/L") != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Verify that all 3 underlying shared files are still open */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(3);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Close object opened through soft link */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gidL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
/* Verify that all underlying shared files have been closed now */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2005-08-09 02:41:35 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gidL);
|
|
|
|
H5Gclose(gidI);
|
|
|
|
H5Gclose(gidH);
|
|
|
|
H5Gclose(gidE);
|
|
|
|
H5Gclose(gidD);
|
|
|
|
H5Gclose(gidB);
|
|
|
|
H5Gclose(gidA);
|
2005-08-09 02:41:35 +08:00
|
|
|
H5Fclose(fid3);
|
|
|
|
H5Fclose(fid2);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(fid1);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2005-08-09 02:41:35 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_symlink() */
|
|
|
|
|
2008-08-08 05:49:05 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_sharedacc
|
|
|
|
*
|
|
|
|
* Purpose: Test shared access to a file's mount table.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
static int
|
2008-08-08 05:49:05 +08:00
|
|
|
test_sharedacc(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
|
|
|
|
filename3[NAME_BUF_SIZE]; /* Name of files to mount */
|
|
|
|
int i, j, k; /* Counters */
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
TESTING("shared mount access");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
|
|
|
|
|
|
|
/* Create file #1 & its group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1[0] = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid = H5Gcreate2(fid1[0], "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Create file #2 & its group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2[0] = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid = H5Gcreate2(fid2[0], "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Test mount before reopen, then using reopened handle for access */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1[0], "/A", fid2[0], H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1[1] = H5Freopen(fid1[0])) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2[1] = H5Freopen(fid2[0])) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid = H5Gopen2(fid1[1], "/A/B", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(fid1[1], "/A") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* "Brute force" test of all possible ways of mounting, accessing, and
|
|
|
|
* unmounting files with multiple handles (mount after reopen) */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
for (k = 0; k < 2; k++) {
|
|
|
|
if (H5Fmount(fid1[i], "/A", fid2[j], H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid = H5Gopen2(fid1[k], "/A/B", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(fid1[k], "/A") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Close file IDs */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
if (H5Fclose(fid1[i]) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2[i]) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gid);
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
H5Fclose(fid1[i]);
|
|
|
|
H5Fclose(fid2[i]);
|
|
|
|
}
|
2008-08-08 05:49:05 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2008-08-08 05:49:05 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_sharedacc() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_sharedclose
|
|
|
|
*
|
|
|
|
* Purpose: Test that files within a shared mount structure are properly
|
|
|
|
* closed.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
static int
|
2008-08-08 05:49:05 +08:00
|
|
|
test_sharedclose(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE],
|
|
|
|
filename3[NAME_BUF_SIZE]; /* Name of files to mount */
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
TESTING("closing shared mounts");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
|
|
|
|
|
|
|
/* Create file #1a & its group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid1 = H5Gcreate2(fid1a, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Create file #1b & its groups */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1b = H5Freopen(fid1a)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid2 = H5Gcreate2(fid1b, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid3 = H5Gcreate2(fid1b, "B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Create file #3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Mount file #2 to file #1a */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gid1, ".", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Mount file #3 to file #1b */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(gid2, ".", fid3, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Close file #1b. It should be held open by the groups in it. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1b) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Close file #3. It should be held open by the groups in its parent. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Close group B in file #1b. This should not close file #1b and #3. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Check that file #3 is still open */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(3);
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Close group B/C in file #1b. This should close file #1b and #3. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Check that file #3 has been closed */
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(2);
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Unmount file 2 and close the rest of the handles */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(fid1a, "A") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1a) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Create file #1 & its group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1a = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid1 = H5Gcreate2(fid1a, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Create file #1b & its group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1b = H5Freopen(fid1a)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid2 = H5Gcreate2(fid1b, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Create file #2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Mount file #2 to file #1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1a, "A", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Close file #1b. It should be held open by the group in it. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1b) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Close the group in file #1b. This should close file # 1b. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Unmount file 2 and close the rest of the handles */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Funmount(fid1a, "A") < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(gid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1a) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2008-08-08 05:49:05 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gid1);
|
|
|
|
H5Gclose(gid2);
|
|
|
|
H5Gclose(gid3);
|
|
|
|
H5Fclose(fid1a);
|
|
|
|
H5Fclose(fid1b);
|
|
|
|
H5Fclose(fid2);
|
|
|
|
H5Fclose(fid3);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2008-08-08 05:49:05 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_sharedclose() */
|
|
|
|
|
2008-11-18 02:48:37 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_multisharedclose
|
|
|
|
*
|
|
|
|
* Purpose: Test that multiple files mounted to a shared mount structure
|
|
|
|
* can be properly closed by closing the groups holding them open.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
static int
|
2008-11-18 02:48:37 +08:00
|
|
|
test_multisharedclose(hid_t fapl)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
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;
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE],
|
|
|
|
filename4[NAME_BUF_SIZE]; /* Name of files to mount */
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
TESTING("closing multiple shared mounts");
|
|
|
|
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
|
|
|
|
h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
|
|
|
|
h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3);
|
|
|
|
h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4);
|
|
|
|
|
|
|
|
/* Create master file with three groups to serve as mount points */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(fid1, "mnt1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(fid1, "mnt2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(fid1, "mnt3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Create child file with group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Create child file with group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Create child file with group */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Gclose(H5Gcreate2(fid1, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Open master and child 1 and mount child 1 to master */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "mnt1", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Open the group in child 1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid1 = H5Gopen2(fid1, "mnt1/grp", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Close both files. They will be held open by gid1 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Open master and child 2 and mount child 2 to master */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "mnt2", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Open the group in child 2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid2 = H5Gopen2(fid1, "mnt2/grp", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Close both files. They will be held open by gid2 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Open master and child 3 and mount child 3 to master */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid1 = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fid2 = H5Fopen(filename3, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fmount(fid1, "mnt3", fid2, H5P_DEFAULT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Open the group in child 3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((gid3 = H5Gopen2(fid1, "mnt3/grp", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Close both files. They will be held open by gid3 */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(fid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(fid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Close gid1. This will close child 1. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(gid1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Close gid2. This will close child 2. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(gid2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Close gid3. This will close child 3 and the master file. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Idec_ref(gid3) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
/* Check that all file IDs have been closed */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5I_nmembers(H5I_FILE) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2012-10-18 02:41:42 +08:00
|
|
|
H5F_sfile_assert_num(0);
|
2008-11-18 02:48:37 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Gclose(gid1);
|
|
|
|
H5Gclose(gid2);
|
|
|
|
H5Gclose(gid3);
|
|
|
|
H5Fclose(fid2);
|
|
|
|
H5Fclose(fid2);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2008-11-18 02:48:37 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_multisharedclose() */
|
|
|
|
|
1998-10-15 03:35:08 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: main
|
|
|
|
*
|
|
|
|
* Purpose: Test file mounting
|
|
|
|
*
|
|
|
|
* Return: Success: zero
|
|
|
|
*
|
|
|
|
* Failure: non-zero
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
int nerrors = 0;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fapl = H5I_INVALID_HID;
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
|
2024-06-21 05:01:43 +08:00
|
|
|
h5_test_init();
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
fapl = h5_fileaccess();
|
2020-09-30 22:27:10 +08:00
|
|
|
if (setup(fapl) < 0)
|
|
|
|
goto error;
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
|
|
|
|
nerrors += test_basic(fapl);
|
|
|
|
nerrors += test_illegal(fapl);
|
|
|
|
nerrors += test_samefile(fapl);
|
|
|
|
nerrors += test_hide(fapl);
|
|
|
|
nerrors += test_assoc(fapl);
|
|
|
|
nerrors += test_mntlnk(fapl);
|
|
|
|
nerrors += test_unlink(fapl);
|
|
|
|
nerrors += test_move(fapl);
|
|
|
|
nerrors += test_mvmpt(fapl);
|
|
|
|
nerrors += test_preopen(fapl);
|
|
|
|
nerrors += test_postopen(fapl);
|
|
|
|
nerrors += test_interlink(fapl);
|
|
|
|
nerrors += test_uniformity(fapl);
|
|
|
|
nerrors += test_close(fapl);
|
|
|
|
nerrors += test_mount_after_close(fapl);
|
|
|
|
nerrors += test_mount_after_unmount(fapl);
|
|
|
|
nerrors += test_missing_unmount(fapl);
|
|
|
|
nerrors += test_hold_open_file(fapl);
|
|
|
|
nerrors += test_hold_open_group(fapl);
|
|
|
|
nerrors += test_fcdegree_same(fapl);
|
|
|
|
nerrors += test_fcdegree_semi(fapl);
|
|
|
|
nerrors += test_fcdegree_strong(fapl);
|
|
|
|
nerrors += test_acc_perm(fapl);
|
|
|
|
nerrors += test_mult_mount(fapl);
|
|
|
|
nerrors += test_nested_survive(fapl);
|
|
|
|
nerrors += test_close_parent(fapl);
|
|
|
|
nerrors += test_cut_graph(fapl);
|
|
|
|
nerrors += test_symlink(fapl);
|
|
|
|
nerrors += test_sharedacc(fapl);
|
|
|
|
nerrors += test_sharedclose(fapl);
|
2008-11-18 02:48:37 +08:00
|
|
|
nerrors += test_multisharedclose(fapl);
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
|
2011-04-16 06:05:23 +08:00
|
|
|
/* Verify symbol table messages are cached */
|
|
|
|
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (nerrors)
|
|
|
|
goto error;
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
|
2023-09-16 06:13:18 +08:00
|
|
|
puts("All mount tests passed.");
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
h5_cleanup(FILENAME, fapl);
|
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
return 0;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
error:
|
2023-09-16 06:13:18 +08:00
|
|
|
puts("***** MOUNT ERRORS *****");
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
return 1;
|
1998-10-15 03:35:08 +08:00
|
|
|
}
|