summaryrefslogtreecommitdiffstats
path: root/test/tmisc.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2009-10-15 22:14:10 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2009-10-15 22:14:10 (GMT)
commit62521fcb96cbaaa5befc598ebf518d79f2fa7ac3 (patch)
tree26b8fd3df7f5c8b4c8bac81f3d1c2541b46bfa97 /test/tmisc.c
parent148828d46a193048e99df253c429bc0ea307de1a (diff)
downloadhdf5-62521fcb96cbaaa5befc598ebf518d79f2fa7ac3.zip
hdf5-62521fcb96cbaaa5befc598ebf518d79f2fa7ac3.tar.gz
hdf5-62521fcb96cbaaa5befc598ebf518d79f2fa7ac3.tar.bz2
[svn-r17656] Added h5_make_local_copy function to address bug 1630, and refactored tests that were discovered to copy data files to avoid writing to data files checked into svn to use the new function.
Tested on amani, jam, and linew with h5committest and on jam with a read only mount of source files on pegdub.
Diffstat (limited to 'test/tmisc.c')
-rw-r--r--test/tmisc.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/test/tmisc.c b/test/tmisc.c
index 005e77a..d6c10b0 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -32,9 +32,6 @@
#include "testhdf5.h"
#include "H5Dpkg.h" /* Datasets */
-#define NAME_BUF_SIZE 1024
-#define READ_OLD_BUFSIZE 1024
-
/* Definitions for misc. test #1 */
#define MISC1_FILE "tmisc1.h5"
#define MISC1_VAL (13417386) /* 0xccbbaa */
@@ -5136,39 +5133,15 @@ test_misc28(void)
static void
test_misc29(void)
{
- int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
- char buf[READ_OLD_BUFSIZE]; /* Buffer for copying data */
- ssize_t nread; /* Number of bytes read in */
- char *srcdir = HDgetenv("srcdir"); /* where the src code is located */
- char filename[NAME_BUF_SIZE] = ""; /* old test file name */
hid_t fid; /* File ID */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Speculative metadata reads\n"));
- /* Generate correct name for test file by prepending the source path */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC29_ORIG_FILE) + 1) < sizeof(filename))) {
- HDstrcpy(filename, srcdir);
- HDstrcat(filename, "/");
- } /* end if */
- HDstrcat(filename, MISC29_ORIG_FILE);
-
- /* Copy old file into temporary file */
- fd_old = HDopen(filename, O_RDONLY, 0666);
- CHECK(fd_old, -1, "HDopen");
- fd_new = HDopen(MISC29_COPY_FILE, O_RDWR|O_CREAT|O_TRUNC, 0666);
- CHECK(fd_new, -1, "HDopen");
-
- /* Copy data */
- while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0)
- HDwrite(fd_new, buf, (size_t)nread);
-
- /* Close files */
- ret = HDclose(fd_old);
- CHECK(ret, -1, "HDclose");
- ret = HDclose(fd_new);
- CHECK(ret, -1, "HDclose");
+ /* Make a copy of the data file from svn. */
+ ret = h5_make_local_copy(MISC29_ORIG_FILE, MISC29_COPY_FILE);
+ CHECK(ret, -1, "h5_make_local_copy");
/* Open the copied file */
fid = H5Fopen(MISC29_COPY_FILE, H5F_ACC_RDWR, H5P_DEFAULT);