Opened at 2011-01-13T04:20:49Z
Last modified at 2011-01-20T20:28:05Z
#1303 closed defect
allow running Tahoe correctly via other commands such as coverage — at Initial Version
Reported by: | davidsarah | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.8.2 |
Component: | code-frontend-cli | Version: | 1.8.1 |
Keywords: | trial coverage | Cc: | |
Launchpad Bug: |
Description
Normally, the command to use coverage to obtain coverage information for another program such as Tahoe would be:
coverage run <coverage-options> bin/tahoe <tahoe-options>
For example, with the fix to #1296, you could get branch coverage for the Tahoe test suite with
coverage run --branch bin/tahoe debug trial
However, this does not work, for two reasons:
- on Windows, the Unicode arguments hack implemented in src/allmydata/windows/fixups.py undoes the modification to sys.argv performed by coverage before it runs bin/tahoe. This causes Tahoe to act as though the command line were bin/tahoe run --branch bin/tahoe debug trial.
- the actual Tahoe process is a subprocess of bin/tahoe, but coverage will only obtain coverage information for the bin/tahoe script itself.
- if we tried to work around the previous point by using (on Unix) coverage run --branch support/bin/tahoe debug trial, we wouldn't be setting PYTHONPATH correctly.
The attached patch makes, for example:
bin/tahoe @coverage run --branch @tahoe debug trial
do the right thing. ("@tahoe" will be replaced by the full path to the support script.)
It is more general than just running coverage; you can specify an arbitrary command. For example, to specify the python -3 option (warning about Python 3 incompatibilities):
bin/tahoe @python -3 @tahoe <command>
(Again, python -3 bin/tahoe <command> would not work because it would run only the bin/tahoe script with -3.)
Between bin/tahoe-script.template and src/allmydata/windows/fixups.py, we actually end up having less code with this patch, because it uses a simpler way of deciding which suffix of the arguments to retain.
Add support to bin/tahoe for invoking a runner command prefixed with @, with the Tahoe libraries on the PYTHONPATH. This is documented in 'tahoe debug --help'.