summaryrefslogtreecommitdiffstats
path: root/test/mount.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-11-23 20:40:35 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-11-23 20:40:35 (GMT)
commitdedc8c37b4fd21a657313a6ecd43318fa4b0fa5c (patch)
treec7ba6d465bfe7ccf19bbac452d81d40358f9241b /test/mount.c
parentae8f25bd43666b75275f6cb9e2bf0c084f8cea5e (diff)
downloadhdf5-dedc8c37b4fd21a657313a6ecd43318fa4b0fa5c.zip
hdf5-dedc8c37b4fd21a657313a6ecd43318fa4b0fa5c.tar.gz
hdf5-dedc8c37b4fd21a657313a6ecd43318fa4b0fa5c.tar.bz2
[svn-r944] Changes since 19981120
---------------------- ./MANIFEST ./test/Makefile.in ./test/shtype.c [REMOVED] Removed shtype.c because it was all commented out. Besides, these tests are done in dtypes.c now anyway. ./test/external.c ./test/fillval.c ./test/flush1.c ./test/flush2.c ./test/links.c ./test/mount.c ./test/mtime.c ./test/unlink.c The tests that check the HDF5 API use the h5test support functions. For one thing, that means that you can specify the file driver that thay use by the HDF5_DRIVER environment variable. Possible values are: HDF5_DRIVER='sec2' Use read() and write() HDF5_DRIVER='stdio' Use fread() and fwrite() HDF5_DRIVER='core' Use malloc() and free() HDF5_DRIVER='split' Split meta and raw data HDF5_DRIVER='family N' Use file families with each member being N megabytes (N can be fractional, defaults to one). Some tests might fail for certain drivers: for instance, the mount and link tests fail for the `core' driver because they must be able to close and then reopen a file.
Diffstat (limited to 'test/mount.c')
-rw-r--r--test/mount.c390
1 files changed, 180 insertions, 210 deletions
diff --git a/test/mount.c b/test/mount.c
index 1acd1e7..e5887a0 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -7,79 +7,14 @@
*
* Purpose: Tests file mounting.
*/
+#include <h5test.h>
-/* See H5private.h for how to include headers */
-#undef NDEBUG
-#include <hdf5.h>
-
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-#endif
-
-#define FALSE 0
-#define TRUE 1
-
-#define FILE_NAME_1 "mount_1.h5"
-#define FILE_NAME_2 "mount_2.h5"
-#define FILE_NAME_3 "mount_3.h5"
-
-#ifndef HAVE_ATTRIBUTE
-# undef __attribute__
-# define __attribute__(X) /*void*/
-# define __unused__ /*void*/
-#else
-# define __unused__ __attribute__((unused))
-#endif
-
-
-/*-------------------------------------------------------------------------
- * Function: cleanup
- *
- * Purpose: Removes test files
- *
- * Return: void
- *
- * Programmer: Robb Matzke
- * Thursday, June 4, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static void
-cleanup(void)
-{
- if (!getenv("HDF5_NOCLEANUP")) {
- remove(FILE_NAME_1);
- remove(FILE_NAME_2);
- remove(FILE_NAME_3);
- }
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: display_error_cb
- *
- * Purpose: Displays the error stack after printing "*FAILED*".
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, March 4, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-display_error_cb(void __unused__ *client_data)
-{
- puts("*FAILED*");
- H5Eprint(stdout);
- return 0;
-}
+const char *FILENAME[] = {
+ "mount_1",
+ "mount_2",
+ "mount_3",
+ NULL
+};
/*-------------------------------------------------------------------------
@@ -99,13 +34,15 @@ display_error_cb(void __unused__ *client_data)
*-------------------------------------------------------------------------
*/
static int
-setup(void)
+setup(hid_t fapl)
{
hid_t file=-1;
+ char filename[1024];
/* file 1 */
- if ((file=H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT))<0) goto error;
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ goto error;
if (H5Gclose(H5Gcreate(file, "/mnt1", 0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/mnt1/file1", 0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/mnt_unlink", 0))<0) goto error;
@@ -115,8 +52,9 @@ setup(void)
if (H5Fclose(file)<0) goto error;
/* file 2 */
- if ((file=H5Fcreate(FILE_NAME_2, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT))<0) goto error;
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ goto error;
if (H5Gclose(H5Gcreate(file, "/file2", 0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/rename_a", 0))<0) goto error;
if (H5Gclose(H5Gcreate(file, "/rename_b", 0))<0) goto error;
@@ -124,8 +62,9 @@ setup(void)
if (H5Fclose(file)<0) goto error;
/* file 3 */
- if ((file=H5Fcreate(FILE_NAME_3, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT))<0) goto error;
+ h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ goto error;
if (H5Fclose(file)<0) goto error;
return 0;
@@ -156,15 +95,17 @@ setup(void)
*-------------------------------------------------------------------------
*/
static int
-test_basic(void)
+test_basic(hid_t fapl)
{
hid_t file1=-1, file2=-1, grp=-1;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing basic functionality");
- fflush(stdout);
+ TESTING("basic functionality");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDONLY, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
if ((grp=H5Gopen(file1, "/mnt1/file2"))<0) goto error;
@@ -173,7 +114,7 @@ test_basic(void)
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -203,18 +144,22 @@ test_basic(void)
*-------------------------------------------------------------------------
*/
static int
-test_illegal(void)
+test_illegal(hid_t fapl)
{
hid_t file1=-1, file2=-1, file3=-1, mnt=-1;
herr_t status;
+ char filename1[1024], filename2[1024], filename3[1024];
- printf("%-70s", "Testing illegal mount operations");
- fflush(stdout);
+ 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);
+
/* Open the files */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file3=H5Fopen(FILE_NAME_3, H5F_ACC_RDONLY, H5P_DEFAULT))<0)
+ 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)
goto error;
/* Try mounting a file on itself */
@@ -222,8 +167,8 @@ test_illegal(void)
status = H5Fmount(file1, "/mnt1", file1, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Mounting a file on itself should have failed.");
+ FAILED();
+ puts(" Mounting a file on itself should have failed.");
goto error;
}
@@ -238,8 +183,8 @@ test_illegal(void)
status = H5Fmount(mnt, ".", file3, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Mounting two files at one mount point should have failed.");
+ FAILED();
+ puts(" Mounting two files at one mount point should have failed.");
goto error;
}
if (H5Funmount(mnt, ".")<0) goto error;
@@ -250,7 +195,7 @@ test_illegal(void)
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
if (H5Fclose(file3)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -283,16 +228,18 @@ test_illegal(void)
*-------------------------------------------------------------------------
*/
static int
-test_hide(void)
+test_hide(hid_t fapl)
{
hid_t file1=-1, file2=-1, grp=-1;
H5G_stat_t sb1, sb2;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing name hiding under mount point");
- fflush(stdout);
+ TESTING("name hiding under mount point");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDONLY, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0)
goto error;
/* Get information about file1:/mnt1/file1 for later */
@@ -306,8 +253,8 @@ test_hide(void)
grp = H5Gopen(file1, "/mnt1/file1");
} H5E_END_TRY;
if (grp>=0) {
- puts("*FAILED*");
- puts(" Name is still accessible under mount point.");
+ FAILED();
+ puts(" Name is still accessible under mount point.");
goto error;
}
@@ -318,8 +265,8 @@ test_hide(void)
if (H5Gget_objinfo(file1, "/file1", TRUE, &sb2)<0) goto error;
if (sb1.fileno[0]!=sb2.fileno[0] || sb1.fileno[1]!=sb2.fileno[1] ||
sb1.objno[0]!=sb2.objno[0] || sb1.objno[1]!=sb2.objno[1]) {
- puts("*FAILED*");
- puts(" Hard link failed for hidden object.");
+ FAILED();
+ puts(" Hard link failed for hidden object.");
goto error;
}
@@ -327,7 +274,7 @@ test_hide(void)
if (H5Funmount(file1, "/mnt1")<0) goto error;
H5Fclose(file1);
H5Fclose(file2);
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -358,17 +305,19 @@ test_hide(void)
*-------------------------------------------------------------------------
*/
static int
-test_assoc(void)
+test_assoc(hid_t fapl)
{
hid_t file1=-1, file2=-1;
H5G_stat_t sb1, sb2;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing mount point open");
- fflush(stdout);
+ TESTING("mount point open");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Open the files */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDONLY, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0)
goto error;
/* Get information about the root of file2 */
@@ -384,8 +333,8 @@ test_assoc(void)
if (H5Gget_objinfo(file1, "/mnt1", TRUE, &sb2)<0) goto error;
if (sb1.fileno[0]!=sb2.fileno[0] || sb1.fileno[1]!=sb2.fileno[1] ||
sb1.objno[0]!=sb2.objno[0] || sb1.objno[1]!=sb2.objno[1]) {
- puts("*FAILED*");
- puts(" Association failed.");
+ FAILED();
+ puts(" Association failed.");
goto error;
}
@@ -393,7 +342,7 @@ test_assoc(void)
if (H5Funmount(file1, "/mnt1_link")<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -424,16 +373,19 @@ test_assoc(void)
*-------------------------------------------------------------------------
*/
static int
-test_mntlnk(void)
+test_mntlnk(hid_t fapl)
{
hid_t file1=-1, file2=-1, grp=-1;
+ char filename1[1024], filename2[1024];
+
+ TESTING("multi-linked mount point");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
- printf("%-70s", "Testing multi-linked mount point");
- fflush(stdout);
/* Build the virtual file */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDONLY, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
@@ -450,7 +402,7 @@ test_mntlnk(void)
if (H5Funmount(file1, "/mnt1_link")<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -482,17 +434,19 @@ test_mntlnk(void)
*-------------------------------------------------------------------------
*/
static int
-test_move(void)
+test_move(hid_t fapl)
{
hid_t file1=-1, file2=-1;
herr_t status;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing object renaming");
- fflush(stdout);
+ TESTING("object renaming");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
@@ -502,8 +456,8 @@ test_move(void)
status = H5Gmove(file1, "/mnt1/rename_b/y", "/y");
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Moving an object across files should not have been possible");
+ FAILED();
+ puts(" Moving an object across files should't have been possible");
goto error;
}
@@ -511,7 +465,7 @@ test_move(void)
if (H5Funmount(file1, "/mnt1")<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -541,15 +495,17 @@ test_move(void)
*-------------------------------------------------------------------------
*/
static int
-test_preopen(void)
+test_preopen(hid_t fapl)
{
hid_t file1=-1, file2=-1, grp=-1;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing preopening objects under the mount point");
- fflush(stdout);
+ TESTING("preopening objects under the mount point");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDONLY, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0)
goto error;
/* Open something under the mount point */
@@ -566,7 +522,7 @@ test_preopen(void)
if (H5Gclose(grp)<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -598,17 +554,19 @@ test_preopen(void)
*-------------------------------------------------------------------------
*/
static int
-test_postopen(void)
+test_postopen(hid_t fapl)
{
hid_t file1=-1, file2=-1, grp=-1;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing open object access after unmount");
- fflush(stdout);
+ TESTING("open object access after unmount");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Create the virtual file */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDONLY, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDONLY, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
@@ -628,7 +586,7 @@ test_postopen(void)
if (H5Gclose(grp)<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -660,17 +618,19 @@ test_postopen(void)
*-------------------------------------------------------------------------
*/
static int
-test_unlink(void)
+test_unlink(hid_t fapl)
{
hid_t file1=-1, file2=-1, mnt=-1, root=-1;
herr_t status;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing mount point unlinking");
- fflush(stdout);
+ TESTING("mount point unlinking");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Open files */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0)
goto error;
/*
@@ -696,8 +656,8 @@ test_unlink(void)
status = H5Gget_objinfo(mnt, "file2", TRUE, NULL);
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Incorrect traversal from mount point!");
+ FAILED();
+ puts(" Incorrect traversal from mount point!");
goto error;
}
@@ -713,16 +673,16 @@ test_unlink(void)
status = H5Gget_objinfo(mnt, "file2", TRUE, NULL);
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Traversal through mount point should not have worked!");
+ FAILED();
+ puts(" Traversal through mount point should not have worked!");
goto error;
}
H5E_BEGIN_TRY {
status = H5Gget_objinfo(file2, "/mnt_unlink/file2", TRUE, NULL);
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Traversal through mount point should not have worked!");
+ FAILED();
+ puts(" Traversal through mount point should not have worked!");
goto error;
}
@@ -735,16 +695,16 @@ test_unlink(void)
status = H5Funmount(file1, "/mnt_unlink");
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Unmount by name should not have been allowed!");
+ FAILED();
+ puts(" Unmount by name should not have been allowed!");
goto error;
}
H5E_BEGIN_TRY {
status = H5Funmount(file2, "/");
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Unmount by name should not have been allowed!");
+ FAILED();
+ puts(" Unmount by name should not have been allowed!");
goto error;
}
if (H5Funmount(mnt, ".")<0) goto error;
@@ -754,7 +714,7 @@ test_unlink(void)
if (H5Gclose(root)<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -785,16 +745,18 @@ test_unlink(void)
*-------------------------------------------------------------------------
*/
static int
-test_mvmpt(void)
+test_mvmpt(hid_t fapl)
{
hid_t file1=-1, file2=-1;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing mount point renaming");
- fflush(stdout);
+ TESTING("mount point renaming");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT)<0) goto error;
@@ -808,7 +770,7 @@ test_mvmpt(void)
if (H5Funmount(file1, "/mnt_move_b")<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -837,18 +799,20 @@ test_mvmpt(void)
*-------------------------------------------------------------------------
*/
static int
-test_interlink(void)
+test_interlink(hid_t fapl)
{
hid_t file1=-1, file2=-1, type=-1, space=-1, dset=-1;
+ char filename1[1024], filename2[1024];
herr_t status;
hsize_t cur_dims[1] = {2};
- printf("%-70s", "Testing interfile hard links");
- fflush(stdout);
+ TESTING("interfile hard links");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
@@ -857,8 +821,8 @@ test_interlink(void)
status = H5Glink(file1, H5G_LINK_HARD, "/mnt1/file2", "/file2");
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Interfile hard link should not have been allowed!");
+ FAILED();
+ puts(" Interfile hard link should not have been allowed!");
goto error;
}
@@ -867,8 +831,8 @@ test_interlink(void)
status = H5Gmove(file1, "/mnt1/file2", "/file2");
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" Interfile renaming should not have been allowed!");
+ FAILED();
+ puts(" Interfile renaming should not have been allowed!");
goto error;
}
@@ -880,8 +844,8 @@ test_interlink(void)
dset = H5Dcreate(file1, "/mnt1/file2/dset", type, space, H5P_DEFAULT);
} H5E_END_TRY;
if (dset>=0) {
- puts("*FAILED*");
- puts(" Dataset and shared type must be in the same file!");
+ FAILED();
+ puts(" Dataset and shared type must be in the same file!");
goto error;
}
@@ -891,7 +855,7 @@ test_interlink(void)
if (H5Funmount(file1, "/mnt1")<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -924,16 +888,18 @@ test_interlink(void)
*-------------------------------------------------------------------------
*/
static int
-test_uniformity(void)
+test_uniformity(hid_t fapl)
{
hid_t file1=-1, file2=-1;
+ char filename1[1024], filename2[1024];
- printf("%-70s", "Testing file handle uniformity");
- fflush(stdout);
+ TESTING("file handle uniformity");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
@@ -955,7 +921,7 @@ test_uniformity(void)
if (H5Funmount(file1, "/mnt1")<0) goto error;
if (H5Fclose(file1)<0) goto error;
if (H5Fclose(file2)<0) goto error;
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -984,17 +950,19 @@ test_uniformity(void)
*-------------------------------------------------------------------------
*/
static int
-test_close(void)
+test_close(hid_t fapl)
{
hid_t file1=-1, file2=-1;
+ char filename1[1024], filename2[1024];
herr_t status;
- printf("%-70s", "Testing file handle close");
- fflush(stdout);
+ TESTING("file handle close");
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
/* Build the virtual file */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
@@ -1008,15 +976,15 @@ test_close(void)
status = H5Gget_objinfo(file2, "/mnt1", TRUE, NULL);
} H5E_END_TRY;
if (status>=0) {
- puts("*FAILED*");
- puts(" File1 contents are still accessible!");
+ FAILED();
+ puts(" File1 contents are still accessible!");
goto error;
}
if (H5Fclose(file2)<0) goto error;
/* Build the virtual file again */
- if ((file1=H5Fopen(FILE_NAME_1, H5F_ACC_RDWR, H5P_DEFAULT))<0 ||
- (file2=H5Fopen(FILE_NAME_2, H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 ||
+ (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0)
goto error;
if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error;
@@ -1028,7 +996,7 @@ test_close(void)
if (H5Fclose(file1)<0) goto error;
/* Shut down */
- puts(" PASSED");
+ PASSED();
return 0;
error:
@@ -1061,30 +1029,32 @@ int
main(void)
{
int nerrors = 0;
-
- H5Eset_auto(display_error_cb, NULL);
- if (setup()<0) goto error;
-
- nerrors += test_basic();
- nerrors += test_illegal();
- nerrors += test_hide();
- nerrors += test_assoc();
- nerrors += test_mntlnk();
- nerrors += test_unlink();
- nerrors += test_move();
- nerrors += test_mvmpt();
- nerrors += test_preopen();
- nerrors += test_postopen();
- nerrors += test_interlink();
- nerrors += test_uniformity();
- nerrors += test_close();
+ hid_t fapl = -1;
+
+ h5_reset();
+ fapl = h5_fileaccess();
+ if (setup(fapl)<0) goto error;
+
+ nerrors += test_basic(fapl);
+ nerrors += test_illegal(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);
if (nerrors) goto error;
puts("All mount tests passed.");
- cleanup();
- return(0);
+ h5_cleanup(fapl);
+ return 0;
error:
puts("***** MOUNT ERRORS *****");
- return(1);
+ return 1;
}