Bug 816630 - B2G xpcshell tests use wrong binary directory, r=jgriffin, DONTBUILD a=NPOTB,test-only

This commit is contained in:
Andrew Halberstadt 2012-11-30 11:25:40 -05:00
parent 6dcb9d382e
commit b314f9861f
2 changed files with 56 additions and 38 deletions

View File

@ -19,8 +19,8 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
def __init__(self, devmgr, options, args):
xpcshell.XPCShellTests.__init__(self)
self.localLib = None
self.localBin = None
self.localLib = options.localLib
self.localBin = options.localBin
self.options = options
self.device = devmgr
self.pathMapping = []
@ -98,14 +98,6 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
remoteFile = self.remoteJoin(self.remoteScriptsDir, "head.js")
self.device.pushFile(local, remoteFile)
if not self.localBin:
self.localBin = os.path.join(self.options.objdir, "dist/bin")
if not os.path.exists(self.localBin):
self.localBin = os.path.join(self.options.objdir, "bin")
if not os.path.exists(self.localBin):
print >>sys.stderr, "Error: could not find bin in objdir"
sys.exit(1)
local = os.path.join(self.localBin, "xpcshell")
remoteFile = self.remoteJoin(self.remoteBinDir, "xpcshell")
self.device.pushFile(local, remoteFile)
@ -129,17 +121,6 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
self.pushLibs()
def pushLibs(self):
if not self.localLib:
if self.options.localAPK:
self.localLib = os.path.join(self.options.objdir, "dist/fennec")
if not os.path.exists(self.localLib):
self.localLib = os.path.join(self.options.objdir, "fennec/lib")
if not os.path.exists(self.localLib):
print >>sys.stderr, "Error: could not find libs in objdir"
sys.exit(1)
else:
self.localLib = os.path.join(self.options.objdir, 'dist/bin')
for file in os.listdir(self.localLib):
if (file.endswith(".so")):
print >> sys.stderr, "Pushing %s.." % file
@ -380,8 +361,50 @@ class RemoteXPCShellOptions(xpcshell.XPCShellOptions):
help = "do not copy any files to device (to be used only if device is already setup)")
defaults["setup"] = True
self.add_option("--local-lib-dir", action="store",
type = "string", dest = "localLib",
help = "local path to library directory")
defaults["localLib"] = None
self.add_option("--local-bin-dir", action="store",
type = "string", dest = "localBin",
help = "local path to bin directory")
defaults["localBin"] = None
self.set_defaults(**defaults)
def verifyRemoteOptions(self, options):
if options.localLib is None:
if options.localAPK and options.objdir:
for path in ['dist/fennec', 'fennec/lib']:
options.localLib = os.path.join(options.objdir, path)
if os.path.isdir(options.localLib):
break
else:
self.error("Couldn't find local library dir, specify --local-lib-dir")
elif options.objdir:
options.localLib = os.path.join(options.objdir, 'dist/bin')
elif os.path.isfile(os.path.join(here, '..', 'bin', 'xpcshell')):
# assume tests are being run from a tests.zip
options.localLib = os.path.abspath(os.path.join(here, '..', 'bin'))
else:
self.error("Couldn't find local library dir, specify --local-lib-dir")
if options.localBin is None:
if options.objdir:
for path in ['dist/bin', 'bin']:
options.localBin = os.path.join(options.objdir, path)
if os.path.isdir(options.localBin):
break
else:
self.error("Couldn't find local binary dir, specify --local-bin-dir")
elif os.path.isfile(os.path.join(here, '..', 'bin', 'xpcshell')):
# assume tests are being run from a tests.zip
options.localBin = os.path.abspath(os.path.join(here, '..', 'bin'))
else:
self.error("Couldn't find local binary dir, specify --local-bin-dir")
return options
class PathMapping:
def __init__(self, localDir, remoteDir):
@ -392,6 +415,7 @@ def main():
parser = RemoteXPCShellOptions()
options, args = parser.parse_args()
options = parser.verifyRemoteOptions(options)
if len(args) < 1 and options.manifest is None:
print >>sys.stderr, """Usage: %s <test dirs>

View File

@ -18,15 +18,10 @@ DEVICE_TEST_ROOT = '/data/local/tests'
from marionette import Marionette
class B2GXPCShellRemote(XPCShellRemote):
# Overridden
def setupUtilities(self):
if self.options.xrePath:
self.localLib = self.options.xrePath
self.localBin = self.options.xrePath
if self.options.clean:
# Ensure a fresh directory structure for our tests
self.clean()
@ -147,22 +142,21 @@ class B2GOptions(RemoteXPCShellOptions):
self.set_defaults(**defaults)
def verifyRemoteOptions(self, options):
if options.b2g_path is None:
self.error("Need to specify a --b2gpath")
if options.geckoPath and not options.emulator:
self.error("You must specify --emulator if you specify --gecko-path")
if options.logcat_dir and not options.emulator:
self.error("You must specify --emulator if you specify --logcat-dir")
return RemoteXPCShellOptions.verifyRemoteOptions(self, options)
def main():
parser = B2GOptions()
options, args = parser.parse_args()
if options.b2g_path is None:
parser.error("Need to specify a --b2gpath")
if options.xrePath is None:
parser.error("Need to specify a --xre-path")
if options.geckoPath and not options.emulator:
self.error("You must specify --emulator if you specify --gecko-path")
if options.logcat_dir and not options.emulator:
self.error("You must specify --emulator if you specify --logcat-dir")
options = parser.verifyRemoteOptions(options)
# Create the Marionette instance
kwargs = {}