[arrayfire] 01/07: Add upstream patch fixing the testsuite for i686 architecture.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Dec 17 14:05:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.
commit b440613895276d7dd875f8e665be1dbfc948b7e3
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date: Tue Dec 15 15:22:36 2015 +0000
Add upstream patch fixing the testsuite for i686 architecture.
Gbp-Dch: Short
Thanks: Gianfranco Costamagna for reporting this issue.
---
.../patches/Fixing-select-and-replace-tests.patch | 125 +++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 126 insertions(+)
diff --git a/debian/patches/Fixing-select-and-replace-tests.patch b/debian/patches/Fixing-select-and-replace-tests.patch
new file mode 100644
index 0000000..a138bc0
--- /dev/null
+++ b/debian/patches/Fixing-select-and-replace-tests.patch
@@ -0,0 +1,125 @@
+From: Pavan Yalamanchili <pavan at arrayfire.com>
+Date: Mon, 14 Dec 2015 11:18:17 -0500
+Subject: Fixing select and replace tests
+
+---
+ test/replace.cpp | 22 +++++++++++++++++-----
+ test/select.cpp | 20 +++++++++++++++-----
+ 2 files changed, 32 insertions(+), 10 deletions(-)
+
+diff --git a/test/replace.cpp b/test/replace.cpp
+index c6d3b5d..9e99eae 100644
+--- a/test/replace.cpp
++++ b/test/replace.cpp
+@@ -35,10 +35,17 @@ void replaceTest(const dim4 &dims)
+ af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
+
+ array a = randu(dims, ty);
+- array c = a.copy();
+- array cond = randu(dims, ty) > constant(0.3, dims, ty);
+ array b = randu(dims, ty);
+
++ if (a.isinteger()) {
++ a = (a % (1 << 30)).as(ty);
++ b = (b % (1 << 30)).as(ty);
++ }
++
++ array c = a.copy();
++
++ array cond = randu(dims, ty) > a;
++
+ replace(c, cond, b);
+
+ int num = (int)a.elements();
+@@ -65,8 +72,13 @@ void replaceScalarTest(const dim4 &dims)
+ af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
+
+ array a = randu(dims, ty);
++
++ if (a.isinteger()) {
++ a = (a % (1 << 30)).as(ty);
++ }
++
+ array c = a.copy();
+- array cond = randu(dims, ty) > constant(0.3, dims, ty);
++ array cond = randu(dims, ty) > a;
+ double b = 3;
+
+ replace(c, cond, b);
+@@ -81,7 +93,7 @@ void replaceScalarTest(const dim4 &dims)
+ cond.host(&hcond[0]);
+
+ for (int i = 0; i < num; i++) {
+- ASSERT_EQ(hc[i], hcond[i] ? b : ha[i]);
++ ASSERT_EQ(hc[i], hcond[i] ? T(b) : ha[i]);
+ }
+ }
+
+@@ -103,7 +115,7 @@ TEST(Replace, NaN)
+ array a = randu(dims, ty);
+ a(seq(a.dims(0) / 2), span, span, span) = af::NaN;
+ array c = a.copy();
+- double b = 0;
++ float b = 0;
+ replace(c, isNaN(c), b);
+
+ int num = (int)a.elements();
+diff --git a/test/select.cpp b/test/select.cpp
+index 91c8110..1c39282 100644
+--- a/test/select.cpp
++++ b/test/select.cpp
+@@ -34,9 +34,15 @@ void selectTest(const dim4 &dims)
+ af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
+
+ array a = randu(dims, ty);
+- array cond = randu(dims, ty) > constant(0.3, dims, ty);
+ array b = randu(dims, ty);
+
++ if (a.isinteger()) {
++ a = (a % (1 << 30)).as(ty);
++ b = (b % (1 << 30)).as(ty);
++ }
++
++ array cond = randu(dims, ty) > a;
++
+ array c = select(cond, a, b);
+
+ int num = (int)a.elements();
+@@ -63,9 +69,13 @@ void selectScalarTest(const dim4 &dims)
+ af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
+
+ array a = randu(dims, ty);
+- array cond = randu(dims, ty) > constant(0.3, dims, ty);
++ array cond = randu(dims, ty) > a;
+ double b = 3;
+
++ if (a.isinteger()) {
++ a = (a % (1 << 30)).as(ty);
++ }
++
+ array c = is_right ? select(cond, a, b) : select(cond, b, a);
+
+ int num = (int)a.elements();
+@@ -80,11 +90,11 @@ void selectScalarTest(const dim4 &dims)
+
+ if (is_right) {
+ for (int i = 0; i < num; i++) {
+- ASSERT_EQ(hc[i], hcond[i] ? ha[i] : b);
++ ASSERT_EQ(hc[i], hcond[i] ? ha[i] : T(b));
+ }
+ } else {
+ for (int i = 0; i < num; i++) {
+- ASSERT_EQ(hc[i], hcond[i] ? b : ha[i]);
++ ASSERT_EQ(hc[i], hcond[i] ? T(b) : ha[i]);
+ }
+ }
+ }
+@@ -111,7 +121,7 @@ TEST(Select, NaN)
+
+ array a = randu(dims, ty);
+ a(seq(a.dims(0) / 2), span, span, span) = af::NaN;
+- double b = 0;
++ float b = 0;
+ array c = select(isNaN(a), b, a);
+
+ int num = (int)a.elements();
diff --git a/debian/patches/series b/debian/patches/series
index 09dc281..8a95f06 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ Use-system-gtest.patch
Use-custom-cflags-in-examples.patch
Fix-missing-includes-in-testsuite.patch
Disable-git-usage-in-Doxygen-settings.patch
+Fixing-select-and-replace-tests.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list