|
1 JS Trace Test Suite |
|
2 |
|
3 * PURPOSE |
|
4 |
|
5 This is a test suite for testing TraceMonkey. All tests are run in the JS shell |
|
6 with tracing enabled (-j). |
|
7 |
|
8 * REQUIREMENTS |
|
9 |
|
10 Python 2.5. This is already a standard requirement for building our tree. |
|
11 |
|
12 * RUNNING THE TESTS |
|
13 |
|
14 Basic usage: |
|
15 |
|
16 python jit_test.py <path-to-js-shell> |
|
17 |
|
18 The progress bar shows [#tests passed, #tests failed, #tests run] at the left. |
|
19 If all tests pass, the output is 'PASSED ALL'. The test suite can be interrupted |
|
20 at any time with Ctrl+C and partial results will be printed. |
|
21 |
|
22 To run only the basic tests, not including the slow tests: |
|
23 |
|
24 python jit_test.py <path-to-js-shell> basic |
|
25 |
|
26 For more options: |
|
27 |
|
28 python jit_test.py -h |
|
29 |
|
30 * CREATING NEW TESTS |
|
31 |
|
32 Simply create a JS file under the 'tests/' directory. Most tests should go in |
|
33 'tests/basic/'. |
|
34 |
|
35 All tests are run with 'lib/prolog.js' included first on the command line. The |
|
36 command line also creates a global variable 'libdir' that is set to the path |
|
37 of the 'lib' directory. To include a file 'foo.js' from the lib directory in a |
|
38 test case: |
|
39 |
|
40 load(libdir + 'foo.js') |
|
41 |
|
42 * TEST METALINES |
|
43 |
|
44 The first line of a test case can contain a special comment controlling how the |
|
45 test is run. For example: |
|
46 |
|
47 // |jit-test| allow-oom; |
|
48 |
|
49 The general format in EBNF is: |
|
50 |
|
51 metaline ::= cookie { item ";" } |
|
52 cookie ::= "|jit-test|" |
|
53 item ::= flag | attribute |
|
54 |
|
55 flag ::= "slow" | "allow-oom" | "valgrind" | "tz-pacific" | |
|
56 "ion-eager" | "debug" | |
|
57 "dump-bytecode" | |
|
58 |
|
59 |
|
60 attribute ::= name ":" value |
|
61 name ::= "error" | "exitstatus" |
|
62 value ::= <string> |
|
63 |
|
64 The metaline may appear anywhere in the first line of the file: this allows it |
|
65 to be placed inside any kind of comment. |
|
66 |
|
67 The meaning of the items: |
|
68 |
|
69 slow Test runs slowly. Do not run if the --no-slow option is given. |
|
70 allow-oom If the test runs out of memory, it counts as passing. |
|
71 valgrind Run test under valgrind. |
|
72 tz-pacific Always run test with the Pacific time zone (TZ=PST8PDT). |
|
73 ion-eager Run js with --ion-eager, whether --jitflags says to or not |
|
74 debug Run js with -d, whether --jitflags says to or not |
|
75 dump-bytecode Run js with -D, whether --jitflags says to or not |
|
76 |
|
77 error The test should be considered to pass iff it throws the |
|
78 given JS exception. |
|
79 exitstatus The test should exit with the given status value (an integer). |
|
80 |
|
81 * END |