summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-04-17 16:50:56 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-04-17 16:50:56 (GMT)
commit3bff6431c7d890a3963ebd14a0eb5c72db93ee2b (patch)
tree56c3e7a18086a149a775068286a0cb47391ca20a /tools/h5diff
parent8bb9ae44477bd1698f61c560d593e6c78b209389 (diff)
downloadhdf5-3bff6431c7d890a3963ebd14a0eb5c72db93ee2b.zip
hdf5-3bff6431c7d890a3963ebd14a0eb5c72db93ee2b.tar.gz
hdf5-3bff6431c7d890a3963ebd14a0eb5c72db93ee2b.tar.bz2
[svn-r6694] Purpose:
added some niceties and utilities, and more tests Description: some niceties: more error messages on cases of bad input utilities: some functions to more human readable output more tests: described in the test matrix Platforms tested: Linux/rockaway(C) SunOS/arabica (C) SGI/modi4 (C)
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/h5diff.c202
-rw-r--r--tools/h5diff/h5difftst.c618
-rwxr-xr-xtools/h5diff/testh5diff.sh102
3 files changed, 411 insertions, 511 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c
index 63251cd..9796144 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/h5diff/h5diff.c
@@ -51,8 +51,10 @@ void print_class( H5T_class_t tclass, char *sclass );
void list( const char *filename, int nobjects, info_t *info );
void diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj2_name,
options_t options, int type );
-void compare( hid_t file1_id, const char *obj1_name, int nobjects1, info_t *info1,
- hid_t file2_id, const char *obj2_name, int nobjects2, info_t *info2,
+void compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
+ int nobjects1, info_t *info1,
+ hid_t file2_id, const char *file2_name, const char *obj2_name,
+ int nobjects2, info_t *info2,
options_t options );
void match( hid_t file1_id, const char *file1_name, int nobjects1, info_t *info1,
hid_t file2_id, const char *file2_name, int nobjects2, info_t *info2,
@@ -71,6 +73,7 @@ int check_f_input( const char* );
int get_index( const char *obj, int nobjects, info_t *info );
int compare_object( char *obj1, char *obj2 );
void usage(void);
+void leave();
@@ -89,22 +92,33 @@ void usage(void);
*/
void usage(void)
{
- printf("Usage: h5diff [obj1_name] [obj2_name] [OPTIONS] file1_name [file2_name]\n");
- printf("Items in [ ] are optional\n");
- printf("\n");
- printf("[obj1_name] Name of an HDF5 object\n");
- printf("[obj2_name] Name of an HDF5 object\n");
- printf("file1_name File name of the first HDF5 file\n");
- printf("file2_name File name of the second HDF5 file\n");
- printf("[OPTIONS] are:\n");
- printf("[-h ] Print out this information\n");
- printf("[-l ] List contents of file\n");
- printf("[-r ] Print only what objects differ\n");
- printf("[-n count] Print difference up to count number for each variable\n");
- printf("[-d delta] Print difference when it is greater than limit delta\n");
- printf("[-p relative] Print differences which are within a relative error value\n");
- printf("\n");
+ printf("Usage: h5diff [obj1_name] [obj2_name] [OPTIONS] file1_name file2_name\n");
+ printf("Items in [ ] are optional\n");
+ printf("[obj1_name] Name of an HDF5 object\n");
+ printf("[obj2_name] Name of an HDF5 object\n");
+ printf("file1_name File name of the first HDF5 file\n");
+ printf("file2_name File name of the second HDF5 file\n");
+ printf("[OPTIONS] are:\n");
+ printf("[-h ] Print out this information\n");
+ printf("[-l ] List contents of file\n");
+ printf("[-r ] Print only what objects differ\n");
+ printf("[-n count] Print difference up to count number for each variable\n");
+ printf("[-d delta] Print difference when it is greater than limit delta\n");
+ printf("[-p relative] Print differences which are within a relative error value\n");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: leave
+ *
+ * Purpose: exit and print newline
+ *
+ *-------------------------------------------------------------------------
+ */
+void leave()
+{
+ exit(EXIT_SUCCESS);
+ printf("\n");
}
@@ -128,15 +142,13 @@ void usage(void)
int main(int argc, const char *argv[])
{
- int argno;
+ int i;
const char *s = NULL;
hid_t file1_id, file2_id;
herr_t status;
int nobjects1, nobjects2;
info_t *info1=NULL;
info_t *info2=NULL;
- /*int obj1_found = 0;
- int obj2_found = 0;*/
options_t options = {0,0,0,0,0,0,0,0};
void *edata;
hid_t (*func)(void*);
@@ -146,7 +158,18 @@ int main(int argc, const char *argv[])
const char *obj1_name = NULL;
const char *obj2_name = NULL;
- /*do_test_files();*/
+/*-------------------------------------------------------------------------
+ * print the command line options
+ *-------------------------------------------------------------------------
+ */
+
+ printf("$h5diff");
+ for (i=1; i<argc ; i++)
+ {
+ printf(" %s", argv[i] );
+ }
+ printf("\n");
+
/*-------------------------------------------------------------------------
* parse command line options
@@ -154,29 +177,30 @@ int main(int argc, const char *argv[])
*/
if (argc < 3) {
+ printf("Number of arguments is only %d\n", argc );
usage();
- exit(EXIT_FAILURE);
+ leave();
}
/* last 2 items are the file names */
- for (argno=1; argno<argc ; argno++)
+ for (i=1; i<argc ; i++)
{
/* get the single-letter switches */
- if ( '-'==argv[argno][0] )
+ if ( '-'==argv[i][0] )
{
- for (s=argv[argno]+1; *s; s++)
+ for (s=argv[i]+1; *s; s++)
{
switch (*s) {
default:
printf("-%s is an invalid option\n", s );
usage();
- exit(EXIT_SUCCESS);
+ leave();
break;
case 'h':
usage();
- exit(EXIT_SUCCESS);
+ leave();
case 'l':
options.l_ = 1;
break;
@@ -185,53 +209,53 @@ int main(int argc, const char *argv[])
break;
case 'd':
/* if it is not another option */
- if ( '-' !=argv[argno+1][0] )
+ if ( '-' !=argv[i+1][0] )
{
options.d_ = 1;
- if ( check_f_input(argv[argno+1])==-1)
+ if ( check_f_input(argv[i+1])==-1)
{
- printf("<-d %s> is not a valid option\n", argv[argno+1] );
+ printf("<-d %s> is not a valid option\n", argv[i+1] );
usage();
- exit(EXIT_SUCCESS);
+ leave();
}
- options.d_delta = atof(argv[argno+1]);
+ options.d_delta = atof(argv[i+1]);
}
else
{
- printf("<-d %s> is not a valid option\n", argv[argno+1] );
+ printf("<-d %s> is not a valid option\n", argv[i+1] );
usage();
- exit(EXIT_SUCCESS);
+ leave();
}
break;
case 'p':
- if ( '-' !=argv[argno+1][0] )
+ if ( '-' !=argv[i+1][0] )
{
options.p_ = 1;
- if ( check_f_input(argv[argno+1])==-1)
+ if ( check_f_input(argv[i+1])==-1)
{
- printf("<-p %s> is not a valid option\n", argv[argno+1] );
+ printf("<-p %s> is not a valid option\n", argv[i+1] );
usage();
- exit(EXIT_SUCCESS);
+ leave();
}
- options.p_relative = atof(argv[argno+1]);
+ options.p_relative = atof(argv[i+1]);
}
break;
case 'n':
- if ( '-' !=argv[argno+1][0] )
+ if ( '-' !=argv[i+1][0] )
{
options.n_ = 1;
- if ( check_n_input(argv[argno+1])==-1)
+ if ( check_n_input(argv[i+1])==-1)
{
- printf("<-n %s> is not a valid option\n", argv[argno+1] );
+ printf("<-n %s> is not a valid option\n", argv[i+1] );
usage();
- exit(EXIT_SUCCESS);
+ leave();
}
- options.n_number_count = atoi(argv[argno+1]);
+ options.n_number_count = atoi(argv[i+1]);
}
break;
} /*switch*/
@@ -243,18 +267,18 @@ int main(int argc, const char *argv[])
{
/* 2 last args are the file names, and it is not a -switch parameter */
- if ( argno < argc-2 && '-' !=argv[argno-1][0] )
+ if ( i < argc-2 && '-' !=argv[i-1][0] )
{
if ( obj1_name == NULL )
- obj1_name = argv[argno];
+ obj1_name = argv[i];
if ( obj2_name == NULL )
{
/* check if we have a second object name */
- if ( argno+1 < argc-2 && '-' !=argv[argno+1][0] )
+ if ( i+1 < argc-2 && '-' !=argv[i+1][0] )
/* yes */
- obj2_name = argv[argno+1];
+ obj2_name = argv[i+1];
else
/* no */
obj2_name = obj1_name;
@@ -283,13 +307,13 @@ int main(int argc, const char *argv[])
if ((file1_id=H5Fopen(file1_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
{
printf("h5diff: %s: No such file or directory\n", file1_name );
- exit(EXIT_FAILURE);
+ leave();
}
if ((file2_id=H5Fopen(file2_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
{
printf("h5diff: %s: No such file or directory\n", file2_name );
- exit(EXIT_FAILURE);
+ leave();
}
/* enable error reporting */
@@ -331,8 +355,8 @@ int main(int argc, const char *argv[])
if ( obj1_name )
{
- compare(file1_id,obj1_name,nobjects1,info1,
- file2_id,obj2_name,nobjects2,info2,options);
+ compare(file1_id,file1_name,obj1_name,nobjects1,info1,
+ file2_id,file2_name,obj2_name,nobjects2,info2,options);
}
/*-------------------------------------------------------------------------
@@ -354,7 +378,7 @@ int main(int argc, const char *argv[])
free(info1);
if ( info2 )
free(info2);
-
+ printf("\n");
return 0;
}
@@ -529,30 +553,38 @@ int get_index( const char *obj, int nobjects, info_t *info )
*/
-void compare( hid_t file1_id, const char *obj1_name, int nobjects1, info_t *info1,
- hid_t file2_id, const char *obj2_name, int nobjects2, info_t *info2,
+void compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
+ int nobjects1, info_t *info1,
+ hid_t file2_id, const char *file2_name, const char *obj2_name,
+ int nobjects2, info_t *info2,
options_t options )
{
+ int f1=0, f2=0;
+
int i = get_index( obj1_name, nobjects1, info1 );
int j = get_index( obj2_name, nobjects2, info2 );
if ( i == -1 )
{
- printf( "Object <%s> could not be found\n", obj1_name );
- return;
+ printf( "Object <%s> could not be found in <%s>\n", obj1_name, file1_name );
+ f1=1;
}
if ( j == -1 )
{
- printf( "Object <%s> could not be found\n", obj1_name );
- return;
+ printf( "Object <%s> could not be found in <%s>\n", obj2_name, file2_name );
+ f2=1;
}
+ if ( f1 || f2 )
+ return;
+
/* objects are not the same type */
if ( info1[i].type != info2[j].type )
{
- printf( "<%s> is of different type than <%s>\n", obj1_name, obj2_name );
+ printf( "<%s> in <%s> is of different type than <%s> in <%s>\n",
+ obj1_name, file1_name, obj2_name, file2_name );
return;
}
@@ -769,7 +801,6 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
char sclass1[20];
char sclass2[20];
int nfound;
- /*size_t type1_size, type2_size;*/
hid_t type_mem =-1; /* read to memory type */
void *edata;
hid_t (*func)(void*);
@@ -809,10 +840,6 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
if ( (type2_id = H5Dget_type(dset2_id)) < 0 )
goto out;
- /* Get the size */
- /*type1_size = H5Tget_size( type1_id );
- type2_size = H5Tget_size( type2_id );*/
-
/* Get the dataspace handle */
if ( (space1_id = H5Dget_space(dset1_id)) < 0 )
return -1;
@@ -893,7 +920,7 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
printf( "H5T_ARRAY comparison is not supported\n");
goto out;
default:
- break;
+ break;
}
/*-------------------------------------------------------------------------
@@ -1044,7 +1071,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
double *dptr1, *dptr2;
int nfound=0; /* number of differences found */
int ph=1; /* print header */
- int i8diff;
+ int i8diff;
/* accumulator and matrix position */
int acc[32];
@@ -1069,9 +1096,8 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
switch(type_class)
{
- default:
- return -1;
- /*break;*/
+ default:
+ return -1;
case H5T_INTEGER:
@@ -1110,7 +1136,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage but not delta */
else if ( !options.d_ && options.p_ )
{
- if ( abs(1 - *i1ptr1 / *i1ptr2) > options.p_relative )
+ if ( abs(1 - *i1ptr2 / *i1ptr1) > options.p_relative )
{
if ( options.n_ && nfound>=options.n_number_count)
return nfound;
@@ -1127,7 +1153,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage and delta */
else if ( options.d_ && options.p_ )
{
- if ( abs(1 - *i1ptr1 / *i1ptr2) > options.p_relative &&
+ if ( abs(1 - *i1ptr2 / *i1ptr1) > options.p_relative &&
abs(*i1ptr1 - *i1ptr2) > options.d_delta )
{
if ( options.n_ && nfound>=options.n_number_count)
@@ -1192,7 +1218,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage but not delta */
else if ( !options.d_ && options.p_ )
{
- if ( abs(1 - *i2ptr1 / *i2ptr2) > options.p_relative )
+ if ( abs(1 - *i2ptr2 / *i2ptr1) > options.p_relative )
{
if ( options.n_ && nfound>=options.n_number_count)
return nfound;
@@ -1209,7 +1235,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage and delta */
else if ( options.d_ && options.p_ )
{
- if ( abs(1 - *i2ptr1 / *i2ptr2) > options.p_relative &&
+ if ( abs(1 - *i2ptr2 / *i2ptr1) > options.p_relative &&
abs(*i2ptr1 - *i2ptr2) > options.d_delta )
{
if ( options.n_ && nfound>=options.n_number_count)
@@ -1275,7 +1301,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage but not delta */
else if ( !options.d_ && options.p_ )
{
- if ( abs(1 - *i4ptr1 / *i4ptr2) > options.p_relative )
+ if ( abs(1 - *i4ptr2 / *i4ptr1) > options.p_relative )
{
if ( options.n_ && nfound>=options.n_number_count)
return nfound;
@@ -1292,7 +1318,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage and delta */
else if ( options.d_ && options.p_ )
{
- if ( abs(1 - *i4ptr1 / *i4ptr2) > options.p_relative &&
+ if ( abs(1 - *i4ptr2 / *i4ptr1) > options.p_relative &&
abs(*i4ptr1 - *i4ptr2) > options.d_delta )
{
if ( options.n_ && nfound>=options.n_number_count)
@@ -1335,7 +1361,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
case 8:
i8ptr1 = (long *) buf1;
i8ptr2 = (long *) buf2;
- i8diff = (int)(*i8ptr1 - *i8ptr2);
+ i8diff = (int)(*i8ptr1 - *i8ptr2);
for ( i = 0; i < tot_cnt; i++)
{
@@ -1359,7 +1385,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage but not delta */
else if ( !options.d_ && options.p_ )
{
- if ( abs((int)(1 - *i8ptr1 / *i8ptr2)) > options.p_relative )
+ if ( abs((int)(1 - *i8ptr2 / *i8ptr1)) > options.p_relative )
{
if ( options.n_ && nfound>=options.n_number_count)
return nfound;
@@ -1376,7 +1402,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage and delta */
else if ( options.d_ && options.p_ )
{
- if ( abs((int)(1 - *i8ptr1 / *i8ptr2)) > options.p_relative &&
+ if ( abs((int)(1 - *i8ptr2 / *i8ptr1)) > options.p_relative &&
abs(i8diff) > options.d_delta )
{
if ( options.n_ && nfound>=options.n_number_count)
@@ -1410,19 +1436,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
} /*for */
break;
-
default:
printf("no valid H5T_INTEGER size found" );
break;
-
} /*switch*/
-
break; /* H5T_INTEGER */
-
case H5T_FLOAT:
switch(type_size)
@@ -1458,7 +1480,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage but not delta */
else if ( !options.d_ && options.p_ )
{
- if ( fabs(1 - *fptr1 / *fptr2) > options.p_relative )
+ if ( fabs(1 - *fptr2 / *fptr1) > options.p_relative )
{
if ( options.n_ && nfound>=options.n_number_count)
return nfound;
@@ -1475,7 +1497,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage and delta */
else if ( options.d_ && options.p_ )
{
- if ( fabs(1 - *fptr1 / *fptr2) > options.p_relative &&
+ if ( fabs(1 - *fptr2 / *fptr1) > options.p_relative &&
fabs(*fptr1 - *fptr2) > options.d_delta )
{
if ( options.n_ && nfound>=options.n_number_count)
@@ -1539,7 +1561,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage but not delta */
else if ( !options.d_ && options.p_ )
{
- if ( 1 - *dptr1 / *dptr2 > options.p_relative )
+ if ( fabs(1 - *dptr2 / *dptr1) > options.p_relative )
{
if ( options.n_ && nfound>=options.n_number_count)
return nfound;
@@ -1556,7 +1578,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, hid_t type_id, int rank
/* percentage and delta */
else if ( options.d_ && options.p_ )
{
- if ( fabs(1 - *dptr1 / *dptr2) > options.p_relative &&
+ if ( fabs(1 - *dptr2 / *dptr1) > options.p_relative &&
fabs(*dptr1 - *dptr2) > options.d_delta )
{
if ( options.n_ && nfound>=options.n_number_count)
@@ -1744,9 +1766,8 @@ hid_t fixtype(hid_t f_type)
switch (H5Tget_class(f_type))
{
- default:
- return -1;
- /*break;*/
+ default:
+ return -1;
case H5T_INTEGER:
/*
* Use the smallest native integer type of the same sign as the file
@@ -1799,3 +1820,4 @@ hid_t fixtype(hid_t f_type)
+
diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c
index 41e5da6..aa41864 100644
--- a/tools/h5diff/h5difftst.c
+++ b/tools/h5diff/h5difftst.c
@@ -22,7 +22,7 @@
/* diff tst*/
int do_test_files(void);
int write_dataset( hid_t file_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t type_id, void *data );
+ hid_t type_id, void *data );
int main(int argc, const char *argv[])
@@ -33,6 +33,8 @@ int main(int argc, const char *argv[])
}
+
+
/*-------------------------------------------------------------------------
* these command line options are tested in ./testh5diff.sh
*-------------------------------------------------------------------------
@@ -54,14 +56,81 @@ dset1.1 dset1.5 h5diff_test1.h5 h5diff_test2.h5
# test 1.6
dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5
+#######################################################
# Different datatype sizes and different mix of options
+#######################################################
# test 2.1.0
-dset2.1 dset2.2 h5diff_test1.h5 h5diff_test2.h5
+dset2.1a dset2.1b h5diff_test1.h5 h5diff_test2.h5
# test 2.1.1
-dset2.1 dset2.2 -n 2 h5diff_test1.h5 h5diff_test2.h5
+dset2.1a dset2.1b -n 2 h5diff_test1.h5 h5diff_test2.h5
# test 2.1.2
-dset2.1 dset2.2 -d 3 h5diff_test1.h5 h5diff_test2.h5
-
+dset2.1a dset2.1b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.1.3
+dset2.1a dset2.1b -p 3 h5diff_test1.h5 h5diff_test2.h5
+#######################################################
+# test 2.2.0
+dset2.2a dset2.2b h5diff_test1.h5 h5diff_test2.h5
+# test 2.2.1
+dset2.2a dset2.2b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.2.2
+dset2.2a dset2.2b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.2.3
+dset2.2a dset2.2b -p 3 h5diff_test1.h5 h5diff_test2.h5
+#######################################################
+# test 2.3.0
+dset2.3a dset2.3b h5diff_test1.h5 h5diff_test2.h5
+# test 2.3.1
+dset2.3a dset2.3b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.3.2
+dset2.3a dset2.3b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.3.3
+dset2.3a dset2.3b -p 3 h5diff_test1.h5 h5diff_test2.h5
+#######################################################
+# test 2.4.0
+dset2.4a dset2.4b h5diff_test1.h5 h5diff_test2.h5
+# test 2.4.1
+dset2.4a dset2.4b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.4.2
+dset2.4a dset2.4b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.4.3
+dset2.4a dset2.4b -p 3 h5diff_test1.h5 h5diff_test2.h5
+#######################################################
+# test 2.5.0
+dset2.5a dset2.5b h5diff_test1.h5 h5diff_test2.h5
+# test 2.5.1
+dset2.5a dset2.5b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.5.2
+dset2.5a dset2.5b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.5.3
+dset2.5a dset2.5b -p 3 h5diff_test1.h5 h5diff_test2.h5
+#######################################################
+# test 2.6.0
+dset2.6a dset2.6b h5diff_test1.h5 h5diff_test2.h5
+# test 2.6.1
+dset2.6a dset2.6b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.6.2
+dset2.6a dset2.6b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.6.3
+dset2.6a dset2.6b -p 3 h5diff_test1.h5 h5diff_test2.h5
+
+#######################################################
+# Different combination of objects
+#######################################################
+
+# test 3.0
+h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.1
+dset3 dset3 h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.2
+dset3 dset4 h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.3
+dset6 dset3 h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.4
+dset6 dset6 h5diff_test3.h5 h5diff_test4.h5
*/
@@ -69,44 +138,55 @@ dset2.1 dset2.2 -d 3 h5diff_test1.h5 h5diff_test2.h5
int do_test_files(void)
{
- hid_t file1_id, file2_id;
+ hid_t file1_id, file2_id, file3_id, file4_id;
hid_t dataset_id;
hid_t space_id;
hid_t group_id;
- hid_t type_id, type2_id;
+ hid_t type_id, type2_id;
herr_t status;
- int val;
+ int val;
- /* Test 1. */
- hsize_t dims1 [1] = { 7 };
- hsize_t dims1_1[1] = { 8 };
- hsize_t dims2 [2] = { 3,2 };
+ /* Test 1. */
+ hsize_t dims1 [1] = { 7 };
+ hsize_t dims1_1[1] = { 8 };
+ hsize_t dims2 [2] = { 3,2 };
char data1_3[] = {"A string"};
- float data1_4[7] = {1,1,3,4,5,6,7};
-
- /* Test 2. */
- char data2_1[3][2] = {{1,1},{1,1},{1,1}};
- char data2_2[3][2] = {{1,1},{3,4},{5,6}};
-
-/*
- float data5[3][2] = {{1,1},{3,4},{5,6}};
- float data6[3][2] = {{1,1.1f},{3.02f,4.002f},{5.00002f,6}};
- double data8[3][2] = {{1,1},{3.40505e-9,4},{5,6}};
- double data9[3][2] = {{1,1},{3.58911e-9,4},{5,6}};*/
-
- /* Compound datatype */
+ float data1_4[7] = {1,1,3,4,5,6,7};
+
+ /* Compound datatype */
typedef struct s_t
- {
- int a;
- float b;
+ {
+ int a;
+ float b;
} s_t;
- typedef enum
- {
+ typedef enum
+ {
E_RED,
E_GREEN
} e_t;
+ /* Test 2.1 */
+ char data2_1a[3][2] = {{1,1},{1,1},{1,1}};
+ char data2_1b[3][2] = {{1,1},{3,4},{5,6}};
+ /* Test 2.2 */
+ short data2_2a[3][2] = {{1,1},{1,1},{1,1}};
+ short data2_2b[3][2] = {{1,1},{3,4},{5,6}};
+ /* Test 2.3 */
+ int data2_3a[3][2] = {{1,1},{1,1},{1,1}};
+ int data2_3b[3][2] = {{1,1},{3,4},{5,6}};
+ /* Test 2.4 */
+ long data2_4a[3][2] = {{1,1},{1,1},{1,1}};
+ long data2_4b[3][2] = {{1,1},{3,4},{5,6}};
+ /* Test 2.5 */
+ float data2_5a[3][2] = {{1,1},{1,1},{1,1}};
+ float data2_5b[3][2] = {{1,1},{3,4},{5,6}};
+ /* Test 2.6 */
+ double data2_6a[3][2] = {{1,1},{1,1},{1,1}};
+ double data2_6b[3][2] = {{1,1},{3,4},{5,6}};
+
+
+
/*-------------------------------------------------------------------------
* Create two files
*-------------------------------------------------------------------------
@@ -120,7 +200,7 @@ int do_test_files(void)
/*-------------------------------------------------------------------------
* Test 1.1
- * Objects are not the same type (e.g try to compare a group with a dataset)
+ * Objects are not the same type (e.g try to compare a group with a dataset)
*-------------------------------------------------------------------------
*/
@@ -142,7 +222,7 @@ int do_test_files(void)
/*-------------------------------------------------------------------------
* Test 1.2
- * Objects are of classes H5G_TYPE and H5G_GROUP and their name is supplied
+ * Objects are of classes H5G_TYPE and H5G_GROUP and their name is supplied
*-------------------------------------------------------------------------
*/
@@ -152,35 +232,35 @@ int do_test_files(void)
/* Close */
status = H5Gclose(group_id);
- /* Create a memory compound datatype on file1 */
- type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
+ /* Create a memory compound datatype on file1 */
+ type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_INT);
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT);
- /* Commit compound datatype and close it */
+ /* Commit compound datatype and close it */
H5Tcommit(file1_id, "compound", type_id);
- type2_id = H5Tcopy(type_id);
- H5Tcommit(file2_id, "compound", type2_id);
- H5Tclose(type_id);
- H5Tclose(type2_id);
-
- /* Create a memory enum datatype on file1 */
- type_id = H5Tcreate(H5T_ENUM, sizeof(e_t));
+ type2_id = H5Tcopy(type_id);
+ H5Tcommit(file2_id, "compound", type2_id);
+ H5Tclose(type_id);
+ H5Tclose(type2_id);
+
+ /* Create a memory enum datatype on file1 */
+ type_id = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(type_id, "RED", (val = 0, &val));
- H5Tenum_insert(type_id, "GREEN", (val = 1, &val));
- type2_id = H5Tcopy(type_id);
+ H5Tenum_insert(type_id, "GREEN", (val = 1, &val));
+ type2_id = H5Tcopy(type_id);
- /* Commit enumeration datatype and close it */
- H5Tcommit(file1_id, "enum", type_id);
- H5Tcommit(file2_id, "enum", type2_id);
- H5Tclose(type_id);
- H5Tclose(type2_id);
+ /* Commit enumeration datatype and close it */
+ H5Tcommit(file1_id, "enum", type_id);
+ H5Tcommit(file2_id, "enum", type2_id);
+ H5Tclose(type_id);
+ H5Tclose(type2_id);
/*-------------------------------------------------------------------------
* Test 1.3
- * Check for non supported classes. Supported classes are H5T_INTEGER and H5T_FLOAT
- * Non supported classes are
- * H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE,
- * H5T_ENUM, H5T_VLEN, H5T_ARRAY
+ * Check for non supported classes. Supported classes are H5T_INTEGER and H5T_FLOAT
+ * Non supported classes are
+ * H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE,
+ * H5T_ENUM, H5T_VLEN, H5T_ARRAY
*-------------------------------------------------------------------------
*/
@@ -218,8 +298,8 @@ int do_test_files(void)
/*-------------------------------------------------------------------------
* Test 1.4
- * Datasets are not the same class type
- * Write a float dataset and compare with integer "dset1.1"
+ * Datasets are not the same class type
+ * Write a float dataset and compare with integer "dset1.1"
*-------------------------------------------------------------------------
*/
@@ -227,7 +307,7 @@ int do_test_files(void)
/*-------------------------------------------------------------------------
* Test 1.5
- * Datasets are not the same rank
+ * Datasets are not the same rank
*-------------------------------------------------------------------------
*/
@@ -235,7 +315,7 @@ int do_test_files(void)
/*-------------------------------------------------------------------------
* Test 1.6
- * Check for the same current dimensions. Only compare if they are the same.
+ * Check for the same current dimensions. Only compare if they are the same.
*-------------------------------------------------------------------------
*/
@@ -243,434 +323,138 @@ int do_test_files(void)
/*-------------------------------------------------------------------------
* Test 2.1
- * Check for the same current dimensions. Only compare if they are the same.
- *-------------------------------------------------------------------------
- */
-
- write_dataset(file1_id,2,dims2,"dset2.1",H5T_NATIVE_CHAR,data2_1);
- write_dataset(file2_id,2,dims2,"dset2.2",H5T_NATIVE_CHAR,data2_2);
-
-
-
-/*-------------------------------------------------------------------------
- * Close files
- *-------------------------------------------------------------------------
- */
- status = H5Fclose(file1_id);
- status = H5Fclose(file2_id);
-
-
- return 0;
-
-
-}
-
-/*-------------------------------------------------------------------------
- * Function: write_dataset
- *
- * Purpose: utility function to write a dataset
- *
- * Return:
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: April 7, 2003
- *
- *-------------------------------------------------------------------------
- */
-
-int write_dataset( hid_t file_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t type_id, void *data )
-{
- hid_t dataset_id;
- hid_t space_id;
- herr_t status;
-
- /* Create a data space */
- space_id = H5Screate_simple(rank,dims,NULL);
-
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file_id,dset_name,type_id,space_id,H5P_DEFAULT);
-
- /* Write the data */
- if ( data )
- status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,data);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
-
- return 0;
-
-}
-
-
-
-
-#if 0
-
-
-/*
-dset1 dset2 h5diff_test1.h5 h5diff_test2.h5
-dset1 dset2 -l h5diff_test1.h5 h5diff_test2.h5
-h5diff_test1.h5 h5diff_test2.h5
-dset1 dset2 -r h5diff_test1.h5 h5diff_test2.h5
-dset1 dset2 -n 2 h5diff_test1.h5 h5diff_test2.h5
-dset3 dset4 -d 0.01 h5diff_test1.h5 h5diff_test2.h5
-dset5 dset6 -p 0.05 h5diff_test1.h5 h5diff_test2.h5
-dset5 dset7 h5diff_test1.h5 h5diff_test2.h5
-dset8 dset9 h5diff_test2.h5 h5diff_test2.h5
-dset11 dset12 h5diff_test1.h5 h5diff_test2.h5
-*/
-
-int do_test_files()
-{
-
- hid_t file1_id, file2_id;
- hid_t dataset_id;
- hid_t space_id;
- hid_t group_id, group2_id;
- hid_t type_id;
- hsize_t dims [1] = { 7 };
- hsize_t dims2 [2] = { 3,2 };
- hsize_t dims3 [2] = { 3,3 };
- int data1[7] = {1,1,1,1,1,1,1};
- int data2[7] = {1,1,1,4,5,6,7};
- float data3[7] = {1,1,3,4,5,6,7};
- float data4[7] = {1,1,3.02f,4.002f,5.00002f,6,7};
- float data5[3][2] = {1,1,3,4,5,6};
- float data6[3][2] = {1,1.1f,3.02f,4.002f,5.00002f,6};
- float data7[3][3] = {1,1,3,4,5,6,7,8,9};
- double data8[3][2] = {1,1,3.40505e-9,4,5,6};
- double data9[3][2] = {1,1,3.58911e-9,4,5,6};
- char data10[] = {"A string"};
- long data11[7] = {1,1,1,1,1,1,1};
- long data12[7] = {1,1,1,4,5,6,7};
- herr_t status;
-
-/*-------------------------------------------------------------------------
- * Create two files
- *-------------------------------------------------------------------------
- */
-
- /* Create a file */
- file1_id = H5Fcreate ("h5diff_test1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /* Create a file */
- file2_id = H5Fcreate ("h5diff_test2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
-/*-------------------------------------------------------------------------
- * Make dataset "dset1" on file1
- *-------------------------------------------------------------------------
- */
-
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a dataset "dset1" */
- dataset_id = H5Dcreate(file1_id,"dset1",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data1);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
-
-/*-------------------------------------------------------------------------
- * Make dataset "dset3" on file1
- *-------------------------------------------------------------------------
- */
-
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a dataset "dset3" */
- dataset_id = H5Dcreate(file1_id,"dset3",H5T_NATIVE_FLOAT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data3);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
-
-
-/*-------------------------------------------------------------------------
- * Make dataset "g1/dset1" on file1
- *-------------------------------------------------------------------------
- */
-
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a group. */
- group_id = H5Gcreate(file1_id, "g1", 0);
-
- /* Create a dataset "g1/dset1" */
- dataset_id = H5Dcreate(group_id,"dset1",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data1);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Gclose(group_id);
- status = H5Sclose(space_id);
-
-
-/*-------------------------------------------------------------------------
- * Make dataset "dset1" on file2
- *-------------------------------------------------------------------------
- */
-
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a dataset "dset1" */
- dataset_id = H5Dcreate(file2_id,"dset1",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data2);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
-
-
-/*-------------------------------------------------------------------------
- * Make dataset "dset2" on file2
+ * Check H5T_NATIVE_CHAR data
*-------------------------------------------------------------------------
*/
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a dataset "dset1" */
- dataset_id = H5Dcreate(file2_id,"dset2",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data2);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
-
+ write_dataset(file1_id,2,dims2,"dset2.1a",H5T_NATIVE_CHAR,data2_1a);
+ write_dataset(file2_id,2,dims2,"dset2.1b",H5T_NATIVE_CHAR,data2_1b);
/*-------------------------------------------------------------------------
- * Make dataset "g1/dset1" on file2
+ * Test 2.2
+ * Check H5T_NATIVE_SHORT data
*-------------------------------------------------------------------------
*/
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a group. */
- group_id = H5Gcreate(file2_id, "g1", 0);
-
- /* Create a dataset "g1/dset1" */
- dataset_id = H5Dcreate(group_id,"dset1",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data2);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Gclose(group_id);
- status = H5Sclose(space_id);
+ write_dataset(file1_id,2,dims2,"dset2.2a",H5T_NATIVE_SHORT,data2_2a);
+ write_dataset(file2_id,2,dims2,"dset2.2b",H5T_NATIVE_SHORT,data2_2b);
/*-------------------------------------------------------------------------
- * Make group "g2/g1" on file2
+ * Test 2.3
+ * Check H5T_NATIVE_INT data
*-------------------------------------------------------------------------
*/
- /* Create a group. */
- group_id = H5Gcreate(file2_id, "g2", 0);
- group2_id = H5Gcreate(group_id, "g1", 0);
-
- /* Close */
- status = H5Gclose(group_id);
- status = H5Gclose(group2_id);
+ write_dataset(file1_id,2,dims2,"dset2.3a",H5T_NATIVE_INT,data2_3a);
+ write_dataset(file2_id,2,dims2,"dset2.3b",H5T_NATIVE_INT,data2_3b);
/*-------------------------------------------------------------------------
- * Make dataset "dset4" on file2
+ * Test 2.4
+ * Check H5T_NATIVE_LONG data
*-------------------------------------------------------------------------
*/
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file2_id,"dset4",H5T_NATIVE_FLOAT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data4);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
+ write_dataset(file1_id,2,dims2,"dset2.4a",H5T_NATIVE_LONG,data2_4a);
+ write_dataset(file2_id,2,dims2,"dset2.4b",H5T_NATIVE_LONG,data2_4b);
/*-------------------------------------------------------------------------
- * Make dataset "dset5" on file1
+ * Test 2.5
+ * Check H5T_NATIVE_FLOAT data
*-------------------------------------------------------------------------
*/
- /* Create a data space */
- space_id = H5Screate_simple(2,dims2,NULL);
-
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file1_id,"dset5",H5T_NATIVE_FLOAT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data5);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
+ write_dataset(file1_id,2,dims2,"dset2.5a",H5T_NATIVE_FLOAT,data2_5a);
+ write_dataset(file2_id,2,dims2,"dset2.5b",H5T_NATIVE_FLOAT,data2_5b);
/*-------------------------------------------------------------------------
- * Make dataset "dset6" on file2
+ * Test 2.4
+ * Check H5T_NATIVE_LONG data
*-------------------------------------------------------------------------
*/
- /* Create a data space */
- space_id = H5Screate_simple(2,dims2,NULL);
-
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file2_id,"dset6",H5T_NATIVE_FLOAT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data6);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
+ write_dataset(file1_id,2,dims2,"dset2.6a",H5T_NATIVE_DOUBLE,data2_6a);
+ write_dataset(file2_id,2,dims2,"dset2.6b",H5T_NATIVE_DOUBLE,data2_6b);
-/*-------------------------------------------------------------------------
- * Make dataset "dset7" on file2
- *-------------------------------------------------------------------------
- */
- /* Create a data space */
- space_id = H5Screate_simple(2,dims3,NULL);
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file2_id,"dset7",H5T_NATIVE_FLOAT,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_FLOAT,H5S_ALL,H5S_ALL,H5P_DEFAULT,data7);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
/*-------------------------------------------------------------------------
- * Make dataset "dset8" on file2
+ * Create two files
*-------------------------------------------------------------------------
*/
-
- /* Create a data space */
- space_id = H5Screate_simple(2,dims2,NULL);
-
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file2_id,"dset8",H5T_NATIVE_DOUBLE,space_id,H5P_DEFAULT);
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,data8);
+ /* Create a file */
+ file3_id = H5Fcreate ("h5diff_test3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
+ /* Create a file */
+ file4_id = H5Fcreate ("h5diff_test4.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Make dataset "dset9" on file2
+ * Test 3.0
+ * Check for different objects
*-------------------------------------------------------------------------
*/
- /* Create a data space */
- space_id = H5Screate_simple(2,dims2,NULL);
+ write_dataset(file3_id,1,dims1_1,"dset3",H5T_NATIVE_INT,0);
+ write_dataset(file4_id,1,dims1_1,"dset3",H5T_NATIVE_INT,0);
+ write_dataset(file3_id,1,dims1_1,"dset4",H5T_NATIVE_INT,0);
+ write_dataset(file4_id,1,dims1_1,"dset5",H5T_NATIVE_INT,0);
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file2_id,"dset9",H5T_NATIVE_DOUBLE,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_DOUBLE,H5S_ALL,H5S_ALL,H5P_DEFAULT,data9);
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
+
/*-------------------------------------------------------------------------
- * Make dataset "dset10" on file2
+ * Close files
*-------------------------------------------------------------------------
*/
+ status = H5Fclose(file1_id);
+ status = H5Fclose(file2_id);
+ status = H5Fclose(file3_id);
+ status = H5Fclose(file4_id);
- /* Create a data space */
- space_id = H5Screate(H5S_SCALAR);
- /* Make a string type */
- type_id = H5Tcopy(H5T_C_S1);
- status = H5Tset_size (type_id, strlen(data10));
+ return 0;
- /* Create a dataset "dset" */
- dataset_id = H5Dcreate(file2_id,"dset10",type_id,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,data10);
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
- status = H5Tclose(type_id);
+}
/*-------------------------------------------------------------------------
- * Make dataset "dset11" on file1
+ * Function: write_dataset
+ *
+ * Purpose: utility function to write a dataset
+ *
+ * Return:
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: April 7, 2003
+ *
*-------------------------------------------------------------------------
*/
- /* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
-
- /* Create a dataset "dset1" */
- dataset_id = H5Dcreate(file1_id,"dset11",H5T_NATIVE_LONG,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_LONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,data11);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
-
-/*-------------------------------------------------------------------------
- * Make dataset "dset12" on file2
- *-------------------------------------------------------------------------
- */
+int write_dataset( hid_t file_id, int rank, hsize_t *dims, const char *dset_name,
+ hid_t type_id, void *data )
+{
+ hid_t dataset_id;
+ hid_t space_id;
+ herr_t status;
/* Create a data space */
- space_id = H5Screate_simple(1,dims,NULL);
+ space_id = H5Screate_simple(rank,dims,NULL);
- /* Create a dataset "dset12" */
- dataset_id = H5Dcreate(file2_id,"dset12",H5T_NATIVE_LONG,space_id,H5P_DEFAULT);
+ /* Create a dataset */
+ dataset_id = H5Dcreate(file_id,dset_name,type_id,space_id,H5P_DEFAULT);
/* Write the data */
- status = H5Dwrite(dataset_id,H5T_NATIVE_LONG,H5S_ALL,H5S_ALL,H5P_DEFAULT,data12);
+ if ( data )
+ status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,data);
/* Close */
status = H5Dclose(dataset_id);
status = H5Sclose(space_id);
-
-/*-------------------------------------------------------------------------
- * Close files
- *-------------------------------------------------------------------------
- */
- status = H5Fclose(file1_id);
- status = H5Fclose(file2_id);
-
-
return 0;
-
}
-#endif \ No newline at end of file
+
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index f225901..0f0a703 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -86,7 +86,7 @@ TOOLTEST() {
##############################################################################
##############################################################################
-### T H E T E S T S ###
+### T H E T E S T S ###
##############################################################################
##############################################################################
@@ -156,15 +156,109 @@ TOOLTEST h5diff_16.txt dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5
# tests 2., Different datatype sizes and different mix of options
##############################################################################
-# test 2.1.0: H5T_INTEGER size 1 
+##############################################################################
+# H5T_INTEGER size 1 
+##############################################################################
+
+# test 2.1.0
TOOLTEST h5diff_210.txt dset2.1 dset2.2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.1.1: H5T_INTEGER size 1 
+# test 2.1.1
TOOLTEST h5diff_211.txt dset2.1 dset2.2 -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.1.2: H5T_INTEGER size 1 
+# test 2.1.2
TOOLTEST h5diff_212.txt dset2.1 dset2.2 -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.1.3
+TOOLTEST h5diff_213.txt dset2.1a dset2.1b -p 3 h5diff_test1.h5 h5diff_test2.h5
+
+##############################################################################
+# H5T_INTEGER size 2
+##############################################################################
+
+# test 2.2.0
+TOOLTEST h5diff_220.txt dset2.2a dset2.2b h5diff_test1.h5 h5diff_test2.h5
+# test 2.2.1
+TOOLTEST h5diff_221.txt dset2.2a dset2.2b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.2.2
+TOOLTEST h5diff_222.txt dset2.2a dset2.2b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.2.3
+TOOLTEST h5diff_223.txt dset2.2a dset2.2b -p 3 h5diff_test1.h5 h5diff_test2.h5
+
+##############################################################################
+# H5T_INTEGER size 4
+##############################################################################
+
+# test 2.3.0
+TOOLTEST h5diff_230.txt dset2.3a dset2.3b h5diff_test1.h5 h5diff_test2.h5
+# test 2.3.1
+TOOLTEST h5diff_231.txt dset2.3a dset2.3b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.3.2
+TOOLTEST h5diff_232.txt dset2.3a dset2.3b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.3.3
+TOOLTEST h5diff_233.txt dset2.3a dset2.3b -p 3 h5diff_test1.h5 h5diff_test2.h5
+
+##############################################################################
+# H5T_INTEGER size 8
+##############################################################################
+
+# test 2.4.0
+TOOLTEST h5diff_240.txt dset2.4a dset2.4b h5diff_test1.h5 h5diff_test2.h5
+# test 2.4.1
+TOOLTEST h5diff_241.txt dset2.4a dset2.4b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.4.2
+TOOLTEST h5diff_242.txt dset2.4a dset2.4b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.4.3
+TOOLTEST h5diff_243.txt dset2.4a dset2.4b -p 3 h5diff_test1.h5 h5diff_test2.h5
+
+##############################################################################
+# H5T_FLOAT size 4
+##############################################################################
+
+# test 2.5.0
+TOOLTEST h5diff_250.txt dset2.5a dset2.5b h5diff_test1.h5 h5diff_test2.h5
+# test 2.5.1
+TOOLTEST h5diff_251.txt dset2.5a dset2.5b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.5.2
+TOOLTEST h5diff_252.txt dset2.5a dset2.5b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.5.3
+TOOLTEST h5diff_253.txt dset2.5a dset2.5b -p 3 h5diff_test1.h5 h5diff_test2.h5
+
+##############################################################################
+# H5T_FLOAT size 8
+##############################################################################
+
+# test 2.6.0
+TOOLTEST h5diff_260.txt dset2.6a dset2.6b h5diff_test1.h5 h5diff_test2.h5
+# test 2.6.1
+TOOLTEST h5diff_261.txt dset2.6a dset2.6b -n 2 h5diff_test1.h5 h5diff_test2.h5
+# test 2.6.2
+TOOLTEST h5diff_262.txt dset2.6a dset2.6b -d 3 h5diff_test1.h5 h5diff_test2.h5
+# test 2.6.3
+TOOLTEST h5diff_263.txt dset2.6a dset2.6b -p 3 h5diff_test1.h5 h5diff_test2.h5
+
+
+#######################################################
+# Different combination of objects
+#######################################################
+
+# test 3.0
+TOOLTEST h5diff_30.txt h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.1
+TOOLTEST h5diff_31.txt dset3 dset3 h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.2
+TOOLTEST h5diff_32.txt dset3 dset4 h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.3
+TOOLTEST h5diff_33.txt dset6 dset3 h5diff_test3.h5 h5diff_test4.h5
+
+# test 3.4
+TOOLTEST h5diff_34.txt dset6 dset6 h5diff_test3.h5 h5diff_test4.h5
+
+
+
if test $nerrors -eq 0 ; then
echo "All $H5DIFF tests passed."