Closed Bug 1057453 Opened 6 years ago Closed 6 years ago
"mach test filename" does not run the file test
As I understand from "mach test --help" command like "mach test browser_Finder.js" (assuming pwd = toolkit/modules/tests/browser) should just work (what = filename). Instead it says: From _tests: Kept 19027 existing; Added/updated 0; Removed 0 files and 0 directories. No tests could be found in the path specified. Please specify a path that is a test file or is a directory containing tests. "mach mochitest-browser browser_Finder.js" works just fine.
I'm playing with this a little bit. Source file that defines test command is `testing/mach_commands.py`. It looks like running `mach test browser_bug594509.js` is expanded to `mach mochitest --flavor browser-chrome browser_bug594509.js` which fails with the message I see in the first line. On the other hand running `mach mochitest-browser browser_bug594509.js` works fine. So it looks like some problem with mochitest which lives in `testing/mochitest/mach_commands.py` I added some print in run_desktop_test in the above file right before line saying 'No tests could be found in the path specified' and I got: [u'toolkit/content/tests/browser/toolkit/content/tests/browser/browser_bug594509.js'] Which is clearly nonsense. The line that is breaking it is the one that has a comment: `#Need to call relpath before os.chdir() below.` When I remove it everything works as expected!
I'm not sure how this will work on Windows (we do normalization of paths) but basically what we need here to satisfy the comment is to convert the absolute paths to relative. If a path is already relative the comment guarantees it to be relative to the top source directory. I'm also not sure where to add tests for this bug. Not much changes in this bug but it took me a while to track it down :-)
Assignee: nobody → tkolodziejski
Attachment #8482954 - Flags: feedback?(gps)
Comment on attachment 8482954 [details] [diff] [review] mach-test.patch Review of attachment 8482954 [details] [diff] [review]: ----------------------------------------------------------------- This looks sane to me. I don't believe we have any tests for this, so r+. Worst case is it breaks something and we back it out.
Attachment #8482954 - Flags: feedback?(gps) → review+
I just updated to use built-in isabs method.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.