[Pkg-electronics-commits] [libsigrok] 01/01: Fix unit tests on i386 by casting floats to doubles

Jonathan McDowell noodles at moszumanska.debian.org
Mon Sep 18 18:41:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

noodles pushed a commit to branch master
in repository libsigrok.

commit c6a394f98b1887f9717ef7d3859a7d53f6176764
Author: Jonathan McDowell <noodles at earth.li>
Date:   Mon Sep 18 18:46:03 2017 +0100

    Fix unit tests on i386 by casting floats to doubles
    
    See https://www.earth.li/~noodles/blog/2017/08/help-me-c.html
    for more details.
---
 debian/changelog                     |  6 ++++++
 debian/patches/01-i386-test-fix.diff | 28 ++++++++++++++++++++++++++++
 debian/patches/series                |  1 +
 3 files changed, 35 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index f31df95..c58d89b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libsigrok (0.5.0-3) UNRELEASED; urgency=medium
+
+  * Fix unit tests on i386 by casting floats to doubles.
+
+ -- Jonathan McDowell <noodles at earth.li>  Mon, 18 Sep 2017 18:45:04 +0100
+
 libsigrok (0.5.0-2) experimental; urgency=medium
 
   * Update debian/copyright.
diff --git a/debian/patches/01-i386-test-fix.diff b/debian/patches/01-i386-test-fix.diff
new file mode 100644
index 0000000..ae38eb0
--- /dev/null
+++ b/debian/patches/01-i386-test-fix.diff
@@ -0,0 +1,28 @@
+Description: Fix unit tests on i386 by forcing floats to doubles
+ The unit tests check that various macros and number to string
+ functions operate as expected. However on i386 the precision of
+ the floating point numbers is not quite as expected, which leads to
+ test failures. These are not seen on x86_64 or other platforms, but
+ can be worked around by casting the numbers in questions to double
+ precision rather than defaulting to floats.
+ .
+ See https://www.earth.li/~noodles/blog/2017/08/help-me-c.html and the
+ associated comments for further details.
+Author: Jonathan McDowell <noodles at earth.li>
+Forwarded: no
+Last-Update: 2017-09-18
+diff --git a/tests/strutil.c b/tests/strutil.c
+index a36b6a2d..8883d85a 100644
+--- a/tests/strutil.c
++++ b/tests/strutil.c
+@@ -136,8 +136,8 @@ START_TEST(test_mhz)
+ 	test_samplerate(SR_MHZ(12.345678), "12.345678 MHz");
+ 	test_samplerate(SR_MHZ(123.456789), "123.456789 MHz");
+ 	test_samplerate(SR_MHZ(1.230007), "1.230007 MHz");
+-	test_samplerate(SR_MHZ(1.034567), "1.034567 MHz");
+-	test_samplerate(SR_MHZ(1.000007), "1.000007 MHz");
++	test_samplerate(SR_MHZ((double)1.034567), "1.034567 MHz");
++	test_samplerate(SR_MHZ((double)1.000007), "1.000007 MHz");
+ 	test_samplerate(SR_MHZ(1.234000), "1.234 MHz");
+ }
+ END_TEST
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..f2f44da
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+01-i386-test-fix.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/libsigrok.git



More information about the Pkg-electronics-commits mailing list