summaryrefslogtreecommitdiffstats
path: root/test/th5s.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2000-10-24 18:58:31 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2000-10-24 18:58:31 (GMT)
commit493f90f74ac5f028f70cfd94caad90b3b2bd7987 (patch)
tree7c398ac24099609502fb9feb74accc66a29b6448 /test/th5s.c
parent810d2979cc28e0a197ee0b39b32e221e88bcbe85 (diff)
downloadhdf5-493f90f74ac5f028f70cfd94caad90b3b2bd7987.zip
hdf5-493f90f74ac5f028f70cfd94caad90b3b2bd7987.tar.gz
hdf5-493f90f74ac5f028f70cfd94caad90b3b2bd7987.tar.bz2
[svn-r2725] Purpose:
Bug fix. Description: Could not find the pre-created file for the H5S_MAX_RANK test when --srcdir option is used. testhdf5 was looking for it in the currect directory only. Solution: Make use of the value of the environment variable srcdir that is passed to the tests. Compose the real location of the testfile in order to open it even from a remote build directory. Platforms tested: Modi4, arabica, eirene
Diffstat (limited to 'test/th5s.c')
-rw-r--r--test/th5s.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/test/th5s.c b/test/th5s.c
index 6e35bf9..eceaf02 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -168,12 +168,26 @@ test_h5s_basic(void)
* If this test fails and the H5S_MAX_RANK variable has changed, follow
* the instructions in space_overflow.c for regenating the th5s.h5 file.
*/
- fid1 = H5Fopen(TESTFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ {
+ char testfile[512]="";
+ char *srcdir = getenv("srcdir");
+ if (srcdir && ((strlen(srcdir) + strlen(TESTFILE) + 1) < sizeof(testfile))){
+ strcpy(testfile, srcdir);
+ strcat(testfile, "/");
+ }
+ strcat(testfile, TESTFILE);
+ fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK_I(fid1, "H5Fopen");
- dset1 = H5Dopen(fid1, "dset");
- VERIFY(dset1, FAIL, "H5Dopen");
- ret = H5Fclose(fid1);
- CHECK_I(ret, "H5Fclose");
+ if (fid1 >= 0){
+ dset1 = H5Dopen(fid1, "dset");
+ VERIFY(dset1, FAIL, "H5Dopen");
+ ret = H5Fclose(fid1);
+ CHECK_I(ret, "H5Fclose");
+ }
+ else
+ printf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n",
+ testfile);
+ }
/* Verify that incorrect dimensions don't work */
dims1[0]=0;