diff options
author | Michael Cree <mcree@orcon.net.nz> | 2015-09-15 10:08:41 +0530 |
---|---|---|
committer | David Henningsson <david.henningsson@canonical.com> | 2015-09-17 08:12:49 +0200 |
commit | 392060d0fca30cd3fac68a6feabe25bb87823d9b (patch) | |
tree | 6573ef0d915e778025e73c7c251da0e35c316d0e | |
parent | 76e2cec9a2c3a09fc62ce62042d33375d9878471 (diff) | |
download | pulseaudio-392060d0fca30cd3fac68a6feabe25bb87823d9b.tar.gz |
tests: Fix test-suite failure on Alpha
Pulseaudio fails to build on the Alpha architecture due to a failure
in the volume-test of the test suite. I had reported this to the
Debian bug tracker [1] but the maintainer has asked that I forward the
patch to this mail list. The failure in volume-test occurs because it
is compiled with -ffast-math which implies -ffinite-math-only of which
the gcc manual states that it optimizes for floating-point arithmetic
with the assumption that arguments and results are not NaNs or
+/-infinity, and futher notes that it may result in incorrect output.
On the Alpha platform that is somewhat an understatement as the use of
non-finite floating-point arithmetic with -ffinite-math-only results in
a floating-point exception and the termination of the program.
The volume-test converts volumes into decibels (so a zero volume
becomes a negative infinity) and proceeds to add two volumes (in
decibels), thus does arithmetic with non-finite floating point numbers
despite being compiled with -ffast-math!
I attach a patch that protects against the arithmetic with non-finite
numbers for your consideration. With that patch the test-suite passes
on Alpha.
Cheers
Michael.
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798248
-rw-r--r-- | src/tests/volume-test.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tests/volume-test.c b/src/tests/volume-test.c index bd0b01c68..191bc2127 100644 --- a/src/tests/volume-test.c +++ b/src/tests/volume-test.c @@ -114,7 +114,10 @@ START_TEST (volume_test) { double q, qq; p = pa_sw_volume_multiply(v, w); - qq = db + db2; + if (isfinite(db) && isfinite(db2)) + qq = db + db2; + else + qq = -INFINITY; p2 = pa_sw_volume_from_dB(qq); q = l*t; p1 = pa_sw_volume_from_linear(q); |