[opengm] 02/04: Add patch fixing execution of testsuite on 32-bit arch.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Fri Dec 4 10:07:21 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 opengm.

commit 3f5e847d5004f5096550c949d9378aa0f1a53fee
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Fri Dec 4 09:16:47 2015 +0000

    Add patch fixing execution of testsuite on 32-bit arch.
---
 .../Fix-testsuite-execution-on-32-bit.patch        | 171 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 172 insertions(+)

diff --git a/debian/patches/Fix-testsuite-execution-on-32-bit.patch b/debian/patches/Fix-testsuite-execution-on-32-bit.patch
new file mode 100644
index 0000000..923cd20
--- /dev/null
+++ b/debian/patches/Fix-testsuite-execution-on-32-bit.patch
@@ -0,0 +1,171 @@
+From: joergkappes <kappes at math.uni-heidelberg.de>
+Date: Fri, 27 Nov 2015 15:00:55 +0100
+Subject: Fix testsuite execution on 32-bit.
+
+This fix is a squashed commit of the following upstream commits:
+3acdc4f, 3993109 and 83611ee.
+---
+ include/opengm/unittests/test.hxx |  2 +-
+ src/unittest/test_functions.cxx   | 36 ++++++++++++++++++------------------
+ src/unittest/test_partitions.cxx  | 13 +++++++------
+ 3 files changed, 26 insertions(+), 25 deletions(-)
+
+diff --git a/include/opengm/unittests/test.hxx b/include/opengm/unittests/test.hxx
+index 69343cb..54e8691 100644
+--- a/include/opengm/unittests/test.hxx
++++ b/include/opengm/unittests/test.hxx
+@@ -29,7 +29,7 @@
+ }
+ 
+ #define OPENGM_TEST_EQUAL_TOLERANCE(x, y, epsilon) \
+-    if( (x<y && y-x > epsilon) || (x>y && x-y > epsilon) ) { \
++   if( (x<y && y-epsilon > x) || (x>y && x-epsilon > y) ) {        \
+     std::stringstream s; \
+     s << x << " != " << y << " [line " << __LINE__ << ": " << #x << " == " << #y << " ]"; \
+     throw std::logic_error(s.str().c_str()); \
+diff --git a/src/unittest/test_functions.cxx b/src/unittest/test_functions.cxx
+index b69f55f..21c38b9 100644
+--- a/src/unittest/test_functions.cxx
++++ b/src/unittest/test_functions.cxx
+@@ -1013,19 +1013,19 @@ struct FunctionsTest {
+          // bounds
+          typename std::vector<ValueType>::const_iterator boundsIter = bounds.begin();
+          for(LinearConstraintsIteratorType constraintsIter = lessEqualFunction.linearConstraintsBegin(); constraintsIter != lessEqualFunction.linearConstraintsEnd(); ++constraintsIter) {
+-            OPENGM_TEST_EQUAL(constraintsIter->getBound(), *boundsIter);
++            OPENGM_TEST_EQUAL_TOLERANCE(constraintsIter->getBound(), *boundsIter, OPENGM_FLOAT_TOL);
+             ++boundsIter;
+          }
+          OPENGM_TEST(boundsIter == bounds.end());
+          boundsIter = bounds.begin();
+          for(LinearConstraintsIteratorType constraintsIter = equalFunction.linearConstraintsBegin(); constraintsIter != equalFunction.linearConstraintsEnd(); ++constraintsIter) {
+-            OPENGM_TEST_EQUAL(constraintsIter->getBound(), *boundsIter);
++            OPENGM_TEST_EQUAL_TOLERANCE(constraintsIter->getBound(), *boundsIter, OPENGM_FLOAT_TOL);
+             ++boundsIter;
+          }
+          OPENGM_TEST(boundsIter == bounds.end());
+          boundsIter = bounds.begin();
+          for(LinearConstraintsIteratorType constraintsIter = greaterEqualFunction.linearConstraintsBegin(); constraintsIter != greaterEqualFunction.linearConstraintsEnd(); ++constraintsIter) {
+-            OPENGM_TEST_EQUAL(constraintsIter->getBound(), *boundsIter);
++            OPENGM_TEST_EQUAL_TOLERANCE(constraintsIter->getBound(), *boundsIter, OPENGM_FLOAT_TOL);
+             ++boundsIter;
+          }
+          OPENGM_TEST(boundsIter == bounds.end());
+@@ -1173,8 +1173,8 @@ struct FunctionsTest {
+                OPENGM_TEST(std::distance(violatedConstraintsBegin, violatedConstraintsEnd) > 0);
+                for(size_t i = 0; i < numConstraints; i++) {
+                   if(expectedValues[i] > bounds[i]) {
+-                     OPENGM_TEST_EQUAL(expectedValues[i] - bounds[i], *violatedConstraintsWeightsBegin);
+-                     OPENGM_TEST_EQUAL(bounds[i], violatedConstraintsBegin->getBound());
++                     OPENGM_TEST_EQUAL_TOLERANCE(expectedValues[i] - bounds[i], *violatedConstraintsWeightsBegin, OPENGM_FLOAT_TOL);
++                     OPENGM_TEST_EQUAL_TOLERANCE(bounds[i], violatedConstraintsBegin->getBound(), OPENGM_FLOAT_TOL);
+                      OPENGM_TEST_EQUAL_SEQUENCE(constraints[i].indicatorVariablesBegin(), constraints[i].indicatorVariablesEnd(), violatedConstraintsBegin->indicatorVariablesBegin());
+                      ++violatedConstraintsBegin;
+                      ++violatedConstraintsWeightsBegin;
+@@ -1200,8 +1200,8 @@ struct FunctionsTest {
+                OPENGM_TEST(std::distance(violatedConstraintsBegin, violatedConstraintsEnd) > 0);
+                for(size_t i = 0; i < numConstraints; i++) {
+                   if(expectedValues[i] != bounds[i]) {
+-                     OPENGM_TEST_EQUAL(std::abs(expectedValues[i] - bounds[i]), *violatedConstraintsWeightsBegin);
+-                     OPENGM_TEST_EQUAL(bounds[i], violatedConstraintsBegin->getBound());
++                     OPENGM_TEST_EQUAL_TOLERANCE(std::abs(expectedValues[i] - bounds[i]), *violatedConstraintsWeightsBegin, OPENGM_FLOAT_TOL);
++                     OPENGM_TEST_EQUAL_TOLERANCE(bounds[i], violatedConstraintsBegin->getBound(), OPENGM_FLOAT_TOL);
+                      OPENGM_TEST_EQUAL_SEQUENCE(constraints[i].indicatorVariablesBegin(), constraints[i].indicatorVariablesEnd(), violatedConstraintsBegin->indicatorVariablesBegin());
+                      ++violatedConstraintsBegin;
+                      ++violatedConstraintsWeightsBegin;
+@@ -1227,8 +1227,8 @@ struct FunctionsTest {
+                OPENGM_TEST(std::distance(violatedConstraintsBegin, violatedConstraintsEnd) > 0);
+                for(size_t i = 0; i < numConstraints; i++) {
+                   if(expectedValues[i] < bounds[i]) {
+-                     OPENGM_TEST_EQUAL(bounds[i] - expectedValues[i], *violatedConstraintsWeightsBegin);
+-                     OPENGM_TEST_EQUAL(bounds[i], violatedConstraintsBegin->getBound());
++                     OPENGM_TEST_EQUAL_TOLERANCE(bounds[i] - expectedValues[i], *violatedConstraintsWeightsBegin, OPENGM_FLOAT_TOL);
++                     OPENGM_TEST_EQUAL_TOLERANCE(bounds[i], violatedConstraintsBegin->getBound(), OPENGM_FLOAT_TOL);
+                      OPENGM_TEST_EQUAL_SEQUENCE(constraints[i].indicatorVariablesBegin(), constraints[i].indicatorVariablesEnd(), violatedConstraintsBegin->indicatorVariablesBegin());
+                      ++violatedConstraintsBegin;
+                      ++violatedConstraintsWeightsBegin;
+@@ -1278,27 +1278,27 @@ struct FunctionsTest {
+             greaterEqualFunction.challengeRelaxed(violatedConstraintsGreaterEqualFunctionBegin, violatedConstraintsGreaterEqualFunctionEnd, violatedConstraintsWeightsGreaterEqualFunctionBegin, evalVecRelaxed.begin());
+ 
+             for(size_t i = 0; i < numConstraints; i++) {
+-               if(expectedValues[i] < bounds[i]) {
+-                  OPENGM_TEST_EQUAL(bounds[i] - expectedValues[i], *violatedConstraintsWeightsEqualFunctionBegin);
+-                  OPENGM_TEST_EQUAL(bounds[i], violatedConstraintsEqualFunctionBegin->getBound());
++               if(expectedValues[i] < bounds[i]) {  
++                  OPENGM_TEST_EQUAL_TOLERANCE(bounds[i] - expectedValues[i], *violatedConstraintsWeightsEqualFunctionBegin, OPENGM_FLOAT_TOL);
++                  OPENGM_TEST_EQUAL_TOLERANCE(bounds[i], violatedConstraintsEqualFunctionBegin->getBound(), OPENGM_FLOAT_TOL);
+                   OPENGM_TEST_EQUAL_SEQUENCE(constraints[i].indicatorVariablesBegin(), constraints[i].indicatorVariablesEnd(), violatedConstraintsEqualFunctionBegin->indicatorVariablesBegin());
+                   ++violatedConstraintsEqualFunctionBegin;
+                   ++violatedConstraintsWeightsEqualFunctionBegin;
+ 
+-                  OPENGM_TEST_EQUAL(bounds[i] - expectedValues[i], *violatedConstraintsWeightsGreaterEqualFunctionBegin);
+-                  OPENGM_TEST_EQUAL(bounds[i], violatedConstraintsGreaterEqualFunctionBegin->getBound());
++                  OPENGM_TEST_EQUAL_TOLERANCE(bounds[i] - expectedValues[i], *violatedConstraintsWeightsGreaterEqualFunctionBegin, OPENGM_FLOAT_TOL);
++                  OPENGM_TEST_EQUAL_TOLERANCE(bounds[i], violatedConstraintsGreaterEqualFunctionBegin->getBound(), OPENGM_FLOAT_TOL);
+                   OPENGM_TEST_EQUAL_SEQUENCE(constraints[i].indicatorVariablesBegin(), constraints[i].indicatorVariablesEnd(), violatedConstraintsGreaterEqualFunctionBegin->indicatorVariablesBegin());
+                   ++violatedConstraintsGreaterEqualFunctionBegin;
+                   ++violatedConstraintsWeightsGreaterEqualFunctionBegin;
+                } else if(expectedValues[i] > bounds[i]) {
+-                  OPENGM_TEST_EQUAL(expectedValues[i] - bounds[i], *violatedConstraintsWeightsEqualFunctionBegin);
+-                  OPENGM_TEST_EQUAL(bounds[i], violatedConstraintsEqualFunctionBegin->getBound());
++                  OPENGM_TEST_EQUAL_TOLERANCE(expectedValues[i] - bounds[i], *violatedConstraintsWeightsEqualFunctionBegin, OPENGM_FLOAT_TOL);
++                  OPENGM_TEST_EQUAL_TOLERANCE(bounds[i], violatedConstraintsEqualFunctionBegin->getBound(), OPENGM_FLOAT_TOL);
+                   OPENGM_TEST_EQUAL_SEQUENCE(constraints[i].indicatorVariablesBegin(), constraints[i].indicatorVariablesEnd(), violatedConstraintsEqualFunctionBegin->indicatorVariablesBegin());
+                   ++violatedConstraintsEqualFunctionBegin;
+                   ++violatedConstraintsWeightsEqualFunctionBegin;
+ 
+-                  OPENGM_TEST_EQUAL(expectedValues[i] - bounds[i], *violatedConstraintsWeightsLessEqualFunctionBegin);
+-                  OPENGM_TEST_EQUAL(bounds[i], violatedConstraintsLessEqualFunctionBegin->getBound());
++                  OPENGM_TEST_EQUAL_TOLERANCE(expectedValues[i] - bounds[i], *violatedConstraintsWeightsLessEqualFunctionBegin, OPENGM_FLOAT_TOL);
++                  OPENGM_TEST_EQUAL_TOLERANCE(bounds[i], violatedConstraintsLessEqualFunctionBegin->getBound(), OPENGM_FLOAT_TOL);
+                   OPENGM_TEST_EQUAL_SEQUENCE(constraints[i].indicatorVariablesBegin(), constraints[i].indicatorVariablesEnd(), violatedConstraintsLessEqualFunctionBegin->indicatorVariablesBegin());
+                   ++violatedConstraintsLessEqualFunctionBegin;
+                   ++violatedConstraintsWeightsLessEqualFunctionBegin;
+diff --git a/src/unittest/test_partitions.cxx b/src/unittest/test_partitions.cxx
+index 4826c86..dca0e78 100644
+--- a/src/unittest/test_partitions.cxx
++++ b/src/unittest/test_partitions.cxx
+@@ -2,11 +2,12 @@
+ #include <iostream>
+ #include "opengm/utilities/partitions.hxx"
+ #include <opengm/unittests/test.hxx>
++#include <stdint.h>
+ 
+ 
+ void testPartition()
+ {
+-   opengm::Partitions<size_t,size_t> P;
++   opengm::Partitions<uint64_t,uint64_t> P;
+    P.resize(3); 
+    std::cout <<"Test BellNumber: ..."<<std::flush;
+    OPENGM_TEST(P.BellNumber(2)==2);
+@@ -20,8 +21,8 @@ void testPartition()
+    OPENGM_TEST(P.getPartition(4)==7); 
+    OPENGM_TEST(P.getPartition(5)>8);
+ 
+-   std::vector<size_t> ltest(3);
+-   for(size_t i=0; i<5; ++i){
++   std::vector<uint64_t> ltest(3);
++   for(uint64_t i=0; i<5; ++i){
+       //const size_t el = P.getPartition(i);
+       P.getPartition(i,ltest);
+       //std::cout << P.label2Index(ltest) <<" ("<< el <<") "<<ltest[0]<<ltest[1]<<ltest[2]<<std::endl;
+@@ -33,16 +34,16 @@ void testPartition()
+ 
+    std::cout <<"Test label2Index: ..."<<std::flush;
+    P.resize(3);
+-   std::vector<size_t> l(3,0);
++   std::vector<uint64_t> l(3,0);
+    OPENGM_TEST(P.label2Index(l)==4);
+    l[0]=1;
+    OPENGM_TEST(P.label2Index(l)==3);
+    l[1]=2;
+    OPENGM_TEST(P.label2Index(l)==0); 
+ 
+-   for(size_t b=4;b<12;++b){
++   for(uint64_t b=4;b<12;++b){
+       P.resize(b);
+-      std::vector<size_t> l(b,0);
++      std::vector<uint64_t> l(b,0);
+       OPENGM_TEST(P.label2Index(l)==P.BellNumber(b)-1);
+    }
+    std::cout <<"  OK!"<<std::endl;
diff --git a/debian/patches/series b/debian/patches/series
index b3d940e..82e1662 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 fix-hdf5-detection.patch
+Fix-testsuite-execution-on-32-bit.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git



More information about the debian-science-commits mailing list