1 |
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
2 |
<html> |
3 |
<head> |
4 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
5 |
<meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; I; SunOS 5.8 sun4u) [Netscape]"> |
6 |
<meta name="CREATED" content="20010209;11071700"> |
7 |
<meta name="CHANGEDBY" content="Rice Ed"> |
8 |
<meta name="CHANGED" content="20010209;11352500"> |
9 |
<meta name="Template" content="C:\Program Files\MSOffice\Office\html.dot"> |
10 |
<title>CppUnit Cookbook</title> |
11 |
<style> |
12 |
<!-- |
13 |
A:link { color: #0000ff } |
14 |
A:visited { color: #800080 } |
15 |
--> |
16 |
</style> |
17 |
</head> |
18 |
<body link="#0000FF" vlink="#800080"> |
19 |
|
20 |
<h1> |
21 |
<b><font color="#3366FF"><font size=+2>UnitTest System</font></font></b></h1> |
22 |
<font color="#330000">The UnitTest system consists of two major components. |
23 |
A library which is derived from the CppUnitTest library developed by Michael |
24 |
Feathers. This library has been modified to better suit the requirements |
25 |
of PGS and the PGS development environment. Please read the</font> <a href="license.html">license</a> |
26 |
agreement. The library provides a framework written in C++ for creating |
27 |
unit tests. The units being tested can be either C or C++. |
28 |
<p>The second component of the UnitTest system is a collection of scripts |
29 |
which allow libraries and unit tests to be rebuilt and executed each night |
30 |
automatically. The scripts are designed so that the building and testing |
31 |
may take place on more than one platform at once. The results of all of |
32 |
the rebuilds and the execution of each unit test is presented in an html |
33 |
document which provides a quick and easy summary of the state of each component |
34 |
built and tested. |
35 |
<p><b><font color="#3366FF"><font size=+2>Creation of A Unit Test</font></font></b> |
36 |
<p>A script which is part of the Alien package makes it simple to create |
37 |
a unit test skeleton for a particular class or module. The script also |
38 |
creates a makefile for the unit test. An example session is shown below. |
39 |
A unit test will be created for the class Range. |
40 |
<p>Running the script without an argument generates a usage message. |
41 |
<blockquote><tt>$ALIEN_HOME/scripts/UTSkel.pl</tt> |
42 |
<br><tt>Program Usage: UTSkel.pl <ClassName></tt> |
43 |
<p><tt> where ClassName - Name of class for which to create UnitTest |
44 |
files.</tt></blockquote> |
45 |
Running the script again with the name of the class for which the unit |
46 |
test skeleton will be built generates the following. |
47 |
<blockquote>$<tt>ALIEN_HOME/scripts/UTSkel.pl Range</tt> |
48 |
<br><tt>UTSkel.pl: Wrote file (RangeTest.C).</tt> |
49 |
<br><tt>UTSkel.pl: Wrote file (RangeTest.mk).</tt> |
50 |
<br><tt>UTSkel.pl: Wrote file (RangeTestCase.C).</tt> |
51 |
<br><tt>UTSkel.pl: Wrote file (RangeTestCase.h).</tt> |
52 |
<br><tt>UTSkel.pl: Finished.</tt></blockquote> |
53 |
The script creates four output files. |
54 |
<br>RangeTest.C contains main for the unit test and often doesn't need |
55 |
to be edited. In fact the code generated for the skeleton should build |
56 |
and execute as is although it doesn't do anything useful. The executable |
57 |
produced is called RangeTest. |
58 |
<p>Contents of <font color="#3333FF">RangeTest.C</font> skeleton. |
59 |
<blockquote><tt>/*</tt> |
60 |
<br><tt>COPYRIGHT Petroleum Geo-Sciences 2000 - All Rights Reserved This</tt> |
61 |
<br><tt>software is the property of Petroleum Geo-Sciences (PGS). No par</tt> |
62 |
<br><tt>t of</tt> |
63 |
<br><tt>this code may be copied in any form or by any means without the</tt> |
64 |
<br><tt>expressed written consent of PGS. Copying, use or modification</tt> |
65 |
<br><tt>of</tt> |
66 |
<br><tt>this software by any person other than a Petroleum Geo-Sciences</tt> |
67 |
<br><tt>employee is illegal unless that person has a software license</tt> |
68 |
<br><tt>agreement with PGS to do so. NOTICE: This is confidential |
69 |
infor</tt> |
70 |
<br><tt>mation</tt> |
71 |
<br><tt>not to be discussed or used outside of PGS.</tt> |
72 |
<br><tt>*/</tt> |
73 |
<br><tt>#include "RangeTestCase.h"</tt> |
74 |
<br><tt>#include "Alien/TestRunner.h"</tt> |
75 |
<br> |
76 |
<p><tt>main(int argc, char *argv[]) {</tt> |
77 |
<br><tt> //</tt> |
78 |
<br><tt> // object which runs all of the tests</tt> |
79 |
<br><tt> TestRunner runner;</tt> |
80 |
<br><tt> //</tt> |
81 |
<br><tt> // add the RangeTestCase suite of tests to the runner</tt> |
82 |
<br><tt> runner.addTest ("RangeTestCase",</tt> |
83 |
<br><tt> |
84 |
RangeTestCase::suite ());</tt> |
85 |
<br><tt> //</tt> |
86 |
<br><tt> // actually run the unit tests.</tt> |
87 |
<br><tt> runner.run (argc, argv);</tt> |
88 |
<p><tt> return 0;</tt> |
89 |
<br><tt>}</tt></blockquote> |
90 |
|
91 |
<p><br>RangeTest.mk may need to be edited depending on the libraries and |
92 |
objects needed for the test. Refer to the documentation for the Alien make |
93 |
system. |
94 |
<p>Contents of <font color="#3333FF">RangeTest.mk</font> skeleton. |
95 |
<blockquote><tt># Specify a list of the objects that</tt> |
96 |
<br><tt># will be built.</tt> |
97 |
<br><tt>OBJS = RangeTestCase.o RangeTest.o</tt> |
98 |
<p><tt># BUILDNAME is the name of the executable to build.</tt> |
99 |
<br><tt># if it is defined the value provided is the name of the executa</tt> |
100 |
<br><tt>ble generated</tt> |
101 |
<br><tt>BUILDTYPE=EXECUTABLE</tt> |
102 |
<br><tt>USECMENV=NO</tt> |
103 |
<br><tt>USEALIENENV=YES</tt> |
104 |
<br><tt>BUILDNAME = RangeTest</tt> |
105 |
<p><tt>USER_LINK =</tt> |
106 |
<p><tt>DODEBUG = YES</tt> |
107 |
<p><tt>include $(ALIEN_HOME)/Make/Makefile.perth</tt></blockquote> |
108 |
|
109 |
<p><br>RangeTestCase.C contains the bulk of the code for performing the |
110 |
unit test. This will always need to be edited. |
111 |
<p>Contents of <font color="#3333FF">RangeTestCase.C </font>skeleton. |
112 |
<blockquote><b>/</b><tt>*</tt> |
113 |
<p><tt>COPYRIGHT Petroleum Geo-Sciences 2000 - All Rights Reserved This</tt> |
114 |
<br><tt>software is the property of Petroleum Geo-Sciences (PGS). No part |
115 |
of</tt> |
116 |
<br><tt>this code may be copied in any form or by any means without the</tt> |
117 |
<br><tt>expressed written consent of PGS. Copying, use or modification |
118 |
of</tt> |
119 |
<br><tt>this software by any person other than a Petroleum Geo-Sciences</tt> |
120 |
<br><tt>employee is illegal unless that person has a software license</tt> |
121 |
<br><tt>agreement with PGS to do so. NOTICE: This is confidential |
122 |
information</tt> |
123 |
<br><tt>not to be discussed or used outside of PGS.</tt> |
124 |
<p><tt>*/</tt> |
125 |
<br><tt>#include "Alien/Range.h"</tt> |
126 |
<br><tt>#include "RangeTestCase.h"</tt> |
127 |
<p><tt>void RangeTestCase::setUp() {</tt> |
128 |
<br><tt> //</tt> |
129 |
<br><tt> // This is called before each test is run</tt> |
130 |
<p><tt>}</tt> |
131 |
<p><tt>void RangeTestCase::tearDown() {</tt> |
132 |
<br><tt> //</tt> |
133 |
<br><tt> // This is called after each test has been run</tt> |
134 |
<p><tt>}</tt> |
135 |
<p><tt>void RangeTestCase::testAll() {</tt> |
136 |
<br><tt> //</tt> |
137 |
<br><tt> // The test code may be entered here</tt> |
138 |
<br><tt> // There is nothing special about the function name, it |
139 |
may be renamed to</tt> |
140 |
<br><tt> // something more suitable.</tt> |
141 |
<br><tt> // As many test methods as desired may be added.</tt> |
142 |
<p><tt>}</tt> |
143 |
<br> |
144 |
<p><tt>Test* RangeTestCase::suite ()</tt> |
145 |
<br><tt>{</tt> |
146 |
<br><tt> //</tt> |
147 |
<br><tt> // create the suite of tests to perform.</tt> |
148 |
<br><tt> TestSuite *testSuite = new TestSuite ("RangeTestCase");</tt> |
149 |
<br><tt> testSuite->addTest (new TestCaller <RangeTestCase> ("testAll",&RangeTestCase::testAll));</tt> |
150 |
<br><tt> return testSuite;</tt> |
151 |
<br><tt>}</tt></blockquote> |
152 |
|
153 |
<p><br>RangeTestCase.h may need editing depending on whetherthe default |
154 |
function name testAll is changed or additional functions are added. |
155 |
<p>Contents of <font color="#3333FF">RangeTestCase.h</font> skeleton |
156 |
<blockquote><tt>/*</tt> |
157 |
<p><tt>COPYRIGHT Petroleum Geo-Sciences 2000 - All Rights Reserved This</tt> |
158 |
<br><tt>software is the property of Petroleum Geo-Sciences (PGS). No part |
159 |
of</tt> |
160 |
<br><tt>this code may be copied in any form or by any means without the</tt> |
161 |
<br><tt>expressed written consent of PGS. Copying, use or modification |
162 |
of</tt> |
163 |
<br><tt>this software by any person other than a Petroleum Geo-Sciences</tt> |
164 |
<br><tt>employee is illegal unless that person has a software license</tt> |
165 |
<br><tt>agreement with PGS to do so. NOTICE: This is confidential |
166 |
information</tt> |
167 |
<br><tt>not to be discussed or used outside of PGS.</tt> |
168 |
<p><tt>*/</tt> |
169 |
<br><tt>#if !defined RANGETESTCASE_H</tt> |
170 |
<br><tt>#define RANGETESTCASE_H</tt> |
171 |
<p><tt>#include "Alien/AlienNamespace.h"</tt> |
172 |
<p><tt>#include "Alien/TestCase.h"</tt> |
173 |
<br><tt>#include "Alien/TestSuite.h"</tt> |
174 |
<br><tt>#include "Alien/TestCaller.h"</tt> |
175 |
<p><tt>BEGIN_NAMESPACE_ALIEN</tt> |
176 |
<p><tt>class RangeTestCase : public TestCase</tt> |
177 |
<br><tt>{</tt> |
178 |
<br><tt> public:</tt> |
179 |
<br><tt> RangeTestCase (string name) : TestCase (name) {}</tt> |
180 |
<br><tt> ~RangeTestCase() {}</tt> |
181 |
<br><tt> //</tt> |
182 |
<br><tt> // Virtual methods of TestCase. These are provided to ensure |
183 |
the objects</tt> |
184 |
<br><tt> // being used in the tests are in a known state.</tt> |
185 |
<br><tt> // setUp is called before each test method is called</tt> |
186 |
<br><tt> void setUp();</tt> |
187 |
<br><tt> //</tt> |
188 |
<br><tt> // tearDown is called after each test method is called.</tt> |
189 |
<br><tt> void tearDown();</tt> |
190 |
<br><tt> //</tt> |
191 |
<br><tt> // return the suite of tests to perform</tt> |
192 |
<br><tt> static Test* suite ();</tt> |
193 |
<p><tt> protected:</tt> |
194 |
<br><tt> //</tt> |
195 |
<br><tt> // The following methods are for testing various methods |
196 |
of the</tt> |
197 |
<br><tt> // Range class</tt> |
198 |
<br><tt> void testAll();</tt> |
199 |
<p><tt> private:</tt> |
200 |
<br> |
201 |
<p><tt>};</tt> |
202 |
<p><tt>END_NAMESPACE_ALIEN</tt> |
203 |
<p><tt>#endif</tt></blockquote> |
204 |
<font color="#330000">In order to complete the unit test the skeleton generated |
205 |
was modfied to produce the final code. In our example the "testAll" |
206 |
method has been removed from the skeleton code and four new methods created |
207 |
to perform the required tests. Each method tests a different aspect of |
208 |
the Range class.</font> |
209 |
<p> <a href="Range.html">Range Class</a> |
210 |
<p>The |
211 |
<i>RangeTestCase</i> class inherits from the |
212 |
<i>TestCase</i> class |
213 |
which is part of the UnitTest library. All unit tests must inherit |
214 |
from the <i>TestCase</i> class. It of course is often possible to test |
215 |
all of the aspects of a class or module with just one method. The four |
216 |
methods created are |
217 |
<br> testEquality |
218 |
<br> testWithin |
219 |
<br> testRangeException |
220 |
<br> testOverlap |
221 |
<br>These methods are bundled together into an object called a "suite". |
222 |
A "suite" is just a collection of tests to be performed together. The UnitTest |
223 |
library provides the <i>TestSuite</i> class for grouping together a collection |
224 |
of tests. All of the tests within this suite are run within a <i>TestRunner</i> |
225 |
object also provided by the UnitTest library. More than one suite may be |
226 |
run within a <i>TestRunner</i>. |
227 |
<p><font color="#330000">Final code for </font><font color="#3366FF">RangeTestCase.h</font> |
228 |
<blockquote><tt>/*</tt> |
229 |
<p><tt>COPYRIGHT Petroleum Geo-Sciences 2000 - All Rights Reserved This</tt> |
230 |
<br><tt>software is the property of Petroleum Geo-Sciences (PGS). No part |
231 |
of</tt> |
232 |
<br><tt>this code may be copied in any form or by any means without the</tt> |
233 |
<br><tt>expressed written consent of PGS. Copying, use or modification |
234 |
of</tt> |
235 |
<br><tt>this software by any person other than a Petroleum Geo-Sciences</tt> |
236 |
<br><tt>employee is illegal unless that person has a software license</tt> |
237 |
<br><tt>agreement with PGS to do so. NOTICE: This is confidential |
238 |
information</tt> |
239 |
<br><tt>not to be discussed or used outside of PGS.</tt> |
240 |
<p><tt>*/</tt> |
241 |
<br><tt>#if !defined RANGETESTCASE_H</tt> |
242 |
<br><tt>#define RANGETESTCASE_H</tt> |
243 |
<p><tt>#include "Alien/AlienNamespace.h"</tt> |
244 |
<p><tt>#include "Alien/TestCase.h"</tt> |
245 |
<br><tt>#include "Alien/TestSuite.h"</tt> |
246 |
<br><tt>#include "Alien/TestCaller.h"</tt> |
247 |
<p><tt>BEGIN_NAMESPACE_ALIEN</tt> |
248 |
<p><tt>class RangeTestCase : public TestCase</tt> |
249 |
<br><tt>{</tt> |
250 |
<br><tt> private:</tt> |
251 |
<br><tt> //</tt> |
252 |
<br><tt> // Two integer ranges created by setUp method. They are |
253 |
destructed in the</tt> |
254 |
<br><tt> // tearDown method. All of the tests use these ranges.</tt> |
255 |
<br><tt> Range<int> *r1,*r2;</tt> |
256 |
<br><tt> protected:</tt> |
257 |
<br><tt> //</tt> |
258 |
<br><tt> // The following methods are for testing various methods |
259 |
of the Range class</tt> |
260 |
<br><tt> //</tt> |
261 |
<br><tt> // Method to test whether operator==() method is working</tt> |
262 |
<br><tt> void testEquality();</tt> |
263 |
<br><tt> //</tt> |
264 |
<br><tt> // Method to test whether within() method is working</tt> |
265 |
<br><tt> void testWithin();</tt> |
266 |
<br><tt> //</tt> |
267 |
<br><tt> // Method to test whether a RangeException is contructed |
268 |
and thrown correctly</tt> |
269 |
<br><tt> void testRangeException();</tt> |
270 |
<br><tt> //</tt> |
271 |
<br><tt> // Method to test whether the overlap method works</tt> |
272 |
<br><tt> void testOverlap();</tt> |
273 |
<p><tt> public:</tt> |
274 |
<br><tt> RangeTestCase (string name) : TestCase (name) {}</tt> |
275 |
<br><tt> ~RangeTestCase() {}</tt> |
276 |
<br><tt> //</tt> |
277 |
<br><tt> // Virtual methods of TestCase. These are provided to ensure |
278 |
the objects</tt> |
279 |
<br><tt> // being used in the tests are in a known state.</tt> |
280 |
<br><tt> // setUp is called before each test method is called</tt> |
281 |
<br><tt> void setUp();</tt> |
282 |
<br><tt> //</tt> |
283 |
<br><tt> // tearDown is called after each test method is called.</tt> |
284 |
<br><tt> void tearDown();</tt> |
285 |
<br><tt> //</tt> |
286 |
<br><tt> // return the suite of tests to perform</tt> |
287 |
<br><tt> static Test* suite ();</tt> |
288 |
<br><tt>};</tt> |
289 |
<p><tt>END_NAMESPACE_ALIEN</tt> |
290 |
<p><tt>#endif</tt></blockquote> |
291 |
<font color="#330000">Final code for</font><font color="#3366FF"> RangeTestCase.C</font> |
292 |
<blockquote><tt>/*</tt> |
293 |
<p><tt>COPYRIGHT Petroleum Geo-Sciences 2000 - All Rights Reserved This</tt> |
294 |
<br><tt>software is the property of Petroleum Geo-Sciences (PGS). No part |
295 |
of</tt> |
296 |
<br><tt>this code may be copied in any form or by any means without the</tt> |
297 |
<br><tt>expressed written consent of PGS. Copying, use or modification |
298 |
of</tt> |
299 |
<br><tt>this software by any person other than a Petroleum Geo-Sciences</tt> |
300 |
<br><tt>employee is illegal unless that person has a software license</tt> |
301 |
<br><tt>agreement with PGS to do so. NOTICE: This is confidential |
302 |
information</tt> |
303 |
<br><tt>not to be discussed or used outside of PGS.</tt> |
304 |
<p><tt>*/</tt> |
305 |
<br><tt>#include "Alien/Range.h"</tt> |
306 |
<br><tt>#include "RangeTestCase.h"</tt> |
307 |
<p><tt>void RangeTestCase::setUp() {</tt> |
308 |
<br><tt> //</tt> |
309 |
<br><tt> // create fresh objects for this test</tt> |
310 |
<br><tt> r1=new Range<int>(1,5);</tt> |
311 |
<br><tt> r2=new Range<int>(1,7);</tt> |
312 |
<br><tt>}</tt> |
313 |
<p><tt>void RangeTestCase::tearDown() {</tt> |
314 |
<br><tt> //</tt> |
315 |
<br><tt> // destroy the objects from the last test</tt> |
316 |
<br><tt> delete r1;</tt> |
317 |
<br><tt> delete r2;</tt> |
318 |
<br><tt>}</tt> |
319 |
<p><tt>void RangeTestCase::testEquality() {</tt> |
320 |
<br><tt> //</tt> |
321 |
<br><tt> // check whether the operator==() method returns r1 as equal |
322 |
to itself.</tt> |
323 |
<br><tt> // This should return true if the method is working correctly</tt> |
324 |
<br><tt> // If false is returned the test will stop and a failure |
325 |
is reported</tt> |
326 |
<br><tt> assert((*r1)==(*r1));</tt> |
327 |
<br><tt> //</tt> |
328 |
<br><tt> // This should return true as r1 does not equal r2.</tt> |
329 |
<br><tt> assert(!(*r1)==(*r2));</tt> |
330 |
<br><tt>}</tt> |
331 |
<p><tt>void RangeTestCase::testWithin() {</tt> |
332 |
<br><tt> //</tt> |
333 |
<br><tt> // test whether the minimum and maximum value for |
334 |
the range are within</tt> |
335 |
<br><tt> // the range. Both should return true.</tt> |
336 |
<br><tt> assert((*r1).within((*r1).getMin()));</tt> |
337 |
<br><tt> assert((*r1).within((*r1).getMax()));</tt> |
338 |
<br><tt>}</tt> |
339 |
<p><tt>void RangeTestCase::testRangeException() {</tt> |
340 |
<br><tt> try {</tt> |
341 |
<br><tt> //</tt> |
342 |
<br><tt> // This call should throw an exception as the |
343 |
range is invalid</tt> |
344 |
<br><tt> (*r1).setRange(3,1);</tt> |
345 |
<br><tt> //</tt> |
346 |
<br><tt> // if the test gets here the exception has failed</tt> |
347 |
<br><tt> assert(false);</tt> |
348 |
<br><tt> }</tt> |
349 |
<br><tt> catch (RangeException &e) {</tt> |
350 |
<br><tt> }</tt> |
351 |
<br><tt>}</tt> |
352 |
<br><tt>void RangeTestCase::testOverlap() {</tt> |
353 |
<br><tt> //</tt> |
354 |
<br><tt> // Test whether r1 overlaps r2. Should return true.</tt> |
355 |
<br><tt> assert((*r1).overlap((*r2)));</tt> |
356 |
<br><tt>}</tt> |
357 |
<br> |
358 |
<p><tt>Test* RangeTestCase::suite ()</tt> |
359 |
<br><tt>{</tt> |
360 |
<br><tt> //</tt> |
361 |
<br><tt> // create the suite of tests to perform.</tt> |
362 |
<br><tt> TestSuite *testSuite = new TestSuite ("RangeTestCase");</tt> |
363 |
<p><tt> testSuite->addTest (new TestCaller <RangeTestCase> ("testEquality",&RangeTestCase::testEquality));</tt> |
364 |
<br><tt> testSuite->addTest (new TestCaller <RangeTestCase> ("testWithin",&RangeTestCase::testWithin));</tt> |
365 |
<br><tt> testSuite->addTest (new TestCaller <RangeTestCase> ("testRangeException",&RangeTestCase::testRangeException));</tt> |
366 |
<br><tt> testSuite->addTest (new TestCaller <RangeTestCase> ("testOverlap",&RangeTestCase::testOverlap));</tt> |
367 |
<br><tt> return testSuite;</tt> |
368 |
<br><tt>}</tt> |
369 |
<br> </blockquote> |
370 |
Final code for <font color="#3333FF">RangeTest.C</font> |
371 |
<blockquote><tt>/*</tt> |
372 |
<br><tt>COPYRIGHT Petroleum Geo-Sciences 2000 - All Rights Reserved This</tt> |
373 |
<br><tt>software is the property of Petroleum Geo-Sciences (PGS). No par</tt> |
374 |
<br><tt>t of</tt> |
375 |
<br><tt>this code may be copied in any form or by any means without the</tt> |
376 |
<br><tt>expressed written consent of PGS. Copying, use or modification</tt> |
377 |
<br><tt>of</tt> |
378 |
<br><tt>this software by any person other than a Petroleum Geo-Sciences</tt> |
379 |
<br><tt>employee is illegal unless that person has a software license</tt> |
380 |
<br><tt>agreement with PGS to do so. NOTICE: This is confidential |
381 |
infor</tt> |
382 |
<br><tt>mation</tt> |
383 |
<br><tt>not to be discussed or used outside of PGS.</tt> |
384 |
<br><tt>*/</tt> |
385 |
<br><tt>#include "RangeTestCase.h"</tt> |
386 |
<br><tt>#include "Alien/TestRunner.h"</tt> |
387 |
<br> |
388 |
<p><tt>main(int argc, char *argv[]) {</tt> |
389 |
<br><tt> //</tt> |
390 |
<br><tt> // object which runs all of the tests</tt> |
391 |
<br><tt> TestRunner runner;</tt> |
392 |
<br><tt> //</tt> |
393 |
<br><tt> // add the RangeTestCase suite of tests to the runner</tt> |
394 |
<br><tt> runner.addTest ("RangeTestCase",</tt> |
395 |
<br><tt> |
396 |
RangeTestCase::suite ());</tt> |
397 |
<br><tt> //</tt> |
398 |
<br><tt> // give the same suite another name to demonstrate</tt> |
399 |
<br><tt> // multiple suites</tt> |
400 |
<br><tt> runner.addTest ("R2Test",</tt> |
401 |
<br><tt> |
402 |
RangeTestCase::suite ());</tt> |
403 |
<br><tt> //</tt> |
404 |
<br><tt> // actually run the unit tests.</tt> |
405 |
<br><tt> runner.run (argc, argv);</tt> |
406 |
<p><tt> return 0;</tt> |
407 |
<br><tt>}</tt> |
408 |
<br> </blockquote> |
409 |
<font color="#3366FF"><font size=+2>Example Output</font></font> |
410 |
<p>Executing RangeTest produces the following |
411 |
<p><font color="#3366FF">Output with no errors or failures</font> |
412 |
<p><tt>Suite: RangeTestCase</tt> |
413 |
<br><tt> Test: testEquality Ok</tt> |
414 |
<br><tt> Test: testWithin Ok</tt> |
415 |
<br><tt> Test: testRangeException Ok</tt> |
416 |
<br><tt> Test: testOverlap Ok</tt> |
417 |
<p><tt>OK (4 tests)</tt> |
418 |
<p><tt>Suite: R2Test</tt> |
419 |
<br><tt> Test: testEquality Ok</tt> |
420 |
<br><tt> Test: testWithin Ok</tt> |
421 |
<br><tt> Test: testRangeException Ok</tt> |
422 |
<br><tt> Test: testOverlap Ok</tt> |
423 |
<p><tt>OK (4 tests)</tt> |
424 |
<p><font color="#3366FF">Output with some of the tests deliberately made |
425 |
to fail.</font> |
426 |
<br><font color="#3366FF">Note: There is one failure and one error generated.</font> |
427 |
<p><tt>Suite: RangeTestCase</tt> |
428 |
<br><tt> Test: testEquality Failure</tt> |
429 |
<br><tt> Test: testWithin Error</tt> |
430 |
<br><tt> Test: testRangeException Ok</tt> |
431 |
<br><tt> Test: testOverlap Ok</tt> |
432 |
<p><tt>!!!FAILURES!!!</tt> |
433 |
<br><tt>Test Results:</tt> |
434 |
<br><tt>Run: 4 Failures: 1 Errors: 1</tt> |
435 |
<br><tt>There was 1 error:</tt> |
436 |
<br><tt>1) testWithin line: -1 <unknown> "RangeException: Deliberate |
437 |
exception from testWithin"</tt> |
438 |
<br><tt>There was 1 failure:</tt> |
439 |
<br><tt>1) testEquality line: 22 RangeTest.C "!((*r1)==(*r1))"</tt> |
440 |
<p><tt>Suite: R2Test</tt> |
441 |
<br><tt> Test: testEquality Failure</tt> |
442 |
<br><tt> Test: testWithin Error</tt> |
443 |
<br><tt> Test: testRangeException Ok</tt> |
444 |
<br><tt> Test: testOverlap Ok</tt> |
445 |
<p><tt>!!!FAILURES!!!</tt> |
446 |
<br><tt>Test Results:</tt> |
447 |
<br><tt>Run: 4 Failures: 1 Errors: 1</tt> |
448 |
<br><tt>There was 1 error:</tt> |
449 |
<br><tt>1) testWithin line: -1 <unknown> "RangeException: Deliberate |
450 |
exception from testWithin"</tt> |
451 |
<br><tt>There was 1 failure:</tt> |
452 |
<br><tt>1) testEquality line: 22 RangeTest.C "!((*r1)==(*r1))"</tt> |
453 |
<p><font color="#3366FF"><font size=+2>Run-time options</font></font> |
454 |
<p><font color="#330000"><font size=+0>You can specify the test suites |
455 |
that you wish to run in a test by using arguments on the command line -</font></font> |
456 |
<p><tt><font color="#330000"><font size=+0>TestExeName [suite=suite1[,suite2...]] |
457 |
[suite=suitea[,suiteb...]]</font></font></tt> |
458 |
<p><font color="#330000"><font size=+0>where suite1, suite2, suitea and |
459 |
suiteb are the names of suites you want to run - suites can be repeated.</font></font> |
460 |
<br> |
461 |
<p><font color="#330000"><font size=+0>For example, in the range test above |
462 |
which has two suites (RangeTestCase and R2Test). The test executable is |
463 |
called RangeTest. You could use</font></font> |
464 |
<p><tt><font color="#330000"><font size=+0>RangeTest</font></font></tt> |
465 |
<p><font color="#330000"><font size=+0>to run both suites, or</font></font> |
466 |
<p><tt><font color="#330000"><font size=+0>RangeTest suite=R2Test</font></font></tt> |
467 |
<p><font color="#330000"><font size=+0>to just run the R2Test suite, or</font></font> |
468 |
<p><tt><font color="#330000"><font size=+0>RangeTest suite=R2Test,R2Test,RangeTestCase |
469 |
suite=RangeTestCase suite=R2Test,R2Test</font></font></tt> |
470 |
<p><font color="#330000"><font size=+0>to run R2Test, followed by R2Test |
471 |
, followed by RangeTestCase, followed by RangeTestCase, followed by two |
472 |
more R2Test runs.</font></font> |
473 |
<p><font color="#3366FF"><font size=+2>Run-time Arguments</font></font> |
474 |
<p><font color="#330000"><font size=+0>Run-time arguments can be passed |
475 |
through to the individual tests. In a test case, you can call the getArgs |
476 |
function to obtain a const vector<string>& to a vector that contains |
477 |
the command line arguments - note that all the suite=... arguments will |
478 |
have been stripped out. If the system being run provides the name of the |
479 |
executable as the first argument to the main function, then this will be |
480 |
available to you as the first string in the argument vector (in whatever |
481 |
format the system provides it).</font></font> |
482 |
<p><font color="#330000"><font size=+0>For example in the testRangeException |
483 |
function, the run time arguments could be obtained by changing the code |
484 |
to the following -</font></font> |
485 |
<p><tt><font color="#330000"><font size=+0>void RangeTestCase::testRangeException() |
486 |
{</font></font></tt> |
487 |
<br><b><tt><font color="#330000"><font size=+0>const vector<string>& |
488 |
args = getArgs();</font></font></tt></b> |
489 |
<br><tt><font color="#330000"><font size=+0>if(args.size()>0) {</font></font></tt> |
490 |
<br><tt><font color="#330000"><font size=+0>cout << "exe name is |
491 |
" << args[0] << endl;</font></font></tt> |
492 |
<br><tt><font color="#330000"><font size=+0>}</font></font></tt> |
493 |
<br><tt><font color="#330000"><font size=+0> try {</font></font></tt> |
494 |
<br><tt><font color="#330000"><font size=+0> //</font></font></tt> |
495 |
<br><tt><font color="#330000"><font size=+0> // This |
496 |
call should throw an exception as the range is invalid</font></font></tt> |
497 |
<br><tt><font color="#330000"><font size=+0> (*r1).setRange(3,1);</font></font></tt> |
498 |
<br><tt><font color="#330000"><font size=+0> //</font></font></tt> |
499 |
<br><tt><font color="#330000"><font size=+0> // if the |
500 |
test gets here the exception has failed</font></font></tt> |
501 |
<br><tt><font color="#330000"><font size=+0> assert(false);</font></font></tt> |
502 |
<br><tt><font color="#330000"><font size=+0> }</font></font></tt> |
503 |
<br><tt><font color="#330000"><font size=+0> catch (RangeException |
504 |
&e) {</font></font></tt> |
505 |
<br><tt><font color="#330000"><font size=+0> }</font></font></tt> |
506 |
<br><tt><font color="#330000"><font size=+0>}</font></font></tt> |
507 |
<br> |
508 |
<p><font color="#3366FF"><font size=+2>UnitTest Scripts</font></font> |
509 |
<p>Several scripts exist to help manage the building and execution |
510 |
of unit tests each night. All of these scripts and associated configuration |
511 |
files may be found in $ALIEN_HOME/scripts. |
512 |
<p><font color="#3333FF">fandExe.pl </font><font color="#000000">Is a find |
513 |
and execute command similar to the unix "find" command although slightly |
514 |
more configurable in it's ability to execute commands for any files found.</font> |
515 |
<p><tt>Usage fandExe.pl -file -command -rootDir [-depth -stdout -stderr |
516 |
-trial -cprefix -fail]</tt> |
517 |
<br><tt> -file - The file |
518 |
pattern.</tt> |
519 |
<br><tt> -rootDir - Directory to begin search |
520 |
from.</tt> |
521 |
<br><tt> -command - The command to run including |
522 |
arguments.</tt> |
523 |
<br><tt> -depth - The maximum |
524 |
search depth. Default 0</tt> |
525 |
<br><tt> -stdout - Where STDOUT from |
526 |
the executable should go.</tt> |
527 |
<br><tt> -stderr - Where STDERR from |
528 |
the executable should go.</tt> |
529 |
<br><tt> -trial - Don't execute |
530 |
the commands just display.</tt> |
531 |
<br><tt> -cprefix - Command prefix. Default |
532 |
"Executing: "</tt> |
533 |
<br><tt> -fail - The name |
534 |
of the fail flag file.</tt> |
535 |
<br><tt>All switches with the exception of -trial require an argument.</tt> |
536 |
<p><font color="#000000"># Script to find files according to a pattern |
537 |
and then perform commands</font> |
538 |
<br><font color="#000000"># on them. Various tokens may be supplied on |
539 |
the command line which are</font> |
540 |
<br><font color="#000000"># relaced by actual values when the command is |
541 |
executed. This script</font> |
542 |
<br><font color="#000000"># has a sister script runExeConfig.pl which reads |
543 |
a configuration file</font> |
544 |
<br><font color="#000000"># containing a list of fandExe.pl commands.</font> |
545 |
<br><font color="#000000">#</font> |
546 |
<br><font color="#000000"># Example:</font> |
547 |
<br><font color="#000000">#</font> |
548 |
<br><font color="#000000"># fandExe.pl -rootDir $ALIEN_HOME/include</font> |
549 |
<br><font color="#000000"># |
550 |
-file "*.mk"</font> |
551 |
<br><font color="#000000"># |
552 |
-command "$ALIEN_MAKE -f @currentFile clean"</font> |
553 |
<br><font color="#000000"># |
554 |
-command "$ALIEN_MAKE -f @currentFile DODEBUG=YES"</font> |
555 |
<br><font color="#000000"># |
556 |
-depth 0</font> |
557 |
<br><font color="#000000"># |
558 |
-stdout @arch/@headFile_DEBUG.log</font> |
559 |
<br><font color="#000000"># |
560 |
-stderr @arch/@headFile_DEBUG.log</font> |
561 |
<br><font color="#000000"># |
562 |
-fail @arch/@headFile_DEBUG.err</font> |
563 |
<br><font color="#000000"># |
564 |
-cprefix "Building library: "</font> |
565 |
<br><font color="#000000"># |
566 |
-trial</font> |
567 |
<br><font color="#000000">#</font> |
568 |
<br><font color="#000000"># This example will begin searching for files |
569 |
with the extension ".mk"</font> |
570 |
<br><font color="#000000"># from the root directory $ALIEN_HOME/include. |
571 |
The search will occur</font> |
572 |
<br><font color="#000000"># only in the root directory as the depth is |
573 |
specified as 0. If the depth</font> |
574 |
<br><font color="#000000"># was specified as 1 all subdirectories would |
575 |
also be searched. Depth</font> |
576 |
<br><font color="#000000"># may have any value greater than 0 so that an |
577 |
entire directory hierarchy</font> |
578 |
<br><font color="#000000"># may be searched. The -rootDir switch may be |
579 |
repeated as often as necessary.</font> |
580 |
<br><font color="#000000"># The file search will then commence from each |
581 |
root directory specified.</font> |
582 |
<br><font color="#000000"># For each file found the two commands listed |
583 |
will be executed. The token</font> |
584 |
<br><font color="#000000"># @currentFile will be replaced by the name of |
585 |
the file found. STDOUT</font> |
586 |
<br><font color="#000000"># has been redirected to the file named @arch/@headFile_DEBUG.log. |
587 |
The tokens</font> |
588 |
<br><font color="#000000"># @arch and @headFile will be replaced by actual |
589 |
values. See below for an</font> |
590 |
<br><font color="#000000"># explanation of the tokens available. Similarly |
591 |
for STDERR. The -fail switch</font> |
592 |
<br><font color="#000000"># causes a flag file named @arch/@headFile_DEBUG.err |
593 |
to be created should</font> |
594 |
<br><font color="#000000"># either of the commands fail. The file is named |
595 |
in a similar manner to the</font> |
596 |
<br><font color="#000000"># STDOUT and STDERR files. As the example shows |
597 |
the -command switch may be</font> |
598 |
<br><font color="#000000"># repeated as often as necessary.</font> |
599 |
<br><font color="#000000">#</font> |
600 |
<br><font color="#000000"># Example output:</font> |
601 |
<br><font color="#000000"># The script writes to STDOUT a progress summary |
602 |
as it executes each command.</font> |
603 |
<br><tt><font color="#000000"># Root: /usr/development/AlienDev/include</font></tt> |
604 |
<br><tt><font color="#000000"># Building library: gmake -f Alien.mk |
605 |
clean |
606 |
OK 0</font></tt> |
607 |
<br><tt><font color="#000000"># Building library: gmake -f Alien.mk |
608 |
DODEBUG=YES |
609 |
OK 0</font></tt> |
610 |
<br><tt><font color="#000000"># Building library: gmake -f CMClient.mk |
611 |
clean |
612 |
OK 0</font></tt> |
613 |
<br><tt><font color="#000000"># Building library: gmake -f CMClient.mk |
614 |
DODEBUG=YES |
615 |
OK 0</font></tt> |
616 |
<br><tt><font color="#000000"># Building library: gmake -f ESInterface.mk |
617 |
clean |
618 |
OK 0</font></tt> |
619 |
<br><tt><font color="#000000"># Building library: gmake -f ESInterface.mk |
620 |
DODEBUG=YES |
621 |
OK 0</font></tt> |
622 |
<br><tt><font color="#000000"># Building library: gmake -f ESUtilFnReplacements.mk |
623 |
clean OK 0</font></tt> |
624 |
<br><tt><font color="#000000"># Building library: gmake -f ESUtilFnReplacements.mk |
625 |
DODEBUG=YES OK 0</font></tt> |
626 |
<br><tt><font color="#000000"># Building library: gmake -f MakeDoc.mk |
627 |
clean |
628 |
OK 0</font></tt> |
629 |
<br><tt><font color="#000000"># Building library: gmake -f MakeDoc.mk |
630 |
DODEBUG=YES |
631 |
OK 0</font></tt> |
632 |
<br><font color="#000000">#</font> |
633 |
<br><font color="#000000"># This output was generated using the -trial |
634 |
switch so that the commands</font> |
635 |
<br><font color="#000000"># did not execute but are simply displayed. This |
636 |
is useful for debugging.</font> |
637 |
<br><font color="#000000"># The number in the far right column is the elapsed |
638 |
time in seconds for the command to complete.</font> |
639 |
<br><font color="#000000"># The -cprefix switch is used to specify the |
640 |
prefix displayed on each output</font> |
641 |
<br><font color="#000000"># line before the command. Please notice that |
642 |
the tokens have been replaced</font> |
643 |
<br><font color="#000000"># by actual filenames generated from the files |
644 |
found.</font> |
645 |
<br><font color="#000000"># Also the shell environment variables $ALIEN_HOME |
646 |
and</font> |
647 |
<br><font color="#000000"># $ALIEN_MAKE have been replaced by their actual |
648 |
values.</font> |
649 |
<br><font color="#000000">#</font> |
650 |
<br><font color="#000000"># Valid Tokens:</font> |
651 |
<br><font color="#000000"># @currentFile The name of the current |
652 |
file found.</font> |
653 |
<br><font color="#000000"># @headFile The |
654 |
prefix of the current file found.</font> |
655 |
<br><font color="#000000"># @fullFilePath The full path to the current |
656 |
file.</font> |
657 |
<br><font color="#000000"># @currentDir The current directory.</font> |
658 |
<br><font color="#000000"># @relDir |
659 |
The directory relative to the root directory.</font> |
660 |
<br><font color="#000000"># @flatRelDir The flattened |
661 |
relative directory name ie "/" replaced by "_".</font> |
662 |
<br><font color="#000000"># @arch |
663 |
The architecture code.</font> |
664 |
<br><font color="#000000">#</font> |
665 |
<br><font color="#000000"># For the file found called Alien.mk. The tokens |
666 |
would have the following</font> |
667 |
<br><font color="#000000"># values.</font> |
668 |
<br><font color="#000000"># @currentFile Alien.mk</font> |
669 |
<br><font color="#000000"># @headFile |
670 |
Alien</font> |
671 |
<br><font color="#000000"># @fullFilePath /usr/development/AlienDev/include/Alien.mk</font> |
672 |
<br><font color="#000000"># @currentDir /usr/development/AlienDev/include</font> |
673 |
<br><font color="#000000"># @relDir</font> |
674 |
<br><font color="#000000"># @flatRelDir</font> |
675 |
<br><font color="#000000"># @arch |
676 |
SOLM</font> |
677 |
<br><font color="#000000">#</font> |
678 |
<p><font color="#3333FF">runExeConfig.pl </font><font color="#000000">This |
679 |
script calls fandExe.pl for each paragraph specified in a configuration |
680 |
file.</font> |
681 |
<p><tt>Usage runExeConfig.pl -cfile [-efile] [-trial]</tt> |
682 |
<br><tt> -cfile - The name |
683 |
of the configuration file to run.</tt> |
684 |
<br><tt> -efile - The name |
685 |
of the file which sets the environment.</tt> |
686 |
<br><tt> -trial - Force |
687 |
all commands to run in trial mode.</tt> |
688 |
<p><i>Configuration File:</i> |
689 |
<br>The configuration file controls the operation of this script. |
690 |
<p># This script reads the given execute configuration file and runs the |
691 |
<br># command fandExe.pl for each distinct command set found. |
692 |
<br># fandExe.pl is essentially a specialised find and execute script. |
693 |
<br># The following syntax is required for the configuration file. |
694 |
<br># Lines begining with a # are considered to be comment lines and are |
695 |
ignored. |
696 |
<br># A command set may flow over many lines with one complete command |
697 |
enclosed |
698 |
<br># in parenthese. See fandExe.pl header for further explanation. |
699 |
<br># Example: |
700 |
<br># |
701 |
<br># (-rootDir /usr/development/AlienDev/UnitTest |
702 |
<br># |
703 |
-file "*.log" |
704 |
<br># |
705 |
-command "ls -l @currentFile" |
706 |
<br># |
707 |
-depth 20 |
708 |
<br># |
709 |
-stdout @headFile.log |
710 |
<br># |
711 |
-stderr @headFile.err) |
712 |
<br># |
713 |
<p><font color="#3333FF">NightlyBuild.cfg </font><font color="#000000">Is |
714 |
an example of a configuration file for runExeConfig.pl</font> |
715 |
<br><font color="#000000">This configuration file controls all of the building |
716 |
and testing that occurs each night. It also configures runExeConfig.pl |
717 |
to rebuild the Alien documentation set each night. As can be seen from |
718 |
the configuration file the results of each build and test are saved in |
719 |
files with the extension ".nblog". If a build or test fails a file with |
720 |
the extension ".nberr" remains. The log and error files drive the creation |
721 |
of the html summary page which is created each morning by the script mkSummary.pl.</font> |
722 |
<p># This configuration file is intended for use with the script runExeConfig.pl. |
723 |
<br># It determines the components of the Alien library that are built |
724 |
each night |
725 |
<br># and the tests performed. |
726 |
<br># Author: J.Gerschwitz Date: 4 Sept 2001 |
727 |
<br># Comment: Original version |
728 |
<br># |
729 |
<br># Build the debug version of all libraries |
730 |
<br>(-rootDir $ALIEN_HOME/include |
731 |
<br> -file "*.mk" |
732 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean" |
733 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES" |
734 |
<br> -depth 0 |
735 |
<br> -stdout @arch/@headFile_DEBUG.nblog |
736 |
<br> -stderr @arch/@headFile_DEBUG.nblog |
737 |
<br> -fail @arch/@headFile_DEBUG.nberr |
738 |
<br> -cprefix "Building: " |
739 |
<br>) |
740 |
<br># |
741 |
<br># Build the non debug version of all libraries |
742 |
<br>(-rootDir $ALIEN_HOME/include |
743 |
<br> -file "*.mk" |
744 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO clean" |
745 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO" |
746 |
<br> -depth 0 |
747 |
<br> -stdout @arch/@headFile_NODEBUG.nblog |
748 |
<br> -stderr @arch/@headFile_NODEBUG.nblog |
749 |
<br> -fail @arch/@headFile_NODEBUG.nberr |
750 |
<br> -cprefix "Building: " |
751 |
<br>) |
752 |
<br># |
753 |
<br># Build the non debug version of ESProcs |
754 |
<br>(-rootDir $ALIEN_HOME/AlienESProcs |
755 |
<br> -file "Makefile" |
756 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean" |
757 |
<br> -command "$ALIEN_MAKE -f @currentFile NAME=@flatRelDir |
758 |
DODEBUG=YES" |
759 |
<br> -depth 2 |
760 |
<br> -stdout @arch/@flatRelDir_DEBUG.nblog |
761 |
<br> -stderr @arch/@flatRelDir_DEBUG.nblog |
762 |
<br> -fail @arch/@flatRelDir_DEBUG.nberr |
763 |
<br> -cprefix "Building: " |
764 |
<br>) |
765 |
<br># |
766 |
<br># Build the ESProc library |
767 |
<br>(-rootDir $ALIEN_HOME/AlienESProcs/lib |
768 |
<br> -file "ProcLib.mk" |
769 |
<br> -command "$ALIEN_MAKE -f @fullFilePath" |
770 |
<br> -depth 0 |
771 |
<br> -stdout /dev/null |
772 |
<br> -cprefix "Building: " |
773 |
<br>) |
774 |
<br># |
775 |
<br># Build the standalone executables |
776 |
<br>(-rootDir $ALIEN_HOME/AlienProg |
777 |
<br> -file "*.mk" |
778 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean" |
779 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES" |
780 |
<br> -depth 2 |
781 |
<br> -stdout @arch/@headFile_DEBUG.nblog |
782 |
<br> -stderr @arch/@headFile_DEBUG.nblog |
783 |
<br> -fail @arch/@headFile_DEBUG.nberr |
784 |
<br> -cprefix "Building: " |
785 |
<br>) |
786 |
<br># |
787 |
<br># Build examples |
788 |
<br>(-rootDir $ALIEN_HOME/Examples |
789 |
<br> -file "*.mk" |
790 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean" |
791 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES" |
792 |
<br> -depth 2 |
793 |
<br> -stdout @arch/@headFile_DEBUG.nblog |
794 |
<br> -stderr @arch/@headFile_DEBUG.nblog |
795 |
<br> -fail @arch/@headFile_DEBUG.nberr |
796 |
<br> -cprefix "Building: " |
797 |
<br>) |
798 |
<br># |
799 |
<br># Build all unit tests with no debug |
800 |
<br>(-rootDir $ALIEN_HOME/UnitTest/AlienClass/Automatic |
801 |
<br> -rootDir $ALIEN_HOME/UnitTest/Gool/Automatic |
802 |
<br> -file "*.mk" |
803 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO clean" |
804 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO" |
805 |
<br> -depth 2 |
806 |
<br> -stdout @arch/@currentFile_NODEBUG.nblog |
807 |
<br> -stderr @arch/@currentFile_NODEBUG.nblog |
808 |
<br> -fail @arch/@currentFile_NODEBUG.nberr |
809 |
<br> -cprefix "Building: " |
810 |
<br>) |
811 |
<br># |
812 |
<br># Run all unit tests |
813 |
<br>(-rootDir $ALIEN_HOME/UnitTest/AlienClass/Automatic |
814 |
<br> -rootDir $ALIEN_HOME/UnitTest/Gool/Automatic |
815 |
<br> -file "*.mk" |
816 |
<br> -command "$ALIEN_HOME/scripts/UTRun.pl -file @currentFile" |
817 |
<br> -depth 2 |
818 |
<br> -stdout @arch/@headFile_NODEBUG.nblog |
819 |
<br> -stderr @arch/@headFile_NODEBUG.nblog |
820 |
<br> -fail @arch/@headFile_NODEBUG.nberr |
821 |
<br> -cprefix "Testing: " |
822 |
<br>) |
823 |
<br># |
824 |
<br># Build unit tests with debug on |
825 |
<br>(-rootDir $ALIEN_HOME/UnitTest/AlienClass/Automatic |
826 |
<br> -rootDir $ALIEN_HOME/UnitTest/Gool/Automatic |
827 |
<br> -file "*.mk" |
828 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean" |
829 |
<br> -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES" |
830 |
<br> -depth 2 |
831 |
<br> -stdout @arch/@currentFile_DEBUG.nblog |
832 |
<br> -stderr @arch/@currentFile_DEBUG.nblog |
833 |
<br> -fail @arch/@currentFile_DEBUG.nberr |
834 |
<br> -cprefix "Building: " |
835 |
<br>) |
836 |
<br># |
837 |
<br># Run unit tests built with debug on |
838 |
<br>(-rootDir $ALIEN_HOME/UnitTest/AlienClass/Automatic |
839 |
<br> -rootDir $ALIEN_HOME/UnitTest/Gool/Automatic |
840 |
<br> -file "*.mk" |
841 |
<br> -command "$ALIEN_HOME/scripts/UTRun.pl -file @currentFile" |
842 |
<br> -depth 2 |
843 |
<br> -stdout @arch/@headFile_DEBUG.nblog |
844 |
<br> -stderr @arch/@headFile_DEBUG.nblog |
845 |
<br> -fail @arch/@headFile_DEBUG.nberr |
846 |
<br> -cprefix "Testing: " |
847 |
<br>) |
848 |
<p># Build alien documentation |
849 |
<br>(-rootDir $ALIEN_HOME/doc |
850 |
<br> -file "*.mk" |
851 |
<br> -command "$ALIEN_MAKE -f @currentFile" |
852 |
<br> -depth 0 |
853 |
<br> -stdout @arch/@headFile_DEBUG.nblog |
854 |
<br> -stderr @arch/@headFile_DEBUG.nblog |
855 |
<br> -fail @arch/@headFile_DEBUG.nberr |
856 |
<br> -cprefix "Building Documentation: " |
857 |
<br>) |
858 |
<p><font color="#3333FF">UTRun.pl </font><font color="#000000">It |
859 |
should be noted that the unit tests are run through this script. This essentially |
860 |
takes one argument which is of the format </font><tt><</tt>UnitTestName>.mk. |
861 |
It then attempts to run an executable called UnitTestName. |
862 |
<br><tt># Script to run a unit test.</tt> |
863 |
<br><tt># The -file argument is expected to be of the format <UnitTestName>.mk</tt> |
864 |
<br><tt># The executable is expected to be in the sub directory <architecture>.</tt> |
865 |
<br><tt># The default action is to run the unit test executable.</tt> |
866 |
<br><tt># If the file "testList.UT" exists it is expected to contain command |
867 |
line</tt> |
868 |
<br><tt># arguments which will be executed instead.</tt> |
869 |
<br><tt># If the file "architectures.UT" exists it will contain the standard</tt> |
870 |
<br><tt># names of architectures for which no tests are to be run.</tt> |
871 |
<p><font color="#3333FF">nightlyBuild.ksh </font><font color="#000000">This |
872 |
script is run by cron each night to rebuild all libraries and unit tests. |
873 |
Following the</font> |
874 |
<br><font color="#000000">complete rebuild each unit test is executed.</font> |
875 |
<p><font color="#3333FF">mkSummary.pl </font><font color="#000000">This |
876 |
script is run each morning by cron after all of the nightly build and tests |
877 |
have completed. As this script doesn't take very long to run it is started |
878 |
30 minutes before normal office hours which is normally well after the |
879 |
nightly builds have completed. It mails a summary of the nightly build |
880 |
logs found and creates a summary html document.</font> |
881 |
<p><font color="#000000">Example mail message.</font> |
882 |
<p><tt><font color="#000000">Quick Summary of Alien builds and Unit tests:</font></tt> |
883 |
<p><tt><font color="#000000"> LINUXM: |
884 |
365 OK, 6 Failures, |
885 |
1 Old log/error files</font></tt> |
886 |
<br><tt><font color="#000000"> RS6K: |
887 |
369 OK, 2 Failures, |
888 |
1 Old log/error files</font></tt> |
889 |
<br><tt><font color="#000000"> RS6K_v5: 339 |
890 |
OK, 26 Failures, |
891 |
7 Old log/error files</font></tt> |
892 |
<br><tt><font color="#000000"> SGIM: |
893 |
369 OK, 2 Failures, |
894 |
1 Old log/error files</font></tt> |
895 |
<br><tt><font color="#000000"> SOLM: |
896 |
365 OK, 6 Failures, |
897 |
1 Old log/error files</font></tt> |
898 |
<br><tt><font color="#000000"> WIN32_NT5: 358 OK, |
899 |
12 Failures, 2 Old log/error files</font></tt> |
900 |
<p><tt><font color="#000000">Full Summary: http://web.prth.tensor.pgs.com/Programming/buildSummary.html</font></tt> |
901 |
<br> |
902 |
<br> |
903 |
<br> |
904 |
<br> |
905 |
<br> |
906 |
<br> |
907 |
<br> |
908 |
</body> |
909 |
</html> |