summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-08-23 18:43:22 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-08-23 18:43:22 (GMT)
commit8a2a3596a57607f43f12edaf1e9d584eb9e006e6 (patch)
tree5cd7f13f5098da87f13bdbcbd7dd93d9d3623a5a /tools
parent93c167f3ff4b74261b13f34e37ea2b0280623c4f (diff)
downloadhdf5-8a2a3596a57607f43f12edaf1e9d584eb9e006e6.zip
hdf5-8a2a3596a57607f43f12edaf1e9d584eb9e006e6.tar.gz
hdf5-8a2a3596a57607f43f12edaf1e9d584eb9e006e6.tar.bz2
[svn-r9137] Purpose:
new test Description: added a test that generates and copies a file with a dataset with fill value (this is to test the property list function H5Pequal) Solution: Platforms tested: linux solaris aix Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5repack/h5repack.h2
-rwxr-xr-xtools/h5repack/h5repack.sh.in2
-rw-r--r--tools/h5repack/testh5repack_main.c38
-rw-r--r--tools/h5repack/testh5repack_make.c79
-rw-r--r--tools/testfiles/test0.h5bin0 -> 2072 bytes
5 files changed, 91 insertions, 30 deletions
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 5c2c7eb..7411085 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -257,6 +257,8 @@ int parse_number(char *str);
*-------------------------------------------------------------------------
*/
+#define FNAME0 "test0.h5"
+#define FNAME0OUT "test0.out.h5"
#define FNAME1 "test1.h5"
#define FNAME1OUT "test1.out.h5"
#define FNAME2 "test2.h5"
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 9e0be8e..a65cb37 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -127,6 +127,8 @@ TOOLTEST()
# is read-only, 1 is write-only, and 0 is not present.
# copy files (these files have no filters; test2.h5 has copied references that h5diff detects)
+TOOLTEST test0.h5
+TOOLTEST test1.h5
TOOLTEST test3.h5
TOOLTEST test4.h5
TOOLTEST test5.h5
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c
index dabc1aa..e99c1fd 100644
--- a/tools/h5repack/testh5repack_main.c
+++ b/tools/h5repack/testh5repack_main.c
@@ -60,10 +60,29 @@ int main (void)
*/
/*-------------------------------------------------------------------------
+ * file with fill values
+ *-------------------------------------------------------------------------
+ */
+ TESTING(" copy of datasets (fill values)");
+ if (h5repack_init (&pack_options, 0)<0)
+ TEST_ERROR;
+ if (h5repack(FNAME0,FNAME0OUT,&pack_options)<0)
+ TEST_ERROR;
+ if (h5diff(FNAME0,FNAME0OUT,NULL,NULL,&diff_options) == 1)
+ TEST_ERROR;
+ if (h5repack_verify(FNAME0OUT,&pack_options)<=0)
+ TEST_ERROR;
+ if (h5repack_cmpdcpl(FNAME0,FNAME0OUT)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
+ TEST_ERROR;
+ PASSED();
+
+/*-------------------------------------------------------------------------
* file with all kinds of dataset datatypes
*-------------------------------------------------------------------------
*/
- TESTING(" copy of datasets");
+ TESTING(" copy of datasets (all datatypes)");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME1,FNAME1OUT,&pack_options)<0)
@@ -72,6 +91,8 @@ int main (void)
TEST_ERROR;
if (h5repack_verify(FNAME1OUT,&pack_options)<=0)
TEST_ERROR;
+ if (h5repack_cmpdcpl(FNAME1,FNAME1OUT)<=0)
+ TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
PASSED();
@@ -80,7 +101,7 @@ int main (void)
* file with attributes
*-------------------------------------------------------------------------
*/
- TESTING(" copy of attributes");
+ TESTING(" copy of datasets (attributes)");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME2,FNAME2OUT,&pack_options)<0)
@@ -89,7 +110,9 @@ int main (void)
TEST_ERROR;
if (h5repack_verify(FNAME2OUT,&pack_options)<=0)
TEST_ERROR;
- if (h5repack_end (&pack_options)<0)
+ if (h5repack_cmpdcpl(FNAME2,FNAME2OUT)<=0)
+ TEST_ERROR;
+ if (h5repack_end (&pack_options)<0)
TEST_ERROR;
PASSED();
@@ -98,7 +121,7 @@ int main (void)
* file with hardlinks
*-------------------------------------------------------------------------
*/
- TESTING(" copy of hardlinks");
+ TESTING(" copy of datasets (hardlinks)");
if (h5repack_init (&pack_options, 0)<0)
TEST_ERROR;
if (h5repack(FNAME3,FNAME3OUT,&pack_options)<0)
@@ -107,6 +130,8 @@ int main (void)
TEST_ERROR;
if (h5repack_verify(FNAME3OUT,&pack_options)<=0)
TEST_ERROR;
+ if (h5repack_cmpdcpl(FNAME3,FNAME3OUT)<=0)
+ TEST_ERROR;
if (h5repack_end (&pack_options)<0)
TEST_ERROR;
@@ -130,6 +155,11 @@ int main (void)
PASSED();
/*-------------------------------------------------------------------------
+ * the remaining files differ in the dcpl's
+ *-------------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
* deflate
*-------------------------------------------------------------------------
*/
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index b0293e3..fe8a626 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -24,7 +24,7 @@
int make_all_objects(hid_t loc_id);
int make_attributes(hid_t loc_id);
-int make_special_objects(hid_t loc_id);
+int make_hlinks(hid_t loc_id);
int make_early(void);
int make_layout(hid_t loc_id);
int make_szip(hid_t loc_id);
@@ -32,6 +32,7 @@ int make_deflate(hid_t loc_id);
int make_shuffle(hid_t loc_id);
int make_fletcher32(hid_t loc_id);
int make_all(hid_t loc_id);
+int make_fill(hid_t loc_id);
/*-------------------------------------------------------------------------
@@ -52,6 +53,17 @@ int make_testfiles(void)
* create a file for general copy test
*-------------------------------------------------------------------------
*/
+ if((loc_id = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ return -1;
+ if (make_fill(loc_id)<0)
+ goto out;
+ if(H5Fclose(loc_id)<0)
+ return -1;
+
+/*-------------------------------------------------------------------------
+ * create another file for general copy test (all datatypes)
+ *-------------------------------------------------------------------------
+ */
if((loc_id = H5Fcreate(FNAME1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
return -1;
if (make_all_objects(loc_id)<0)
@@ -70,12 +82,12 @@ int make_testfiles(void)
if(H5Fclose(loc_id)<0)
return -1;
/*-------------------------------------------------------------------------
- * create a file for special items test
+ * create a file for hard links test
*-------------------------------------------------------------------------
*/
if((loc_id = H5Fcreate(FNAME3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
return -1;
- if (make_special_objects(loc_id)<0)
+ if (make_hlinks(loc_id)<0)
goto out;
if(H5Fclose(loc_id)<0)
return -1;
@@ -289,26 +301,20 @@ int make_attributes(hid_t loc_id)
}
-
-
/*-------------------------------------------------------------------------
- * Function: make_special_objects
+ * Function: make_hlinks
*
- * Purpose: make a test file with non common items
+ * Purpose: make a test file with hard links
*
*-------------------------------------------------------------------------
*/
-int make_special_objects(hid_t loc_id)
+int make_hlinks(hid_t loc_id)
{
hid_t group1_id;
hid_t group2_id;
hid_t group3_id;
hsize_t dims[2]={3,2};
int buf[3][2]= {{1,1},{1,2},{2,2}};
- hid_t dset_id;
- hid_t space_id;
- hid_t plist_id;
- int fillvalue=2;
/*-------------------------------------------------------------------------
* create a dataset and some hard links to it
@@ -346,20 +352,6 @@ int make_special_objects(hid_t loc_id)
H5Gclose(group2_id);
H5Gclose(group3_id);
-/*-------------------------------------------------------------------------
- * H5T_INTEGER, write a fill value
- *-------------------------------------------------------------------------
- */
-
- plist_id = H5Pcreate(H5P_DATASET_CREATE);
- H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue);
- space_id = H5Screate_simple(2,dims,NULL);
- dset_id = H5Dcreate(loc_id,"dset_fill",H5T_NATIVE_INT,space_id,plist_id);
- H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf);
- H5Pclose(plist_id);
- H5Dclose(dset_id);
- H5Sclose(space_id);
-
return 0;
}
@@ -958,3 +950,38 @@ out:
+
+
+/*-------------------------------------------------------------------------
+ * Function: make a file with an integer dataset with a fill value
+ *
+ * Purpose: test copy of fill values
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_fill(hid_t loc_id)
+{
+ hid_t did;
+ hid_t sid;
+ hid_t dcpl;
+ hsize_t dims[2]={3,2};
+ int buf[3][2]= {{1,1},{1,2},{2,2}};
+ int fillvalue=2;
+
+/*-------------------------------------------------------------------------
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
+
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue);
+ sid = H5Screate_simple(2,dims,NULL);
+ did = H5Dcreate(loc_id,"dset_fill",H5T_NATIVE_INT,sid,dcpl);
+ H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf);
+ H5Pclose(dcpl);
+ H5Dclose(did);
+ H5Sclose(sid);
+
+ return 0;
+
+} \ No newline at end of file
diff --git a/tools/testfiles/test0.h5 b/tools/testfiles/test0.h5
new file mode 100644
index 0000000..3c692bc
--- /dev/null
+++ b/tools/testfiles/test0.h5
Binary files differ