Closed Bug 534762 Opened 16 years ago Closed 16 years ago

Let --test-path run full test directories for mochitest-chrome, ala mochitest-plain

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9.3a1

People

(Reporter: jgriffin, Assigned: jgriffin)

Details

Attachments

(1 file)

Currently, the --test-path argument for runtests.py works differently in mochitest-plain vs mochitest-chrome. In mochitest-plain, if the specified path is a directory, it will display the tests in that directory, and will run all those tests in a group if combined with --autorun. In mochitest-chrome, passing a directory for the --test-path argument just displays a directory listing, and combining it with --autorun produces undefined behavior. I'd like to harmonize the meaning of --test-path by causing it to work the same in mochitest-chrome as it does in mochitest-plain. This will be helpful as I migrate groups of tests from mochitest-plain to mochitest-chrome, ala bug 533306.
Attached patch patchSplinter Review
Attachment #417584 - Flags: review?(ted.mielczarek)
This reminded me of bug 508664, but I guess it's not related. Would probably need a different fix to get the same behavior in the chrome harness.
Attachment #417584 - Flags: review?(ted.mielczarek) → review+
Comment on attachment 417584 [details] [diff] [review] patch >diff --git a/testing/mochitest/harness-overlay.xul b/testing/mochitest/harness-overlay.xul >--- a/testing/mochitest/harness-overlay.xul >+++ b/testing/mochitest/harness-overlay.xul >@@ -18,52 +18,64 @@ > <script type="text/javascript" > src="chrome://mochikit/content/tests/SimpleTest/setup.js" /> > <script type="application/javascript;version=1.7"><![CDATA[ > function loadTests() > { > window.removeEventListener("load", loadTests, false); > > var dir = document.documentElement.getAttribute('directory'); >+ var url = "chrome://mochikit/content/" + dir + "/"; > // Find our chrome dir > var ios = Cc["@mozilla.org/network/io-service;1"]. > getService(Ci.nsIIOService); > var chromeURI = ios.newURI("chrome://mochikit/content/", > null, null); > var resolvedURI = Cc["@mozilla.org/chrome/chrome-registry;1"]. > getService(Ci.nsIChromeRegistry). > convertChromeURL(chromeURI); > var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"]. > getService(Ci.nsIFileProtocolHandler); > var chromeDir = fileHandler.getFileFromURLSpec(resolvedURI.spec); > chromeDir = chromeDir.parent.QueryInterface(Ci.nsILocalFile); > chromeDir.appendRelativePath(dir); > >+ if ("testPath" in params && params.testPath) { >+ var extraPath = params.testPath; >+ var pathToCheck = chromeDir.clone().QueryInterface(Ci.nsILocalFile); >+ pathToCheck.appendRelativePath(extraPath); >+ if (pathToCheck.isDirectory()) { >+ chromeDir.appendRelativePath(extraPath); >+ url += extraPath + "/"; >+ } >+ else { >+ var singleTestPath = url + params.testPath; I realize var creates function-scoped variables, but it's kind of ugly to see it like this. Could you move the var declaration outside of the block, and just assign to it here? r=me with that change, although reading this patch makes me hate how different the mochitest-chrome harness is from the mochitest-plain one. :-(
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
could the single test command line be clarified on the devmo page https://developer.mozilla.org/en/Mochitest. It was working for me with: python runtests.py --test-path=toolkit/mozapps/downloads/tests/chrome/test_basic_functionality.xul --chrome but now I have to go to the root and click on the selection. python runtests.py --test-path= --chrome
(In reply to comment #5) > could the single test command line be clarified on the devmo page > https://developer.mozilla.org/en/Mochitest. It was working for me with: > python runtests.py > --test-path=toolkit/mozapps/downloads/tests/chrome/test_basic_functionality.xul > --chrome ok so now I have to put in \\ instead of / I don't quite know what the point is of this patch maybe it's a unix problem. This is windows using msys mozilla-build python runtests.py --test-path=toolkit\\mozapps\\downloads\\tests\\chrome\\test_basic_functionality.xul --chrome
Pushed http://hg.mozilla.org/mozilla-central/rev/83c9f9bfa127 to fix problem identified in comments #5 and #6. > I don't quite know what the point is of this patch maybe it's a unix problem. The purpose of this patch is to allow a user to run an entire directory of tests, e.g., python runtests.py --test-path=toolkit/mozapps/downloads/tests/chrome --chrome will allow you to run all the of tests in toolkit/mozapps/downloads/tests/chrome. Prior to this patch, it was only possible to run a single test, or the entire chrome test suite.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: