Open Bug 1345942 Opened 7 years ago Updated 2 years ago

Have `./mach test` run relevant tests when given a source file

Categories

(Testing :: General, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: ato, Unassigned)

References

Details

If you are new to a piece of code in mozilla-central, it is often hard to know which tests are relevant.  A full try run is expensive and wasteful, and even if you do know which tests to run, it is not trivial to remember and type out the paths.

Today I learned from jgraham about `./mach file-info dep-tests SOURCEFILE`, produces surprisingly relevant results:

% ./mach file-info dep-tests testing/marionette/driver.js 
testing/marionette/driver.js:
	Test file patterns:
		dom/network/tests/marionette/**
		testing/marionette/**
		dom/events/test/marionette/**
		testing/marionette/harness/marionette_harness/tests/unit/**
		dom/system/gonk/tests/marionette/**

It seems a laudable engineering productivity goal to take the output from this command and run these tests when you pass a source file (as opposed to a test file) to `./mach test`.

For example, when running `./mach test testing/marionette/driver.js` I would expect it to run collect test dependency information from the command shown above and run the test directories listed.
Great idea!

For bonus points, let's also add ./mach test --outgoing which would find all files touched by changesets which would be pushed to mozilla-central (as specified by `hg outgoing`) and run their relevant tests. The functionality for finding these files is already implemented in both hg and git by ./mach lint --outgoing.
Component: mach → General
Product: Core → Testing
Priority: -- → P3
See Also: → 1626320
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.