diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-05-30 22:38:46 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-05-30 22:38:46 (GMT) |
commit | 614490a83a8f213123f3ad29b37d5b54d4a4a993 (patch) | |
tree | 4d60b868ef66abef4a4d4a480718e2562bbda5fa /tools/h5diff | |
parent | e6b24e1995a5c24d3e20aaf9a0d2160a7c51ef08 (diff) | |
download | hdf5-614490a83a8f213123f3ad29b37d5b54d4a4a993.zip hdf5-614490a83a8f213123f3ad29b37d5b54d4a4a993.tar.gz hdf5-614490a83a8f213123f3ad29b37d5b54d4a4a993.tar.bz2 |
[svn-r6928] Purpose:
h5diff support for long_long
Description:
added h5diff support for long_long;
No automatic test was added because
it seems that the printf format of long_long is slightly different in Linux and IRIX(modi4),
because the diff command complained about a difference in the 2 test files for long_long;
visually, it seems that in IRIX an extra space is added after the print (or maybe it is
just me that is seeing extra spaces :=)
this test is test 5.8, commented in testh5diff.sh
Platforms tested:
Windows 2000 (octopus)
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 | 646 | ||||
-rw-r--r-- | tools/h5diff/h5difftst.c | 41 | ||||
-rwxr-xr-x | tools/h5diff/testh5diff.sh | 3 |
3 files changed, 630 insertions, 60 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c index 6867b2e..ecb9dd1 100644 --- a/tools/h5diff/h5diff.c +++ b/tools/h5diff/h5diff.c @@ -19,6 +19,8 @@ #include <assert.h> #include "hdf5.h" #include "h5trav.h" +#include "H5private.h" + #if 0 @@ -73,6 +75,7 @@ static int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_ static void list( const char *filename, int nobjects, info_t *info ); static hid_t fixtype( hid_t f_type ); +static int h5diff_can_diff( hid_t type_id ); static void print_datatype(hid_t type); static int check_n_input( const char* ); static int check_f_input( const char* ); @@ -861,6 +864,7 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *name2=NULL; int maxdim_diff=0; int dim_diff=0; + int can1, can2; /* disable error reporting */ H5Eget_auto(&func, &edata); @@ -970,8 +974,6 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name, break; } - - /*------------------------------------------------------------------------- * check for the same rank *------------------------------------------------------------------------- @@ -1094,6 +1096,23 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name, #endif /*------------------------------------------------------------------------- + * check for the comparable types in array_diff + *------------------------------------------------------------------------- + */ + + can1=h5diff_can_diff(m_type1); + can2=h5diff_can_diff(m_type2); + if ( can1==0 || can2==0 ) + { + printf("Comparison not supported\n"); + if ( can1==0 ) + printf("<%s> type is not supported\n", obj1_name); + if ( can2==0 ) + printf("<%s> type is not supported\n", obj2_name); + goto out; + } + +/*------------------------------------------------------------------------- * check for different signed/unsigned types *------------------------------------------------------------------------- */ @@ -1195,13 +1214,13 @@ out: /*------------------------------------------------------------------------- * Function: array_diff * - * Purpose: compare array + * Purpose: compare array; currenttly only the NATIVE types below are supported * * Return: number of differences found * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * - * Date: May 9, 2003 + * Date: May 30, 2003 * * Comments: * @@ -1214,8 +1233,9 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims options_t options, const char *obj1, const char *obj2, hid_t m_type ) { - H5T_class_t type_class; - size_t type_size; + char fmt_llong[255], fmt_ullong[255]; + char fmt_llongp[255], fmt_ullongp[255]; + size_t type_size;/* just check */ int nfound=0; /* number of differences found */ int ph=1; /* print header */ int acc[32]; /* accumulator and matrix position */ @@ -1224,20 +1244,17 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims int j; char *_buf1 = (char*)buf1; char *_buf2 = (char*)buf2; + - /* some temporary store */ - double temp1_double; - double temp2_double; - float temp1_float; - float temp2_float; - long temp1_long; - long temp2_long; - int temp1_int; - int temp2_int; - short temp1_short; - short temp2_short; - char temp1_char; - char temp2_char; + /* Build default formats for long long types */ + sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", + H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); + sprintf(fmt_ullong, "%%%su %%%su %%%su\n", + H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); + sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", + H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); + sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", + H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); acc[rank-1]=1; @@ -1246,27 +1263,17 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims acc[j]=acc[j+1]*(int)dims[j+1]; } - /* Get the class. */ - type_class = H5Tget_class( m_type ); - /* Get the size. */ type_size = H5Tget_size( m_type ); - - switch(type_class) - { - default: - return -1; - - case H5T_INTEGER: - /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- */ - - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)||H5Tequal(m_type, H5T_NATIVE_UCHAR)) + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) { + char temp1_char; + char temp2_char; assert(type_size==sizeof(char)); for ( i = 0; i < tot_cnt; i++) { @@ -1344,12 +1351,98 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims /*------------------------------------------------------------------------- + * H5T_NATIVE_UCHAR + *------------------------------------------------------------------------- + */ + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + { + unsigned char temp1_uchar; + unsigned char temp2_uchar; + assert(type_size==sizeof(unsigned char)); + for ( i = 0; i < tot_cnt; i++) + { + memcpy(&temp1_uchar, _buf1, sizeof(unsigned char)); + memcpy(&temp2_uchar, _buf2, sizeof(unsigned char)); + /* -d and !-p */ + if (options.d && !options.p) + { + if (abs(temp1_uchar-temp2_uchar) > options.delta) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options.d && options.p) + { + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options.percent ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), + abs(1-temp2_uchar/temp1_uchar)); + } + nfound++; + } + } + /* -d and -p */ + else if ( options.d && options.p) + { + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options.percent && + abs(temp1_uchar-temp2_uchar) > options.delta ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), + abs(1-temp2_uchar/temp1_uchar)); + } + nfound++; + } + } + else if (temp1_uchar != temp2_uchar) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar)); + } + nfound++; + } + + _buf1+=sizeof(unsigned char); + _buf2+=sizeof(unsigned char); + }/* i */ + + } /*H5T_NATIVE_UCHAR*/ + + +/*------------------------------------------------------------------------- * H5T_NATIVE_SHORT *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_SHORT)||H5Tequal(m_type, H5T_NATIVE_USHORT)) + else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) { + short temp1_short; + short temp2_short; assert(type_size==sizeof(short)); for ( i = 0; i < tot_cnt; i++) { @@ -1425,14 +1518,100 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims } /*H5T_NATIVE_SHORT*/ +/*------------------------------------------------------------------------- + * H5T_NATIVE_USHORT + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) + { + unsigned short temp1_ushort; + unsigned short temp2_ushort; + assert(type_size==sizeof(short)); + for ( i = 0; i < tot_cnt; i++) + { + memcpy(&temp1_ushort, _buf1, sizeof(unsigned short)); + memcpy(&temp2_ushort, _buf2, sizeof(unsigned short)); + /* -d and !-p */ + if (options.d && !options.p) + { + if (abs(temp1_ushort-temp2_ushort) > options.delta) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options.d && options.p) + { + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options.percent ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort), + abs(1-temp2_ushort/temp1_ushort)); + } + nfound++; + } + } + /* -d and -p */ + else if ( options.d && options.p) + { + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options.percent && + abs(temp1_ushort-temp2_ushort) > options.delta ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort), + abs(1-temp2_ushort/temp1_ushort)); + } + nfound++; + } + } + else if (temp1_ushort != temp2_ushort) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort)); + } + nfound++; + } + + _buf1+=sizeof(unsigned short); + _buf2+=sizeof(unsigned short); + }/* i */ + + } /*H5T_NATIVE_USHORT*/ + /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_INT)||H5Tequal(m_type, H5T_NATIVE_UINT)) + else if (H5Tequal(m_type, H5T_NATIVE_INT)) { + int temp1_int; + int temp2_int; assert(type_size==sizeof(int)); for ( i = 0; i < tot_cnt; i++) { @@ -1508,13 +1687,101 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims } /*H5T_NATIVE_INT*/ + +/*------------------------------------------------------------------------- + * H5T_NATIVE_UINT + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + { + unsigned int temp1_uint; + unsigned int temp2_uint; + assert(type_size==sizeof(int)); + for ( i = 0; i < tot_cnt; i++) + { + memcpy(&temp1_uint, _buf1, sizeof(unsigned int)); + memcpy(&temp2_uint, _buf2, sizeof(unsigned int)); + /* -d and !-p */ + if (options.d && !options.p) + { + if (abs((int)(temp1_uint-temp2_uint)) > options.delta) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint))); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options.d && options.p) + { + if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options.percent ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), + abs((int)(1-temp2_uint/temp1_uint))); + } + nfound++; + } + } + /* -d and -p */ + else if ( options.d && options.p) + { + if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options.percent && + abs((int)(temp1_uint-temp2_uint)) > options.delta ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), + abs((int)(1-temp2_uint/temp1_uint))); + } + nfound++; + } + } + else if (temp1_uint != temp2_uint) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(IFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint))); + } + nfound++; + } + + _buf1+=sizeof(unsigned int); + _buf2+=sizeof(unsigned int); + }/* i */ + + } /*H5T_NATIVE_UINT*/ + + /*------------------------------------------------------------------------- * H5T_NATIVE_LONG *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_LONG)||H5Tequal(m_type, H5T_NATIVE_ULONG)) + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) { + long temp1_long; + long temp2_long; assert(type_size==sizeof(long)); for ( i = 0; i < tot_cnt; i++) { @@ -1590,20 +1857,271 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims } /*H5T_NATIVE_LONG*/ +/*------------------------------------------------------------------------- + * H5T_NATIVE_ULONG + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + { + unsigned long temp1_ulong; + unsigned long temp2_ulong; + assert(type_size==sizeof(unsigned long)); + for ( i = 0; i < tot_cnt; i++) + { + memcpy(&temp1_ulong, _buf1, sizeof(unsigned long)); + memcpy(&temp2_ulong, _buf2, sizeof(unsigned long)); + /* -d and !-p */ + if (options.d && !options.p) + { + if (labs((long)(temp1_ulong-temp2_ulong)) > (long)options.delta) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(LIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong))); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options.d && options.p) + { + if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options.percent ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(LPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)), + labs((long)(1-temp2_ulong/temp1_ulong))); + } + nfound++; + } + } + /* -d and -p */ + else if ( options.d && options.p) + { + if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options.percent && + labs((long)(temp1_ulong-temp2_ulong)) > (long)options.delta ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(LPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)), + labs((long)(1-temp2_ulong/temp1_ulong))); + } + nfound++; + } + } + else if (temp1_ulong != temp2_ulong) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(LIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong))); + } + nfound++; + } + + _buf1+=sizeof(unsigned long); + _buf2+=sizeof(unsigned long); + }/* i */ + + } /*H5T_NATIVE_ULONG*/ - break; /*H5T_INTEGER*/ - - - case H5T_FLOAT: +/*------------------------------------------------------------------------- + * H5T_NATIVE_LLONG + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + { + long_long temp1_llong; + long_long temp2_llong; + assert(type_size==sizeof(long_long)); + for ( i = 0; i < tot_cnt; i++) + { + memcpy(&temp1_llong, _buf1, sizeof(long_long)); + memcpy(&temp2_llong, _buf2, sizeof(long_long)); + /* -d and !-p */ + if (options.d && !options.p) + { + if (labs((long)(temp1_llong-temp2_llong)) > (long)options.delta) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong))); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options.d && options.p) + { + if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options.percent ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)), + (long_long)labs((long)(1-temp2_llong/temp1_llong))); + } + nfound++; + } + } + /* -d and -p */ + else if ( options.d && options.p) + { + if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options.percent && + labs((long)(temp1_llong-temp2_llong)) > (long)options.delta ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)), + (long_long)labs((long)(1-temp2_llong/temp1_llong))); + } + nfound++; + } + } + else if (temp1_llong != temp2_llong) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong))); + } + nfound++; + } + + _buf1+=sizeof(long_long); + _buf2+=sizeof(long_long); + }/* i */ + + } /*H5T_NATIVE_LLONG*/ +/*------------------------------------------------------------------------- + * H5T_NATIVE_ULLONG + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + { + unsigned long_long temp1_ullong; + unsigned long_long temp2_ullong; + assert(type_size==sizeof(unsigned long_long)); + for ( i = 0; i < tot_cnt; i++) + { + memcpy(&temp1_ullong, _buf1, sizeof(unsigned long_long)); + memcpy(&temp2_ullong, _buf2, sizeof(unsigned long_long)); + /* -d and !-p */ + if (options.d && !options.p) + { + if (labs((long)(temp1_ullong-temp2_ullong)) > (long)options.delta) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_ullong,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options.d && options.p) + { + if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options.percent ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_ullongp,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), + (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong))); + } + nfound++; + } + } + /* -d and -p */ + else if ( options.d && options.p) + { + if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options.percent && + labs((long)(temp1_ullong-temp2_ullong)) > (long)options.delta ) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_ullongp,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), + (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong))); + } + nfound++; + } + } + else if (temp1_ullong != temp2_ullong) + { + if (options.n && nfound>=options.count) + return nfound; + if ( options.r==0 ) + { + print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); + printf(SPACES); + printf(fmt_ullong,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); + } + nfound++; + } + + _buf1+=sizeof(unsigned long_long); + _buf2+=sizeof(unsigned long_long); + }/* i */ + + } /*H5T_NATIVE_ULLONG*/ /*------------------------------------------------------------------------- * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + else if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) { + float temp1_float; + float temp2_float; assert(type_size==sizeof(float)); for ( i = 0; i < tot_cnt; i++) { @@ -1679,9 +2197,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims } /*H5T_NATIVE_FLOAT*/ +/*------------------------------------------------------------------------- + * H5T_NATIVE_DOUBLE + *------------------------------------------------------------------------- + */ else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) { + double temp1_double; + double temp2_double; assert(type_size==sizeof(double)); for ( i = 0; i < tot_cnt; i++) { @@ -1757,11 +2281,14 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims } /*H5T_NATIVE_DOUBLE*/ - - break; /*H5T_FLOAT*/ - - - } /*switch*/ +/*------------------------------------------------------------------------- + * no more + *------------------------------------------------------------------------- + */ + else + { + assert(0); + } return nfound; } @@ -1882,6 +2409,35 @@ hid_t fixtype(hid_t f_type) } +/*------------------------------------------------------------------------- + * Function: h5diff_can_diff + * + * Purpose: Check if TYPE_ID is supported; only the listed types are + * supported in the current version + * + *------------------------------------------------------------------------- + */ +static +int h5diff_can_diff(hid_t type_id) +{ + int ret=0; + if ( (H5Tequal(type_id, H5T_NATIVE_FLOAT)==1)|| + (H5Tequal(type_id, H5T_NATIVE_DOUBLE)==1)|| + (H5Tequal(type_id, H5T_NATIVE_INT)==1)|| + (H5Tequal(type_id, H5T_NATIVE_UINT)==1)|| + (H5Tequal(type_id, H5T_NATIVE_SCHAR)==1)|| + (H5Tequal(type_id, H5T_NATIVE_UCHAR)==1)|| + (H5Tequal(type_id, H5T_NATIVE_SHORT)==1)|| + (H5Tequal(type_id, H5T_NATIVE_USHORT)==1)|| + (H5Tequal(type_id, H5T_NATIVE_LONG)==1)|| + (H5Tequal(type_id, H5T_NATIVE_ULONG)==1)|| + (H5Tequal(type_id, H5T_NATIVE_LLONG)==1)|| + (H5Tequal(type_id, H5T_NATIVE_ULLONG)==1) + ) + ret=1; + return ret; +} + diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c index 968365b..344e356 100644 --- a/tools/h5diff/h5difftst.c +++ b/tools/h5diff/h5difftst.c @@ -14,17 +14,8 @@ #include <stdio.h> #include <stdlib.h> - #include "hdf5.h" - -#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus -# undef __attribute__ -# define __attribute__(X) /*void*/ -# define UNUSED /*void*/ -#else -# define UNUSED __attribute__((unused)) -#endif - +#include "H5private.h" /* diff test*/ @@ -85,6 +76,7 @@ int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, /* Close */ status = H5Dclose(dataset_id); status = H5Sclose(space_id); + assert(status>=0); return status; @@ -211,6 +203,12 @@ int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, # 5.6 file6.h5 file6.h5 dset6a dset6b +# 5.7 + file6.h5 file6.h5 dset7a dset7b + +# 5.8 + file6.h5 file6.h5 dset8a dset8b + # ############################################################################## # # Error messages # ############################################################################## @@ -672,8 +670,12 @@ int do_test_5(const char *file1, const char UNUSED *file2) */ char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}}; unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}}; - unsigned char buf8a[3][2] = {{1,1},{1,1},{1,1}}; - unsigned char buf8b[3][2] = {{1,1},{3,4},{5,6}}; + + /* long_long test */ + long_long buf8a[3][2] = {{1,1},{1,1},{1,1}}; + long_long buf8b[3][2] = {{1,1},{3,4},{5,6}}; + unsigned long_long buf9a[3][2] = {{1,1},{1,1},{1,1}}; + unsigned long_long buf9b[3][2] = {{1,1},{3,4},{5,6}}; /*------------------------------------------------------------------------- @@ -742,12 +744,21 @@ int do_test_5(const char *file1, const char UNUSED *file2) write_dataset(file1_id,2,dims,"dset7b",H5T_NATIVE_UCHAR,buf7b); /*------------------------------------------------------------------------- - * H5T_NATIVE_UCHAR + * H5T_NATIVE_LLONG *------------------------------------------------------------------------- */ - write_dataset(file1_id,2,dims,"dset8a",H5T_NATIVE_UCHAR,buf8a); - write_dataset(file1_id,2,dims,"dset8b",H5T_NATIVE_UCHAR,buf8b); + write_dataset(file1_id,2,dims,"dset8a",H5T_NATIVE_LLONG,buf8a); + write_dataset(file1_id,2,dims,"dset8b",H5T_NATIVE_LLONG,buf8b); + +/*------------------------------------------------------------------------- + * H5T_NATIVE_ULLONG + *------------------------------------------------------------------------- + */ + + write_dataset(file1_id,2,dims,"dset9a",H5T_NATIVE_ULLONG,buf9a); + write_dataset(file1_id,2,dims,"dset9b",H5T_NATIVE_ULLONG,buf9b); + /*------------------------------------------------------------------------- * Close diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index aa31ab6..47095f1 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -216,6 +216,9 @@ TOOLTEST h5diff_56.txt file6.h5 file6.h5 dset6a dset6b # 5.7 TOOLTEST h5diff_57.txt file6.h5 file6.h5 dset7a dset7b +# 5.8 long_long test; different format of long_long print in Linux and IRIX +#TOOLTEST h5diff_58.txt file6.h5 file6.h5 dset8a dset8b + # ############################################################################## # # Error messages # ############################################################################## |