diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-04-28 23:56:32 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-04-28 23:56:32 (GMT) |
commit | c37bcc12fcb51330a640adc82de5caaf388e9f92 (patch) | |
tree | 035582ed081f60033ed1fc9160e5b0c32981fd99 /tools/h5diff | |
parent | 23a8546574873e201838f2424c7326d4014ba903 (diff) | |
download | hdf5-c37bcc12fcb51330a640adc82de5caaf388e9f92.zip hdf5-c37bcc12fcb51330a640adc82de5caaf388e9f92.tar.gz hdf5-c37bcc12fcb51330a640adc82de5caaf388e9f92.tar.bz2 |
[svn-r6771] Purpose:
added more tests, described in the test matrix
Description:
test -r
test -l
expanded -d, -p and -n tests
test different types to include links and named types
test for non supported classes, e.g bitfield, opaque , etc
Platforms tested:
Linux 2.4 (rockaway)
SunOS 5.7 (arabica)
IRIX 6.5 (modi4)
Misc. update:
Diffstat (limited to 'tools/h5diff')
-rw-r--r-- | tools/h5diff/h5diff.c | 302 | ||||
-rw-r--r-- | tools/h5diff/h5difftst.c | 357 | ||||
-rwxr-xr-x | tools/h5diff/testh5diff.sh | 211 |
3 files changed, 676 insertions, 194 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c index ca05a59..4031b88 100644 --- a/tools/h5diff/h5diff.c +++ b/tools/h5diff/h5diff.c @@ -78,6 +78,14 @@ void leave(); +/* 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 ); + + + + /*------------------------------------------------------------------------- * Function: usage * @@ -158,6 +166,9 @@ int main(int argc, const char *argv[]) const char *file2_name; const char *obj1_name = NULL; const char *obj2_name = NULL; + + /*do_test_files();*/ + /*------------------------------------------------------------------------- * print the command line options @@ -440,6 +451,10 @@ int check_f_input( const char *str ) unsigned i; char c; + /* '0' values not allowed */ + if ( strlen(str)==1 && str[0]=='0' ) + return -1; + for ( i = 0; i < strlen(str); i++) { c = str[i]; @@ -486,8 +501,11 @@ void list( const char *filename, int nobjects, info_t *info ) case H5G_TYPE: printf("%s %20s\n", info[i].name, "datatype" ); break; + case H5G_LINK: + printf("%s %20s\n", info[i].name, "link" ); + break; default: - printf("non supported object\n" ); + printf("%s %20s\n", info[i].name, "User defined object" ); break; } } @@ -619,33 +637,26 @@ void diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *ob switch ( type ) { - -/*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - - case H5G_GROUP: - printf( "<%s> and <%s> are of type H5G_GROUP\n", obj1_name, obj2_name ); - break; - - /*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - + case H5G_DATASET: diff_dataset(file1_id,file2_id,obj1_name,obj2_name,options); break; - - /*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ - + + case H5G_GROUP: + printf( "<%s> and <%s> are of type H5G_GROUP\n", obj1_name, obj2_name ); + break; + case H5G_TYPE: printf( "<%s> and <%s> are of type H5G_TYPE\n", obj1_name, obj2_name ); break; + + case H5G_LINK: + printf( "<%s> and <%s> are of type H5G_LINK\n", obj1_name, obj2_name ); + break; + + default: + printf( "<%s> and <%s> are user defined types\n", obj1_name, obj2_name ); + break; } /* switch */ @@ -1186,35 +1197,41 @@ 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 - *i1ptr2 / *i1ptr1) > options.p_relative ) + if (*i1ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs(1 - *i1ptr2 / *i1ptr1) > options.p_relative ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(IFORMAT, *i1ptr1, *i1ptr2, abs(*i1ptr1 - *i1ptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(IFORMAT, *i1ptr1, *i1ptr2, abs(*i1ptr1 - *i1ptr2)); + } + nfound++; } - nfound++; } } /* percentage and delta */ else if ( options.d_ && options.p_ ) { - if ( abs(1 - *i1ptr2 / *i1ptr1) > options.p_relative && - abs(*i1ptr1 - *i1ptr2) > options.d_delta ) + if (*i1ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs(1 - *i1ptr2 / *i1ptr1) > options.p_relative && + abs(*i1ptr1 - *i1ptr2) > options.d_delta ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(IFORMAT, *i1ptr1, *i1ptr2, abs(*i1ptr1 - *i1ptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(IFORMAT, *i1ptr1, *i1ptr2, abs(*i1ptr1 - *i1ptr2)); + } + nfound++; } - nfound++; } } @@ -1268,35 +1285,41 @@ 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 - *i2ptr2 / *i2ptr1) > options.p_relative ) + if (*i2ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs(1 - *i2ptr2 / *i2ptr1) > options.p_relative ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(IFORMAT, *i2ptr1, *i2ptr2, abs(*i2ptr1 - *i2ptr2)); - } - nfound++; + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(IFORMAT, *i2ptr1, *i2ptr2, abs(*i2ptr1 - *i2ptr2)); + } + nfound++; } + } } /* percentage and delta */ else if ( options.d_ && options.p_ ) { - if ( abs(1 - *i2ptr2 / *i2ptr1) > options.p_relative && - abs(*i2ptr1 - *i2ptr2) > options.d_delta ) + if (*i2ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs(1 - *i2ptr2 / *i2ptr1) > options.p_relative && + abs(*i2ptr1 - *i2ptr2) > options.d_delta ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(IFORMAT, *i2ptr1, *i2ptr2, abs(*i2ptr1 - *i2ptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(IFORMAT, *i2ptr1, *i2ptr2, abs(*i2ptr1 - *i2ptr2)); + } + nfound++; } - nfound++; } } @@ -1351,35 +1374,41 @@ 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 - *i4ptr2 / *i4ptr1) > options.p_relative ) + if (*i4ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs(1 - *i4ptr2 / *i4ptr1) > options.p_relative ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(IFORMAT, *i4ptr1, *i4ptr2, abs(*i4ptr1 - *i4ptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(IFORMAT, *i4ptr1, *i4ptr2, abs(*i4ptr1 - *i4ptr2)); + } + nfound++; } - nfound++; } } /* percentage and delta */ else if ( options.d_ && options.p_ ) { - if ( abs(1 - *i4ptr2 / *i4ptr1) > options.p_relative && - abs(*i4ptr1 - *i4ptr2) > options.d_delta ) + if (*i4ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs(1 - *i4ptr2 / *i4ptr1) > options.p_relative && + abs(*i4ptr1 - *i4ptr2) > options.d_delta ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(IFORMAT, *i4ptr1, *i4ptr2, abs(*i4ptr1 - *i4ptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(IFORMAT, *i4ptr1, *i4ptr2, abs(*i4ptr1 - *i4ptr2)); + } + nfound++; } - nfound++; } } @@ -1435,35 +1464,41 @@ 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 - *i8ptr2 / *i8ptr1)) > options.p_relative ) + if (*i8ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs((int)(1 - *i8ptr2 / *i8ptr1)) > options.p_relative ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(LIFORMAT, *i8ptr1, *i8ptr2, i8diff); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(LIFORMAT, *i8ptr1, *i8ptr2, i8diff); + } + nfound++; } - nfound++; } } /* percentage and delta */ else if ( options.d_ && options.p_ ) { - if ( abs((int)(1 - *i8ptr2 / *i8ptr1)) > options.p_relative && - abs(i8diff) > options.d_delta ) + if (*i8ptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( abs((int)(1 - *i8ptr2 / *i8ptr1)) > options.p_relative && + abs(i8diff) > options.d_delta ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(LIFORMAT, *i8ptr1, *i8ptr2, i8diff); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(LIFORMAT, *i8ptr1, *i8ptr2, i8diff); + } + nfound++; } - nfound++; } } @@ -1530,35 +1565,41 @@ 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 - *fptr2 / *fptr1) > options.p_relative ) + if (*fptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( fabs(1 - *fptr2 / *fptr1) > options.p_relative ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(FFORMAT, *fptr1, *fptr2, fabs(*fptr1 - *fptr2)); - } - nfound++; + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(FFORMAT, *fptr1, *fptr2, fabs(*fptr1 - *fptr2)); + } + nfound++; } + } } /* percentage and delta */ else if ( options.d_ && options.p_ ) { - if ( fabs(1 - *fptr2 / *fptr1) > options.p_relative && - fabs(*fptr1 - *fptr2) > options.d_delta ) + if (*fptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( fabs(1 - *fptr2 / *fptr1) > options.p_relative && + fabs(*fptr1 - *fptr2) > options.d_delta ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(FFORMAT, *fptr1, *fptr2, fabs(*fptr1 - *fptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(FFORMAT, *fptr1, *fptr2, fabs(*fptr1 - *fptr2)); + } + nfound++; } - nfound++; } } @@ -1611,35 +1652,41 @@ 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 - *dptr2 / *dptr1) > options.p_relative ) + if (*dptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( fabs(1 - *dptr2 / *dptr1) > options.p_relative ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(FFORMAT, *dptr1, *dptr2, fabs(*dptr1 - *dptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(FFORMAT, *dptr1, *dptr2, fabs(*dptr1 - *dptr2)); + } + nfound++; } - nfound++; } } /* percentage and delta */ else if ( options.d_ && options.p_ ) { - if ( fabs(1 - *dptr2 / *dptr1) > options.p_relative && - fabs(*dptr1 - *dptr2) > options.d_delta ) + if (*dptr1!=0) { - if ( options.n_ && nfound>=options.n_number_count) - return nfound; - if ( options.r_==0 ) + if ( fabs(1 - *dptr2 / *dptr1) > options.p_relative && + fabs(*dptr1 - *dptr2) > options.d_delta ) { - print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); - printf(SPACES); - printf(FFORMAT, *dptr1, *dptr2, fabs(*dptr1 - *dptr2)); + if ( options.n_ && nfound>=options.n_number_count) + return nfound; + if ( options.r_==0 ) + { + print_pos( &ph, i, acc, pos, rank, obj1, obj2 ); + printf(SPACES); + printf(FFORMAT, *dptr1, *dptr2, fabs(*dptr1 - *dptr2)); + } + nfound++; } - nfound++; } } @@ -1973,3 +2020,6 @@ void print_datatype(hid_t type) }/*switch*/ } + + + diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c index bbb5a1c..912ec33 100644 --- a/tools/h5diff/h5difftst.c +++ b/tools/h5diff/h5difftst.c @@ -18,7 +18,6 @@ #include "hdf5.h" - /* diff tst*/ int do_test_files(void); int write_dataset( hid_t file_id, int rank, hsize_t *dims, const char *dset_name, @@ -35,39 +34,230 @@ int main(int argc, const char *argv[]) - - /*------------------------------------------------------------------------- * these command line options are tested in ./testh5diff.sh *------------------------------------------------------------------------- */ /* -# test 1.1 + +############################################################################## +# tests 0., Check for individual options +############################################################################## + +# test 0.1: Check if the command line number of arguments is less than 3 +h5diff_test1.h5 + +# test 0.2: Check for invalid options +-x h5diff_test1.h5 h5diff_test2.h5 + +# test 0.3.1: Check for -h option +-h h5diff_test1.h5 h5diff_test2.h5 + +# test 0.3.2: Check for -l option +-l h5diff_test1.h5 h5diff_test2.h5 + +# test 0.3.3: Check for -r option +-r h5diff_test1.h5 h5diff_test2.h5 + +############################################################################## +# Test -d option +############################################################################## + + +# test 0.4.1: no value +-d h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.2: negative value +-d -4 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.3: zero +-d 0 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.4: non number +-d u h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.5: hexadecimal +-d 0x1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.6: string which is a number +-d "1" h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.7: repeated value +-d 1 -d 2 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.8: number larger than biggest difference +dset2.1a dset2.1b -d 7 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.9: number smaller than smallest difference +dset2.1a dset2.1b -d 1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.10: non-integer +dset2.1a dset2.1b -d 2.3 h5diff_test1.h5 h5diff_test2.h5 + + +############################################################################## +# Test -p option +############################################################################## + + +# test 0.5.1: no value +-p h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.2: negative value +-p -4 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.3: zero +-p 0 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.4: non number +-p u h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.5: hexadecimal +-p 0x1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.6: string +-p "1" h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.7: repeated value +-p 1 -p 2 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.8: number larger than biggest difference +dset2.1a dset2.1b -p 7 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.9: number smaller than smallest difference +dset2.1a dset2.1b -p 1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.10: non-integer +dset2.1a dset2.1b -p 2.3 h5diff_test1.h5 h5diff_test2.h5 + +############################################################################## +# Test -n option +############################################################################## + + +# test 0.6.1: no value +-n h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.2: negative value +-n -4 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.3: zero +-n 0 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.4: non number +-n u h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.5: hexadecimal +-n 0x1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.6: string +-n "1" h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.7: repeated value +-n 1 -n 2 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.8: number larger than biggest difference +dset2.1a dset2.1b -n 7 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.9: number smaller than smallest difference +dset2.1a dset2.1b -n 1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.10: non-integer +dset2.1a dset2.1b -n 2.3 h5diff_test1.h5 h5diff_test2.h5 + +############################################################################## +# Test valid files +############################################################################## + +# test 0.7: Check if the file names supplied are valid files +h5diff_test1.h6 h5diff_test2.h6 + + +############################################################################## +# Check for not comparable issues +############################################################################## + +############################################################################## +# Different types +############################################################################## + +# test 1.1.1: Compare a dataset with a group dset1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5 + +# test 1.1.2 Dataset vs Link +dset1.1 soft h5diff_test1.h5 h5diff_test1.h5 + +# test 1.1.3 Dataset vs Named type +dset1.1 compound h5diff_test1.h5 h5diff_test1.h5 + +############################################################################## +# not comparable types +############################################################################## + +# test 1.2.1: Group vs Group g1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5 -# test 1.2 + +# test 1.2.2: Type vs Type compound h5diff_test1.h5 h5diff_test2.h5 -enum h5diff_test1.h5 h5diff_test2.h5 -# test 1.3 -dset1.3 h5diff_test1.h5 h5diff_test2.h5 -# test 1.4 + +# test 1.2.3: Link vs Link +soft soft h5diff_test1.h5 h5diff_test1.h5 + + +############################################################################## +# Class issues +############################################################################## + +# test 1.3.1: H5T_STRING +dset1.3.1 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.2: H5T_BITFIELD +dset1.3.2 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.3: H5T_OPAQUE +dset1.3.3 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.4: H5T_COMPOUND +dset1.3.4 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.5: H5T_REFERENCE +dset1.3.5 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.6: H5T_ENUM +dset1.3.6 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.7: H5T_VLEN +dset1.3.7 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.8: H5T_ARRAY +dset1.3.8 h5diff_test1.h5 h5diff_test1.h5 + + +# test 1.4: Compare integer with float dset1.1 dset1.4 h5diff_test1.h5 h5diff_test2.h5 -# test 1.5 + +# test 1.5 : Check for the same rank, for datasets dset1.1 dset1.5 h5diff_test1.h5 h5diff_test2.h5 -# test 1.6 + +# test 1.6: Check for the same current dimensions. Only compare if they are the same. dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5 -# test 1.7 +# test 1.7: Check for the same maximum dimensions. Give a warning if they are different. dset1.7 dset1.7 h5diff_test1.h5 h5diff_test2.h5 -# test 1.8 + +# test 1.8: Check for the same storage datatype. Give a warning if they are different. 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 ####################################################### + +############################################################################## +# H5T_INTEGER size 1 +############################################################################## + # test 2.1.0 dset2.1a dset2.1b h5diff_test1.h5 h5diff_test2.h5 # test 2.1.1 @@ -76,7 +266,11 @@ dset2.1a dset2.1b -n 2 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 -####################################################### + +############################################################################## +# H5T_INTEGER size 2 +############################################################################## + # test 2.2.0 dset2.2a dset2.2b h5diff_test1.h5 h5diff_test2.h5 # test 2.2.1 @@ -85,7 +279,11 @@ dset2.2a dset2.2b -n 2 h5diff_test1.h5 h5diff_test2.h5 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 -####################################################### + +############################################################################## +# H5T_INTEGER size 4 +############################################################################## + # test 2.3.0 dset2.3a dset2.3b h5diff_test1.h5 h5diff_test2.h5 # test 2.3.1 @@ -94,7 +292,11 @@ dset2.3a dset2.3b -n 2 h5diff_test1.h5 h5diff_test2.h5 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 -####################################################### + +############################################################################## +# H5T_INTEGER size 8 +############################################################################## + # test 2.4.0 dset2.4a dset2.4b h5diff_test1.h5 h5diff_test2.h5 # test 2.4.1 @@ -103,7 +305,11 @@ dset2.4a dset2.4b -n 2 h5diff_test1.h5 h5diff_test2.h5 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 -####################################################### + +############################################################################## +# H5T_FLOAT size 4 +############################################################################## + # test 2.5.0 dset2.5a dset2.5b h5diff_test1.h5 h5diff_test2.h5 # test 2.5.1 @@ -112,7 +318,11 @@ dset2.5a dset2.5b -n 2 h5diff_test1.h5 h5diff_test2.h5 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 -####################################################### + +############################################################################## +# H5T_FLOAT size 8 +############################################################################## + # test 2.6.0 dset2.6a dset2.6b h5diff_test1.h5 h5diff_test2.h5 # test 2.6.1 @@ -163,6 +373,7 @@ int do_test_files(void) hsize_t dims0 [1] = { 1 }; hsize_t dims2 [2] = { 3,2 }; char data1_3[] = {"A string"}; + unsigned char data1_3_2[7] = {1,2,3,4,5,6,7}; float data1_4[7] = {1,1,3,4,5,6,7}; /* Compound datatype */ @@ -268,7 +479,16 @@ int do_test_files(void) H5Tclose(type2_id); /*------------------------------------------------------------------------- - * Test 1.3 + * Test 1.2.3 + * Links + *------------------------------------------------------------------------- + */ + + /* Create a symbolic link */ + status = H5Glink(file1_id, H5G_LINK_SOFT, "dset1.1", "soft"); + +/*------------------------------------------------------------------------- + * Tests 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, @@ -277,7 +497,8 @@ int do_test_files(void) */ /*------------------------------------------------------------------------- - * Write two string datatypes + * Test 1.3.1 + * H5T_STRING *------------------------------------------------------------------------- */ @@ -289,26 +510,95 @@ int do_test_files(void) status = H5Tset_size (type_id, strlen(data1_3)); /* Create a dataset "dset1.3" on file 1 */ - dataset_id = H5Dcreate(file1_id,"dset1.3",type_id,space_id,H5P_DEFAULT); + dataset_id = H5Dcreate(file1_id,"dset1.3.1",type_id,space_id,H5P_DEFAULT); /* Write the data */ status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,data1_3); /* Close */ status = H5Dclose(dataset_id); + status = H5Sclose(space_id); + status = H5Tclose(type_id); - /* Create a dataset "dset1.3" on file 2 */ - dataset_id = H5Dcreate(file2_id,"dset1.3",type_id,space_id,H5P_DEFAULT); - - /* Write the data */ - status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,data1_3); +/*------------------------------------------------------------------------- + * Test 1.3.2 + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ - /* Close */ - status = H5Dclose(dataset_id); - status = H5Sclose(space_id); + type_id = H5Tcopy(H5T_STD_B8LE); + write_dataset(file1_id,1,dims1,"dset1.3.2",type_id,data1_3_2); + status = H5Tclose(type_id); + + +/*------------------------------------------------------------------------- + * Test 1.3.3 + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + + type_id = H5Tcreate(H5T_OPAQUE, 1); + status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ + write_dataset(file1_id,1,dims1,"dset1.3.3",type_id,data1_3_2); + status = H5Tclose(type_id); + +/*------------------------------------------------------------------------- + * Test 1.3.4 + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + + 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); + write_dataset(file1_id,1,dims1,"dset1.3.4",type_id,0); + status = H5Tclose(type_id); + +/*------------------------------------------------------------------------- + * Test 1.3.5 + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ + + write_dataset(file1_id,1,dims1,"dset1.3.5",H5T_STD_REF_OBJ,0); + + +/*------------------------------------------------------------------------- + * Test 1.3.6 + * H5T_ENUM + *------------------------------------------------------------------------- + */ + + type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); + H5Tenum_insert(type_id, "RED", (val = 0, &val)); + H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); + write_dataset(file1_id,1,dims1,"dset1.3.6",type_id,0); status = H5Tclose(type_id); /*------------------------------------------------------------------------- + * Test 1.3.7 + * H5T_VLEN + *------------------------------------------------------------------------- + */ + + type_id = H5Tvlen_create(H5T_NATIVE_INT); + write_dataset(file1_id,1,dims1,"dset1.3.7",type_id,0); + status = H5Tclose(type_id); + + +/*------------------------------------------------------------------------- + * Test 1.3.8 + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + + type_id = H5Tarray_create(H5T_NATIVE_INT,1,dims1,NULL); + write_dataset(file1_id,1,dims1,"dset1.3.8",type_id,0); + status = H5Tclose(type_id); + + + +/*------------------------------------------------------------------------- * Test 1.4 * Datasets are not the same class type * Write a float dataset and compare with integer "dset1.1" @@ -513,3 +803,8 @@ 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 ceaaddb..8ce28d3 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -79,9 +79,9 @@ TOOLTEST() { fi # Clean up output file - if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err - fi + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi } ############################################################################## @@ -91,7 +91,7 @@ TOOLTEST() { ############################################################################## ############################################################################## -# tests 0., check for bad input values +# tests 0., Check for individual options ############################################################################## # test 0.1: Check if the command line number of arguments is less than 3 @@ -100,66 +100,203 @@ TOOLTEST h5diff_01.txt h5diff_test1.h5 # test 0.2: Check for invalid options TOOLTEST h5diff_02.txt -x h5diff_test1.h5 h5diff_test2.h5 -# test 0.3: Check for -h option -TOOLTEST h5diff_03.txt -h h5diff_test1.h5 h5diff_test2.h5 +# test 0.3.1: Check for -h option +TOOLTEST h5diff_031.txt -h h5diff_test1.h5 h5diff_test2.h5 -# test 0.4: Check for invalid -d options -TOOLTEST h5diff_04.txt -d h5diff_test1.h5 h5diff_test2.h5 +# test 0.3.2: Check for -l option +TOOLTEST h5diff_032.txt -l h5diff_test1.h5 h5diff_test2.h5 -# test 0.5: Check for invalid -d options -TOOLTEST h5diff_05.txt -d -4 h5diff_test1.h5 h5diff_test2.h5 +# test 0.3.3: Check for -r option +TOOLTEST h5diff_033.txt -r h5diff_test1.h5 h5diff_test2.h5 + +############################################################################## +# Test -d option +############################################################################## + + +# test 0.4.1: no value +TOOLTEST h5diff_041.txt -d h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.2: negative value +TOOLTEST h5diff_042.txt -d -4 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.3: zero +TOOLTEST h5diff_043.txt -d 0 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.4: non number +TOOLTEST h5diff_044.txt -d u h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.5: hexadecimal +TOOLTEST h5diff_045.txt -d 0x1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.6: string +TOOLTEST h5diff_046.txt -d "1" h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.7: repeated value +TOOLTEST h5diff_047.txt -d 1 -d 2 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.8: number larger than biggest difference +TOOLTEST h5diff_048.txt dset2.1a dset2.1b -d 7 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.9: number smaller than smallest difference +TOOLTEST h5diff_049.txt dset2.1a dset2.1b -d 1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.4.10: non-integer +TOOLTEST h5diff_0410.txt dset2.1a dset2.1b -d 2.3 h5diff_test1.h5 h5diff_test2.h5 + +############################################################################## +# Test -p option +############################################################################## + + +# test 0.5.1: no value +TOOLTEST h5diff_051.txt -p h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.2: negative value +TOOLTEST h5diff_052.txt -p -4 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.3: zero +TOOLTEST h5diff_053.txt -p 0 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.4: non number +TOOLTEST h5diff_054.txt -p u h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.5: hexadecimal +TOOLTEST h5diff_055.txt -p 0x1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.6: string +TOOLTEST h5diff_056.txt -p "1" h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.7: repeated value +TOOLTEST h5diff_057.txt -p 1 -p 2 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.8: number larger than biggest difference +TOOLTEST h5diff_058.txt dset2.1a dset2.1b -p 7 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.9: number smaller than smallest difference +TOOLTEST h5diff_059.txt dset2.1a dset2.1b -p 1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.5.10: non-integer +TOOLTEST h5diff_0510.txt dset2.1a dset2.1b -p 2.3 h5diff_test1.h5 h5diff_test2.h5 + +############################################################################## +# Test -n option +############################################################################## -# test 0.6: Check for invalid -p options -TOOLTEST h5diff_06.txt -p h5diff_test1.h5 h5diff_test2.h5 -# test 0.7: Check for invalid -p options -TOOLTEST h5diff_07.txt -p -4 h5diff_test1.h5 h5diff_test2.h5 +# test 0.6.1: no value +TOOLTEST h5diff_061.txt -n h5diff_test1.h5 h5diff_test2.h5 -# test 0.8: Check for invalid -n options -TOOLTEST h5diff_08.txt -n h5diff_test1.h5 h5diff_test2.h5 +# test 0.6.2: negative value +TOOLTEST h5diff_062.txt -n -4 h5diff_test1.h5 h5diff_test2.h5 -# test 0.9: Check for invalid -n options -TOOLTEST h5diff_09.txt -n 0 h5diff_test1.h5 h5diff_test2.h5 +# test 0.6.3: zero +TOOLTEST h5diff_063.txt -n 0 h5diff_test1.h5 h5diff_test2.h5 -# test 0.10: Check if the file names supplied are valid files -TOOLTEST h5diff_010.txt h5diff_test1.h6 h5diff_test2.h6 +# test 0.6.4: non number +TOOLTEST h5diff_064.txt -n u h5diff_test1.h5 h5diff_test2.h5 +# test 0.6.5: hexadecimal +TOOLTEST h5diff_065.txt -n 0x1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.6: string +TOOLTEST h5diff_066.txt -n "1" h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.7: repeated value +TOOLTEST h5diff_067.txt -n 1 -n 2 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.8: number larger than biggest difference +TOOLTEST h5diff_068.txt dset2.1a dset2.1b -n 7 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.9: number smaller than smallest difference +TOOLTEST h5diff_069.txt dset2.1a dset2.1b -n 1 h5diff_test1.h5 h5diff_test2.h5 + +# test 0.6.10: non-integer +TOOLTEST h5diff_0610.txt dset2.1a dset2.1b -n 2.3 h5diff_test1.h5 h5diff_test2.h5 + +############################################################################## +# Test valid files +############################################################################## + +# test 0.7: Check if the file names supplied are valid files +TOOLTEST h5diff_07.txt h5diff_test1.h6 h5diff_test2.h6 + + +############################################################################## +# Check for not comparable issues ############################################################################## -# tests 1., Check for not comparable issues + +############################################################################## +# Different types ############################################################################## -# test 1.1.1: Objects are not the same type (e.g try to compare a group with a dataset) +# test 1.1.1: Compare a dataset with a group TOOLTEST h5diff_111.txt dset1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5 -# test 1.1.2: Objects are not the same type (e.g try to compare a group with a dataset) -TOOLTEST h5diff_112.txt g1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5 +# test 1.1.2 Dataset vs Link +TOOLTEST h5diff_112.txt dset1.1 soft h5diff_test1.h5 h5diff_test1.h5 + +# test 1.1.3 Dataset vs Named type +TOOLTEST h5diff_113.txt dset1.1 compound h5diff_test1.h5 h5diff_test1.h5 + +############################################################################## +# not comparable types +############################################################################## + +# test 1.2.1: Group vs Group +TOOLTEST h5diff_121.txt g1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5 + +# test 1.2.2: Type vs Type +TOOLTEST h5diff_122.txt compound h5diff_test1.h5 h5diff_test2.h5 + +# test 1.2.3: Link vs Link +TOOLTEST h5diff_123.txt soft soft h5diff_test1.h5 h5diff_test1.h5 + + +############################################################################## +# Class issues +############################################################################## + +# test 1.3.1: H5T_STRING +TOOLTEST h5diff_131.txt dset1.3.1 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.2: H5T_BITFIELD +TOOLTEST h5diff_132.txt dset1.3.2 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.3: H5T_OPAQUE +TOOLTEST h5diff_133.txt dset1.3.3 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.4: H5T_COMPOUND +TOOLTEST h5diff_134.txt dset1.3.4 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.5: H5T_REFERENCE +TOOLTEST h5diff_135.txt dset1.3.5 h5diff_test1.h5 h5diff_test1.h5 + +# test 1.3.6: H5T_ENUM +TOOLTEST h5diff_136.txt dset1.3.6 h5diff_test1.h5 h5diff_test1.h5 -# test 1.2.1: Objects are of classes H5G_TYPE and H5G_GROUP and their name is supplied -TOOLTEST h5diff_121.txt compound h5diff_test1.h5 h5diff_test2.h5 +# test 1.3.7: H5T_VLEN +TOOLTEST h5diff_137.txt dset1.3.7 h5diff_test1.h5 h5diff_test1.h5 -# test 1.2.2: Objects are of classes H5G_TYPE and H5G_GROUP and their name is supplied -TOOLTEST h5diff_122.txt enum h5diff_test1.h5 h5diff_test2.h5 +# test 1.3.8: H5T_ARRAY +TOOLTEST h5diff_138.txt dset1.3.8 h5diff_test1.h5 h5diff_test1.h5 -# test 1.3: Check for non supported classes. Supported classes are H5T_INTEGER and H5T_FLOAT -TOOLTEST h5diff_13.txt dset1.3 h5diff_test1.h5 h5diff_test2.h5 -# test 1.4: Objects are not the same dataset class type +# test 1.4: Compare integer with float TOOLTEST h5diff_14.txt dset1.1 dset1.4 h5diff_test1.h5 h5diff_test2.h5 -# test 1.5: Check for the same rank, for datasets +# test 1.5 : Check for the same rank, for datasets TOOLTEST h5diff_15.txt dset1.1 dset1.5 h5diff_test1.h5 h5diff_test2.h5 -# test 1.6: Check for the same current dimensions +# test 1.6: Check for the same current dimensions. Only compare if they are the same. TOOLTEST h5diff_16.txt dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5 -# test 1.7 Check for the same maximum dimensions +# test 1.7: Check for the same maximum dimensions. Give a warning if they are different. TOOLTEST h5diff_17.txt dset1.7 dset1.7 h5diff_test1.h5 h5diff_test2.h5 -# test 1.8 Check for different storage order +# test 1.8: Check for the same storage datatype. Give a warning if they are different. 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 |