81 'port': ('HGTEST_PORT', 20059), |
81 'port': ('HGTEST_PORT', 20059), |
82 } |
82 } |
83 |
83 |
84 def parseargs(): |
84 def parseargs(): |
85 parser = optparse.OptionParser("%prog [options] [tests]") |
85 parser = optparse.OptionParser("%prog [options] [tests]") |
|
86 |
|
87 # keep these sorted |
|
88 parser.add_option("--blacklist", action="append", |
|
89 help="skip tests listed in the specified blacklist file") |
86 parser.add_option("-C", "--annotate", action="store_true", |
90 parser.add_option("-C", "--annotate", action="store_true", |
87 help="output files annotated with coverage") |
91 help="output files annotated with coverage") |
88 parser.add_option("--child", type="int", |
92 parser.add_option("--child", type="int", |
89 help="run as child process, summary to given fd") |
93 help="run as child process, summary to given fd") |
90 parser.add_option("-c", "--cover", action="store_true", |
94 parser.add_option("-c", "--cover", action="store_true", |
91 help="print a test coverage report") |
95 help="print a test coverage report") |
|
96 parser.add_option("-d", "--debug", action="store_true", |
|
97 help="debug mode: write output of test scripts to console" |
|
98 " rather than capturing and diff'ing it (disables timeout)") |
92 parser.add_option("-f", "--first", action="store_true", |
99 parser.add_option("-f", "--first", action="store_true", |
93 help="exit on the first test failure") |
100 help="exit on the first test failure") |
|
101 parser.add_option("--inotify", action="store_true", |
|
102 help="enable inotify extension when running tests") |
94 parser.add_option("-i", "--interactive", action="store_true", |
103 parser.add_option("-i", "--interactive", action="store_true", |
95 help="prompt to accept changed output") |
104 help="prompt to accept changed output") |
96 parser.add_option("-j", "--jobs", type="int", |
105 parser.add_option("-j", "--jobs", type="int", |
97 help="number of jobs to run in parallel" |
106 help="number of jobs to run in parallel" |
98 " (default: $%s or %d)" % defaults['jobs']) |
107 " (default: $%s or %d)" % defaults['jobs']) |
|
108 parser.add_option("--keep-tmpdir", action="store_true", |
|
109 help="keep temporary directory after running tests") |
99 parser.add_option("-k", "--keywords", |
110 parser.add_option("-k", "--keywords", |
100 help="run tests matching keywords") |
111 help="run tests matching keywords") |
101 parser.add_option("--keep-tmpdir", action="store_true", |
112 parser.add_option("-l", "--local", action="store_true", |
102 help="keep temporary directory after running tests") |
113 help="shortcut for --with-hg=<testdir>/../hg") |
103 parser.add_option("--tmpdir", type="string", |
114 parser.add_option("-n", "--nodiff", action="store_true", |
104 help="run tests in the given temporary directory" |
115 help="skip showing test changes") |
105 " (implies --keep-tmpdir)") |
|
106 parser.add_option("-d", "--debug", action="store_true", |
|
107 help="debug mode: write output of test scripts to console" |
|
108 " rather than capturing and diff'ing it (disables timeout)") |
|
109 parser.add_option("-R", "--restart", action="store_true", |
|
110 help="restart at last error") |
|
111 parser.add_option("-p", "--port", type="int", |
116 parser.add_option("-p", "--port", type="int", |
112 help="port on which servers should listen" |
117 help="port on which servers should listen" |
113 " (default: $%s or %d)" % defaults['port']) |
118 " (default: $%s or %d)" % defaults['port']) |
|
119 parser.add_option("--pure", action="store_true", |
|
120 help="use pure Python code instead of C extensions") |
|
121 parser.add_option("-R", "--restart", action="store_true", |
|
122 help="restart at last error") |
114 parser.add_option("-r", "--retest", action="store_true", |
123 parser.add_option("-r", "--retest", action="store_true", |
115 help="retest failed tests") |
124 help="retest failed tests") |
116 parser.add_option("-S", "--noskips", action="store_true", |
125 parser.add_option("-S", "--noskips", action="store_true", |
117 help="don't report skip tests verbosely") |
126 help="don't report skip tests verbosely") |
118 parser.add_option("-t", "--timeout", type="int", |
127 parser.add_option("-t", "--timeout", type="int", |
119 help="kill errant tests after TIMEOUT seconds" |
128 help="kill errant tests after TIMEOUT seconds" |
120 " (default: $%s or %d)" % defaults['timeout']) |
129 " (default: $%s or %d)" % defaults['timeout']) |
|
130 parser.add_option("--tmpdir", type="string", |
|
131 help="run tests in the given temporary directory" |
|
132 " (implies --keep-tmpdir)") |
121 parser.add_option("-v", "--verbose", action="store_true", |
133 parser.add_option("-v", "--verbose", action="store_true", |
122 help="output verbose messages") |
134 help="output verbose messages") |
123 parser.add_option("-n", "--nodiff", action="store_true", |
135 parser.add_option("--view", type="string", |
124 help="skip showing test changes") |
136 help="external diff viewer") |
125 parser.add_option("--with-hg", type="string", |
137 parser.add_option("--with-hg", type="string", |
126 metavar="HG", |
138 metavar="HG", |
127 help="test using specified hg script rather than a " |
139 help="test using specified hg script rather than a " |
128 "temporary installation") |
140 "temporary installation") |
129 parser.add_option("--local", action="store_true", |
|
130 help="shortcut for --with-hg=<testdir>/../hg") |
|
131 parser.add_option("--pure", action="store_true", |
|
132 help="use pure Python code instead of C extensions") |
|
133 parser.add_option("-3", "--py3k-warnings", action="store_true", |
141 parser.add_option("-3", "--py3k-warnings", action="store_true", |
134 help="enable Py3k warnings on Python 2.6+") |
142 help="enable Py3k warnings on Python 2.6+") |
135 parser.add_option("--inotify", action="store_true", |
|
136 help="enable inotify extension when running tests") |
|
137 parser.add_option("--blacklist", action="append", |
|
138 help="skip tests listed in the specified blacklist file") |
|
139 |
143 |
140 for option, default in defaults.items(): |
144 for option, default in defaults.items(): |
141 defaults[option] = int(os.environ.get(*default)) |
145 defaults[option] = int(os.environ.get(*default)) |
142 parser.set_defaults(**defaults) |
146 parser.set_defaults(**defaults) |
143 (options, args) = parser.parse_args() |
147 (options, args) = parser.parse_args() |