Control: tags -1 patch
Control: tags -1 pending

I think the memory leak results from a missing cleanup in the mips64el
specific path. The full patch (including the original one) is here.

I am going to upload the new version ASAP.

Best

Ole
Author: Lars Kristian Lundin <[email protected]>
Description: Fix testing on mips64el
Bug: #753089
Url: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753089#10
--- a/cplcore/tests/cpl_matrix-test.c
+++ b/cplcore/tests/cpl_matrix-test.c
@@ -200,6 +200,7 @@
     FILE       * stream;
     const double * data;
     cpl_boolean  do_bench;
+    cpl_boolean  did_fail;
     cpl_error_code code;
     const cpl_matrix * null; /* This one is expected to be NULL */
 
@@ -1579,6 +1580,8 @@
   cpl_msg_info("", "Try to solve increasingly large systems A^TAx=A^Tb, "
                "with A(i,j) = 1/(2*n-(1+i+j)) and x(j) = 1");
 
+  k = 0;
+  did_fail = CPL_FALSE;
   for (size = 1; size < nreps * nelem; size++) {
       cpl_matrix * p2;
       double error, residual;
@@ -1595,6 +1598,13 @@
       cpl_test_nonnull(product);
 
       xsolv = cpl_matrix_solve_normal(matrix, product);
+      if (cpl_error_get_code()) {
+          cpl_test_error(CPL_ERROR_SINGULAR_MATRIX);
+          cpl_test_null(xsolv);
+          did_fail = CPL_TRUE;
+          cpl_matrix_delete(product);
+          break;
+      }
       cpl_test_nonnull(xsolv);
 
       x_min = cpl_matrix_get_min(xsolv);
@@ -1631,7 +1641,17 @@
                        "x_min=%g, x_max=%g", size, x_min, x_max);
           break;
       }
+      k++;
+  }
 
+  if (did_fail) {
+      /* Solving stopped prematurely. Normally, we should stop when the system
+         is near-singular and so ill-conditioned that the solution has an
+         element where not even the most significant bit is correct. For this
+         final iteration we will allow the solver to alternatively fail (due a
+         singular matrix).
+         This should add support for Debian sbuild on mips64el */
+      cpl_test_leq(6, k);
   }
 
   cpl_msg_info("", "Compute the determinant of increasingly large "

Reply via email to