#1303 closed defect (fixed)

allow running Tahoe correctly via other commands such as coverage

Reported by: davidsarah Owned by: davidsarah
Priority: major Milestone: 1.8.2
Component: code-frontend-cli Version: 1.8.1
Keywords: trial coverage Cc:
Launchpad Bug:

Description (last modified by davidsarah)

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 three 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.

Attachments (2)

bin-tahoe-runner-support.darcs.patch (18.1 KB) - added by davidsarah at 2011-01-13T04:24:01Z.
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'.
bin-tahoe-runner-support.darcs.2.patch (20.7 KB) - added by davidsarah at 2011-01-19T05:55:50Z.
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'.

Download all attachments as: .zip

Change History (12)

Changed at 2011-01-13T04:24:01Z by davidsarah

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'.

comment:1 Changed at 2011-01-13T04:29:39Z by davidsarah

  • Keywords review-needed added
  • Milestone changed from undecided to soon

comment:2 Changed at 2011-01-13T04:31:28Z by davidsarah

  • Description modified (diff)

comment:3 Changed at 2011-01-19T05:40:51Z by david-sarah@…

In 93c1909847e9dc44:

bin/tahoe-script.template, src/windows/fixups.py: simplify the method of stripping initial arguments in sys.argv on Windows. This helps with bb-freeze and running tahoe via 'coverage'. Also includes some wording changes and minor refactoring of bin/tahoe-script.template. refs #585, #1303

comment:4 Changed at 2011-01-19T05:48:27Z by zooko

  • Milestone changed from soon to 1.8.2

Changed at 2011-01-19T05:55:50Z by davidsarah

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'.

comment:5 Changed at 2011-01-19T06:12:37Z by zooko

I reviewed 93c1909847e9dc44 and it looks good to me.

comment:6 Changed at 2011-01-19T07:28:26Z by zooko

  • Keywords reviewed added; review-needed removed
  • Owner set to davidsarah

comment:7 Changed at 2011-01-19T07:29:59Z by zooko

  • Keywords review-needed added; reviewed removed
  • Owner changed from davidsarah to zooko
  • Status changed from new to assigned

Oh whoops, I reviewed 93c1909847e9dc44 but didn't realize I needed to review attachment:bin-tahoe-runner-support.darcs.2.patch as well before setting this from review-needed to reviewed.

comment:8 Changed at 2011-01-19T07:31:35Z by zooko

  • Keywords reviewed added; review-needed removed
  • Owner changed from zooko to warner
  • Status changed from assigned to new

comment:9 Changed at 2011-01-20T09:35:20Z by zooko

  • Owner changed from warner to davidsarah

David-Sarah is going to merge and push into trunk.

comment:10 Changed at 2011-01-20T20:28:05Z by davidsarah

  • Keywords reviewed removed
  • Resolution set to fixed
  • Status changed from new to closed

Applied in 3798d9946e1f62cc.

Note: See TracTickets for help on using tickets.