leto / math--gsl

Perl interface to the GNU Scientific Library
http://leto.net/code/Math-GSL
33 stars 25 forks source link

Test t/Histogram.t fails on Windows 10, MSYS2 : pdf.c:46: ERROR: cannot find r in cumulative pdf #223

Closed hakonhagland closed 3 years ago

hakonhagland commented 3 years ago

After applying the fix in PR #222, I get some test failures (Windows 10, MSYS 2, perl version 5.32.0):

$ ./Build test
Processing 2.6 XS files, GSL 2.6 (via gsl-config) at /usr/lib/perl5/site_perl/auto/share/dist/Alien-GSL
Compiler        = gcc (GCC) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ccflags         = -I/usr/lib/perl5/site_perl/auto/share/dist/Alien-GSL/include -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -march=x86-64 -mtune=generic -O2 -pipe -fwrapv -fno-strict-aliasing -fstack-protector-strong -Wall -Wno-sometimes-uninitialized -Wno-unused-function -Wno-unused-value -Wno-unused-function -Wno-unused-variable -Wno-gnu -g -fPIC -fno-omit-frame-pointer -I/usr/lib/perl5/site_perl/auto/share/dist/Alien-GSL/include
ldflags         = -shared -L/usr/lib/perl5/site_perl/auto/share/dist/Alien-GSL/lib -lgsl -lgslcblas -lm -L/usr/lib/perl5/core_perl/CORE -lperl -fPIC -fno-omit-frame-pointer
PERL5LIB        =
LD_LIBRARY_PATH =
t/00-load.t ........ 45/? # Testing Math::GSL 0.42 with GSL 2.6 on x86_64-msys-thread-multi, Perl (/usr/bin/perl) 5.032000
t/00-load.t ........ ok
t/BLAS.t ........... ok
t/BSpline.t ........ ok
t/CBLAS.t .......... ok
t/CDF.t ............ ok
t/Chebyshev.t ...... ok
t/Combination.t .... ok
t/Complex.t ........ ok
t/Const.t .......... ok
t/DHT.t ............ ok
t/Deriv.t .......... ok
t/Diff.t ........... ok
t/Eigen.t .......... ok
t/Errno.t .......... ok
t/FFT.t ............ ok
t/Fit.t ............ ok
t/GSL.t ............ 1/? #
#       Elements start differing at index 2, delta = 0.00099999999999989
#               $x->[2] = 3
#               $y->[2] = 3.001
#
#       Elements start differing at index 2, delta = 9.99999998363421e-08
#               $x->[2] = 3.0010001
#               $y->[2] = 3.0010002
t/GSL.t ............ ok
t/Heapsort.t ....... ok
t/Histogram.t ...... 1/74 gsl: pdf.c:46: ERROR: cannot find r in cumulative pdf
Default GSL error handler invoked.
t/Histogram.t ...... Failed 40/74 subtests
[...]
leto commented 3 years ago

@hakonhagland at first glance, it seems that no error handler is defined for those tests, and something bad enough happens that causes all following tests to fail

hakonhagland commented 3 years ago

@leto Yes, but at line 11 the error handler is turned off.. So I wonder why the default error handler invoked?

hakonhagland commented 3 years ago

I think the problem could be that we do not initialize the probability distribution function for the histogram, see test GSL_HISTOGRAM_PDF_SAMPLE on line 271 :

sub GSL_HISTOGRAM_PDF_SAMPLE : Tests {
    my $p = gsl_histogram_pdf_alloc(100);
    ok_status(gsl_histogram_pdf_sample( $p, 0.5 ));
}

according to the documentation, there is a function gsl_histogram_pdf_init() that can be used to initialize the probability distribution with the contents of a histogram.