Debian Codegraph @

rhino/testsrc/tests/README-jsDriver.html

raw symbols SCIP
1 {# This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. #}
4
5 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
6 <html>
7 <head>
8 <title>jsDriver.pl</title>
9 </head>
10
11 <body bgcolor="white">
12 <h1 align="right">jsDriver.pl</h1>
13
14 <dl>
15 <dt><b>NAME</b></dt>
16 <dd>
17 <b>jsDriver.pl</b> - execute JavaScript programs in various shells in
18 batch or single mode, reporting on failures encountered.
19 <br>
20 <br>
21
22 <dt><b>SYNOPSIS</b></dt>
23 <dd>
24 <table>
25 <tr>
26 <td align="right" valign="top">
27 <code>
28 <b>jsDriver.pl</b>
29 </code>
30 </td>
31 <td>
32 <code>
33 [-hkt] [-b BUGURL] [-c CLASSPATH] [-f OUTFILE]
34 [-j JAVAPATH] [-l TESTLIST ...] [-L NEGLIST ...] [-p TESTPATH]
35 [-s SHELLPATH] [-u LXRURL] [--help] [--confail] [--trace]
36 [--classpath=CLASSPATH] [--file=OUTFILE] [--javapath=JAVAPATH]
37 [--list=TESTLIST] [--neglist=TESTLIST] [--testpath=TESTPATH]
38 [--shellpath=SHELLPATH] [--lxrurl=LXRURL] {-e ENGINETYPE |
39 --engine=ENGINETYPE}
40 </code>
41 </td>
42 </tr>
43 </table>
44 <br>
45 <br>
46
47 <dt><b>DESCRIPTION</b></dt>
48 <dd>
49 <b>jsDriver.pl</b> is normally used to run a series of tests against
50 one of the JavaScript shells. These tests are expected to be laid out
51 in a directory structure exactly three levels deep. The first level
52 is considered the <b>root</b> of the tests, subdirectories under the
53 <b>root</b> represent <b>Test Suites</b> and generally mark broad
54 categories such as <i>ECMA Level 1</i> or <i>Live Connect 3</i>. Under the
55 <b>Test Suites</b> are the <b>Test Categories</b>, which divide the
56 <b>Test Suite</b> into smaller categories, such as <i>Execution Contexts</i>
57 or <i>Lexical Rules</i>. Testcases are located under the
58 <B>Test Categories</b> as normal JavaScript (*.js) files.
59 <p>
60 If a file named <b>shell.js</b> exists in either the
61 <b>Test Suite</b> or the <b>Test Category</b> directory, it is
62 loaded into the shell before the testcase. If <b>shell.js</b>
63 exists in both directories, the version in the <b>Test Suite</b>
64 directory is loaded <i>first</i>, giving the version associated with
65 the <b>Test Category</b> the ability to override functions previously
66 declared. You can use this to
67 create functions and variables common to an entire suite or category.
68 <p>
69 Testcases can report failures back to <b>jsDriver.pl</b> in one of
70 two ways. The most common is to write a line of text containing
71 the word <code>FAILED!</code> to <b>STDOUT</b> or <b>STDERR</b>.
72 When the engine encounters a matching line, the test is marked as
73 failed, and any line containing <code>FAILED!</code> is displayed in
74 the failure report. The second way a test case can report failure is
75 to return an unexpected exit code. By default, <b>jsDriver.pl</b>
76 expects all test cases to return exit code 0, although a test
77 can output a line containing <code>EXPECT EXIT <i>n</i></code> where
78 <i>n</i> is the exit code the driver should expect to see. Testcases
79 can return a nonzero exit code by calling the shell function
80 <code>quit(<i>n</i>)</code> where <code><i>n</i></code> is the
81 code to exit with. The various JavaScript shells report
82 non-zero exit codes under the following conditions:
83
84 <center>
85 <table border="1">
86 <tr>
87 <th>Reason</th>
88 <th>Exit Code</th>
89 </tr>
90 <tr>
91 <td>
92 Engine initialization failure.
93 </td>
94 <td>
95 1
96 </td>
97 </tr>
98 <tr>
99 <td>
100 Invalid argument on command line.
101 </td>
102 <td>
103 2
104 </td>
105 </tr>
106 <tr>
107 <td>
108 Runtime error (uncaught exception) encountered.
109 </td>
110 <td>
111 3
112 </td>
113 </tr>
114 <tr>
115 <td>
116 File argument specified on command line not found.
117 </td>
118 <td>
119 4
120 </td>
121 </tr>
122 <tr>
123 <td>
124 Reserved for future use.
125 </td>
126 <td>
127 5-9
128 </td>
129 </tr>
130 </table>
131 </center>
132 <br>
133 <br>
134
135 <dt><b>OPTIONS</b></dt>
136 <dd>
137 <dl>
138 <dt><b>-b URL, --bugurl=URL</b></dt>
139 <dd>
140 Bugzilla URL. When a testcase writes a line in the format
141 <code>BUGNUMBER <i>n</i></code> to <b>STDOUT</b> or <b>STDERR</b>,
142 <b>jsDriver.pl</b> interprets <code><i>n</i></code> as a bugnumber
143 in the <a href="http://bugzilla.mozilla.org">BugZilla</a> bug
144 tracking system. In the event that a testcase which has specified
145 a bugnumber fails, a hyperlink to the BugZilla database
146 will be included in the output by prefixing the bugnumber with the
147 URL specified here. By default, URL is assumed to be
148 &quot;http://bugzilla.mozilla.org/show_bug.cgi?id=&quot;.
149 <br>
150 <br>
151 <a name="classpath"></a>
152 <dt><b>-c PATH, --classpath=PATH</b></dt>
153 <dd>
154 Classpath to pass the the Java Virtual Machine. When running tests
155 against the <b>Rhino</b> engine, PATH will be passed in as the value
156 to an argument named &quot;-classpath&quot;. If your particular JVM
157 does not support this option, it is recommended you specify your
158 class path via an environment setting. Refer to your JVM
159 documentation for more details about CLASSPATH.
160 <br>
161 <br>
162 <dt><b>-e TYPE ..., --engine=TYPE ...</b></dt>
163 <dd>
164 Required. Type of engine(s) to run the tests against. TYPE can be
165 one or more of the following values:
166 <center>
167 <table border="1">
168 <tr>
169 <th>TYPE</th>
170 <th>Engine</th>
171 </tr>
172 <tr>
173 <td>lcopt</td>
174 <td>LiveConnect, optimized</td>
175 </tr>
176 <tr>
177 <td>lcdebug</td>
178 <td>LiveConnect, debug</td>
179 </tr>
180 <tr>
181 <td>rhino</td>
182 <td>Rhino compiled mode</td>
183 </tr>
184 <tr>
185 <td>rhinoi</td>
186 <td>Rhino interpreted mode</td>
187 </tr>
188 <tr>
189 <td>rhinoms</td>
190 <td>Rhino compiled mode for the Microsoft VM (jview)</td>
191 </tr>
192 <tr>
193 <td>rhinomsi</td>
194 <td>Rhino interpreted mode for the Microsoft VM (jview)</td>
195 </tr>
196 <tr>
197 <td>smopt</td>
198 <td>Spider-Monkey, optimized</td>
199 </tr>
200 <tr>
201 <td>smdebug</td>
202 <td>Spider-Monkey, debug</td>
203 </tr>
204 <tr>
205 <td>xpcshell</td>
206 <td>XPConnect shell</td>
207 </tr>
208 </table>
209 </center>
210 <br>
211 <br>
212 <dt><b>-f FILE, --file=FILE</b></dt>
213 <dd>
214 Generate html output to the HTML file named by FILE. By default,
215 a filename will be generated using a combination of the engine type
216 and a date/time stamp, in the format:
217 <code>results-<i>&lt;engine-type&gt;</i>-<i>&lt;date-stamp&gt;</i>.html</code>
218 <br>
219 <br>
220 <dt><b>-h, --help</b></dt>
221 <dd>
222 Prints usage information.
223 <br>
224 <br>
225 <dt><b>-j PATH, --javapath=PATH</b></dt>
226 <dd>
227 Set the location of the Java Virtual Machine to use when running
228 tests against the <b>Rhino</b> engine. This can be used to test
229 against multiple JVMs on the same system.
230 <br>
231 <br>
232 <dt><b>-k, --confail</b></dt>
233 <dd>
234 Log failures to the console. This will show any failures, as they
235 occur, on <b>STDERR</b> in addition to creating the HTML results
236 file. This can be useful for times when it may be
237 counter-productive to load an HTML version of the results each time
238 a test is re-run.
239 <br>
240 <br>
241 <dt><b>-l FILE ..., --list=FILE ...</b></dt>
242 <dd>
243 Specify a list of tests to execute. FILE can be a plain text file
244 containing a list of testcases to execute, a subdirectory
245 in which to
246 <a href="http://www.instantweb.com/~foldoc/foldoc.cgi?query=grovel">grovel</a>
247 for tests, or a single testcase to execute. Any number of FILE
248 specifiers may follow this option. The driver uses the fact that a
249 valid testcase should be a file ending in .js to make the distinction
250 between a file containing a list of tests and an actual testcase.
251 <br>
252 <br>
253 <dt><b>-L FILE ..., --neglist=FILE ...</b></dt>
254 <dd>
255 Specify a list of tests to skip. FILE has the same meaning as in
256 the <b>-l</b> option. This option is evaluated after
257 <b>all</b> <b>-l</b> and <b>--list</b> options, allowing a user
258 to subtract a single testcase, a directory of testcases, or a
259 collection of unrelated testcases from the execution list.
260 <br>
261 <br>
262 <dt><b>-p PATH, --testpath=PATH</b></dt>
263 <dd>
264 Directory holding the &quot;Test Suite&quot; subdirectories. By
265 default this is ./
266 <br>
267 <br>
268 <dt><b>-s PATH, --shellpath=PATH</b></dt>
269 <dd>
270 Directory holding the JavaScript shell. This can be used to override
271 the automatic shell location <b>jsDriver.pl</b> performs based on
272 you OS and engine type. For Non <b>Rhino</b> engines, this
273 includes the name of the executable as well as the path. In
274 <b>Rhino</b>, this path will be appended to your
275 <a href="#classpath">CLASSPATH</a>. For the
276 <b>SpiderMonkey</b> shells, this value defaults to
277 ../src/&lt;Platform-and-buildtype-specific-directory&gt;/[js|jsshell],
278 for the
279 <b>LiveConnect</b> shells,
280 ../src/liveconnect/src/&lt;Platform-and-buildtype-specific-directory&gt;/lschell
281 and for the <b>xpcshell</b> the default is the value of your
282 <code>MOZILLA_FIVE_HOME</code> environment variable. There is no
283 default (as it is usually not needed) for the <b>Rhino</b> shell.
284 <br>
285 <br>
286 <dt><b>-t, --trace</b></dt>
287 <dd>
288 Trace execution of <b>jsDriver.pl</b>. This option is primarily
289 used for debugging of the script itself, but if you are interested in
290 seeing the actual command being run, or generally like gobs of
291 useless information, you may find it entertaining.
292 <br>
293 <br>
294 <dt><b>-u URL, --lxrurl=URL</b></dt>
295 <dd>
296 Failures listed in the HTML results will be hyperlinked to the
297 lxr source available online by prefixing the test path and
298 name with this URL. By default, URL is
299 http://lxr.mozilla.org/mozilla/source/js/tests/
300 <br>
301 <br>
302
303 </dl>
304 <dt><b>SEE ALSO</b></dt>
305 <dd>
306 <a href="http://lxr.mozilla.org/mozilla/source/js/tests/jsDriver.pl">jsDriver.pl</a>,
307 <a href="http://lxr.mozilla.org/mozilla/source/js/tests/mklistpage.pl">mklistpage.pl</a>,
308 <a href="http://www.mozilla.org/js/">http://www.mozilla.org/js/</a>,
309 <a href="http://www.mozilla.org/js/tests/library.html">http://www.mozilla.org/js/tests/library.html</a>
310 <br>
311 <br>
312
313 <dt><b>REQUIREMENTS</b></dt>
314 <dd>
315 <b>jsDriver.pl</b> requires the
316 <a href="http://search.cpan.org/search?module=Getopt::Mixed">Getopt::Mixed</a>
317 perl package, available from <a href="http://www.cpan.org">cpan.org</a>.
318 <br>
319 <br>
320 <dt><b>EXAMPLES</b></dt>
321 <dd>
322 <code>perl jsDriver.pl -e smdebug -L lc*</code><br>
323 Executes all tests EXCEPT the liveconnect tests against the
324 SpiderMonkey debug shell, writing the results
325 to the default result file. (NOTE: Unix shells take care of wildcard
326 expansion, turning <code>lc*</code> into <code>lc2 lc3</code>. Under
327 a DOS shell, you must explicitly list the directories.)
328 <p>
329 <code>perl jsDriver.pl -e rhino -L rhino-n.tests</code><br>
330 Executes all tests EXCEPT those listed in the
331 <code>rhino-n.tests</code> file.
332 <p>
333 <code>perl -I/home/rginda/perl/lib/ jsDriver.pl -e lcopt -l lc2
334 lc3 -f lcresults.html -k</code><br>
335 Executes ONLY the tests under the <code>lc2</code> and <code>lc3</code>
336 directories against the LiveConnect shell. Results will be written to
337 the file <code>lcresults.html</code> <b>AND</b> the console. The
338 <code>-I</code> option tells perl to look for modules in the
339 <code>/home/rginda/perl/lib</code> directory (in addition to the
340 usual places), useful if you do not have root access to install new
341 modules on the system.
342 </dl>
343 <hr>
344 Author: Robert Ginda<br>
345 Currently maintained by <i><a href="mailto:[email protected]">Phil Schwartau</a> </i><br>
346 <!-- Created: Thu Dec 2 19:08:05 PST 1999 -->
347 </body>
348 </html>