summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-04-17 20:53:06 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-04-17 20:53:06 (GMT)
commit4147628137ef4ec5e596da7ff297e0d93a13d25c (patch)
treee7ca9bf3ba97471c4b334f4677bc40e49507d1d1 /tools
parent053cde0b3305724ee9983c3698d405995b46dec0 (diff)
downloadhdf5-4147628137ef4ec5e596da7ff297e0d93a13d25c.zip
hdf5-4147628137ef4ec5e596da7ff297e0d93a13d25c.tar.gz
hdf5-4147628137ef4ec5e596da7ff297e0d93a13d25c.tar.bz2
[svn-r6700] Purpose:
added tests 1.7, 1.8, 1.9 described in the test matrix Description: Solution: Platforms tested: Linux/rockaway(C) SunOS/arabica (C) SGI/modi4 (C) Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/h5diff.c162
-rw-r--r--tools/h5diff/h5difftst.c55
-rwxr-xr-xtools/h5diff/testh5diff.sh9
-rw-r--r--tools/testfiles/h5diff_16.txt3
4 files changed, 224 insertions, 5 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c
index 9796144..ca05a59 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/h5diff/h5diff.c
@@ -68,6 +68,7 @@ void print_pos( int *ph, unsigned int curr_pos, int *acc,
*/
hid_t fixtype( hid_t f_type );
+void print_datatype(hid_t type);
int check_n_input( const char* );
int check_f_input( const char* );
int get_index( const char *obj, int nobjects, info_t *info );
@@ -793,7 +794,7 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
hid_t rank1, rank2;
void *buf1, *buf2;
hsize_t tot_cnt, tot_cnt1, tot_cnt2;
- hsize_t dims1[32], dims2[32];
+ hsize_t dims1[32], dims2[32], maxdim1[32], maxdim2[32];
int i, j;
herr_t status;
H5T_class_t tclass1;
@@ -804,6 +805,7 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
hid_t type_mem =-1; /* read to memory type */
void *edata;
hid_t (*func)(void*);
+ htri_t is1, is2;
/* disable error reporting */
H5Eget_auto(&func, &edata);
@@ -857,16 +859,16 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
return -1;
/* Get dimensions */
- if ( H5Sget_simple_extent_dims(space1_id,dims1,NULL) < 0 )
+ if ( H5Sget_simple_extent_dims(space1_id,dims1,maxdim1) < 0 )
goto out;
/* Get dimensions */
- if ( H5Sget_simple_extent_dims(space2_id,dims2,NULL) < 0 )
+ if ( H5Sget_simple_extent_dims(space2_id,dims2,maxdim2) < 0 )
goto out;
/*-------------------------------------------------------------------------
- * check for the same class datatype
+ * check for the same class
*-------------------------------------------------------------------------
*/
@@ -924,6 +926,21 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
}
/*-------------------------------------------------------------------------
+ * check for equal datatype
+ *-------------------------------------------------------------------------
+ */
+
+ if ( (H5Tequal(type1_id, type2_id)==0) )
+ {
+ printf("Warning: <%s> has different storage datatype than <%s>\n", obj1_name, obj2_name );
+ printf("<%s> has datatype ", obj1_name);
+ print_datatype(type1_id);
+ printf(" and <%s> has datatype ", obj2_name);
+ print_datatype(type2_id);
+ printf("\n");
+ }
+
+/*-------------------------------------------------------------------------
* check for the same rank
*-------------------------------------------------------------------------
*/
@@ -946,6 +963,30 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
}
/*-------------------------------------------------------------------------
+ * check for different maximum dimensions; just give a warning
+ *-------------------------------------------------------------------------
+ */
+
+ for (i = 0; i < rank1; i++)
+ {
+ if ( maxdim1[i] != maxdim2[i] )
+ {
+ printf( "Warning: <%s> has different maximum dimensions than <%s>\n", obj1_name, obj2_name );
+ printf( "<%s>: ", obj1_name );
+ printf("[ " );
+ for (j = 0; j < rank1; j++)
+ printf("%d ", (int)maxdim1[j] );
+ printf("]\n" );
+ printf( "<%s>: ", obj2_name );
+ printf("[ " );
+ for (j = 0; j < rank1; j++)
+ printf("%d ", (int)maxdim2[j] );
+ printf("]\n" );
+ }
+ }
+
+
+/*-------------------------------------------------------------------------
* check for the same dimensionality
*-------------------------------------------------------------------------
*/
@@ -970,6 +1011,15 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
}
+/*-------------------------------------------------------------------------
+ * check for simple dataspace
+ *-------------------------------------------------------------------------
+ */
+
+ is1 = H5Sis_simple(space1_id);
+ is2 = H5Sis_simple(space2_id);
+
+
tot_cnt1 = 1;
for (i = 0; i < rank1; i++)
{
@@ -1749,7 +1799,7 @@ void print_class( H5T_class_t tclass, char *sclass )
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
- * Date: march 5, 2003
+ * Date: March 5, 2003
*
* Comments: Adapted from h5tools_fixtype
*
@@ -1820,4 +1870,106 @@ hid_t fixtype(hid_t f_type)
+/*-------------------------------------------------------------------------
+ * Function: print_datatype
+ *
+ * Purpose: Print name of datatype
+ *
+ * Return:
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: April 17, 2003
+ *
+ * Comments: Adapted from h5dump for H5T_INTEGER and H5T_FLOAT classes only
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void print_datatype(hid_t type)
+{
+ switch (H5Tget_class(type))
+ {
+ default:
+ return;
+ case H5T_INTEGER:
+ if (H5Tequal(type, H5T_STD_I8BE)) {
+ printf("H5T_STD_I8BE");
+ } else if (H5Tequal(type, H5T_STD_I8LE)) {
+ printf("H5T_STD_I8LE");
+ } else if (H5Tequal(type, H5T_STD_I16BE)) {
+ printf("H5T_STD_I16BE");
+ } else if (H5Tequal(type, H5T_STD_I16LE)) {
+ printf("H5T_STD_I16LE");
+ } else if (H5Tequal(type, H5T_STD_I32BE)) {
+ printf("H5T_STD_I32BE");
+ } else if (H5Tequal(type, H5T_STD_I32LE)) {
+ printf("H5T_STD_I32LE");
+ } else if (H5Tequal(type, H5T_STD_I64BE)) {
+ printf("H5T_STD_I64BE");
+ } else if (H5Tequal(type, H5T_STD_I64LE)) {
+ printf("H5T_STD_I64LE");
+ } else if (H5Tequal(type, H5T_STD_U8BE)) {
+ printf("H5T_STD_U8BE");
+ } else if (H5Tequal(type, H5T_STD_U8LE)) {
+ printf("H5T_STD_U8LE");
+ } else if (H5Tequal(type, H5T_STD_U16BE)) {
+ printf("H5T_STD_U16BE");
+ } else if (H5Tequal(type, H5T_STD_U16LE)) {
+ printf("H5T_STD_U16LE");
+ } else if (H5Tequal(type, H5T_STD_U32BE)) {
+ printf("H5T_STD_U32BE");
+ } else if (H5Tequal(type, H5T_STD_U32LE)) {
+ printf("H5T_STD_U32LE");
+ } else if (H5Tequal(type, H5T_STD_U64BE)) {
+ printf("H5T_STD_U64BE");
+ } else if (H5Tequal(type, H5T_STD_U64LE)) {
+ printf("H5T_STD_U64LE");
+ } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
+ printf("H5T_NATIVE_SCHAR");
+ } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
+ printf("H5T_NATIVE_UCHAR");
+ } else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
+ printf("H5T_NATIVE_SHORT");
+ } else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
+ printf("H5T_NATIVE_USHORT");
+ } else if (H5Tequal(type, H5T_NATIVE_INT)) {
+ printf("H5T_NATIVE_INT");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT)) {
+ printf("H5T_NATIVE_UINT");
+ } else if (H5Tequal(type, H5T_NATIVE_LONG)) {
+ printf("H5T_NATIVE_LONG");
+ } else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
+ printf("H5T_NATIVE_ULONG");
+ } else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
+ printf("H5T_NATIVE_LLONG");
+ } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
+ printf("H5T_NATIVE_ULLONG");
+ } else {
+ printf("undefined integer");
+ }
+ break;
+
+ case H5T_FLOAT:
+ if (H5Tequal(type, H5T_IEEE_F32BE)) {
+ printf("H5T_IEEE_F32BE");
+ } else if (H5Tequal(type, H5T_IEEE_F32LE)) {
+ printf("H5T_IEEE_F32LE");
+ } else if (H5Tequal(type, H5T_IEEE_F64BE)) {
+ printf("H5T_IEEE_F64BE");
+ } else if (H5Tequal(type, H5T_IEEE_F64LE)) {
+ printf("H5T_IEEE_F64LE");
+ } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
+ printf("H5T_NATIVE_FLOAT");
+ } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
+ printf("H5T_NATIVE_DOUBLE");
+ } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
+ printf("H5T_NATIVE_LDOUBLE");
+ } else {
+ printf("undefined float");
+ }
+ break;
+
+ }/*switch*/
+}
diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c
index aa41864..bbb5a1c 100644
--- a/tools/h5diff/h5difftst.c
+++ b/tools/h5diff/h5difftst.c
@@ -35,6 +35,8 @@ int main(int argc, const char *argv[])
+
+
/*-------------------------------------------------------------------------
* these command line options are tested in ./testh5diff.sh
*-------------------------------------------------------------------------
@@ -56,6 +58,13 @@ dset1.1 dset1.5 h5diff_test1.h5 h5diff_test2.h5
# test 1.6
dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5
+# test 1.7
+dset1.7 dset1.7 h5diff_test1.h5 h5diff_test2.h5
+# test 1.8
+dset1.8 dset1.8 h5diff_test1.h5 h5diff_test2.h5
+# test 1.9
+dset1.9 dset1.9 h5diff_test1.h5 h5diff_test2.h5
+
#######################################################
# Different datatype sizes and different mix of options
#######################################################
@@ -142,6 +151,7 @@ int do_test_files(void)
hid_t dataset_id;
hid_t space_id;
hid_t group_id;
+ hid_t plist_id;
hid_t type_id, type2_id;
herr_t status;
int val;
@@ -149,6 +159,8 @@ int do_test_files(void)
/* Test 1. */
hsize_t dims1 [1] = { 7 };
hsize_t dims1_1[1] = { 8 };
+ hsize_t maxdim [1] = { 8 };
+ hsize_t dims0 [1] = { 1 };
hsize_t dims2 [2] = { 3,2 };
char data1_3[] = {"A string"};
float data1_4[7] = {1,1,3,4,5,6,7};
@@ -322,6 +334,47 @@ int do_test_files(void)
write_dataset(file2_id,1,dims1_1,"dset1.6",H5T_NATIVE_INT,NULL);
/*-------------------------------------------------------------------------
+ * Test 1.7
+ * Check for the same maximum dimensions. Give a warning if they are different
+ *-------------------------------------------------------------------------
+ */
+
+ space_id = H5Screate_simple(1,dims1,dims1);
+ dataset_id = H5Dcreate(file1_id,"dset1.7",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
+ status = H5Dclose(dataset_id);
+ status = H5Sclose(space_id);
+ space_id = H5Screate_simple(1,dims1,maxdim);
+ plist_id = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_chunk(plist_id,1,dims1);
+ dataset_id = H5Dcreate(file2_id,"dset1.7",H5T_NATIVE_INT,space_id,plist_id);
+ status = H5Dclose(dataset_id);
+ status = H5Sclose(space_id);
+
+/*-------------------------------------------------------------------------
+ * Test 1.8
+ * Check for different storage order. Give a warning if they are different
+ *-------------------------------------------------------------------------
+ */
+
+ write_dataset(file1_id,1,dims1,"dset1.8",H5T_STD_I32BE,0);
+ write_dataset(file2_id,1,dims1,"dset1.8",H5T_STD_I32LE,0);
+
+/*-------------------------------------------------------------------------
+ * Test 1.9
+ * Check for H5S_SCALAR dataspace vs simple dataspace with 1 element
+ *-------------------------------------------------------------------------
+ */
+
+ space_id = H5Screate(H5S_SCALAR);
+ dataset_id = H5Dcreate(file1_id,"dset1.9",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
+ status = H5Dclose(dataset_id);
+ status = H5Sclose(space_id);
+ space_id = H5Screate_simple(0,dims0,NULL);
+ dataset_id = H5Dcreate(file2_id,"dset1.9",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
+ status = H5Dclose(dataset_id);
+ status = H5Sclose(space_id);
+
+/*-------------------------------------------------------------------------
* Test 2.1
* Check H5T_NATIVE_CHAR data
*-------------------------------------------------------------------------
@@ -458,3 +511,5 @@ int write_dataset( hid_t file_id, int rank, hsize_t *dims, const char *dset_name
}
+
+
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 0f0a703..ceaaddb 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -152,6 +152,15 @@ TOOLTEST h5diff_15.txt dset1.1 dset1.5 h5diff_test1.h5 h5diff_test2.h5
# test 1.6: Check for the same current dimensions
TOOLTEST h5diff_16.txt dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5
+# test 1.7 Check for the same maximum dimensions
+TOOLTEST h5diff_17.txt dset1.7 dset1.7 h5diff_test1.h5 h5diff_test2.h5
+
+# test 1.8 Check for different storage order
+TOOLTEST h5diff_18.txt dset1.8 dset1.8 h5diff_test1.h5 h5diff_test2.h5
+
+# test 1.9 Check for H5S_SCALAR dataspace vs simple dataspace with 1 element
+TOOLTEST h5diff_19.txt dset1.9 dset1.9 h5diff_test1.h5 h5diff_test2.h5
+
##############################################################################
# tests 2., Different datatype sizes and different mix of options
##############################################################################
diff --git a/tools/testfiles/h5diff_16.txt b/tools/testfiles/h5diff_16.txt
index 5986bc9..7d2452a 100644
--- a/tools/testfiles/h5diff_16.txt
+++ b/tools/testfiles/h5diff_16.txt
@@ -3,6 +3,9 @@ Expected output for 'h5diff dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5'
#############################
$h5diff dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5
Comparing <dset1.1> with <dset1.6>
+Warning: <dset1.1> has different maximum dimensions than <dset1.6>
+<dset1.1>: [ 7 ]
+<dset1.6>: [ 8 ]
<dset1.1> has different dimensions than <dset1.6>
<dset1.1>: [ 7 ]
<dset1.6>: [ 8 ]