Bug 1240723 - Harmonise xpcshell head- and tail list computation; r?ted
Head- and tail entries in manifest files are not mandatory on
local/desktop xpcshell tests, and they should not be on remote/B2G either.
This change makes remotexpcshelltests and runxpcshelltests agree on how
to get head- and tail files.
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -82,35 +82,40 @@ class RemoteXPCShellTestThread(xpcshell.
return mozInfoJSPath
def logCommand(self, name, completeCmd, testdir):
self.log.info("%s | full command: %r" % (name, completeCmd))
self.log.info("%s | current directory: %r" % (name, self.remoteHere))
self.log.info("%s | environment: %s" % (name, self.env))
def getHeadAndTailFiles(self, test):
- """Override parent method to find files on remote device."""
+ """Override parent method to find files on remote device.
+
+ Obtains lists of head- and tail files. Returns a tuple containing
+ a list of head files and a list of tail files.
+ """
def sanitize_list(s, kind):
for f in s.strip().split(' '):
f = f.strip()
if len(f) < 1:
continue
path = remoteJoin(self.remoteHere, f)
# skip check for file existence: the convenience of discovering
# a missing file does not justify the time cost of the round trip
# to the device
-
yield path
self.remoteHere = self.remoteForLocal(test['here'])
- return (list(sanitize_list(test['head'], 'head')),
- list(sanitize_list(test['tail'], 'tail')))
+ headlist = test.get('head', '')
+ taillist = test.get('tail', '')
+ return (list(sanitize_list(headlist, 'head')),
+ list(sanitize_list(taillist, 'tail')))
def buildXpcsCmd(self):
# change base class' paths to remote paths and use base class to build command
self.xpcshell = remoteJoin(self.remoteBinDir, "xpcw")
self.headJSPath = remoteJoin(self.remoteScriptsDir, 'head.js')
self.httpdJSPath = remoteJoin(self.remoteComponentsDir, 'httpd.js')
self.httpdManifest = remoteJoin(self.remoteComponentsDir, 'httpd.manifest')
self.testingModulesDir = self.remoteModulesDir
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -385,39 +385,37 @@ class XPCShellTestThread(Thread):
return xpcscmd + \
['-e', 'const _SERVER_ADDR = "localhost"',
'-e', 'const _HEAD_FILES = [%s];' % cmdH,
'-e', 'const _TAIL_FILES = [%s];' % cmdT,
'-e', 'const _JSDEBUGGER_PORT = %d;' % dbgport,
]
- def getHeadAndTailFiles(self, test_object):
- """Obtain the list of head and tail files.
-
- Returns a 2-tuple. The first element is a list of head files. The second
- is a list of tail files.
+ def getHeadAndTailFiles(self, test):
+ """Obtain lists of head- and tail files. Returns a tuple
+ containing a list of head files and a list of tail files.
"""
def sanitize_list(s, kind):
for f in s.strip().split(' '):
f = f.strip()
if len(f) < 1:
continue
- path = os.path.normpath(os.path.join(test_object['here'], f))
+ path = os.path.normpath(os.path.join(test['here'], f))
if not os.path.exists(path):
raise Exception('%s file does not exist: %s' % (kind, path))
if not os.path.isfile(path):
raise Exception('%s file is not a file: %s' % (kind, path))
yield path
- headlist = test_object['head'] if 'head' in test_object else ''
- taillist = test_object['tail'] if 'tail' in test_object else ''
+ headlist = test.get('head', '')
+ taillist = test.get('tail', '')
return (list(sanitize_list(headlist, 'head')),
list(sanitize_list(taillist, 'tail')))
def buildXpcsCmd(self):
"""
Load the root head.js file as the first file in our test path, before other head, test, and tail files.
On a remote system, we overload this to add additional command line arguments, so this gets overloaded.
"""