Closed
Bug 1237958
Opened 8 years ago
Closed 8 years ago
Running marionette via mach attempts to run the wrong things if a manifest isn't specified
Categories
(Remote Protocol :: Marionette, defect)
Remote Protocol
Marionette
Tracking
(firefox50 fixed)
RESOLVED
FIXED
mozilla50
Tracking | Status | |
---|---|---|
firefox50 | --- | fixed |
People
(Reporter: standard8, Assigned: vakila)
References
Details
Attachments
(1 file, 1 obsolete file)
I was helping another developer who was trying to run the marionette tests but was getting failures. We determined that it was because he was doing: ./mach marionette-test browser/extensions/loop rather than: ./mach marionette-test browser/extensions/loop/manifest.ini The first form attempts to run some random tests in the directory, rather than the actual tests. xpcshell & mochitest work without specifying the manifest, it would be nice if marionette did here as well - or at least gave a proper error.
Comment 1•8 years ago
|
||
(In reply to Mark Banner (:standard8) from comment #0) > ./mach marionette-test browser/extensions/loop [..] > The first form attempts to run some random tests in the directory, rather > than the actual tests. Really "some" random tests? If you specify a folder all the files starting with test_* should be run. About the default order I'm not sure.
Reporter | ||
Comment 2•8 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #1) > (In reply to Mark Banner (:standard8) from comment #0) > > ./mach marionette-test browser/extensions/loop > [..] > > The first form attempts to run some random tests in the directory, rather > > than the actual tests. > > Really "some" random tests? If you specify a folder all the files starting > with test_* should be run. About the default order I'm not sure. Well, its probably trying to run the xpcshell ones then, which I'd call random. The way the other commands work is if you specify a directory, they'll run everything under that sub-directory, but only those that are matching the test types as supplied by the manifest.
Comment 3•8 years ago
|
||
So the test argument gets passed-through to Marionette itself: http://mxr.mozilla.org/mozilla-central/source/testing/marionette/mach_commands.py#52 That means the same happens when running Marionette itself. As far as I remember Marionette explicitly expects a manifest to be given for a folder, otherwise it iterates through all sub folders for possible tests. This is happening here. The manifest has tests which point to a complete different directory. http://mxr.mozilla.org/mozilla-central/source/browser/extensions/loop/ http://mxr.mozilla.org/mozilla-central/source/browser/extensions/loop/manifest.ini Andreas or David, not sure if that is what we want for Marionette or not regarding parity with other test harnesses.
Flags: needinfo?(dburns)
Flags: needinfo?(ato)
Comment 4•8 years ago
|
||
I have no knowledge of how manifests or the Marionette Python harness works.
Flags: needinfo?(ato)
Comment 5•8 years ago
|
||
we should probably have parity here so that people get what they want.
Flags: needinfo?(dburns)
Comment 6•8 years ago
|
||
I wonder how other harnesses work in case no manifest.ini file has been found in the specified directory. Do they also collect all available files starting with test_ or do nothing?
Assignee | ||
Comment 7•8 years ago
|
||
As Henrik said, if a directory is specified, Marionette will walk the directory and add any test files (files named "test_*(.py|.js)"). It will just ignore a ".ini" manifest if there's one in that directory. But it seems it would be pretty simple to have it first look for a manifest (".ini") in the specified directory (or look through all subdirectories recursively?), and if there is one, add the tests in that (as if you had passed the manifest to the command). Maja, is that something I should do? Or do we want to leave it as-is for now? Either way, for Bug 1276974 I'll test that the expected behavior is happening.
Flags: needinfo?(mjzffr)
Not sure. What if you actually want to run all the tests in a directory that contains a manifest? It sucks to have to edit the manifest to be able to do that. tl;dr: matching the behaviour of some other mach commands (by using TestResolver) is a larger question/task, and for now I think we should just clarify the |mach marionette-test| output/help message/options so that users don't get confused. The mochitest mach command uses TestResolver [1], which only runs tests that are listed in manifests referenced in moz.build files [2] and depends on ./mach configure. When I was working on |mach python-test|, I actually found this approach quite opaque (not clear which tests or test manifests will be run) and inflexible (can't easily run tests that are not in recognized manifest). I ended up added a --path-only option to |mach python-test| in response (Bug 1261412). [1] https://dxr.mozilla.org/mozilla-central/source/testing/mochitest/mach_commands.py#158 [2] https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/components/moz.build#20
Flags: needinfo?(mjzffr)
Assignee | ||
Comment 9•8 years ago
|
||
(In reply to Maja Frydrychowicz (:maja_zf) from comment #8) > tl;dr: matching the behaviour of some other mach commands (by using > TestResolver) is a larger question/task, and for now I think we should just > clarify the |mach marionette-test| output/help message/options so that users > don't get confused. In addition to clarifying in the help message, what if, when a user specifies the path to a dir, we do check for an `.ini` file, and if found, we display a message like the following? "Dir containing manifest specified; ignoring `manifest.ini` and running all tests found in `browser/extensions/loop`. To run manifest tests use the command `./mach marionette-test browser/extensions/loop/manifest.ini`. See command help for details."
Flags: needinfo?(mjzffr)
That sounds good.
Flags: needinfo?(mjzffr)
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → anjanavakil
Assignee | ||
Comment 11•8 years ago
|
||
Expand the help message for the `marionette-test` mach command to more clearly explain Marionette's behavior when a path to a test module, directory, or manifest file is specified. Review commit: https://reviewboard.mozilla.org/r/58232/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/58232/
Attachment #8760779 -
Flags: review?(mjzffr)
Attachment #8760780 -
Flags: review?(mjzffr)
Assignee | ||
Comment 12•8 years ago
|
||
If a user passes a directory path to Marionette on the command line, any manifest ('.ini') file(s) in that dir will be ignored and instead all test modules in the dir will be run. Clarify this behavior by logging a warning if we find any '.ini' file(s) in the specified directory. Review commit: https://reviewboard.mozilla.org/r/58234/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/58234/
Comment on attachment 8760780 [details] Bug 1237958 - Clarify Marionette's behavior re dir/manifest; https://reviewboard.mozilla.org/r/58234/#review55204 ::: testing/marionette/harness/marionette/runner/base.py:900 (Diff revision 1) > > if os.path.isdir(filepath): > for root, dirs, files in os.walk(filepath): > for filename in files: > - if (filename.startswith('test_') and > + if (filename.endswith('.ini')): > + relpath = os.path.relpath(os.path.join(root, filename), test) I'm guessing that it might be better to use `filepath` here and below instead of `test` ::: testing/marionette/harness/marionette/runner/base.py:901 (Diff revision 1) > + msg_tmpl = "Directory containing manifest specified; "\ > + "ignoring manifest '{0}' and running all tests found in '{1}'. "\ > + "To run the manifest tests specify the manifest file directly. "\ > + "See command help for details." Let's shorten this message to something like "Ignoring manifest '{0}' and running all tests in '{1}'. See --help for details." ::: testing/marionette/harness/marionette/runner/base.py:901 (Diff revision 1) > + msg_tmpl = "Directory containing manifest specified; "\ > + "ignoring manifest '{0}' and running all tests found in '{1}'. "\ > + "To run the manifest tests specify the manifest file directly. "\ > + "See command help for details." Instead of using line breaks '\' please wrap the long string in () like: ``` ("my " "multi-line " "string") ```
Attachment #8760780 -
Flags: review?(mjzffr) → review-
Comment on attachment 8760779 [details] Bug 1237958 - Expand `mach marionette-test` help msg re test paths; https://reviewboard.mozilla.org/r/58232/#review55210 ::: testing/marionette/harness/marionette/runner/base.py:256 (Diff revision 1) > + 'Can be path(s) to Python or JavaScript test modules, ' > + 'the path to a directory containing test modules, ' > + "or the path to a manifest ('.ini') file describing tests to run. " > + 'If the path to a directory is provided and that directory ' > + 'contains both test modules and a manifest file, ' > + 'the manifest will be ignored and all test modules ' > + 'in the given directory will be run.') Yay for clear help messages! :) Could you make the new part shorter? Something like "One or more paths to test files (Python or JS), manifest files (ini) or directories. When a directory is specified, all test files in the directory will be run."
Attachment #8760779 -
Flags: review?(mjzffr) → review+
Assignee | ||
Comment 15•8 years ago
|
||
Comment on attachment 8760779 [details] Bug 1237958 - Expand `mach marionette-test` help msg re test paths; Review request updated; see interdiff: https://reviewboard.mozilla.org/r/58232/diff/1-2/
Attachment #8760780 -
Flags: review- → review?(mjzffr)
Assignee | ||
Comment 16•8 years ago
|
||
Comment on attachment 8760780 [details] Bug 1237958 - Clarify Marionette's behavior re dir/manifest; Review request updated; see interdiff: https://reviewboard.mozilla.org/r/58234/diff/1-2/
Assignee | ||
Comment 17•8 years ago
|
||
https://reviewboard.mozilla.org/r/58234/#review55332 ::: testing/marionette/harness/marionette/runner/base.py:903 (Diff revisions 1 - 2) > - "To run the manifest tests specify the manifest file directly. "\ > + self.logger.warning(msg_tmpl.format(relpath, filepath)) > - "See command help for details." > - self.logger.warning(msg_tmpl.format(relpath, test)) > elif (filename.startswith('test_') and > (filename.endswith('.py') or filename.endswith('.js'))): > - filepath = os.path.join(root, filename) > + test_file = os.path.join(root, filename) The variable `filepath` was being used for two different things. Renamed the second usage to `test_file` to avoid conflict.
Comment on attachment 8760780 [details] Bug 1237958 - Clarify Marionette's behavior re dir/manifest; https://reviewboard.mozilla.org/r/58234/#review55446 Looks good. In this case, squash down to one commit please.
Attachment #8760780 -
Flags: review?(mjzffr) → review+
Assignee | ||
Comment 19•8 years ago
|
||
Comment on attachment 8760780 [details] Bug 1237958 - Clarify Marionette's behavior re dir/manifest; Review request updated; see interdiff: https://reviewboard.mozilla.org/r/58234/diff/2-3/
Attachment #8760780 -
Attachment description: Bug 1237958 - Warn if dir passed to Marionette contains manifest; → Bug 1237958 - Clarify Marionette's behavior re dir/manifest;
Assignee | ||
Updated•8 years ago
|
Attachment #8760779 -
Attachment is obsolete: true
Comment 20•8 years ago
|
||
Pushed by mjzffr@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/17dec170c383 Clarify Marionette's behavior re dir/manifest; r=maja_zf
Comment 21•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/17dec170c383
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Updated•1 year ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•