/[escript]/trunk/finley/test/python/run_utilOnFinley.py
ViewVC logotype

Contents of /trunk/finley/test/python/run_utilOnFinley.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1376 - (show annotations)
Wed Jan 9 01:38:18 2008 UTC (12 years, 1 month ago) by gross
File MIME type: text/x-python
File size: 7714 byte(s)
inserted sys.exit(1) into the tests so scons can detect the failure of the test. 
A similar statement has been removed from an earlier as it produces problems on 64bit Linux. Previously exit(0) was called in case of success but now this is not done in order to avoid a fatal end of the program. in the case of an error in the test there could be a fatal error so but I guess that this not really a problem.

PS: the fact that signal 0 was returned even for the case of an error lead to the illusion that all tests have been completed successfully.


1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
18 http://www.access.edu.au
19 Primary Business: Queensland, Australia"""
20 __license__="""Licensed under the Open Software License version 3.0
21 http://www.opensource.org/licenses/osl-3.0.php"""
22 import unittest
23 from test_util import Test_util as Test_util
24 from test_util import Test_Util_SpatialFunctions, Test_Util_SpatialFunctions_noGradOnBoundary, Test_Util_SpatialFunctions_noGradOnBoundary_noContact
25 from test_symbols import Test_symbols
26
27 from esys.escript import FunctionOnBoundary
28 from esys.finley import Rectangle,Brick,JoinFaces,ReadMesh
29 import sys
30 import os
31
32 try:
33 FINLEY_TEST_DATA=os.environ['FINLEY_TEST_DATA']
34 except KeyError:
35 FINLEY_TEST_DATA='.'
36
37 FINLEY_TEST_MESH_PATH=FINLEY_TEST_DATA+"/data_meshes/"
38
39
40 NE=4 # number elements, must be even
41
42 class Test_UtilOnFinley(Test_util,Test_symbols):
43 def setUp(self):
44 self.domain =Rectangle(NE,NE+1,2)
45 self.functionspace = FunctionOnBoundary(self.domain) # due to a bug in escript python needs to hold a reference to the domain
46 def tearDown(self):
47 del self.functionspace
48 del self.domain
49
50 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
51 def setUp(self):
52 self.order=1
53 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order1.fly",optimize=False)
54 def tearDown(self):
55 del self.order
56 del self.domain
57
58 class Test_Util_SpatialFunctionsOnFinleyTet2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
59 def setUp(self):
60 self.order=2
61 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_2D_order2.fly",optimize=False)
62 def tearDown(self):
63 del self.order
64 del self.domain
65
66 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
67 def setUp(self):
68 self.order=1
69 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order1.fly",optimize=False)
70 def tearDown(self):
71 del self.order
72 del self.domain
73
74 class Test_Util_SpatialFunctionsOnFinleyTet3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary_noContact):
75 def setUp(self):
76 self.order=2
77 self.domain = ReadMesh(FINLEY_TEST_MESH_PATH+"tet_3D_order2.fly",optimize=False)
78 def tearDown(self):
79 del self.order
80 del self.domain
81
82 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
83 def setUp(self):
84 self.order=1
85 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1)
86 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1)
87 d2.setX(d2.getX()+[0.5,0.])
88 self.domain = JoinFaces([d1,d2],optimize=False)
89 def tearDown(self):
90 del self.order
91 del self.domain
92
93 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
94 def setUp(self):
95 self.order=2
96 d1 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
97 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2)
98 d2.setX(d2.getX()+[0.5,0.])
99 self.domain = JoinFaces([d1,d2],optimize=False)
100 def tearDown(self):
101 del self.order
102 del self.domain
103
104 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1(Test_Util_SpatialFunctions_noGradOnBoundary):
105 def setUp(self):
106 self.order=1
107 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1)
108 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1)
109 d2.setX(d2.getX()+[0.5,0.,0.])
110 self.domain = JoinFaces([d1,d2],optimize=False)
111 def tearDown(self):
112 del self.order
113 del self.domain
114
115 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2(Test_Util_SpatialFunctions_noGradOnBoundary):
116 def setUp(self):
117 self.order=2
118 d1 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2)
119 d2 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2)
120 d2.setX(d2.getX()+[0.5,0.,0.])
121 self.domain = JoinFaces([d1,d2],optimize=False)
122 def tearDown(self):
123 del self.order
124 del self.domain
125
126 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
127 def setUp(self):
128 self.order=1
129 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
130 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=1,useElementsOnFace=True)
131 d2.setX(d2.getX()+[0.5,0.])
132 self.domain = JoinFaces([d1,d2],optimize=False)
133 def tearDown(self):
134 del self.order
135 del self.domain
136
137 class Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
138 def setUp(self):
139 self.order=2
140 d1 = Rectangle(n0=NE/2+1,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
141 d2 = Rectangle(n0=NE/2,n1=NE,l0=0.5,order=2,useElementsOnFace=True)
142 d2.setX(d2.getX()+[0.5,0.])
143 self.domain = JoinFaces([d1,d2],optimize=False)
144 def tearDown(self):
145 del self.order
146 del self.domain
147
148 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace(Test_Util_SpatialFunctions):
149 def setUp(self):
150 self.order=1
151 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
152 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=1,useElementsOnFace=True)
153 d2.setX(d2.getX()+[0.5,0.,0.])
154 self.domain = JoinFaces([d1,d2],optimize=False)
155 def tearDown(self):
156 del self.order
157 del self.domain
158
159 class Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace(Test_Util_SpatialFunctions):
160 def setUp(self):
161 self.order=2
162 d1 = Brick(n0=NE/2,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
163 d2 = Brick(n0=NE/2+1,n1=NE,n2=NE,l0=0.5,order=2,useElementsOnFace=True)
164 d2.setX(d2.getX()+[0.5,0.,0.])
165 self.domain = JoinFaces([d1,d2],optimize=False)
166 def tearDown(self):
167 del self.order
168 del self.domain
169
170 if __name__ == '__main__':
171 suite = unittest.TestSuite()
172 if True:
173 suite.addTest(unittest.makeSuite(Test_UtilOnFinley))
174 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1))
175 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2))
176 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1))
177 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2))
178 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder1))
179 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet2DOrder2))
180 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder1))
181 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyTet3DOrder2))
182 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder1useElementsOnFace))
183 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex2DOrder2useElementsOnFace))
184 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder1useElementsOnFace))
185 suite.addTest(unittest.makeSuite(Test_Util_SpatialFunctionsOnFinleyHex3DOrder2useElementsOnFace))
186 else:
187 pass
188 s=unittest.TextTestRunner(verbosity=2).run(suite)
189 if not s.wasSuccessful(): sys.exit(1)
190

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26