Ticket #1296: tahoe-debug-trial.darcs.patch

File tahoe-debug-trial.darcs.patch, 13.0 KB (added by davidsarah, at 2011-01-07T10:10:51Z)

src/allmydata/scripts/debug.py: add 'tahoe debug trial' command. refs #1296

Line 
11 patch for repository http://tahoe-lafs.org/source/tahoe-lafs/trunk:
2
3Fri Jan  7 09:37:18 GMT Standard Time 2011  david-sarah@jacaranda.org
4  * src/allmydata/scripts/debug.py: add 'tahoe debug trial' command. refs #1296
5
6New patches:
7
8[src/allmydata/scripts/debug.py: add 'tahoe debug trial' command. refs #1296
9david-sarah@jacaranda.org**20110107093718
10 Ignore-this: 9228ffe655323aa486e88aded90983d7
11] {
12hunk ./src/allmydata/scripts/debug.py 4
13 
14 # do not import any allmydata modules at this level. Do that from inside
15 # individual functions instead.
16-import struct, time, os
17+import struct, time, os, sys
18 from twisted.python import usage, failure
19 from twisted.internet import defer
20hunk ./src/allmydata/scripts/debug.py 7
21+from twisted.scripts import trial as twisted_trial
22 
23 
24 class DumpOptions(usage.Options):
25hunk ./src/allmydata/scripts/debug.py 782
26     return code.interact()
27 
28 
29+class TrialOptions(twisted_trial.Options):
30+    def getSynopsis(self):
31+        return "Usage: tahoe debug trial [options] [[file|package|module|TestCase|testmethod]...]"
32+
33+    def parseArgs(self, *args):
34+        if not args:
35+            args = ["allmydata.test"]
36+        twisted_trial.Options.parseArgs(self, *args)
37+
38+    def getUsage(self, width=None):
39+        t = twisted_trial.Options.getUsage(self, width)
40+        t += """
41+The 'tahoe debug trial' command uses the correct imports for this instance of
42+Tahoe-LAFS. The default test suite is 'allmydata.test'.
43+"""
44+        return t
45+
46+
47+def trial(config):
48+    twisted_trial._initialDebugSetup(config)
49+    trialRunner = twisted_trial._makeRunner(config)
50+    suite = twisted_trial._getSuite(config)
51+
52+    # run the tests
53+    if config.get('until-failure'):
54+        test_result = trialRunner.runUntilFailure(suite)
55+    else:
56+        test_result = trialRunner.run(suite)
57+
58+    # write coverage data
59+    if hasattr(config, 'tracer') and config.tracer:
60+        sys.settrace(None)
61+        results = config.tracer.results()
62+        coverdir = os.path.join(config.get('temp-directory') or '_trial_temp', 'coverage')
63+        results.write_results(show_missing=1, summary=False, coverdir=coverdir)
64+
65+    if test_result.wasSuccessful():
66+        return 0  # success
67+    else:
68+        return 1  # failure
69+
70+
71 class DebugCommand(usage.Options):
72     subCommands = [
73         ["dump-share", None, DumpOptions,
74hunk ./src/allmydata/scripts/debug.py 833
75         ["catalog-shares", None, CatalogSharesOptions, "Describe all shares in node dirs."],
76         ["corrupt-share", None, CorruptShareOptions, "Corrupt a share by flipping a bit."],
77         ["repl", None, ReplOptions, "Open a Python interpreter."],
78+        ["trial", None, TrialOptions, "Run Twisted Trial with the correct imports."],
79         ]
80     def postOptions(self):
81         if not hasattr(self, 'subOptions'):
82hunk ./src/allmydata/scripts/debug.py 850
83     tahoe debug catalog-shares  Describe all shares in node dirs.
84     tahoe debug corrupt-share   Corrupt a share by flipping a bit.
85     tahoe debug repl            Open a Python interpreter.
86+    tahoe debug trial           Run Twisted Trial with the correct imports.
87 
88 Please run e.g. 'tahoe debug dump-share --help' for more details on each
89 subcommand.
90hunk ./src/allmydata/scripts/debug.py 857
91 """
92         return t
93 
94+
95 subDispatch = {
96     "dump-share": dump_share,
97     "dump-cap": dump_cap,
98hunk ./src/allmydata/scripts/debug.py 865
99     "catalog-shares": catalog_shares,
100     "corrupt-share": corrupt_share,
101     "repl": repl,
102+    "trial": trial,
103     }
104 
105 
106}
107
108Context:
109
110[docs: update performance.rst to describe the difference between already-uploaded and not-already-uploaded, to parameterize segment size, and to use "~A" to mean "approximately A"
111zooko@zooko.com**20110104065455
112 Ignore-this: 8df0d79a062ee19854c0211bd202f606
113]
114[bin/tahoe-script.template: On non-Windows, invoke support/bin/tahoe directly as a script (rather than via python), so that 'top' for example will show it as 'tahoe'. On Windows, simplify some code that set argv[0], which is never used. fixes #174
115david-sarah@jacaranda.org**20101127232650
116 Ignore-this: 42a86f3eecfdc1ea7b76a7cc68626898
117]
118[test_runner: avoid unnecessary use of non-ASCII.
119david-sarah@jacaranda.org**20110101100101
120 Ignore-this: e2ff40dce6bb3b021306f2913d4e75df
121]
122[docs/quickstart.html: fix redundant, badly nested tag. refs #1284
123david-sarah@jacaranda.org**20110102175159
124 Ignore-this: 2ae9cc0b47d2e87b9eb64a0f517c4eef
125]
126[docs/quickstart.html: information about 'troublesome dependencies' and 'verified systems' de-emphasized by smaller italic font. Re-wrap so that the HTML source is readable (just about) as text. Minor wording tweaks. Improve organization by adding 'Windows Caveats' subsection. fixes #1284
127david-sarah@jacaranda.org**20110102174212
128 Ignore-this: e9dc57983974478200856651c5318fee
129]
130[NEWS: update entry for removal of Mac and Windows apps. refs #1282
131david-sarah@jacaranda.org**20101226042245
132 Ignore-this: c8099bc6e8235718d042c9a13c1e2425
133]
134[Move dependency imports from windows/depends.py (which has gone away) into src/allmydata/windows/tahoesvc.py. Also fix a pyflakes warning, and change the service display name from 'Allmydata Tahoe Node' to 'Tahoe-LAFS node'. refs #1282
135david-sarah@jacaranda.org**20101226042100
136 Ignore-this: ee45f324934e1251380206dbee6346d0
137]
138[Remove unmaintained Windows GUI app, except for windows/tahoesvc.py which is moved to src/allmydata/windows. refs #1282
139david-sarah@jacaranda.org**20101226040237
140 Ignore-this: cae37b6622a7dd5940acc7d3e6a98b90
141]
142[Remove the Makefile targets relating to the Mac GUI app. refs #1282
143david-sarah@jacaranda.org**20101226025859
144 Ignore-this: 75303be783974b41138744ec62b07965
145]
146[NEWS: remove unmaintained Mac GUI app. refs #1282
147david-sarah@jacaranda.org**20101226020858
148 Ignore-this: 40474a07f4a550b48563d35350be7ab5
149]
150[Remove unmaintained Mac GUI app. fixes #1282
151david-sarah@jacaranda.org**20101226020508
152 Ignore-this: b3613bf1abfd284d542bf7c753ec557a
153]
154[Remove src/allmydata/util/find_exe.py which is no longer used. fixes #1150
155david-sarah@jacaranda.org**20101226023206
156 Ignore-this: 7436c9b53bf210aed34a1a973cd9cace
157]
158[status_web_pages_review.darcs.patch
159freestorm77@gmail.com**20110102034214
160 Ignore-this: 29f1ecb36177f10f3f846b3d56b313b2
161 
162 I make some changes on status web pages
163 
164 status.xhtml:
165 - Delete unused webform_css link
166 - Align tables on the left
167 
168 tahoe-css:
169 - Do some minor changes on code synthax
170 - changes table.status-download-events style to look like other tables
171 
172 status.py:
173 - Align table on the left
174 - Changes table header
175 - Add heading tags
176 - Modify google api graph: add image border, calculate height to feet data
177 
178 signed-off-by: zooko@zooko.com
179 fixes #1219
180]
181[test_storage.py: fix a pyflakes unused import warning.
182david-sarah@jacaranda.org**20101231220756
183 Ignore-this: df08231540cb7dff9d2b038e47ab30ee
184]
185[test_storage.py: leave at least 512 MiB free when running test_large_share. refs #1195
186david-sarah@jacaranda.org**20101231203215
187 Ignore-this: b2144c0341c3452b5d4ba219e284ea0e
188]
189[storage: use fileutil's version of get_disk_stats() and get_available_space(), use mockery/fakery in tests, enable large share test on platforms with sparse files and if > 4 GiB of disk space is currently available
190zooko@zooko.com**20100910173629
191 Ignore-this: 1304f1164c661de6d5304f993eb9b27b
192]
193[fileutil: copy in the get_disk_stats() and get_available_space() functions from storage/server.py
194zooko@zooko.com**20100910173520
195 Ignore-this: 8b15569715f710f4fc5092f7ca109253
196]
197[Update foolscap version requirement to 0.6.0, to address http://foolscap.lothar.com/trac/ticket/167
198david-sarah@jacaranda.org**20101231060039
199 Ignore-this: 98d2b8086a1a500b9f4565bca5a3810
200]
201[docs/webapi.rst: typos.
202david-sarah@jacaranda.org**20101230034422
203 Ignore-this: d1f5166d72cc711f7e0d9981eac9105e
204]
205[docs/webapi.rst: capitalization, formatting of section on URL character encoding, and a correction about Internet Explorer.
206david-sarah@jacaranda.org**20101230034049
207 Ignore-this: b3b9819d2fb264b4cdc5c8afd4e8c48d
208]
209[docs: corrections and clarifications.
210david-sarah@jacaranda.org**20101227051056
211 Ignore-this: e33202858c7644c58f3f924b164294b6
212]
213[docs: more formatting cleanups and corrections. Spell webapi and wapi as web-API.
214david-sarah@jacaranda.org**20101227050533
215 Ignore-this: 18b23cbfb780df585d8a722a1ec63e94
216]
217[docs/debian.rst: bring description of building dependencies from source up-to-date, and change hostname from allmydata.com to tahoe-lafs.org.
218david-sarah@jacaranda.org**20101212222912
219 Ignore-this: f38462afc88b4475195610385a28391c
220]
221[docs/architecture.rst: correct rst syntax.
222david-sarah@jacaranda.org**20101212202003
223 Ignore-this: 3fbe12feb28bec6f1c63aedbc79aad21
224]
225[docs/architecture.rst: formatting.
226david-sarah@jacaranda.org**20101212201719
227 Ignore-this: 305fa5dfc2939355eaf6d0d2161eb1ff
228]
229[docs: linkification, wording improvements.
230david-sarah@jacaranda.org**20101212201234
231 Ignore-this: 4e67287f527a8bc728cfbd93255d2aae
232]
233[docs: formatting.
234david-sarah@jacaranda.org**20101212201115
235 Ignore-this: 2e0ed394ac7726651d3a4f2c4b0d3798
236]
237[docs/configuration.rst: more formatting tweaks; which -> that.
238david-sarah@jacaranda.org**20101212195522
239 Ignore-this: a7becb7021854ca5a90edd892b36fdd7
240]
241[docs/configuration.rst: more changes to formatting.
242david-sarah@jacaranda.org**20101212194511
243 Ignore-this: 491aac33e5f5268d224359f1447d10be
244]
245[docs/configuration.rst: changes to formatting (mainly putting commands and filenames in monospace).
246david-sarah@jacaranda.org**20101212181828
247 Ignore-this: 8a1480e2d5f43bee678476424615b50f
248]
249[scripts/backupdb.py: more accurate comment about path field.
250david-sarah@jacaranda.org**20101212170320
251 Ignore-this: 50e47a2228a85207bbcd188a78a0d4e6
252]
253[scripts/cli.py: fix missing 'put' in usage example for 'tahoe put'.
254david-sarah@jacaranda.org**20101212170207
255 Ignore-this: 2cbadf066fff611fc03d3c0ff97ce6ec
256]
257[docs/frontends/CLI.rst: changes to formatting (mainly putting commands and filenames in monospace), and to command syntax to reflect that DIRCAP/... is accepted. Clarify the syntax of 'tahoe put' and other minor corrections. Tahoe -> Tahoe-LAFS.
258david-sarah@jacaranda.org**20101212165800
259 Ignore-this: a123ef6b564aa8624d1e79c97068ea12
260]
261[docs/frontends/CLI.rst: Unicode arguments to 'tahoe' work on Windows as of v1.7.1.
262david-sarah@jacaranda.org**20101212063740
263 Ignore-this: 3977a99dfa86ac33a44171deaf43aaab
264]
265[docs/known_issues.rst: fix title and linkify another URL. refs #1225
266david-sarah@jacaranda.org**20101212062817
267 Ignore-this: cc91287f7fb51c23440b3d2fe79c449c
268]
269[docs/known_issues.rst: fix an external link. refs #1225
270david-sarah@jacaranda.org**20101212062435
271 Ignore-this: b8cbf12f353131756c358965c48060ec
272]
273[Fix a link from uri.rst to dirnodes.rst. refs #1225
274david-sarah@jacaranda.org**20101212054502
275 Ignore-this: af6205299f5c9a33229cab259c00f9d5
276]
277[Fix a link from webapi.rst to FTP-and-SFTP.rst. refs #1225
278david-sarah@jacaranda.org**20101212053435
279 Ignore-this: 2b9f88678c3447ea860d6b61e8799858
280]
281[More specific hyperlink to architecture.rst from helper.rst. refs #1225
282david-sarah@jacaranda.org**20101212052607
283 Ignore-this: 50424c768fca481252fabf58424852dc
284]
285[Update hyperlinks between docs, and linkify some external references. refs #1225
286david-sarah@jacaranda.org**20101212051459
287 Ignore-this: cd43a4c3d3de1f832abfa88d5fc4ace1
288]
289[docs/specifications/dirnodes.rst: fix references to mutable.rst. refs #1225
290david-sarah@jacaranda.org**20101212012720
291 Ignore-this: 6819b4b4e06e947ee48b365e840db37d
292]
293[docs/specifications/mutable.rst: correct the magic string for v1 mutable containers. refs #1225
294david-sarah@jacaranda.org**20101212011400
295 Ignore-this: 99a5fcdd40cef83dbb08f323f6cdaaca
296]
297[Move .txt files in docs/frontends and docs/specifications to .rst. refs #1225
298david-sarah@jacaranda.org**20101212010251
299 Ignore-this: 8796d35d928370f7dc6ad2dafdc1c0fe
300]
301[Convert docs/frontends and docs/specifications to reStructuredText format (not including file moves).
302david-sarah@jacaranda.org**20101212004632
303 Ignore-this: e3ceb2d832d73875abe48624ddbb5622
304]
305[scripts/cli.py: remove the disclaimer in the help for 'tahoe cp' that it does not handle non-ASCII filenames well. (At least, we intend to handle them.)
306david-sarah@jacaranda.org**20101130002145
307 Ignore-this: 94c003efaa20b9eb4a83503d79844ca
308]
309[relnotes.txt: fifth -> sixth labor-of-love release
310zooko@zooko.com**20101129045647
311 Ignore-this: 21c245015268b38916e3a138d256c09d
312]
313[Makefile: BB_BRANCH is set to the empty string for trunk, not the string 'trunk'.
314david-sarah@jacaranda.org**20101128233512
315 Ignore-this: 5a7ef8eb10475636d21b91e25b56c369
316]
317[relnotes.txt: eleventh -> twelfth release.
318david-sarah@jacaranda.org**20101128223321
319 Ignore-this: 1e26410156a665271c1170803dea2c0d
320]
321[relnotes.tst: point to known_issues.rst, not known_issues.txt.
322david-sarah@jacaranda.org**20101128222918
323 Ignore-this: 60194eb4544cac446fe4f60b3e34b887
324]
325[quickstart.html: fix link to point to allmydata-tahoe-1.8.1.zip.
326david-sarah@jacaranda.org**20101128221728
327 Ignore-this: 7b3ee86f8256aa12f5d862f689f3ee29
328]
329[TAG allmydata-tahoe-1.8.1
330david-sarah@jacaranda.org**20101128212336
331 Ignore-this: 9c18bdeaef4822f590d2a0d879e00621
332]
333Patch bundle hash:
33403d27cc6c7340d1a8a039a40221003399e776b23