From 1dc74b6177e2b5b7245a3146d13876954e8f80f9 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Fri, 9 Nov 2007 14:57:00 -0500 Subject: [PATCH] [svn-r14245] Minor change: the test for opening external link twice doesn't work with MULTI driver. Skip the test if it is. --- test/external.c | 82 +++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/test/external.c b/test/external.c index fa29428642..e1c5da73de 100644 --- a/test/external.c +++ b/test/external.c @@ -821,7 +821,8 @@ test_3 (hid_t fapl) * Function: test_4 * * Purpose: Tests opening an external link twice. It exposed a bug - * in the library. This function tests the fix. + * in the library. This function tests the fix. This test + * doesn't work with MULTI driver. * * Return: Success: 0 * @@ -842,57 +843,66 @@ test_4 (hid_t fapl) char pathname[1024]; char linked_pathname[1024]; char *srcdir = getenv("srcdir"); /*where the src code is located*/ + const char *envval = NULL; TESTING("opening external link twice"); - h5_fixname(FILENAME[3], fapl, filename, sizeof filename); + /* Don't run this test using the multi file driver */ + envval = HDgetenv("HDF5_DRIVER"); + if (envval == NULL) + envval = "nomatch"; + if (HDstrcmp(envval, "multi")) { + h5_fixname(FILENAME[3], fapl, filename, sizeof filename); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) - goto error; + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + goto error; - pathname[0] = '\0'; - /* Generate correct name for test file by prepending the source path */ - if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) { - HDstrcpy(pathname, srcdir); - HDstrcat(pathname, "/"); - } - HDstrcat(pathname, LINKED_FILE); + pathname[0] = '\0'; + /* Generate correct name for test file by prepending the source path */ + if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) { + HDstrcpy(pathname, srcdir); + HDstrcat(pathname, "/"); + } + HDstrcat(pathname, LINKED_FILE); - /* Create an external link to an existing file*/ - if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; + /* Create an external link to an existing file*/ + if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; - if(H5Gclose(gid) < 0) - goto error; + if(H5Gclose(gid) < 0) + goto error; - if(H5Fclose(fid) < 0) - goto error; + if(H5Fclose(fid) < 0) + goto error; - /* Reopen the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - goto error; + /* Reopen the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + goto error; - /* Open the external link */ - if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0) - goto error; + /* Open the external link */ + if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0) + goto error; - /* Open the external link twice */ - if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0) - goto error; + /* Open the external link twice */ + if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0) + goto error; - if(H5Gclose(xid2) < 0) - goto error; + if(H5Gclose(xid2) < 0) + goto error; - if(H5Gclose(xid) < 0) - goto error; + if(H5Gclose(xid) < 0) + goto error; - if(H5Fclose(fid) < 0) - goto error; + if(H5Fclose(fid) < 0) + goto error; + + PASSED(); + } else + SKIPPED(); - PASSED(); return 0; error: