summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-06-23 23:32:02 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-06-23 23:32:02 (GMT)
commit5f8d6d5bb53da6221616e02cef4dbd6d680d9185 (patch)
treee86917f9122d36bc42892affcbebe64daa35c475 /test
parent24b1316f8b91a4ac2fd27668c56a96b04412c191 (diff)
downloadhdf5-5f8d6d5bb53da6221616e02cef4dbd6d680d9185.zip
hdf5-5f8d6d5bb53da6221616e02cef4dbd6d680d9185.tar.gz
hdf5-5f8d6d5bb53da6221616e02cef4dbd6d680d9185.tar.bz2
[svn-r22484] Description:
Copy the file image test file from the source directory to the build directory, instead of trying to open the [in-memory] file R/W. Also, clean up a few other test files that were left lying around from other tests. Tested on: MacOSX/64 10.7.4 (amazon) w/debug Too minor to require h5committest
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am7
-rw-r--r--test/file_image.c30
2 files changed, 19 insertions, 18 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 50ca89c..f1ef97e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -108,11 +108,11 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
max_compact_dataset.h5 simple.h5 set_local.h5 random_chunks.h5 \
huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \
copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \
- sys_file1 tfile[1-5].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \
+ sys_file1 tfile[1-6].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \
stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \
dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
- stdio.h5 sec2.h5 dtypes[0-9].h5 dt_arith[1-2].h5 tattr.h5 \
+ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0]dt_arith[1-2].h5 tattr.h5 \
tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \
trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 flush.h5 \
@@ -126,7 +126,8 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \
objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \
earray.h5 efc[0-5].h5 log_vfd_out.log new_multi_file_v16-r.h5 \
- new_multi_file_v16-s.h5
+ split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \
+ file_image_core_test.h5.copy new_multi_file_v16-s.h5
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
diff --git a/test/file_image.c b/test/file_image.c
index a846a3c..73c901e 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -519,7 +519,7 @@ test_core(void)
udata_t *udata;
unsigned char *file_image;
char filename[1024];
- char src_dir_filename[1024];
+ char copied_filename[1024];
const char *tmp = NULL;
size_t size;
hsize_t dims[2];
@@ -542,16 +542,15 @@ test_core(void)
tmp = h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
VERIFY(tmp != NULL, "h5_fixname failed");
- /* convert file name to srcdir file name. Make a copy as
- * H5_get_srcdir_filename() simply sets up the file name in its
- * own buffer each time it is called -- overwriting the previous
- * value.
- */
- tmp = H5_get_srcdir_filename(filename);
- VERIFY(tmp != NULL, "H5_get_srcdir_filename failed");
- VERIFY(strlen(tmp) < 1023, "srcdir file name too long.");
- HDstrncpy(src_dir_filename, tmp, 1023);
- src_dir_filename[1023] = '\0';
+ /* Append ".copy" to the filename from the source directory */
+ VERIFY(HDstrlen(filename) < (1023 - 5), "file name too long.");
+ HDstrncpy(copied_filename, filename, 1023);
+ copied_filename[1023] = '\0';
+ HDstrcat(copied_filename, ".copy");
+
+ /* Make a copy of the data file from svn. */
+ ret = h5_make_local_copy(filename, copied_filename);
+ VERIFY(ret >= 0, "h5_make_local_copy");
/* Allocate and initialize udata */
udata = (udata_t *)HDmalloc(sizeof(udata_t));
@@ -566,7 +565,7 @@ test_core(void)
/* Test open (no file image) */
reset_udata(udata);
- file = H5Fopen(src_dir_filename, H5F_ACC_RDWR, fapl);
+ file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl);
VERIFY(file >= 0, "H5Fopen failed");
VERIFY(udata->used_callbacks == MALLOC, "opening a core file used the wrong callbacks");
VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open");
@@ -579,7 +578,7 @@ test_core(void)
VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_FILE_CLOSE, "Free callback came from wrong sourc in core close");
/* Reopen file */
- file = H5Fopen(src_dir_filename, H5F_ACC_RDWR, fapl);
+ file = H5Fopen(copied_filename, H5F_ACC_RDWR, fapl);
VERIFY(file >= 0, "H5Fopen failed");
/* Set up a new dset */
@@ -613,7 +612,7 @@ test_core(void)
VERIFY(udata->free_src == H5FD_FILE_IMAGE_OP_FILE_CLOSE, "Free callback came from wrong sourc in core close");
/* Create file image buffer */
- fd = HDopen(src_dir_filename, O_RDONLY, 0666);
+ fd = HDopen(copied_filename, O_RDONLY, 0666);
VERIFY(fd > 0, "open failed");
ret = HDfstat(fd, &sb);
VERIFY(ret == 0, "fstat failed");
@@ -627,13 +626,14 @@ test_core(void)
if(H5Pset_file_image(fapl, file_image, size) < 0) FAIL_STACK_ERROR
/* Test open with file image */
- if((file = H5Fopen("dne.h5", H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if((file = H5Fopen("dne.h5", H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
if(H5Fclose(file) < 0) FAIL_STACK_ERROR
/* Release resources */
h5_cleanup(FILENAME, fapl);
HDfree(udata);
HDfree(file_image);
+ HDremove(copied_filename);
PASSED();