summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2005-01-06 18:17:59 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2005-01-06 18:17:59 (GMT)
commit82f6a72ec92fa12371c386c70c607dd8957ce8b6 (patch)
tree41e4cf0b57c5a123ded9dbe4c3f951b4ae818f4a
parent03edfaa6e90c150e017b2e8d6a6c0772b2a2650c (diff)
downloadhdf5-82f6a72ec92fa12371c386c70c607dd8957ce8b6.zip
hdf5-82f6a72ec92fa12371c386c70c607dd8957ce8b6.tar.gz
hdf5-82f6a72ec92fa12371c386c70c607dd8957ce8b6.tar.bz2
[svn-r9755] Purpose: New feature
Description: Start to support software conversion between long double and all integers. Solution: No major changes to the algorithm. Changes to configure is to exclude SGI for long double to integers test because there're too many problems in their compiler. Platforms tested: h5committest, modi4, fuss, Teragrid, arabica Misc. update: RELEASE.txt
-rw-r--r--config/irix5.x19
-rw-r--r--config/irix6.x14
-rwxr-xr-xconfigure36
-rw-r--r--configure.in33
-rw-r--r--release_docs/RELEASE.txt2
-rw-r--r--src/H5Tconv.c54
-rw-r--r--src/H5config.h.in4
-rw-r--r--test/dtypes.c403
8 files changed, 372 insertions, 193 deletions
diff --git a/config/irix5.x b/config/irix5.x
index 3624e7f..77b35c8 100644
--- a/config/irix5.x
+++ b/config/irix5.x
@@ -48,3 +48,22 @@ case "X-$CC_BASENAME" in
PROFILE_CPPFLAGS=
;;
esac
+
+# Hard set flag to indicate that the 'unsigned long long' to floating-point
+# value conversion are broken by the compilers (as of 4/27/04 - QAK)
+hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_works='no'}
+
+# Set flag to avoid conversion between 'long double' and integers because of
+# SGI's compiler problems. For both IRIX64 6.5 and IRIX 6.5, the compilers
+# have the following problems,
+# long double -> signed char : incorrect rounding
+# long double -> unsigned char : incorrect rounding
+# long double -> short : incorrect rounding
+# long double -> unsigned short : incorrect rounding
+# long double -> long or long long: incorrect value
+# long double -> unsigned long or long long : incorrect value
+#
+# long or long long -> long double : correct value but incorrect bit pattern
+# unsigned long or long long -> long double : correct value but incorrect bit pattern
+# (1/5/05 - SLU)
+hdf5_cv_sw_ldouble_to_int_works=${hdf5_cv_sw_ldouble_to_int_works='no'}
diff --git a/config/irix6.x b/config/irix6.x
index 2481e1e..293f2c8 100644
--- a/config/irix6.x
+++ b/config/irix6.x
@@ -146,3 +146,17 @@ fi
# value conversion are broken by the compilers (as of 4/27/04 - QAK)
hdf5_cv_sw_ulong_to_fp_bottom_bit_works=${hdf5_cv_sw_ulong_to_fp_bottom_bit_works='no'}
+# Set flag to avoid conversion between 'long double' and integers because of
+# SGI's compiler problems. For both IRIX64 6.5 and IRIX 6.5, the compilers
+# have the following problems,
+# long double -> signed char : incorrect rounding
+# long double -> unsigned char : incorrect rounding
+# long double -> short : incorrect rounding
+# long double -> unsigned short : incorrect rounding
+# long double -> long or long long: incorrect value
+# long double -> unsigned long or long long : incorrect value
+#
+# long or long long -> long double : correct value but incorrect bit pattern
+# unsigned long or long long -> long double : correct value but incorrect bit pattern
+# (1/5/05 - SLU)
+hdf5_cv_sw_ldouble_to_int_works=${hdf5_cv_sw_ldouble_to_int_works='no'}
diff --git a/configure b/configure
index b2a1ef3..65f0d82 100755
--- a/configure
+++ b/configure
@@ -33538,6 +33538,28 @@ else
echo "${ECHO_T}no" >&6
fi
+echo "$as_me:$LINENO: checking if accurately converting between long double and integers works" >&5
+echo $ECHO_N "checking if accurately converting between long double and integers works... $ECHO_C" >&6
+if test "${hdf5_cv_sw_ldouble_to_int_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ hdf5_cv_sw_ldouble_to_int_works=yes
+fi
+
+
+if test ${hdf5_cv_sw_ldouble_to_int_works} = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define SW_LDOUBLE_TO_INT_WORKS 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
echo "$as_me:$LINENO: checking if accurately converting unsigned long long to floating-point values works" >&5
echo $ECHO_N "checking if accurately converting unsigned long long to floating-point values works... $ECHO_C" >&6
@@ -33748,18 +33770,20 @@ else
{
float f = 9701917572145405952.00f;
double d1 = 9701917572145405952.00L;
- double d2 = 2e40L;
+ long double d2 = 9701917572145405952.00L;
+ double d3 = 2e40L;
unsigned long long l1 = (unsigned long long)f;
unsigned long long l2 = (unsigned long long)d1;
- unsigned long long l3;
- unsigned long long l4 = 0x7fffffffffffffffLLU;
+ unsigned long long l3 = (unsigned long long)d2;
+ unsigned long long l4;
+ unsigned long long l5 = 0x7fffffffffffffffLLU;
int ret = 0;
- if(l1 <= l4 || l2 <= l4)
+ if(l1 <= l5 || l2 <= l5 || l3 <= l5)
ret = 1;
- l3 = (unsigned long long)d2;
- if(l3 <= l4)
+ l4 = (unsigned long long)d3;
+ if(l4 <= l5)
ret = 1;
done:
diff --git a/configure.in b/configure.in
index 93354db..5d99b2a 100644
--- a/configure.in
+++ b/configure.in
@@ -2500,6 +2500,23 @@ else
AC_MSG_RESULT([no])
fi
+dnl -----------------------------------------------------------------------
+dnl Set flag to indicate that the machine can handle conversion between
+dnl long double and integers. (This flag should be set "yes" for all
+dnl machines except all SGIs, where some conversions are incorrect and its
+dnl cache value is set "no" in its config/irix6.x file.)
+dnl
+AC_MSG_CHECKING([if accurately converting between long double and integers works])
+AC_CACHE_VAL([hdf5_cv_sw_ldouble_to_int_works], [hdf5_cv_sw_ldouble_to_int_works=yes])
+
+if test ${hdf5_cv_sw_ldouble_to_int_works} = "yes"; then
+ AC_DEFINE([SW_LDOUBLE_TO_INT_WORKS], [1],
+ [Define if your system can accurately convert between long double and integer values.])
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
dnl ----------------------------------------------------------------------
dnl Set the flag to indicate that the machine can accurately convert
dnl 'unsigned (long) long' values to 'float' and 'double' values.
@@ -2623,7 +2640,7 @@ fi
dnl ----------------------------------------------------------------------
dnl Set the flag to indicate that the machine can accurately convert
-dnl 'float' or 'double' to 'unsigned (long) long' values.
+dnl 'float', 'double' or 'long double' to 'unsigned (long) long' values.
dnl (This flag should be set for all machines, except for HP-UX machines
dnl where the maximal number for unsigned long long is 0x7fffffffffffffff
dnl during conversion.
@@ -2636,18 +2653,20 @@ AC_CACHE_VAL([hdf5_cv_fp_to_ullong_right_maximum],
{
float f = 9701917572145405952.00f;
double d1 = 9701917572145405952.00L;
- double d2 = 2e40L;
+ long double d2 = 9701917572145405952.00L;
+ double d3 = 2e40L;
unsigned long long l1 = (unsigned long long)f;
unsigned long long l2 = (unsigned long long)d1;
- unsigned long long l3;
- unsigned long long l4 = 0x7fffffffffffffffLLU;
+ unsigned long long l3 = (unsigned long long)d2;
+ unsigned long long l4;
+ unsigned long long l5 = 0x7fffffffffffffffLLU;
int ret = 0;
- if(l1 <= l4 || l2 <= l4)
+ if(l1 <= l5 || l2 <= l5 || l3 <= l5)
ret = 1;
- l3 = (unsigned long long)d2;
- if(l3 <= l4)
+ l4 = (unsigned long long)d3;
+ if(l4 <= l5)
ret = 1;
done:
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 01bca50..2130958 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -36,6 +36,8 @@ New Features
Configuration:
--------------
+ - Started to support software conversion between long double and
+ integers. Hardware conversion will come very soon. SLU - 2005/1/6
- Intel v8.0 compiler would infinite loop when compiling some test
code with -O3 option. Changed enable-production default compiler
option to -O2. AKC - 2004/12/06
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index a9c463f..df87a2d 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -8914,10 +8914,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* the source exponent bias.
*/
if (0==expo || H5T_NORM_NONE==src.u.f.norm) {
- bitno = H5T_bit_find(s, src.u.f.mpos, src.u.f.msize,
- H5T_BIT_MSB, TRUE);
- assert(bitno>=0);
- expo -= (src.u.f.ebias-1) + (src.u.f.msize-bitno);
+ expo -= (src.u.f.ebias-1);
} else if (H5T_NORM_IMPLIED==src.u.f.norm) {
expo -= src.u.f.ebias;
} else {
@@ -8948,7 +8945,7 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Shift mantissa part by exponent minus mantissa size(right shift),
* or by mantissa size minus exponent(left shift). Example: Sequence
* 10...010111, expo=20, expo-msize=-3. Right-shift the sequence, we get
- * 00010...01. The last three ones were dropped.
+ * 00010...10. The last three bits were dropped.
*/
H5T_bit_shift(int_buf, (ssize_t)(expo-src.u.f.msize), 0, buf_size*8);
@@ -8959,17 +8956,10 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if (expo < src.u.f.msize && cb_struct.func)
truncated = TRUE;
- /* Convert to integer representation if negative.
- * equivalent to ~(value - 1).
- */
- if(sign) {
- H5T_bit_dec(int_buf, 0, 8*buf_size);
- H5T_bit_neg(int_buf, 0, 8*buf_size);
- }
-
/*
* What is the bit position for the most significant bit(MSB) of S
- * which is set?
+ * which is set? This is checked before converted to negative
+ * integer.
*/
sfirst = H5T_bit_find(int_buf, 0, 8*buf_size, H5T_BIT_MSB, TRUE);
first = (size_t)sfirst;
@@ -9041,9 +9031,13 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
src_id, dst_id, src_rev, d, cb_struct.user_data);
}
- if(except_ret == H5T_CONV_UNHANDLED) {
- /*copy source value into it if case is ignored by user handler*/
- H5T_bit_copy (d, dst.offset, int_buf, 0, first+1);
+ if(except_ret == H5T_CONV_UNHANDLED) { /*If this case ignored by user handler*/
+ /*Convert to integer representation. Equivalent to ~(value - 1).*/
+ H5T_bit_dec(int_buf, 0, 8*buf_size);
+ H5T_bit_neg(int_buf, 0, 8*buf_size);
+
+ /*copy source value into destiny*/
+ H5T_bit_copy (d, dst.offset, int_buf, 0, dst.prec-1);
H5T_bit_set (d, (dst.offset + dst.prec-1), 1, TRUE);
} else if(except_ret == H5T_CONV_ABORT)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
@@ -9055,7 +9049,8 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* the sign bit because 0x80...00 is the biggest negative value.
*/
if(cb_struct.func) { /*If user's exception handler is present, use it*/
- H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); /*reverse order first*/
+ /*reverse order first*/
+ H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order);
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW,
src_id, dst_id, src_rev, d, cb_struct.user_data);
}
@@ -9072,7 +9067,8 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if (first >= dst.prec-1) {
/*overflow*/
if(cb_struct.func) { /*If user's exception handler is present, use it*/
- H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); /*reverse order first*/
+ /*reverse order first*/
+ H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order);
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI,
src_id, dst_id, src_rev, d, cb_struct.user_data);
}
@@ -9086,7 +9082,8 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
reverse = FALSE;
} else if(first < dst.prec-1) {
if(truncated && cb_struct.func) { /*If user's exception handler is present, use it*/
- H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order); /*reverse order first*/
+ /*reverse order first*/
+ H5T_reverse_order(src_rev, s, src_p->shared->size, src_p->shared->u.atomic.order);
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_TRUNCATE,
src_id, dst_id, src_rev, d, cb_struct.user_data);
}
@@ -9396,11 +9393,10 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/*
* Calculate the true destination exponent by adjusting according to
- * the destination exponent bias.
+ * the destination exponent bias. Implied and non-implied normalization
+ * should be the same.
*/
- if (H5T_NORM_NONE==src.u.f.norm) {
- expo = first + 1 + dst.u.f.ebias;
- } else if (H5T_NORM_IMPLIED==src.u.f.norm) {
+ if (H5T_NORM_NONE==dst.u.f.norm || H5T_NORM_IMPLIED==dst.u.f.norm) {
expo = first + dst.u.f.ebias;
} else {
assert("normalization method not implemented yet" && 0);
@@ -9408,10 +9404,10 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
/* Handle mantissa part here */
- if (H5T_NORM_IMPLIED==src.u.f.norm) {
+ if (H5T_NORM_IMPLIED==dst.u.f.norm) {
/* Imply first bit */
H5T_bit_set(int_buf, first, 1, 0);
- } else if (H5T_NORM_NONE==src.u.f.norm) {
+ } else if (H5T_NORM_NONE==dst.u.f.norm) {
first++;
}
@@ -9461,13 +9457,13 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* last f, we get 0x100...000. Treat this special case here.
*/
if(H5T_bit_get_d(int_buf, dst.u.f.msize, 1)) {
- if (H5T_NORM_IMPLIED==src.u.f.norm) {
+ if (H5T_NORM_IMPLIED==dst.u.f.norm) {
/* The bit at this 1's position was impled already, so this
* number should be 0x200...000. We need to increment the
* exponent in this case.
*/
expo++;
- } else if (H5T_NORM_NONE==src.u.f.norm) {
+ } else if (H5T_NORM_NONE==dst.u.f.norm) {
/* Right shift 1 bit to let the carried 1 fit in the mantissa,
* and increment exponent by 1.
*/
@@ -9479,7 +9475,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} else {
/* The bit sequence can fit mantissa part. Left shift to fit in from high-order of
* bit position. */
- H5T_bit_shift(int_buf, (ssize_t)(dst.u.f.msize-first), 0, buf_size*8);
+ H5T_bit_shift(int_buf, (ssize_t)(dst.u.f.msize-first), 0, dst.u.f.msize);
}
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 4d95197..95e244d 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -516,6 +516,10 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Define if your system can accurately convert between long double and
+ integer values. */
+#undef SW_LDOUBLE_TO_INT_WORKS
+
/* Define if your system can accurately convert unsigned long long values to
floating-point values. */
#undef SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
diff --git a/test/dtypes.c b/test/dtypes.c
index e21cd23..e3c5a30 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -117,8 +117,7 @@ static int num_opaque_conversions_g = 0;
#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT)
void some_dummy_func(float x);
-static hbool_t overflows(unsigned char *origin_bits, dtype_t src_dtype,
- size_t src_size_bytes, size_t dst_num_bits);
+static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits);
static int my_isnan(dtype_t type, void *val);
static int opaque_check(int tag_it);
static herr_t convert_opaque(hid_t UNUSED st, hid_t UNUSED dt,
@@ -3595,8 +3594,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
unsigned hw_uint;
long hw_long;
unsigned long hw_ulong;
- long_long hw_llong;
- unsigned long_long hw_ullong;
+ long long hw_llong;
+ unsigned long long hw_ullong;
@@ -3691,7 +3690,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
dst_sign = H5Tget_sign(dst);
buf = aligned_malloc(nelmts*MAX(src_size, dst_size));
saved = aligned_malloc(nelmts*MAX(src_size, dst_size));
- aligned = HDmalloc(sizeof(long_long));
+ aligned = HDmalloc(sizeof(long long));
#ifdef SHOW_OVERFLOWS
noverflows_g = 0;
#endif
@@ -3759,12 +3758,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_char = (char)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_char = (char)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_char = (char)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_char = (char)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_char = (char)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -3805,12 +3804,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_uchar = (unsigned char)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_uchar = (unsigned char)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_uchar = (unsigned char)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_uchar = (unsigned char)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_uchar = (unsigned char)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -3851,12 +3850,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_short = (short)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_short = (short)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_short = (short)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_short = (short)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_short = (short)(*((unsigned long long*)aligned));
break;
default:
@@ -3898,12 +3897,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_ushort = (unsigned short)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_ushort = (unsigned short)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_ushort = (unsigned short)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_ushort = (unsigned short)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ushort = (unsigned short)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -3944,12 +3943,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_int = (int)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_int = (int)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_int = (int)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_int = (int)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_int = (int)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -3990,12 +3989,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_uint = (unsigned int)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_uint = (unsigned int)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_uint = (unsigned int)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_uint = (unsigned int)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_uint = (unsigned int)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -4036,12 +4035,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_long = (long int)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_long = (long int)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_long = (long int)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_long = (long int)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_long = (long int)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -4082,12 +4081,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
hw_ulong = (unsigned long)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_ulong = (unsigned long)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_ulong = (unsigned long)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_ulong = (unsigned long)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ulong = (unsigned long)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -4097,43 +4096,43 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
switch (src_type) {
case INT_SCHAR:
HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_llong = (long_long)(*((char*)aligned));
+ hw_llong = (long long)(*((char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_llong = (long_long)(*((unsigned char*)aligned));
+ hw_llong = (long long)(*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_llong = (long_long)(*((short*)aligned));
+ hw_llong = (long long)(*((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_llong = (long_long)(*((unsigned short*)aligned));
+ hw_llong = (long long)(*((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_llong = (long_long)(*((int*)aligned));
+ hw_llong = (long long)(*((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_llong = (long_long)(*((unsigned*)aligned));
+ hw_llong = (long long)(*((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_llong = (long_long)(*((long*)aligned));
+ hw_llong = (long long)(*((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_llong = (long_long)(*((unsigned long*)aligned));
+ hw_llong = (long long)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_llong = (long_long)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_llong = (long long)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_llong = (long_long)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_llong = (long long)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -4143,43 +4142,43 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
switch (src_type) {
case INT_SCHAR:
HDmemcpy(aligned, saved+j*sizeof(char), sizeof(char));
- hw_ullong = (unsigned long_long)(*((char*)aligned));
+ hw_ullong = (unsigned long long)(*((char*)aligned));
break;
case INT_UCHAR:
HDmemcpy(aligned, saved+j*sizeof(unsigned char), sizeof(unsigned char));
- hw_ullong = (unsigned long_long)(*((unsigned char*)aligned));
+ hw_ullong = (unsigned long long)(*((unsigned char*)aligned));
break;
case INT_SHORT:
HDmemcpy(aligned, saved+j*sizeof(short), sizeof(short));
- hw_ullong = (unsigned long_long)(*((short*)aligned));
+ hw_ullong = (unsigned long long)(*((short*)aligned));
break;
case INT_USHORT:
HDmemcpy(aligned, saved+j*sizeof(unsigned short), sizeof(unsigned short));
- hw_ullong = (unsigned long_long)(*((unsigned short*)aligned));
+ hw_ullong = (unsigned long long)(*((unsigned short*)aligned));
break;
case INT_INT:
HDmemcpy(aligned, saved+j*sizeof(int), sizeof(int));
- hw_ullong = (unsigned long_long)(*((int*)aligned));
+ hw_ullong = (unsigned long long)(*((int*)aligned));
break;
case INT_UINT:
HDmemcpy(aligned, saved+j*sizeof(unsigned), sizeof(unsigned));
- hw_ullong = (unsigned long_long)(*((unsigned*)aligned));
+ hw_ullong = (unsigned long long)(*((unsigned*)aligned));
break;
case INT_LONG:
HDmemcpy(aligned, saved+j*sizeof(long), sizeof(long));
- hw_ullong = (unsigned long_long)(*((long*)aligned));
+ hw_ullong = (unsigned long long)(*((long*)aligned));
break;
case INT_ULONG:
HDmemcpy(aligned, saved+j*sizeof(unsigned long), sizeof(unsigned long));
- hw_ullong = (unsigned long_long)(*((unsigned long*)aligned));
+ hw_ullong = (unsigned long long)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_ullong = (unsigned long_long)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_ullong = (unsigned long long)(*((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_ullong = (unsigned long_long)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ullong = (unsigned long long)(*((unsigned long long*)aligned));
break;
default:
break;
@@ -4348,12 +4347,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
printf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
default:
break;
@@ -4397,12 +4396,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
printf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, buf+j*sizeof(long_long), sizeof(long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
+ HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, buf+j*sizeof(long_long), sizeof(unsigned long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned));
+ HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(unsigned long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
default:
break;
@@ -4438,10 +4437,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
printf(" %29lu\n", *((unsigned long*)hw));
break;
case INT_LLONG:
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)hw));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw));
break;
case INT_ULLONG:
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw));
break;
default:
break;
@@ -4587,7 +4586,7 @@ my_isnan(dtype_t type, void *val)
} else if (FLT_LDOUBLE==type) {
long double x;
HDmemcpy(&x, val, sizeof(long double));
- sprintf(s, "%Lg", x);
+ sprintf(s, "%LLg", x);
#endif
} else {
return 0;
@@ -5136,7 +5135,7 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
void *user_data; /*returned pointer to user data passed in to the callback*/
hbool_t except_set = FALSE; /*whether user's exception handling is set*/
const size_t ntests=NTESTS; /*number of tests */
- const size_t nelmts=NTESTELEM; /*num values per test */
+ size_t nelmts; /*num values per test */
const size_t max_fails=40; /*max number of failures*/
size_t fails_all_tests=0; /*number of failures */
size_t fails_this_test; /*fails for this test */
@@ -5156,19 +5155,19 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
size_t src_nbits; /*source length in bits */
size_t dst_nbits; /*dst length in bits */
void *aligned=NULL; /*aligned temp buffer */
- float hw_float;
- double hw_double;
- long double hw_ldouble;
- signed char hw_schar;
- unsigned char hw_uchar;
- short hw_short;
- unsigned short hw_ushort;
- int hw_int;
- unsigned hw_uint;
- long hw_long;
- unsigned long hw_ulong;
- long_long hw_llong;
- unsigned long_long hw_ullong;
+ float hw_float=0;
+ double hw_double=0;
+ long double hw_ldouble=0;
+ signed char hw_schar=0;
+ unsigned char hw_uchar=0;
+ short hw_short=0;
+ unsigned short hw_ushort=0;
+ int hw_int=0;
+ unsigned hw_uint=0;
+ long hw_long=0;
+ unsigned long hw_ulong=0;
+ long long hw_llong=0;
+ unsigned long long hw_ullong=0;
/* What is the name of the source type */
if (H5Tequal(src, H5T_NATIVE_SCHAR)) {
@@ -5299,7 +5298,15 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
HDputs(" 2. Not a float-integer conversion.");
goto error;
}
-
+
+ /* Reduce the number of elements if the source is "long double"
+ * because it takes too long.
+ */
+ if(src_type == FLT_LDOUBLE)
+ nelmts = NTESTELEM / 10;
+ else
+ nelmts = NTESTELEM;
+
/* Allocate buffers */
endian = H5Tget_order(H5T_NATIVE_INT);
src_size = H5Tget_size(src);
@@ -5308,7 +5315,7 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */
buf = aligned_malloc(nelmts*MAX(src_size, dst_size));
saved = aligned_malloc(nelmts*MAX(src_size, dst_size));
- aligned = HDmalloc(sizeof(long_long));
+ aligned = HDmalloc(MAX(sizeof(long double), sizeof(long long)));
#ifdef SHOW_OVERFLOWS
noverflows_g = 0;
#endif
@@ -5405,13 +5412,13 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
hw_float = (float)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_float = (float)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_float = (float)(*((long long*)aligned));
break;
#ifdef H5_ULLONG_TO_FP_CAST_WORKS
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_float = (float)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_float = (float)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
default:
@@ -5453,13 +5460,13 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
hw_double = (double)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_double = (double)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_double = (double)(*((long long*)aligned));
break;
#ifdef H5_ULLONG_TO_FP_CAST_WORKS
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_double = (double)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_double = (double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
default:
@@ -5501,13 +5508,13 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
hw_ldouble = (long double)(*((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- hw_ldouble = (long double)(*((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ hw_ldouble = (long double)(*((long long*)aligned));
break;
#ifdef H5_ULLONG_TO_FP_CAST_WORKS
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- hw_ldouble = (long double)(*((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ hw_ldouble = (long double)(*((unsigned long long*)aligned));
break;
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
default:
@@ -5662,15 +5669,15 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
switch (src_type) {
case FLT_FLOAT:
HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_llong = (long_long)(*((float*)aligned));
+ hw_llong = (long long)(*((float*)aligned));
break;
case FLT_DOUBLE:
HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_llong = (long_long)(*((double*)aligned));
+ hw_llong = (long long)(*((double*)aligned));
break;
case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(double));
- hw_llong = (long_long)(*((long double*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
+ hw_llong = (long long)(*((long double*)aligned));
break;
default:
break;
@@ -5680,15 +5687,15 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
switch (src_type) {
case FLT_FLOAT:
HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
- hw_ullong = (unsigned long_long)(*((float*)aligned));
+ hw_ullong = (unsigned long long)(*((float*)aligned));
break;
case FLT_DOUBLE:
HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double));
- hw_ullong = (unsigned long_long)(*((double*)aligned));
+ hw_ullong = (unsigned long long)(*((double*)aligned));
break;
case FLT_LDOUBLE:
- HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(double));
- hw_ullong = (unsigned long_long)(*((long double*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
+ hw_ullong = (unsigned long long)(*((long double*)aligned));
break;
default:
break;
@@ -5730,7 +5737,7 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
&& (INT_SCHAR==dst_type || INT_SHORT==dst_type || INT_INT==dst_type
|| INT_LONG==dst_type || INT_LLONG==dst_type)) {
if(0==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
- overflows(src_bits, src_type, src_size, dst_nbits-1)) {
+ overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is positive and the magnitude is too large for
* the destination. The destination should be set to the
@@ -5746,7 +5753,7 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
continue; /*no error*/
}
} else if (1==H5T_bit_get_d(src_bits, src_nbits-1, 1) &&
- overflows(src_bits, src_type, src_size, dst_nbits-1)) {
+ overflows(src_bits, src, dst_nbits-1)) {
/*
* Source is negative but the magnitude is too large for
* the destination. The destination should be set to the
@@ -5779,7 +5786,7 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
if (dst_bits[0] == fill_value)
continue; /*no error*/
}
- } else if (overflows(src_bits, src_type, src_size, dst_nbits)) {
+ } else if (overflows(src_bits, src, dst_nbits)) {
/*
* The source is a value with a magnitude too large for
* the destination. The destination should be the
@@ -5815,10 +5822,10 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
if((tmp_s+1)==tmp_h || (tmp_s-1)==tmp_h)
continue; /*no error*/
} /* end if */
- else if (dst_size==sizeof(unsigned long_long)) {
- unsigned long_long tmp_s, tmp_h;
- HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long_long));
- HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long_long));
+ else if (dst_size==sizeof(unsigned long long)) {
+ unsigned long long tmp_s, tmp_h;
+ HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long long));
+ HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long long));
if((tmp_s+1)==tmp_h || (tmp_s-1)==tmp_h)
continue; /*no error*/
} /* end if */
@@ -5830,9 +5837,9 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
*/
#ifndef H5_FP_TO_ULLONG_BOTTOM_BIT_WORKS
if((src_type==FLT_FLOAT || src_type==FLT_DOUBLE) && dst_type==INT_ULLONG) {
- unsigned long_long tmp_s, tmp_h;
- HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long_long));
- HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long_long));
+ unsigned long long tmp_s, tmp_h;
+ HDmemcpy(&tmp_s,&buf[j*dst_size],sizeof(unsigned long long));
+ HDmemcpy(&tmp_h,&hw[0],sizeof(unsigned long long));
if((tmp_s+1)==tmp_h)
continue; /*no error*/
}
@@ -5881,12 +5888,12 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
printf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(long long), sizeof(long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, saved+j*sizeof(unsigned long_long), sizeof(unsigned long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned));
+ HDmemcpy(aligned, saved+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
case FLT_FLOAT:
HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float));
@@ -5942,12 +5949,12 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
printf(" %29lu\n", *((unsigned long*)aligned));
break;
case INT_LLONG:
- HDmemcpy(aligned, buf+j*sizeof(long_long), sizeof(long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned));
+ HDmemcpy(aligned, buf+j*sizeof(long long), sizeof(long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)aligned));
break;
case INT_ULLONG:
- HDmemcpy(aligned, buf+j*sizeof(long_long), sizeof(unsigned long_long));
- HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned));
+ HDmemcpy(aligned, buf+j*sizeof(unsigned long long), sizeof(unsigned long long));
+ HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)aligned));
break;
case FLT_FLOAT:
HDmemcpy(aligned, buf+j*sizeof(float), sizeof(float));
@@ -5995,10 +6002,10 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
printf(" %29lu\n", *((unsigned long*)hw));
break;
case INT_LLONG:
- printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)hw));
+ printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long long*)hw));
break;
case INT_ULLONG:
- printf(" %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw));
+ printf(" %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long long*)hw));
break;
case FLT_FLOAT:
printf(" %29f\n", *((float*)hw));
@@ -6064,27 +6071,33 @@ test_conv_int_float(const char *name, hid_t src, hid_t dst)
*-------------------------------------------------------------------------
*/
static hbool_t
-overflows(unsigned char *origin_bits, dtype_t src_dtype, size_t src_size_bytes, size_t dst_num_bits)
+overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits)
{
hbool_t ret_value=FALSE;
hsize_t expt, sig;
- size_t frct_digits=0, expt_digits=0, bias=0;
+ size_t mant_digits=0, expt_digits=0, bias=0;
+ size_t src_prec=0; /*source type precision in bits*/
+ H5T_norm_t norm;
ssize_t indx;
- unsigned char bits[32];
+ unsigned char bits[32], mant_bits[32];
- HDmemcpy(bits, origin_bits, src_size_bytes);
+ HDmemset(bits, 0, 32);
+ HDmemset(mant_bits, 0, 32);
+
+ /*
+ * Sometimes, type size isn't equal to the precision like Linux's "long
+ * double", where size is 96 bits and precision is 80 bits.
+ */
+
+ src_prec = H5Tget_precision(src_id);
+ H5Tget_fields(src_id, NULL, NULL, &expt_digits, NULL, &mant_digits);
+ bias = H5Tget_ebias(src_id);
+ norm = H5Tget_norm(src_id);
+
+ HDmemcpy(bits, origin_bits, src_prec/8+1);
- if(src_dtype==FLT_FLOAT) {
- frct_digits = (FLT_MANT_DIG-1);
- expt_digits = (sizeof(float)*8)-(frct_digits+1);
- } else if(src_dtype==FLT_DOUBLE) {
- frct_digits = (DBL_MANT_DIG-1);
- expt_digits = (sizeof(double)*8)-(frct_digits+1);
- }
- bias = (1<<(expt_digits-2)) - 1;
-
/* get exponent */
- expt = H5T_bit_get_d(bits, frct_digits, expt_digits) - bias;
+ expt = H5T_bit_get_d(bits, mant_digits, expt_digits) - bias;
if(expt>=(dst_num_bits-1)) {
ret_value=TRUE;
@@ -6092,18 +6105,19 @@ overflows(unsigned char *origin_bits, dtype_t src_dtype, size_t src_size_bytes,
}
/* get significand */
- sig = H5T_bit_get_d(bits, 0, frct_digits);
+ H5T_bit_copy (mant_bits, 0, bits, 0, mant_digits);
+
- /* restore implicit bit*/
- sig |= (hsize_t)1<<frct_digits;
+ /* restore implicit bit if normalization is implied*/
+ if(norm == H5T_NORM_IMPLIED) {
+ H5T_bit_inc(mant_bits, mant_digits, 1);
+ mant_digits++;
+ }
/* shift significand */
- if(expt>expt_digits)
- sig <<= expt - expt_digits;
- else
- sig >>= expt_digits - expt;
+ H5T_bit_shift (mant_bits, (expt-expt_digits), 0, 32*8);
- indx = H5T_bit_find((uint8_t *)&sig, 0, 8*sizeof(hsize_t), H5T_BIT_MSB, 1);
+ indx = H5T_bit_find(mant_bits, 0, 32*8, H5T_BIT_MSB, 1);
if((size_t)indx>=dst_num_bits)
ret_value=TRUE;
@@ -6347,6 +6361,49 @@ run_int_float_conv(const char *name)
#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
#endif
+ if(!strcmp(name, "sw")) {
+#if H5_SW_LDOUBLE_TO_INT_WORKS
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ nerrors += test_conv_int_float(name, H5T_NATIVE_SCHAR, H5T_NATIVE_LDOUBLE);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_UCHAR, H5T_NATIVE_LDOUBLE);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_SHORT, H5T_NATIVE_LDOUBLE);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_USHORT, H5T_NATIVE_LDOUBLE);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE);
+#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE);
+#endif
+#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE);
+#ifdef H5_ULLONG_TO_FP_CAST_WORKS
+ nerrors += test_conv_int_float(name, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE);
+#else /* H5_ULLONG_TO_FP_CAST_WORKS */
+ {
+ char str[256]; /*hello string */
+
+ sprintf(str, "Testing random %s %s -> %s conversions",
+ name, "unsigned long long", "long double");
+ printf("%-70s", str);
+ SKIPPED();
+ HDputs(" Test skipped due to compiler not handling conversion.");
+ }
+#endif /* H5_ULLONG_TO_FP_CAST_WORKS */
+#endif
+#endif
+#else /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+ {
+ char str[256]; /*string */
+
+ sprintf(str, "Testing random %s %s -> %s conversions",
+ name, "all integers", "long double");
+ printf("%-70s", str);
+ SKIPPED();
+ HDputs(" Test skipped due to hardware conversion error.");
+ }
+#endif /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+ }
+
return nerrors;
}
@@ -6420,7 +6477,51 @@ run_float_int_conv(const char *name)
}
#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
#endif
-
+
+ if(!strcmp(name, "sw")) {
+#if H5_SW_LDOUBLE_TO_INT_WORKS
+#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
+#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
+#endif
+
+#if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG);
+#ifdef H5_FP_TO_ULLONG_RIGHT_MAXIMUM
+ nerrors += test_conv_int_float(name, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG);
+#else /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
+ {
+ char str[256]; /*string */
+
+ sprintf(str, "Testing random %s %s -> %s conversions",
+ name, "long double", "unsigned long long");
+ printf("%-70s", str);
+ SKIPPED();
+ HDputs(" Test skipped due to hardware conversion error.");
+ }
+#endif /*H5_FP_TO_ULLONG_RIGHT_MAXIMUM*/
+#endif
+#endif
+#else /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+ {
+ char str[256]; /*hello string */
+
+ sprintf(str, "Testing random %s %s -> %s conversions",
+ name, "long double", "all integers");
+ printf("%-70s", str);
+ SKIPPED();
+ HDputs(" Test skipped due to hardware conversion error.");
+ }
+#endif /*H5_SW_LDOUBLE_TO_INT_WORKS*/
+ }
+
return nerrors;
}
class="hl opt">=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list binread$(EXEEXT): $(binread_OBJECTS) $(binread_DEPENDENCIES) $(EXTRA_binread_DEPENDENCIES) @rm -f binread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(binread_OBJECTS) $(binread_LDADD) $(LIBS) h5dump$(EXEEXT): $(h5dump_OBJECTS) $(h5dump_DEPENDENCIES) $(EXTRA_h5dump_DEPENDENCIES) @rm -f h5dump$(EXEEXT) $(AM_V_CCLD)$(h5dump_LINK) $(h5dump_OBJECTS) $(h5dump_LDADD) $(LIBS) h5dumpgentest$(EXEEXT): $(h5dumpgentest_OBJECTS) $(h5dumpgentest_DEPENDENCIES) $(EXTRA_h5dumpgentest_DEPENDENCIES) @rm -f h5dumpgentest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(h5dumpgentest_OBJECTS) $(h5dumpgentest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump_ddl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dump_xml.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5dumpgentest.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) all-local installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ clean-libtool cscopelist ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ mostlyclean-local pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # List all build rules defined by HDF5 Makefiles as "PHONY" targets here. # This tells the Makefiles that these targets are not files to be built but # commands that should be executed even if a file with the same name already # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ build-tests check-clean check-install check-p check-s check-vfd \ install-doc lib progs tests uninstall-doc _exec_check-s _test help help: @$(top_srcdir)/bin/makehelp # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) build-progs: $(LIB) $(PROGS) build-tests: $(LIB) $(PROGS) $(chk_TESTS) # General rule for recursive building targets. # BUILT_SOURCES contain targets that need to be built before anything else # in the directory (e.g., for Fortran type detection) lib progs tests check-s check-p :: $(BUILT_SOURCES) @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; @for d in X $(SUBDIRS); do \ if test $$d != X && test $$d != .; then \ (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ fi; \ done # General rule for recursive cleaning targets. Like the rule above, # but doesn't require building BUILT_SOURCES. check-clean :: @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; @for d in X $(SUBDIRS); do \ if test $$d != X && test $$d != .; then \ (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ fi; \ done # Tell Automake to build tests when the user types `make all' (this is # not its default behavior). Also build EXTRA_LIB and EXTRA_PROG since # Automake won't build them automatically, either. all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS) # make install-doc doesn't do anything outside of doc directory, but # Makefiles should recognize it. # UPDATE: docs no longer reside in this build tree, so this target # is depreciated. install-doc uninstall-doc: @echo "Nothing to be done." # clean up files generated by tests so they can be re-run. build-check-clean: $(RM) -rf $(CHECK_CLEANFILES) # run check-clean whenever mostlyclean is run mostlyclean-local: build-check-clean # check-install is just a synonym for installcheck check-install: installcheck # Run each test in order, passing $(TEST_FLAGS) to the program. # Since tests are done in a shell loop, "make -i" does apply inside it. # Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop. # The timestamps give a rough idea how much time the tests use. # # Note that targets in chk_TESTS (defined above) will be built when the user # types 'make tests' or 'make check', but only programs in TEST_PROG, # TEST_PROG_PARA, or TEST_SCRIPT will actually be executed. check-TESTS: test test _test: @$(MAKE) build-check-s @$(MAKE) build-check-p # Actual execution of check-s. build-check-s: $(LIB) $(PROGS) $(chk_TESTS) @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ fi @$(MAKE) $(AM_MAKEFLAGS) _exec_check-s @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ fi _exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH) # The dummy.chkexe here prevents the target from being # empty if there are no tests in the current directory. # $${log} is the log file. # $${tname} is the name of test. $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \ tname=$(@:.chkexe_=)$(EXEEXT);\ log=$(@:.chkexe_=.chklog); \ echo "============================"; \ if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \ echo "No need to test $${tname} again."; \ else \ echo "============================" > $${log}; \ if test "X$(FORTRAN_API)" = "Xyes"; then \ echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ elif test "X$(CXX_API)" = "Xyes"; then \ echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ else \ echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ fi; \ echo "============================" >> $${log}; \ srcdir="$(srcdir)" \ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $(@:.chkexe_=.chkexe) || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ echo "" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ echo "============================" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)"; \ cat $${log}; \ fi; \ fi # The dummysh.chkexe here prevents the target from being # empty if there are no tests in the current directory. # $${log} is the log file. # $${tname} is the name of test. $(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_: @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \ cmd=$(@:.chkexe_=);\ tname=`basename $$cmd`;\ chkname=`basename $(@:.chkexe_=.chkexe)`;\ log=`basename $(@:.chkexe_=.chklog)`; \ echo "============================"; \ if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \ echo "No need to test $${tname} again."; \ else \ echo "============================" > $${log}; \ if test "X$(FORTRAN_API)" = "Xyes"; then \ echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ elif test "X$(CXX_API)" = "Xyes"; then \ echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ else \ echo "Testing $${tname} $(TEST_FLAGS)"; \ echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ fi; \ echo "============================" >> $${log}; \ RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \ srcdir="$(srcdir)" \ $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \ && touch $${chkname} || \ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ (cat $${log} && false) || exit 1; \ echo "" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ echo "============================" >> $${log}; \ echo "Finished testing $${tname} $(TEST_FLAGS)"; \ cat $${log}; \ fi; \ echo "============================"; \ fi # Actual execution of check-p. build-check-p: $(LIB) $(PROGS) $(chk_TESTS) @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ fi @if test -n "$(TEST_PROG_PARA)"; then \ echo "**** Hint ****"; \ echo "Parallel test files reside in the current directory" \ "by default."; \ echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \ echo " HDF5_PARAPREFIX=/PFS/user/me"; \ echo " export HDF5_PARAPREFIX"; \ echo " make check"; \ echo "**** end of Hint ****"; \ fi @for test in $(TEST_PROG_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ RUNEXEC="$(RUNPARALLEL)" || exit 1; \ fi; \ done @for test in $(TEST_SCRIPT_PARA) dummy; do \ if test $$test != dummy; then \ $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \ fi; \ done @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ fi # Run test with different Virtual File Driver check-vfd: $(LIB) $(PROGS) $(chk_TESTS) @for vfd in $(VFD_LIST) dummy; do \ if test $$vfd != dummy; then \ echo "============================"; \ echo "Testing Virtual File Driver $$vfd"; \ echo "============================"; \ $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ fi; \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: