I am using HDF5 1.10.5 on Arch Linux, where I have
I wanted to install the
hdf5-java:1.10.5-1 package from the Arch User repository (see https://aur.archlinux.org/packages/hdf5-java/), which builds HDF5 on my local machine during the installation.
In the JUnit tests as run by
java/test/junit.sh.in, the timing info in the output of JUnit is replaced by
XXXX, using sed:
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ JUnit-TestH5.ext > JUnit-TestH5.out
JUnit outputs the timing info on my machine with a comma instead of a dot as a decimal separator due to my locale settings and this leads to errors in the test process of HDF5:
**FAILED** JUnit-TestH5 Expected result differs from actual result *** JUnit-TestH5.txt 2020-01-07 16:09:27.549026750 +0100 --- JUnit-TestH5.out 2020-01-07 16:09:28.959026778 +0100 *************** *** 10,16 **** .testH5get_libversion .testH5set_free_list_limits ! Time: XXXX OK (10 tests) --- 10,16 ---- .testH5get_libversion .testH5set_free_list_limits ! Time: XXXX,183 OK (10 tests)
As you can see, only the part before the decimal comma is replaced by
XXXX and this leads to a comparison error.
I suggest to modify the regular expressions in the
sed calls in
junit.sh.in as follows:
< -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \ --- > -e 's/Time: [0-9]*[[\.,][0-9]*]*/Time: XXXX/' \
The JUnit test passes when these modifications are applied.
However, some of the
java/examples/datatype/JavaDatatypeExample.sh.in tests fail as well; in particular the ones where some floating point data is dumped into a text file and compared against a reference file. These are
In my opinion, the correct way would be to force the
DecimalFormat to use the English locale, which probably could be done like this (see e.g. Stack Overflow: Change DecimalFormat locale) in the two Java files:
DecimalFormat df = new DecimalFormat("#,##0.0000", new DecimalFormatSymbols(Locale.US));
For now, I simply did
export LANG=en_US.UTF-8 and the build and tests went fine.
However, it would be nice to have HDF5 compile and be tested successfully independent of the local environment of the users.
What do you think about this?