/[escript]/trunk/tools/CppUnitTest/doc/UnitTestSystem.html
ViewVC logotype

Contents of /trunk/tools/CppUnitTest/doc/UnitTestSystem.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (show annotations)
Fri Jan 11 07:45:58 2008 UTC (15 years, 2 months ago) by trankine
File MIME type: text/html
File size: 45820 byte(s)
And get the *(&(*&(* name right
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>&nbsp;
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 &lt;ClassName></tt>
43 <p><tt>&nbsp; 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.&nbsp; 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.&nbsp; 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>&nbsp;
76 <p><tt>main(int argc, char *argv[]) {</tt>
77 <br><tt>&nbsp; //</tt>
78 <br><tt>&nbsp; // object which runs all of the tests</tt>
79 <br><tt>&nbsp; TestRunner runner;</tt>
80 <br><tt>&nbsp; //</tt>
81 <br><tt>&nbsp; // add the RangeTestCase suite of tests to the runner</tt>
82 <br><tt>&nbsp; runner.addTest ("RangeTestCase",</tt>
83 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
84 RangeTestCase::suite ());</tt>
85 <br><tt>&nbsp; //</tt>
86 <br><tt>&nbsp; // actually run the unit tests.</tt>
87 <br><tt>&nbsp; runner.run (argc, argv);</tt>
88 <p><tt>&nbsp; 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.&nbsp; 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.&nbsp; 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>&nbsp; //</tt>
129 <br><tt>&nbsp; // This is called before each test is run</tt>
130 <p><tt>}</tt>
131 <p><tt>void RangeTestCase::tearDown() {</tt>
132 <br><tt>&nbsp; //</tt>
133 <br><tt>&nbsp; // This is called after each test has been run</tt>
134 <p><tt>}</tt>
135 <p><tt>void RangeTestCase::testAll() {</tt>
136 <br><tt>&nbsp; //</tt>
137 <br><tt>&nbsp; // The test code may be entered here</tt>
138 <br><tt>&nbsp; // There is nothing special about the function name, it
139 may be renamed to</tt>
140 <br><tt>&nbsp; // something more suitable.</tt>
141 <br><tt>&nbsp; // As many test methods as desired may be added.</tt>
142 <p><tt>}</tt>
143 <br>&nbsp;
144 <p><tt>Test* RangeTestCase::suite ()</tt>
145 <br><tt>{</tt>
146 <br><tt>&nbsp; //</tt>
147 <br><tt>&nbsp; // create the suite of tests to perform.</tt>
148 <br><tt>&nbsp; TestSuite *testSuite = new TestSuite ("RangeTestCase");</tt>
149 <br><tt>&nbsp; testSuite->addTest (new TestCaller &lt;RangeTestCase> ("testAll",&amp;RangeTestCase::testAll));</tt>
150 <br><tt>&nbsp; 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.&nbsp; 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.&nbsp; 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&nbsp; 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>&nbsp;public:</tt>
179 <br><tt>&nbsp; RangeTestCase (string name) : TestCase (name) {}</tt>
180 <br><tt>&nbsp; ~RangeTestCase() {}</tt>
181 <br><tt>&nbsp; //</tt>
182 <br><tt>&nbsp; // Virtual methods of TestCase. These are provided to ensure
183 the objects</tt>
184 <br><tt>&nbsp; // being used in the tests are in a known state.</tt>
185 <br><tt>&nbsp; // setUp is called before each test method is called</tt>
186 <br><tt>&nbsp; void setUp();</tt>
187 <br><tt>&nbsp; //</tt>
188 <br><tt>&nbsp; // tearDown is called after each test method is called.</tt>
189 <br><tt>&nbsp; void tearDown();</tt>
190 <br><tt>&nbsp; //</tt>
191 <br><tt>&nbsp; // return the suite of tests to perform</tt>
192 <br><tt>&nbsp; static Test* suite ();</tt>
193 <p><tt>&nbsp;protected:</tt>
194 <br><tt>&nbsp; //</tt>
195 <br><tt>&nbsp; // The following methods are for testing various methods
196 of the</tt>
197 <br><tt>&nbsp; // Range class</tt>
198 <br><tt>&nbsp; void testAll();</tt>
199 <p><tt>&nbsp;private:</tt>
200 <br>&nbsp;
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.&nbsp; 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>&nbsp;<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.&nbsp; 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>&nbsp;&nbsp;&nbsp; testEquality
218 <br>&nbsp;&nbsp;&nbsp; testWithin
219 <br>&nbsp;&nbsp;&nbsp; testRangeException
220 <br>&nbsp;&nbsp;&nbsp; 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.&nbsp; 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.&nbsp; 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.&nbsp; 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&nbsp; 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>&nbsp;private:</tt>
251 <br><tt>&nbsp; //</tt>
252 <br><tt>&nbsp; // Two integer ranges created by setUp method. They are
253 destructed in the</tt>
254 <br><tt>&nbsp; // tearDown method. All of the tests use these ranges.</tt>
255 <br><tt>&nbsp; Range&lt;int> *r1,*r2;</tt>
256 <br><tt>&nbsp;protected:</tt>
257 <br><tt>&nbsp; //</tt>
258 <br><tt>&nbsp; // The following methods are for testing various methods
259 of the Range class</tt>
260 <br><tt>&nbsp; //</tt>
261 <br><tt>&nbsp; // Method to test whether operator==() method is working</tt>
262 <br><tt>&nbsp; void testEquality();</tt>
263 <br><tt>&nbsp; //</tt>
264 <br><tt>&nbsp; // Method to test whether within() method is working</tt>
265 <br><tt>&nbsp; void testWithin();</tt>
266 <br><tt>&nbsp; //</tt>
267 <br><tt>&nbsp; // Method to test whether a RangeException is contructed
268 and thrown correctly</tt>
269 <br><tt>&nbsp; void testRangeException();</tt>
270 <br><tt>&nbsp; //</tt>
271 <br><tt>&nbsp; // Method to test whether the overlap method works</tt>
272 <br><tt>&nbsp; void testOverlap();</tt>
273 <p><tt>&nbsp;public:</tt>
274 <br><tt>&nbsp; RangeTestCase (string name) : TestCase (name) {}</tt>
275 <br><tt>&nbsp; ~RangeTestCase() {}</tt>
276 <br><tt>&nbsp; //</tt>
277 <br><tt>&nbsp; // Virtual methods of TestCase. These are provided to ensure
278 the objects</tt>
279 <br><tt>&nbsp; // being used in the tests are in a known state.</tt>
280 <br><tt>&nbsp; // setUp is called before each test method is called</tt>
281 <br><tt>&nbsp; void setUp();</tt>
282 <br><tt>&nbsp; //</tt>
283 <br><tt>&nbsp; // tearDown is called after each test method is called.</tt>
284 <br><tt>&nbsp; void tearDown();</tt>
285 <br><tt>&nbsp; //</tt>
286 <br><tt>&nbsp; // return the suite of tests to perform</tt>
287 <br><tt>&nbsp; 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.&nbsp; 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.&nbsp; 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>&nbsp; //</tt>
309 <br><tt>&nbsp; // create fresh objects for this test</tt>
310 <br><tt>&nbsp; r1=new Range&lt;int>(1,5);</tt>
311 <br><tt>&nbsp; r2=new Range&lt;int>(1,7);</tt>
312 <br><tt>}</tt>
313 <p><tt>void RangeTestCase::tearDown() {</tt>
314 <br><tt>&nbsp; //</tt>
315 <br><tt>&nbsp; // destroy the objects from the last test</tt>
316 <br><tt>&nbsp; delete r1;</tt>
317 <br><tt>&nbsp; delete r2;</tt>
318 <br><tt>}</tt>
319 <p><tt>void RangeTestCase::testEquality() {</tt>
320 <br><tt>&nbsp; //</tt>
321 <br><tt>&nbsp; // check whether the operator==() method returns r1 as equal
322 to itself.</tt>
323 <br><tt>&nbsp; // This should return true if the method is working correctly</tt>
324 <br><tt>&nbsp; // If false is returned the test will stop and a failure
325 is reported</tt>
326 <br><tt>&nbsp; assert((*r1)==(*r1));</tt>
327 <br><tt>&nbsp; //</tt>
328 <br><tt>&nbsp; // This should return true as r1 does not equal r2.</tt>
329 <br><tt>&nbsp; assert(!(*r1)==(*r2));</tt>
330 <br><tt>}</tt>
331 <p><tt>void RangeTestCase::testWithin() {</tt>
332 <br><tt>&nbsp; //</tt>
333 <br><tt>&nbsp; // test whether the minimum and maximum&nbsp; value for
334 the range are within</tt>
335 <br><tt>&nbsp; // the range. Both should return true.</tt>
336 <br><tt>&nbsp; assert((*r1).within((*r1).getMin()));</tt>
337 <br><tt>&nbsp; assert((*r1).within((*r1).getMax()));</tt>
338 <br><tt>}</tt>
339 <p><tt>void RangeTestCase::testRangeException() {</tt>
340 <br><tt>&nbsp; try {</tt>
341 <br><tt>&nbsp;&nbsp;&nbsp; //</tt>
342 <br><tt>&nbsp;&nbsp;&nbsp; // This call should throw an exception as the
343 range is invalid</tt>
344 <br><tt>&nbsp;&nbsp;&nbsp; (*r1).setRange(3,1);</tt>
345 <br><tt>&nbsp;&nbsp;&nbsp; //</tt>
346 <br><tt>&nbsp;&nbsp;&nbsp; // if the test gets here the exception has failed</tt>
347 <br><tt>&nbsp;&nbsp;&nbsp; assert(false);</tt>
348 <br><tt>&nbsp; }</tt>
349 <br><tt>&nbsp; catch (RangeException &amp;e) {</tt>
350 <br><tt>&nbsp; }</tt>
351 <br><tt>}</tt>
352 <br><tt>void RangeTestCase::testOverlap() {</tt>
353 <br><tt>&nbsp; //</tt>
354 <br><tt>&nbsp; // Test whether r1 overlaps r2. Should return true.</tt>
355 <br><tt>&nbsp; assert((*r1).overlap((*r2)));</tt>
356 <br><tt>}</tt>
357 <br>&nbsp;
358 <p><tt>Test* RangeTestCase::suite ()</tt>
359 <br><tt>{</tt>
360 <br><tt>&nbsp; //</tt>
361 <br><tt>&nbsp; // create the suite of tests to perform.</tt>
362 <br><tt>&nbsp; TestSuite *testSuite = new TestSuite ("RangeTestCase");</tt>
363 <p><tt>&nbsp; testSuite->addTest (new TestCaller &lt;RangeTestCase> ("testEquality",&amp;RangeTestCase::testEquality));</tt>
364 <br><tt>&nbsp; testSuite->addTest (new TestCaller &lt;RangeTestCase> ("testWithin",&amp;RangeTestCase::testWithin));</tt>
365 <br><tt>&nbsp; testSuite->addTest (new TestCaller &lt;RangeTestCase> ("testRangeException",&amp;RangeTestCase::testRangeException));</tt>
366 <br><tt>&nbsp; testSuite->addTest (new TestCaller &lt;RangeTestCase> ("testOverlap",&amp;RangeTestCase::testOverlap));</tt>
367 <br><tt>&nbsp; return testSuite;</tt>
368 <br><tt>}</tt>
369 <br>&nbsp;</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.&nbsp; 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.&nbsp; 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>&nbsp;
388 <p><tt>main(int argc, char *argv[]) {</tt>
389 <br><tt>&nbsp; //</tt>
390 <br><tt>&nbsp; // object which runs all of the tests</tt>
391 <br><tt>&nbsp; TestRunner runner;</tt>
392 <br><tt>&nbsp; //</tt>
393 <br><tt>&nbsp; // add the RangeTestCase suite of tests to the runner</tt>
394 <br><tt>&nbsp; runner.addTest ("RangeTestCase",</tt>
395 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
396 RangeTestCase::suite ());</tt>
397 <br><tt>&nbsp; //</tt>
398 <br><tt>&nbsp; // give the same suite another name to demonstrate</tt>
399 <br><tt>&nbsp; //&nbsp; multiple suites</tt>
400 <br><tt>&nbsp; runner.addTest ("R2Test",</tt>
401 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
402 RangeTestCase::suite ());</tt>
403 <br><tt>&nbsp; //</tt>
404 <br><tt>&nbsp; // actually run the unit tests.</tt>
405 <br><tt>&nbsp; runner.run (argc, argv);</tt>
406 <p><tt>&nbsp; return 0;</tt>
407 <br><tt>}</tt>
408 <br>&nbsp;</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>&nbsp; Test: testEquality Ok</tt>
414 <br><tt>&nbsp; Test: testWithin Ok</tt>
415 <br><tt>&nbsp; Test: testRangeException Ok</tt>
416 <br><tt>&nbsp; Test: testOverlap Ok</tt>
417 <p><tt>OK (4 tests)</tt>
418 <p><tt>Suite: R2Test</tt>
419 <br><tt>&nbsp; Test: testEquality Ok</tt>
420 <br><tt>&nbsp; Test: testWithin Ok</tt>
421 <br><tt>&nbsp; Test: testRangeException Ok</tt>
422 <br><tt>&nbsp; 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>&nbsp; Test: testEquality Failure</tt>
429 <br><tt>&nbsp; Test: testWithin Error</tt>
430 <br><tt>&nbsp; Test: testRangeException&nbsp; Ok</tt>
431 <br><tt>&nbsp; Test: testOverlap Ok</tt>
432 <p><tt>!!!FAILURES!!!</tt>
433 <br><tt>Test Results:</tt>
434 <br><tt>Run:&nbsp; 4&nbsp;&nbsp; Failures: 1&nbsp;&nbsp; Errors: 1</tt>
435 <br><tt>There was 1 error:</tt>
436 <br><tt>1) testWithin line: -1 &lt;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>&nbsp; Test: testEquality Failure</tt>
442 <br><tt>&nbsp; Test: testWithin Error</tt>
443 <br><tt>&nbsp; Test: testRangeException&nbsp; Ok</tt>
444 <br><tt>&nbsp; Test: testOverlap Ok</tt>
445 <p><tt>!!!FAILURES!!!</tt>
446 <br><tt>Test Results:</tt>
447 <br><tt>Run:&nbsp; 4&nbsp;&nbsp; Failures: 1&nbsp;&nbsp; Errors: 1</tt>
448 <br><tt>There was 1 error:</tt>
449 <br><tt>1) testWithin line: -1 &lt;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>&nbsp;
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&lt;string>&amp; 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&lt;string>&amp;
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 &lt;&lt; "exe name is
491 " &lt;&lt; args[0] &lt;&lt; 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>&nbsp; try {</font></font></tt>
494 <br><tt><font color="#330000"><font size=+0>&nbsp;&nbsp;&nbsp; //</font></font></tt>
495 <br><tt><font color="#330000"><font size=+0>&nbsp;&nbsp;&nbsp; // This
496 call should throw an exception as the range is invalid</font></font></tt>
497 <br><tt><font color="#330000"><font size=+0>&nbsp;&nbsp;&nbsp; (*r1).setRange(3,1);</font></font></tt>
498 <br><tt><font color="#330000"><font size=+0>&nbsp;&nbsp;&nbsp; //</font></font></tt>
499 <br><tt><font color="#330000"><font size=+0>&nbsp;&nbsp;&nbsp; // if the
500 test gets here the exception has failed</font></font></tt>
501 <br><tt><font color="#330000"><font size=+0>&nbsp;&nbsp;&nbsp; assert(false);</font></font></tt>
502 <br><tt><font color="#330000"><font size=+0>&nbsp; }</font></font></tt>
503 <br><tt><font color="#330000"><font size=+0>&nbsp; catch (RangeException
504 &amp;e) {</font></font></tt>
505 <br><tt><font color="#330000"><font size=+0>&nbsp; }</font></font></tt>
506 <br><tt><font color="#330000"><font size=+0>}</font></font></tt>
507 <br>&nbsp;
508 <p><font color="#3366FF"><font size=+2>UnitTest Scripts</font></font>
509 <p>Several scripts exist to help&nbsp; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -file&nbsp;&nbsp;&nbsp; - The file
518 pattern.</tt>
519 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -rootDir - Directory to begin search
520 from.</tt>
521 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -command - The command to run including
522 arguments.</tt>
523 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -depth&nbsp;&nbsp; - The maximum
524 search depth. Default 0</tt>
525 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -stdout&nbsp; - Where STDOUT from
526 the executable should go.</tt>
527 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -stderr&nbsp; - Where STDERR from
528 the executable should go.</tt>
529 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -trial&nbsp;&nbsp; - Don't execute
530 the commands just display.</tt>
531 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -cprefix - Command prefix. Default
532 "Executing: "</tt>
533 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -fail&nbsp;&nbsp;&nbsp; - 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">#&nbsp;&nbsp; fandExe.pl -rootDir $ALIEN_HOME/include</font>
549 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
550 -file "*.mk"</font>
551 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
552 -command "$ALIEN_MAKE -f @currentFile clean"</font>
553 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
554 -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES"</font>
555 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
556 -depth 0</font>
557 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
558 -stdout @arch/@headFile_DEBUG.log</font>
559 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
560 -stderr @arch/@headFile_DEBUG.log</font>
561 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
562 -fail @arch/@headFile_DEBUG.err</font>
563 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
564 -cprefix "Building library: "</font>
565 <br><font color="#000000">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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&nbsp; $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:&nbsp; gmake -f Alien.mk
605 clean&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
606 OK&nbsp; 0</font></tt>
607 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f Alien.mk
608 DODEBUG=YES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
609 OK&nbsp; 0</font></tt>
610 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f CMClient.mk
611 clean&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
612 OK&nbsp; 0</font></tt>
613 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f CMClient.mk
614 DODEBUG=YES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
615 OK&nbsp; 0</font></tt>
616 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f ESInterface.mk
617 clean&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
618 OK&nbsp; 0</font></tt>
619 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f ESInterface.mk
620 DODEBUG=YES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
621 OK&nbsp; 0</font></tt>
622 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f ESUtilFnReplacements.mk
623 clean&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OK&nbsp; 0</font></tt>
624 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f ESUtilFnReplacements.mk
625 DODEBUG=YES&nbsp; OK&nbsp; 0</font></tt>
626 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f MakeDoc.mk
627 clean&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
628 OK&nbsp; 0</font></tt>
629 <br><tt><font color="#000000"># Building library:&nbsp; gmake -f MakeDoc.mk
630 DODEBUG=YES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
631 OK&nbsp; 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">#&nbsp; @currentFile&nbsp; The name of the current
652 file found.</font>
653 <br><font color="#000000">#&nbsp; @headFile&nbsp;&nbsp;&nbsp;&nbsp; The
654 prefix of the current file found.</font>
655 <br><font color="#000000">#&nbsp; @fullFilePath The full path to the current
656 file.</font>
657 <br><font color="#000000">#&nbsp; @currentDir&nbsp;&nbsp; The current directory.</font>
658 <br><font color="#000000">#&nbsp; @relDir&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
659 The directory relative to the root directory.</font>
660 <br><font color="#000000">#&nbsp; @flatRelDir&nbsp;&nbsp; The flattened
661 relative directory name ie "/" replaced by "_".</font>
662 <br><font color="#000000">#&nbsp; @arch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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">#&nbsp; @currentFile&nbsp;&nbsp; Alien.mk</font>
669 <br><font color="#000000">#&nbsp; @headFile&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
670 Alien</font>
671 <br><font color="#000000">#&nbsp; @fullFilePath&nbsp; /usr/development/AlienDev/include/Alien.mk</font>
672 <br><font color="#000000">#&nbsp; @currentDir&nbsp;&nbsp;&nbsp; /usr/development/AlienDev/include</font>
673 <br><font color="#000000">#&nbsp; @relDir</font>
674 <br><font color="#000000">#&nbsp; @flatRelDir</font>
675 <br><font color="#000000">#&nbsp; @arch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -cfile&nbsp;&nbsp;&nbsp; - The name
683 of the configuration file to run.</tt>
684 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -efile&nbsp;&nbsp;&nbsp; - The name
685 of the file which sets the environment.</tt>
686 <br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -trial&nbsp;&nbsp;&nbsp; - 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>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (-rootDir /usr/development/AlienDev/UnitTest
702 <br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
703 -file "*.log"
704 <br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
705 -command "ls -l @currentFile"
706 <br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
707 -depth 20
708 <br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
709 -stdout @headFile.log
710 <br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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&nbsp; 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>&nbsp;&nbsp; -file "*.mk"
732 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean"
733 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES"
734 <br>&nbsp;&nbsp; -depth 0
735 <br>&nbsp;&nbsp; -stdout @arch/@headFile_DEBUG.nblog
736 <br>&nbsp;&nbsp; -stderr @arch/@headFile_DEBUG.nblog
737 <br>&nbsp;&nbsp; -fail @arch/@headFile_DEBUG.nberr
738 <br>&nbsp;&nbsp; -cprefix "Building: "
739 <br>)
740 <br>#
741 <br># Build the non debug version of all libraries
742 <br>(-rootDir $ALIEN_HOME/include
743 <br>&nbsp;&nbsp; -file "*.mk"
744 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO clean"
745 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO"
746 <br>&nbsp;&nbsp; -depth 0
747 <br>&nbsp;&nbsp; -stdout @arch/@headFile_NODEBUG.nblog
748 <br>&nbsp;&nbsp; -stderr @arch/@headFile_NODEBUG.nblog
749 <br>&nbsp;&nbsp; -fail @arch/@headFile_NODEBUG.nberr
750 <br>&nbsp;&nbsp; -cprefix "Building: "
751 <br>)
752 <br>#
753 <br># Build the non debug version of ESProcs
754 <br>(-rootDir $ALIEN_HOME/AlienESProcs
755 <br>&nbsp;&nbsp; -file "Makefile"
756 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean"
757 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile NAME=@flatRelDir
758 DODEBUG=YES"
759 <br>&nbsp;&nbsp; -depth 2
760 <br>&nbsp;&nbsp; -stdout @arch/@flatRelDir_DEBUG.nblog
761 <br>&nbsp;&nbsp; -stderr @arch/@flatRelDir_DEBUG.nblog
762 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@flatRelDir_DEBUG.nberr
763 <br>&nbsp;&nbsp; -cprefix "Building: "
764 <br>)
765 <br>#
766 <br># Build the ESProc library
767 <br>(-rootDir $ALIEN_HOME/AlienESProcs/lib
768 <br>&nbsp;&nbsp; -file "ProcLib.mk"
769 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @fullFilePath"
770 <br>&nbsp;&nbsp; -depth 0
771 <br>&nbsp;&nbsp; -stdout /dev/null
772 <br>&nbsp;&nbsp; -cprefix "Building: "
773 <br>)
774 <br>#
775 <br># Build the standalone executables
776 <br>(-rootDir $ALIEN_HOME/AlienProg
777 <br>&nbsp;&nbsp; -file "*.mk"
778 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean"
779 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES"
780 <br>&nbsp;&nbsp; -depth 2
781 <br>&nbsp;&nbsp; -stdout @arch/@headFile_DEBUG.nblog
782 <br>&nbsp;&nbsp; -stderr @arch/@headFile_DEBUG.nblog
783 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@headFile_DEBUG.nberr
784 <br>&nbsp;&nbsp; -cprefix "Building: "
785 <br>)
786 <br>#
787 <br># Build examples
788 <br>(-rootDir $ALIEN_HOME/Examples
789 <br>&nbsp;&nbsp; -file "*.mk"
790 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean"
791 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES"
792 <br>&nbsp;&nbsp; -depth 2
793 <br>&nbsp;&nbsp; -stdout @arch/@headFile_DEBUG.nblog
794 <br>&nbsp;&nbsp; -stderr @arch/@headFile_DEBUG.nblog
795 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@headFile_DEBUG.nberr
796 <br>&nbsp;&nbsp; -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>&nbsp;-rootDir $ALIEN_HOME/UnitTest/Gool/Automatic
802 <br>&nbsp;&nbsp; -file "*.mk"
803 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO clean"
804 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=NO"
805 <br>&nbsp;&nbsp; -depth 2
806 <br>&nbsp;&nbsp; -stdout @arch/@currentFile_NODEBUG.nblog
807 <br>&nbsp;&nbsp; -stderr @arch/@currentFile_NODEBUG.nblog
808 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@currentFile_NODEBUG.nberr
809 <br>&nbsp;&nbsp; -cprefix "Building: "
810 <br>)
811 <br>#
812 <br># Run all unit tests
813 <br>(-rootDir $ALIEN_HOME/UnitTest/AlienClass/Automatic
814 <br>&nbsp;-rootDir $ALIEN_HOME/UnitTest/Gool/Automatic
815 <br>&nbsp;&nbsp; -file "*.mk"
816 <br>&nbsp;&nbsp; -command "$ALIEN_HOME/scripts/UTRun.pl -file @currentFile"
817 <br>&nbsp;&nbsp; -depth 2
818 <br>&nbsp;&nbsp; -stdout @arch/@headFile_NODEBUG.nblog
819 <br>&nbsp;&nbsp; -stderr @arch/@headFile_NODEBUG.nblog
820 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@headFile_NODEBUG.nberr
821 <br>&nbsp;&nbsp; -cprefix "Testing: "
822 <br>)
823 <br>#
824 <br># Build unit tests with debug on
825 <br>(-rootDir $ALIEN_HOME/UnitTest/AlienClass/Automatic
826 <br>&nbsp;-rootDir $ALIEN_HOME/UnitTest/Gool/Automatic
827 <br>&nbsp;&nbsp; -file "*.mk"
828 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES clean"
829 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile DODEBUG=YES"
830 <br>&nbsp;&nbsp; -depth 2
831 <br>&nbsp;&nbsp; -stdout @arch/@currentFile_DEBUG.nblog
832 <br>&nbsp;&nbsp; -stderr @arch/@currentFile_DEBUG.nblog
833 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@currentFile_DEBUG.nberr
834 <br>&nbsp;&nbsp; -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>&nbsp;-rootDir $ALIEN_HOME/UnitTest/Gool/Automatic
840 <br>&nbsp;&nbsp; -file "*.mk"
841 <br>&nbsp;&nbsp; -command "$ALIEN_HOME/scripts/UTRun.pl -file @currentFile"
842 <br>&nbsp;&nbsp; -depth 2
843 <br>&nbsp;&nbsp; -stdout @arch/@headFile_DEBUG.nblog
844 <br>&nbsp;&nbsp; -stderr @arch/@headFile_DEBUG.nblog
845 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@headFile_DEBUG.nberr
846 <br>&nbsp;&nbsp; -cprefix "Testing: "
847 <br>)
848 <p># Build alien documentation
849 <br>(-rootDir $ALIEN_HOME/doc
850 <br>&nbsp;&nbsp; -file "*.mk"
851 <br>&nbsp;&nbsp; -command "$ALIEN_MAKE -f @currentFile"
852 <br>&nbsp;&nbsp; -depth 0
853 <br>&nbsp;&nbsp; -stdout @arch/@headFile_DEBUG.nblog
854 <br>&nbsp;&nbsp; -stderr @arch/@headFile_DEBUG.nblog
855 <br>&nbsp;&nbsp; -fail&nbsp;&nbsp; @arch/@headFile_DEBUG.nberr
856 <br>&nbsp;&nbsp; -cprefix "Building Documentation: "
857 <br>)
858 <p><font color="#3333FF">UTRun.pl&nbsp; </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>&lt;</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 &lt;UnitTestName>.mk</tt>
864 <br><tt># The executable is expected to be in the sub directory &lt;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">&nbsp;&nbsp;&nbsp; LINUXM:&nbsp;&nbsp;&nbsp;
884 365 OK,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6 Failures,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
885 1 Old log/error files</font></tt>
886 <br><tt><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RS6K:&nbsp;&nbsp;&nbsp;
887 369 OK,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 Failures,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
888 1 Old log/error files</font></tt>
889 <br><tt><font color="#000000">&nbsp;&nbsp; RS6K_v5:&nbsp;&nbsp;&nbsp; 339
890 OK,&nbsp;&nbsp;&nbsp;&nbsp; 26 Failures,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
891 7 Old log/error files</font></tt>
892 <br><tt><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SGIM:&nbsp;&nbsp;&nbsp;
893 369 OK,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 Failures,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
894 1 Old log/error files</font></tt>
895 <br><tt><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SOLM:&nbsp;&nbsp;&nbsp;
896 365 OK,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6 Failures,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
897 1 Old log/error files</font></tt>
898 <br><tt><font color="#000000">&nbsp;WIN32_NT5:&nbsp;&nbsp;&nbsp; 358 OK,&nbsp;&nbsp;&nbsp;&nbsp;
899 12 Failures,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;
902 <br>&nbsp;
903 <br>&nbsp;
904 <br>&nbsp;
905 <br>&nbsp;
906 <br>&nbsp;
907 <br>&nbsp;
908 </body>
909 </html>

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26