summaryrefslogtreecommitdiffstats
path: root/test/dsets.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2009-10-20 15:08:56 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2009-10-20 15:08:56 (GMT)
commita99a73d20ecd7ed2c9c65a2979f600f805d01099 (patch)
tree252d65e11b3542322b0e73b510a1a3ef3036b7c4 /test/dsets.c
parent4feddbbbcc655ba2ff2e07b10647bd12f06d2d84 (diff)
downloadhdf5-a99a73d20ecd7ed2c9c65a2979f600f805d01099.zip
hdf5-a99a73d20ecd7ed2c9c65a2979f600f805d01099.tar.gz
hdf5-a99a73d20ecd7ed2c9c65a2979f600f805d01099.tar.bz2
[svn-r17688] Merge make local copy of svn test data files for write access from v1.8 to trunk.
Tested: amani, jam, linew (h5committest).
Diffstat (limited to 'test/dsets.c')
-rw-r--r--test/dsets.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 2876dad..0522bd0 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -34,6 +34,7 @@
#define H5Z_PACKAGE
#include "H5Zpkg.h"
+
const char *FILENAME[] = {
"dataset",
"compact_dataset",
@@ -140,6 +141,7 @@ const char *FILENAME[] = {
/* Names for noencoder test */
#ifdef H5_HAVE_FILTER_SZIP
#define NOENCODER_FILENAME "noencoder.h5"
+#define NOENCODER_COPY_FILENAME "noencoder.h5.copy"
#define NOENCODER_TEST_DATASET "noencoder_tdset.h5"
#define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5"
#define NOENCODER_SZIP_SHUFF_FLETCH_DATASET "noencoder_szip_shuffle_fletcher_dset.h5"
@@ -1691,6 +1693,8 @@ error:
* Monday, June 7, 2004
*
* Modifications:
+ * Make copy of data file since the test writes to the file.
+ * Larry Knox, October 14, 2009
*
*-------------------------------------------------------------------------
*/
@@ -1708,20 +1712,14 @@ test_filter_noencoder(const char *dset_name)
int test_ints[10] = { 12 };
int read_buf[10];
int i;
- char * srcdir = HDgetenv("srcdir"); /* The source directory */
- char testfile[512]=""; /* Buffer to hold name of test file */
-
- /*
- * Create the name of the file to open (in case we are using the --srcdir
- * option and the file is in a different directory from this test).
- */
- if(srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile))) {
- HDstrcpy(testfile, srcdir);
- HDstrcat(testfile, "/");
- }
- HDstrcat(testfile, NOENCODER_FILENAME);
-
- file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT);
+
+ /* Make a local copy of the file since this test writes to the data file
+ from svn. */
+ if (h5_make_local_copy(NOENCODER_FILENAME, NOENCODER_COPY_FILENAME) < 0)
+ goto error;
+
+ /* Open file */
+ file_id = H5Fopen(NOENCODER_COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
if(file_id < 0) goto error;
dset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT);
@@ -1803,6 +1801,7 @@ error:
H5Pclose(dcpl_id);
if(file_id != -1)
H5Fclose(file_id);
+
return -1;
}
#endif /* H5_HAVE_FILTER_SZIP */
@@ -7377,6 +7376,10 @@ main(void)
if(nerrors)
goto error;
printf("All dataset tests passed.\n");
+#ifdef H5_HAVE_FILTER_SZIP
+ if (GetTestCleanup())
+ HDremove(NOENCODER_COPY_FILENAME);
+#endif /* H5_HAVE_FILTER_SZIP */
h5_cleanup(FILENAME, fapl);
return 0;