Closed Bug 920184 Opened 7 years ago Closed 7 years ago
mach xpcshell-test should automatically ensure test files are up to date
Now that test files are installed via install manifests (bug 901990), we should now be able to have the mach command(s) for running tests automatically ensure test files are up to date before running them. Let's prototype this with the xpcshell command. mach has a facility to invoke other mach commands. We could probably make the xpcshell-test command invoke |mach build install-tests| with NO_REMOVE=1 in the environment (to prevent removals).
Patch should be mostly self-explanatory. The rules in Makefile.in are such that if an xpcshell.ini or moz.build is updated, we'll perform a moz.build traversal. So, the developer edit-test loop with this patch should "just work."
Now with mochitest command goodness. I moved the logic for installing tests into a new class. I've been warning to create a high-level "build API" class for a while. This patch is my excuse.
Attachment #812061 - Flags: review?(ted)
Comment on attachment 812061 [details] [diff] [review] Have mach xpcshell-test automatically install test files Review of attachment 812061 [details] [diff] [review]: ----------------------------------------------------------------- ::: python/mozbuild/mozbuild/controller/building.py @@ +536,5 @@ > + > +class BuildDriver(MozbuildObject): > + """Provides a high-level API for build actions.""" > + > + def install_tests(self, remove=True): Seems a little weird that you have to override the default for remove every single place you invoke it. ::: testing/mochitest/mach_commands.py @@ +579,4 @@ > self._ensure_state_subdir_exists('.') > > + driver = self._spawn(BuildDriver) > + driver.install_tests(remove=False) This repeated code feels like it wants to wind up in a decorator.
Attachment #812061 - Flags: review?(ted) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/c689b1d342c7 I can see both comments. But, the default behavior of "install_tests" from the perspective of the build system is to delete untracked files. So, a default to remove from the Python API makes sense. Once we have 100% coverage of _tests, we can remove the support for controlling removing from the API. w.r.t. the repeated code, there is no common class for everything to inherit from. I'm not sure 2 lines is worth it.
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.