Migrate gen_template.pl into `./mach addtest`

RESOLVED FIXED in Firefox 68

Status

enhancement
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: bgrins, Assigned: bgrins)

Tracking

(Depends on 1 bug, Blocks 1 bug, {dev-doc-needed})

unspecified
mozilla68
Dependency tree / graph

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(1 attachment, 2 obsolete attachments)

Assignee

Description

3 months ago

I was recently looking at ways to make scripting some changes to tests easier, and came across this script.

I don't think it's widely in use. But I think it's worth porting into a mach command and cleaning up the boilerplate at https://dxr.mozilla.org/mozilla-central/source/testing/mochitest/static in some lightweight ways (removing Bug # metadata, removing unnecessary attributes, etc).

I'd ultimately like to have a more advanced command that replicates what devs are doing manually right now (for example: add a new test into a manifest file, clone an existing test, etc), and I'm hoping that refreshing this script is a place to start.

Assignee

Comment 1

3 months ago

This also changes the template files in the following ways:

  • removes the bug # boilerplate
  • remove some unnecessary attributes in the
  • removes the th.template
  • adds the browser.template for browser-chrome tests

Instead of:
perl gen_template.pl -b=123456 --type=plain > path/to/test_bug123456.html

You can do:
./mach testgen --flavor="plain" > path/to/test_bug123456.html

Attachment #9054629 - Attachment description: Bug 1540285 - WIP - Move test generator script into `./mach testgen` → Bug 1540285 - WIP - Move test generator script into `./mach addtest`
Attachment #9054629 - Attachment description: Bug 1540285 - WIP - Move test generator script into `./mach addtest` → Bug 1540285 - Add a test generator script into `./mach addtest`
Assignee

Comment 2

3 months ago

web-platform-tests (wpt-specific arguments previously on wpt-create

can be passed in if you pass the wpt subcommand).

./mach addtest testing/web-platform/tests/accelerometer/test.html
./mach addtest wpt testing/web-platform/tests/accelerometer/test.html

Make Creator classes resposible for providing an iterator of
(path, data) objects for files to be created. This allows cases like
reftests where there can be more than one file per test.

Change the command line argument parsing so that each Creator adds an
argument_group. This means that all arguments may be passed
irrespective of the suite, and switching the suite manually requires a
named argument rather than specifying a subcommand. But setting things
up so that the top level command can be called directoy and delegate
to an arbitary subcommand whilst accepting all the options is a little
tricky to set up in mach; this is not as nice but much easier to get
working.

Attachment #9056164 - Attachment description: Bug 1540285 - Add refactor addtest support, → Bug 1540285 - Add mach addtest support,
Attachment #9056100 - Attachment is obsolete: true

Comment 4

3 months ago
Pushed by bgrinstead@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/69eda9f7be57
Add a test generator script into `./mach addtest` r=ahal

Comment 5

3 months ago
bugherder
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Assignee: nobody → bgrinstead
Depends on: 1543007
Attachment #9056164 - Attachment description: Bug 1540285 - Add mach addtest support, → Bug 1540285 - Refactor mach addtest support,
Assignee

Updated

3 months ago
Depends on: 1543244

Comment on attachment 9056164 [details]
Bug 1540285 - Refactor mach addtest support,

Revision D26339 was moved to bug 1543244. Setting attachment 9056164 [details] to obsolete.

Attachment #9056164 - Attachment is obsolete: true
Assignee

Updated

3 months ago
Summary: Migrate gen_template.pl into a mach command → Migrate gen_template.pl into `./mach addtest`
Assignee

Updated

3 months ago
Depends on: 1543300
Assignee

Updated

3 months ago
Depends on: 1543491
Assignee

Updated

3 months ago
Keywords: dev-doc-needed
Assignee

Updated

2 months ago
Depends on: 1543841
Assignee

Updated

2 months ago
Depends on: 1547996
See Also: → 1548319
You need to log in before you can comment on or make changes to this bug.