summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2000-11-27 23:01:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2000-11-27 23:01:48 (GMT)
commit0726621eaa2c3423c8d8969fae314af54e902604 (patch)
tree550e6ebf64bf191fdc21633ee760759b9c2f9950 /test
parente7b7e14a88f37a6d348e62abf10765059383d645 (diff)
downloadhdf5-0726621eaa2c3423c8d8969fae314af54e902604.zip
hdf5-0726621eaa2c3423c8d8969fae314af54e902604.tar.gz
hdf5-0726621eaa2c3423c8d8969fae314af54e902604.tar.bz2
[svn-r3005] Purpose:
Backward compatibility code Description: Add in code to allow the library to emulate the v1.2 API and behavior. Platforms tested: FreeBSD 4.2 (hawkwind)
Diffstat (limited to 'test')
-rw-r--r--test/big.c8
-rw-r--r--test/cmpd_dset.c2
-rw-r--r--test/dsets.c4
-rw-r--r--test/h5test.c50
-rw-r--r--test/istore.c4
-rw-r--r--test/overhead.c4
-rw-r--r--test/tarray.c4
-rw-r--r--test/tselect.c2
-rw-r--r--test/tvlstr.c2
-rw-r--r--test/tvltypes.c8
10 files changed, 75 insertions, 13 deletions
diff --git a/test/big.c b/test/big.c
index 68c8315..b7c190c 100644
--- a/test/big.c
+++ b/test/big.c
@@ -120,7 +120,11 @@ enough_room(hid_t fapl)
for (i=0; i<NELMTS(fd); i++) fd[i] = -1;
/* Get file name template */
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ assert(H5F_LOW_FAMILY==H5Pget_driver(fapl));
+#else /* H5_WANT_H5_V1_2_COMPAT */
assert(H5FD_FAMILY==H5Pget_driver(fapl));
+#endif /* H5_WANT_H5_V1_2_COMPAT */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Create files */
@@ -366,7 +370,11 @@ main (void)
fapl = h5_fileaccess();
/* The file driver must be the family driver */
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ if (H5F_LOW_FAMILY!=H5Pget_driver(fapl)) {
+#else /* H5_WANT_H5_V1_2_COMPAT */
if (H5FD_FAMILY!=H5Pget_driver(fapl)) {
+#endif /* H5_WANT_H5_V1_2_COMPAT */
printf("Changing file drivers to the family driver, %lu bytes each\n",
(unsigned long)FAMILY_SIZE);
if (H5Pset_fapl_family(fapl, FAMILY_SIZE, H5P_DEFAULT)<0) goto error;
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 00ef239..6f63ef0 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -157,7 +157,7 @@ main (int argc, char *argv[])
if ((space = H5Screate_simple (2, dim, NULL))<0) goto error;
/* Create xfer properties to preserve initialized data */
- if ((PRESERVE = H5Pcreate (H5P_DATA_XFER))<0) goto error;
+ if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto error;
if (H5Pset_preserve (PRESERVE, 1)<0) goto error;
/*
diff --git a/test/dsets.c b/test/dsets.c
index d4b3bd1..d0ef567 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -180,7 +180,7 @@ test_simple_io(hid_t file)
/* Create a small conversion buffer to test strip mining */
tconv_buf = malloc (1000);
- xfer = H5Pcreate (H5P_DATA_XFER);
+ xfer = H5Pcreate (H5P_DATASET_XFER);
assert (xfer>=0);
if (H5Pset_buffer (xfer, 1000, tconv_buf, NULL)<0) goto error;
@@ -366,7 +366,7 @@ test_compression(hid_t file)
* Create a small conversion buffer to test strip mining. We
* might as well test all we can!
*/
- if ((xfer = H5Pcreate (H5P_DATA_XFER))<0) goto error;
+ if ((xfer = H5Pcreate (H5P_DATASET_XFER))<0) goto error;
tconv_buf = malloc (1000);
if (H5Pset_buffer (xfer, 1000, tconv_buf, NULL)<0) goto error;
diff --git a/test/h5test.c b/test/h5test.c
index bfd18df..b3d91ca 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -119,7 +119,9 @@ h5_cleanup(const char *base_name[], hid_t fapl)
char temp[2048];
int i, j;
int retval=0;
+#ifndef H5_WANT_H5_V1_2_COMPAT
hid_t driver;
+#endif /* H5_WANT_H5_V1_2_COMPAT */
if (!getenv("HDF5_NOCLEANUP")) {
for (i=0; base_name[i]; i++) {
@@ -128,6 +130,31 @@ h5_cleanup(const char *base_name[], hid_t fapl)
continue;
}
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ switch (H5Pget_driver(fapl)) {
+ case H5F_LOW_CORE:
+ break; /*nothing to remove*/
+
+ case H5F_LOW_SPLIT:
+ HDsnprintf(temp, sizeof temp, "%s.raw", filename);
+ remove(temp);
+ HDsnprintf(temp, sizeof temp, "%s.meta", filename);
+ remove(temp);
+ break;
+
+ case H5F_LOW_FAMILY:
+ for (j=0; /*void*/; j++) {
+ HDsnprintf(temp, sizeof temp, filename, j);
+ if (access(temp, F_OK)<0) break;
+ remove(temp);
+ }
+ break;
+
+ default:
+ remove(filename);
+ break;
+ }
+#else /* H5_WANT_H5_V1_2_COMPAT */
driver = H5Pget_driver(fapl);
if (H5FD_FAMILY==driver) {
for (j=0; /*void*/; j++) {
@@ -148,6 +175,7 @@ h5_cleanup(const char *base_name[], hid_t fapl)
} else {
remove(filename);
}
+#endif /* H5_WANT_H5_V1_2_COMPAT */
}
retval=1;
}
@@ -229,10 +257,15 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
{
const char *prefix=NULL;
const char *suffix=".h5"; /* suffix has default */
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ H5F_driver_t driver;
+#else /* H5_WANT_H5_V1_2_COMPAT */
hid_t driver;
+#endif /* H5_WANT_H5_V1_2_COMPAT */
if (!base_name || !fullname || size<1) return NULL;
+#ifndef H5_WANT_H5_V1_2_COMPAT
/* figure out the suffix */
if (H5P_DEFAULT!=fapl){
if ((driver=H5Pget_driver(fapl))<0) return NULL;
@@ -262,6 +295,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (!prefix) prefix = HDF5_PREFIX;
#endif
}
+#endif /* H5_WANT_H5_V1_2_COMPAT */
/* Prepend the prefix value to the base name */
@@ -275,6 +309,22 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
strcpy(fullname, base_name);
}
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ /* Append a suffix */
+ if ((driver=H5Pget_driver(fapl))<0) return NULL;
+ switch (driver) {
+ case H5F_LOW_SPLIT:
+ case H5F_LOW_CORE:
+ suffix = NULL;
+ break;
+ case H5F_LOW_FAMILY:
+ suffix = "%05d.h5";
+ break;
+ default:
+ suffix = ".h5";
+ break;
+ }
+#endif /* H5_WANT_H5_V1_2_COMPAT */
/* Append a suffix */
if (suffix) {
if (strlen(fullname)+strlen(suffix)>=size) return NULL;
diff --git a/test/istore.c b/test/istore.c
index c6d7b9a..e0448c4 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -562,7 +562,11 @@ main(int argc, char *argv[])
* For testing file families, fool the library into thinking it already
* allocated a whole bunch of data.
*/
+#ifdef H5_WANT_H5_V1_2_COMPAT
+ if (H5F_LOW_FAMILY!=H5Pget_driver(fapl)) {
+#else /* H5_WANT_H5_V1_2_COMPAT */
if (H5FD_FAMILY==H5Pget_driver(fapl)) {
+#endif /* H5_WANT_H5_V1_2_COMPAT */
haddr_t addr;
addr = 8 * ((uint64_t)1<<30); /*8 GB */
if (H5FDset_eoa(f->shared->lf, addr)<0) {
diff --git a/test/overhead.c b/test/overhead.c
index 0fff576..2e1dd23 100644
--- a/test/overhead.c
+++ b/test/overhead.c
@@ -199,7 +199,7 @@ test(fill_t fill_style, const double splits[],
}
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_chunk(dcpl, 1, ch_size)<0) goto error;
- if ((xfer=H5Pcreate(H5P_DATA_XFER))<0) goto error;
+ if ((xfer=H5Pcreate(H5P_DATASET_XFER))<0) goto error;
if (H5Pset_btree_ratios(xfer, splits[0], splits[1], splits[2])<0) {
goto error;
}
@@ -335,7 +335,7 @@ main(int argc, char *argv[])
/* Default split ratios */
H5Eset_auto(display_error_cb, NULL);
- if ((xfer=H5Pcreate(H5P_DATA_XFER))<0) goto error;
+ if ((xfer=H5Pcreate(H5P_DATASET_XFER))<0) goto error;
if (H5Pget_btree_ratios(xfer, splits+0, splits+1, splits+2)<0) {
goto error;
}
diff --git a/test/tarray.c b/test/tarray.c
index f4f3a52..0af9451 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -1197,7 +1197,7 @@ test_array_vlen_atomic(void)
CHECK(ret, FAIL, "H5Tclose");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATA_XFER);
+ xfer_pid=H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
ret=H5Pset_vlen_mem_manager(xfer_pid,test_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used);
@@ -1447,7 +1447,7 @@ test_array_vlen_array(void)
CHECK(ret, FAIL, "H5Tclose");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATA_XFER);
+ xfer_pid=H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
ret=H5Pset_vlen_mem_manager(xfer_pid,test_array_alloc_custom,&mem_used,test_array_free_custom,&mem_used);
diff --git a/test/tselect.c b/test/tselect.c
index 12b922f..33e3988 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -2120,7 +2120,7 @@ test_select_hyper_union(void)
dataset=H5Dcreate(fid1,"Dataset4",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
- xfer = H5Pcreate (H5P_DATA_XFER);
+ xfer = H5Pcreate (H5P_DATASET_XFER);
CHECK(xfer, FAIL, "H5Pcreate");
ret = H5Pset_hyper_cache(xfer,0,1);
diff --git a/test/tvlstr.c b/test/tvlstr.c
index dc3ccd6..b41b82f 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -154,7 +154,7 @@ test_vlstrings_basic(void)
CHECK(ret, FAIL, "H5Dwrite");
/* Change to the custom memory allocation routines for reading VL string */
- xfer_pid=H5Pcreate(H5P_DATA_XFER);
+ xfer_pid=H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vlstr_alloc_custom,&mem_used,test_vlstr_free_custom,&mem_used);
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 5c4e3ee..ea4d481 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -153,7 +153,7 @@ test_vltypes_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dwrite");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATA_XFER);
+ xfer_pid=H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
@@ -293,7 +293,7 @@ test_vltypes_vlen_compound(void)
CHECK(ret, FAIL, "H5Dwrite");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATA_XFER);
+ xfer_pid=H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
@@ -445,7 +445,7 @@ test_vltypes_compound_vlen_atomic(void)
CHECK(ret, FAIL, "H5Dwrite");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATA_XFER);
+ xfer_pid=H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);
@@ -662,7 +662,7 @@ test_vltypes_vlen_vlen_atomic(void)
CHECK(dataset, FAIL, "H5Dopen");
/* Change to the custom memory allocation routines for reading VL data */
- xfer_pid=H5Pcreate(H5P_DATA_XFER);
+ xfer_pid=H5Pcreate(H5P_DATASET_XFER);
CHECK(xfer_pid, FAIL, "H5Pcreate");
ret=H5Pset_vlen_mem_manager(xfer_pid,test_vltypes_alloc_custom,&mem_used,test_vltypes_free_custom,&mem_used);