dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #09946
Re: buildbot failure in mac_osx
On Wednesday 01 October 2008 14:58:00 Johan Hake wrote:
> On Wednesday 01 October 2008 14:46:31 buildbot@xxxxxxxxxx wrote:
> > The Buildbot has detected a new failure of mac_osx.
>
> The error is due to a sloppy check I wrote. It worked on Linux but not on
> Mac.
This should be fixed now.
Johan
> I will fix it.
>
> Johan
>
> > Full details are available at:
> > http://fenics.org:8010/dolfin/mac_osx/builds/766
> >
> > Buildbot URL: http://fenics.org:8010/dolfin/
> >
> > Buildslave for this Build: mac-osx
> >
> > Build Reason:
> > Build Source Stamp: HEAD
> > Blamelist: Johan Hake
> >
> > BUILD FAILED: failed test
> >
> > sincerely,
> > -The Buildbot
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
# HG changeset patch
# User "Johan Hake <hake@xxxxxxxxx>"
# Date 1222896404 -7200
# Node ID 41cf74f735c5f5d66345546b0c6b3da304b2f9a5
# Parent 3842fd2ffbab63c89a62e74925e0d1c77fbaf7cb
Fix la unit test so it hopefully pass on a mac
diff -r 3842fd2ffbab -r 41cf74f735c5 test/unit/la/python/test.py
--- a/test/unit/la/python/test.py Wed Oct 01 16:49:21 2008 +0200
+++ b/test/unit/la/python/test.py Wed Oct 01 23:26:44 2008 +0200
@@ -22,107 +22,107 @@
A = self.MatrixType()
return assemble(dot(grad(u),grad(v))*dx,mesh,tensor=A)
- def assemble_vector(self):
+ def get_vector(self):
" Assemble a simple matrix"
- element = FiniteElement("Lagrange", "triangle", 1)
- v = TestFunction(element)
- f = Function(element)
- mesh = UnitSquare(3,3)
- vec = self.VectorType()
- return assemble(v*f*dx,mesh,["1"],tensor=vec)
+ from numpy import random, linspace
+ vec = self.VectorType(16)
+ vec.assign(1)
+ # FIXME: EpetraVector does not support set.
+ #vec.set(random.rand(vec.size()))
+ return vec
def test_matrix(self):
from numpy import ndarray
org = self.assemble_matrix()
A = org.copy()
B = org.copy()
- self.assertEqual(A(5,5),B(5,5))
+ self.assertAlmostEqual(A(5,5),B(5,5))
B *= 0.5
A *= 2
- self.assertEqual(A(5,5),4*B(5,5))
+ self.assertAlmostEqual(A(5,5),4*B(5,5))
B /= 2
A /= 0.5
- self.assertEqual(A(5,5),16*B(5,5))
+ self.assertAlmostEqual(A(5,5),16*B(5,5))
A += B
- self.assertEqual(A(5,5),17)
+ self.assertAlmostEqual(A(5,5),17)
A -= B
- self.assertEqual(A(5,5),16)
+ self.assertAlmostEqual(A(5,5),16)
C = 16*B
- self.assertEqual(A(5,5),C(5,5))
+ self.assertAlmostEqual(A(5,5),C(5,5))
D = (C+B)*5
- self.assertEqual(D(5,5),85)
+ self.assertAlmostEqual(D(5,5),85)
F = (A-B)/4
- self.assertEqual(F(5,5),3.75)
+ self.assertAlmostEqual(F(5,5),3.75)
A.axpy(100,B)
- self.assertEqual(A(5,5),116)
+ self.assertAlmostEqual(A(5,5),116)
A2 = A.array()
self.assertTrue(isinstance(A2,ndarray))
self.assertEqual(A2.shape,(16,16))
- self.assertEqual(A2[5,5],A(5,5))
+ self.assertAlmostEqual(A2[5,5],A(5,5))
def test_vector(self):
- from numpy import ndarray
- org = self.assemble_vector()
+ from numpy import ndarray, linspace
+ org = self.get_vector()
A = org.copy()
B = org.copy()
- self.assertEqual(A[5],B[5])
+ self.assertAlmostEqual(A[5],B[5])
B *= 0.5
A *= 2
- self.assertEqual(A[5],4*B[5])
+ self.assertAlmostEqual(A[5],4*B[5])
B /= 2
A /= 0.5
- self.assertEqual(A[5],16*B[5])
+ self.assertAlmostEqual(A[5],16*B[5])
- val1 = 0.44444444444444375
- val2 = 0.027777777777777735
+ val1 = A[5]
+ val2 = B[5]
A += B
- self.assertEqual(A[5],val1+val2)
+ self.assertAlmostEqual(A[5],val1+val2)
A -= B
- self.assertEqual(A[5],val1)
+ self.assertAlmostEqual(A[5],val1)
C = 16*B
- self.assertEqual(A[5],C[5])
+ self.assertAlmostEqual(A[5],C[5])
D = (C+B)*5
- self.assertEqual(D[5],(val1+val2)*5)
+ self.assertAlmostEqual(D[5],(val1+val2)*5)
F = (A-B)/4
- self.assertEqual(F[5],(val1-val2)/4)
+ self.assertAlmostEqual(F[5],(val1-val2)/4)
A.axpy(100,B)
- self.assertEqual(A[5],val1+val2*100)
+ self.assertAlmostEqual(A[5],val1+val2*100)
A2 = A.array()
self.assertTrue(isinstance(A2,ndarray))
self.assertEqual(A2.shape,(16,))
- self.assertEqual(A2[5],A[5])
+ self.assertAlmostEqual(A2[5],A[5])
def test_matrix_vector(self):
from numpy import dot, absolute
- v = self.assemble_vector()
+ v = self.get_vector()
A = self.assemble_matrix()
u = A*v
self.assertTrue(isinstance(u,type(v)))
- self.assertEqual(u.size(),v.size())
+ self.assertAlmostEqual(u.size(),v.size())
v2 = v.array()
A2 = A.array()
u2 = dot(A2,v2)
- self.assertEqual(absolute(u.array()).sum(),absolute(u2).sum())
+ self.assertAlmostEqual(absolute(u.array()).sum(),absolute(u2).sum())
class MatrixTester(AbstractBaseTest,unittest.TestCase):
MatrixType = Matrix
References