Skip Menu |

This queue is for tickets about the StorageDisplay CPAN distribution.

Report information
The Basics
Id: 132296
Status: resolved
Priority: 0/
Queue: StorageDisplay

People
Owner: vdanjean.ml [...] free.fr
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.0.4



Subject: Test failure (with -Duselongdouble) (1.0.3)
It seems that the test suite fails if the used perl is configured with increased floating point accuracy (i.e. with the configuration option -Duselongdouble): ... # Failed test 'Perl round' # at t/05_round.t line 18. # +----------+----+----------+ # | GOT | OP | CHECK | # +----------+----+----------+ # | 4.80 GiB | eq | 4.79 GiB | # +----------+----+----------+ # Seeded srand with seed '20200404' from local date. t/05_round.t ........... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests # Failed test 'data/aya.ref.dot and data/aya.dot contents are the same' # at t/10_reference.t line 56. # --- data/aya.ref.dot Sat Apr 4 08:52:31 2020 # +++ data/aya.dot Sat Apr 4 12:27:47 2020 # @@ -909,7 +909,7 @@ # style=striped;fillcolor="pink;0.585982.2:green" # ]; } # { "@FS@/var/log" [ # - label="/var/log\nDevice: /dev/aya+raid1/log\next4\nSize: 4.79 GiB\nFree: 3.64 GiB\nUsed: 909 MiB"; # + label="/var/log\nDevice: /dev/aya+raid1/log\next4\nSize: 4.80 GiB\nFree: 3.64 GiB\nUsed: 909 MiB"; # style=striped;fillcolor="pink;0.240461.2:green" # ]; } # { "@FS@/" [ ... (more similar differences following) ...
On Sat Apr 04 09:00:10 2020, SREZIC wrote: Show quoted text
> It seems that the test suite fails if the used perl is configured with > increased floating point accuracy (i.e. with the configuration option > -Duselongdouble):
Many thanks to identify the root cause. I was still trying to find the good thing in the environment. The computation comes from a little routine. I will try to make it independent of the perl configuration, but if you have some advices, they will be welcome. Initially, the value is always an integer (in bytes). Here is the routine: sub disp_size { my $self = shift; my $size = shift; my $unit = 'B'; if ($size >= 1024) { $unit = 'kiB'; } if ($size >= 1048576) { $unit = 'MiB'; $size=int($size/1024); } if ($size >= 1048576) { $unit = 'GiB'; $size=int($size/1024); } if ($size >= 1048576) { $unit = 'TiB'; $size=int($size/1024); } if ($size >= 1048576) { $unit = 'PiB'; $size=int($size/1024); } if ($size >= 1048576) { $unit = 'EiB'; $size=int($size/1024); } if ($unit eq 'B') { return "$size B"; } $size = int($size * 1000 / 1024); my $d=2; if ($size >= 10000) { $d = 1;} if ($size >= 100000) { $d = 0;} return sprintf("%.$d"."f $unit", $size/1000); }
On Sat Apr 04 15:00:03 2020, VDANJEAN wrote: Show quoted text
> The computation comes from a little routine. I will try to make it > independent of the perl configuration, but if you have some advices, > they will be welcome. > Initially, the value is always an integer (in bytes).
I rewrote the routine using bigint. It seems to solve the problem.