1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/tools/reftest/remotereftest.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,524 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +import sys 1.9 +import os 1.10 +import time 1.11 +import tempfile 1.12 +import traceback 1.13 + 1.14 +# We need to know our current directory so that we can serve our test files from it. 1.15 +SCRIPT_DIRECTORY = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0]))) 1.16 + 1.17 +from runreftest import RefTest 1.18 +from runreftest import ReftestOptions 1.19 +from automation import Automation 1.20 +import devicemanager 1.21 +import droid 1.22 +import moznetwork 1.23 +from remoteautomation import RemoteAutomation, fennecLogcatFilters 1.24 + 1.25 +class RemoteOptions(ReftestOptions): 1.26 + def __init__(self, automation): 1.27 + ReftestOptions.__init__(self, automation) 1.28 + 1.29 + defaults = {} 1.30 + defaults["logFile"] = "reftest.log" 1.31 + # app, xrePath and utilityPath variables are set in main function 1.32 + defaults["app"] = "" 1.33 + defaults["xrePath"] = "" 1.34 + defaults["utilityPath"] = "" 1.35 + defaults["runTestsInParallel"] = False 1.36 + 1.37 + self.add_option("--remote-app-path", action="store", 1.38 + type = "string", dest = "remoteAppPath", 1.39 + help = "Path to remote executable relative to device root using only forward slashes. Either this or app must be specified, but not both.") 1.40 + defaults["remoteAppPath"] = None 1.41 + 1.42 + self.add_option("--deviceIP", action="store", 1.43 + type = "string", dest = "deviceIP", 1.44 + help = "ip address of remote device to test") 1.45 + defaults["deviceIP"] = None 1.46 + 1.47 + self.add_option("--devicePort", action="store", 1.48 + type = "string", dest = "devicePort", 1.49 + help = "port of remote device to test") 1.50 + defaults["devicePort"] = 20701 1.51 + 1.52 + self.add_option("--remote-product-name", action="store", 1.53 + type = "string", dest = "remoteProductName", 1.54 + help = "Name of product to test - either fennec or firefox, defaults to fennec") 1.55 + defaults["remoteProductName"] = "fennec" 1.56 + 1.57 + self.add_option("--remote-webserver", action="store", 1.58 + type = "string", dest = "remoteWebServer", 1.59 + help = "IP Address of the webserver hosting the reftest content") 1.60 + defaults["remoteWebServer"] = moznetwork.get_ip() 1.61 + 1.62 + self.add_option("--http-port", action = "store", 1.63 + type = "string", dest = "httpPort", 1.64 + help = "port of the web server for http traffic") 1.65 + defaults["httpPort"] = automation.DEFAULT_HTTP_PORT 1.66 + 1.67 + self.add_option("--ssl-port", action = "store", 1.68 + type = "string", dest = "sslPort", 1.69 + help = "Port for https traffic to the web server") 1.70 + defaults["sslPort"] = automation.DEFAULT_SSL_PORT 1.71 + 1.72 + self.add_option("--remote-logfile", action="store", 1.73 + type = "string", dest = "remoteLogFile", 1.74 + help = "Name of log file on the device relative to device root. PLEASE USE ONLY A FILENAME.") 1.75 + defaults["remoteLogFile"] = None 1.76 + 1.77 + self.add_option("--enable-privilege", action="store_true", dest = "enablePrivilege", 1.78 + help = "add webserver and port to the user.js file for remote script access and universalXPConnect") 1.79 + defaults["enablePrivilege"] = False 1.80 + 1.81 + self.add_option("--pidfile", action = "store", 1.82 + type = "string", dest = "pidFile", 1.83 + help = "name of the pidfile to generate") 1.84 + defaults["pidFile"] = "" 1.85 + 1.86 + self.add_option("--bootstrap", action="store_true", dest = "bootstrap", 1.87 + help = "test with a bootstrap addon required for native Fennec") 1.88 + defaults["bootstrap"] = False 1.89 + 1.90 + self.add_option("--dm_trans", action="store", 1.91 + type = "string", dest = "dm_trans", 1.92 + help = "the transport to use to communicate with device: [adb|sut]; default=sut") 1.93 + defaults["dm_trans"] = "sut" 1.94 + 1.95 + self.add_option("--remoteTestRoot", action = "store", 1.96 + type = "string", dest = "remoteTestRoot", 1.97 + help = "remote directory to use as test root (eg. /mnt/sdcard/tests or /data/local/tests)") 1.98 + defaults["remoteTestRoot"] = None 1.99 + 1.100 + self.add_option("--httpd-path", action = "store", 1.101 + type = "string", dest = "httpdPath", 1.102 + help = "path to the httpd.js file") 1.103 + defaults["httpdPath"] = None 1.104 + 1.105 + defaults["localLogName"] = None 1.106 + 1.107 + self.set_defaults(**defaults) 1.108 + 1.109 + def verifyRemoteOptions(self, options): 1.110 + if options.runTestsInParallel: 1.111 + self.error("Cannot run parallel tests here") 1.112 + 1.113 + # Ensure our defaults are set properly for everything we can infer 1.114 + if not options.remoteTestRoot: 1.115 + options.remoteTestRoot = self.automation._devicemanager.getDeviceRoot() + '/reftest' 1.116 + options.remoteProfile = options.remoteTestRoot + "/profile" 1.117 + 1.118 + # Verify that our remotewebserver is set properly 1.119 + if (options.remoteWebServer == None or 1.120 + options.remoteWebServer == '127.0.0.1'): 1.121 + print "ERROR: Either you specified the loopback for the remote webserver or ", 1.122 + print "your local IP cannot be detected. Please provide the local ip in --remote-webserver" 1.123 + return None 1.124 + 1.125 + # One of remoteAppPath (relative path to application) or the app (executable) must be 1.126 + # set, but not both. If both are set, we destroy the user's selection for app 1.127 + # so instead of silently destroying a user specificied setting, we error. 1.128 + if (options.remoteAppPath and options.app): 1.129 + print "ERROR: You cannot specify both the remoteAppPath and the app" 1.130 + return None 1.131 + elif (options.remoteAppPath): 1.132 + options.app = options.remoteTestRoot + "/" + options.remoteAppPath 1.133 + elif (options.app == None): 1.134 + # Neither remoteAppPath nor app are set -- error 1.135 + print "ERROR: You must specify either appPath or app" 1.136 + return None 1.137 + 1.138 + if (options.xrePath == None): 1.139 + print "ERROR: You must specify the path to the controller xre directory" 1.140 + return None 1.141 + else: 1.142 + # Ensure xrepath is a full path 1.143 + options.xrePath = os.path.abspath(options.xrePath) 1.144 + 1.145 + # Default to <deviceroot>/reftest/reftest.log 1.146 + if (options.remoteLogFile == None): 1.147 + options.remoteLogFile = 'reftest.log' 1.148 + 1.149 + options.localLogName = options.remoteLogFile 1.150 + options.remoteLogFile = options.remoteTestRoot + '/' + options.remoteLogFile 1.151 + 1.152 + # Ensure that the options.logfile (which the base class uses) is set to 1.153 + # the remote setting when running remote. Also, if the user set the 1.154 + # log file name there, use that instead of reusing the remotelogfile as above. 1.155 + if (options.logFile): 1.156 + # If the user specified a local logfile name use that 1.157 + options.localLogName = options.logFile 1.158 + 1.159 + options.logFile = options.remoteLogFile 1.160 + 1.161 + if (options.pidFile != ""): 1.162 + f = open(options.pidFile, 'w') 1.163 + f.write("%s" % os.getpid()) 1.164 + f.close() 1.165 + 1.166 + # httpd-path is specified by standard makefile targets and may be specified 1.167 + # on the command line to select a particular version of httpd.js. If not 1.168 + # specified, try to select the one from hostutils.zip, as required in bug 882932. 1.169 + if not options.httpdPath: 1.170 + options.httpdPath = os.path.join(options.utilityPath, "components") 1.171 + 1.172 + # TODO: Copied from main, but I think these are no longer used in a post xulrunner world 1.173 + #options.xrePath = options.remoteTestRoot + self.automation._product + '/xulrunner' 1.174 + #options.utilityPath = options.testRoot + self.automation._product + '/bin' 1.175 + return options 1.176 + 1.177 +class ReftestServer: 1.178 + """ Web server used to serve Reftests, for closer fidelity to the real web. 1.179 + It is virtually identical to the server used in mochitest and will only 1.180 + be used for running reftests remotely. 1.181 + Bug 581257 has been filed to refactor this wrapper around httpd.js into 1.182 + it's own class and use it in both remote and non-remote testing. """ 1.183 + 1.184 + def __init__(self, automation, options, scriptDir): 1.185 + self.automation = automation 1.186 + self._utilityPath = options.utilityPath 1.187 + self._xrePath = options.xrePath 1.188 + self._profileDir = options.serverProfilePath 1.189 + self.webServer = options.remoteWebServer 1.190 + self.httpPort = options.httpPort 1.191 + self.scriptDir = scriptDir 1.192 + self.pidFile = options.pidFile 1.193 + self._httpdPath = os.path.abspath(options.httpdPath) 1.194 + self.shutdownURL = "http://%(server)s:%(port)s/server/shutdown" % { "server" : self.webServer, "port" : self.httpPort } 1.195 + 1.196 + def start(self): 1.197 + "Run the Refest server, returning the process ID of the server." 1.198 + 1.199 + env = self.automation.environment(xrePath = self._xrePath) 1.200 + env["XPCOM_DEBUG_BREAK"] = "warn" 1.201 + if self.automation.IS_WIN32: 1.202 + env["PATH"] = env["PATH"] + ";" + self._xrePath 1.203 + 1.204 + args = ["-g", self._xrePath, 1.205 + "-v", "170", 1.206 + "-f", os.path.join(self._httpdPath, "httpd.js"), 1.207 + "-e", "const _PROFILE_PATH = '%(profile)s';const _SERVER_PORT = '%(port)s'; const _SERVER_ADDR ='%(server)s';" % 1.208 + {"profile" : self._profileDir.replace('\\', '\\\\'), "port" : self.httpPort, "server" : self.webServer }, 1.209 + "-f", os.path.join(self.scriptDir, "server.js")] 1.210 + 1.211 + xpcshell = os.path.join(self._utilityPath, 1.212 + "xpcshell" + self.automation.BIN_SUFFIX) 1.213 + 1.214 + if not os.access(xpcshell, os.F_OK): 1.215 + raise Exception('xpcshell not found at %s' % xpcshell) 1.216 + if self.automation.elf_arm(xpcshell): 1.217 + raise Exception('xpcshell at %s is an ARM binary; please use ' 1.218 + 'the --utility-path argument to specify the path ' 1.219 + 'to a desktop version.' % xpcshell) 1.220 + 1.221 + self._process = self.automation.Process([xpcshell] + args, env = env) 1.222 + pid = self._process.pid 1.223 + if pid < 0: 1.224 + print "TEST-UNEXPECTED-FAIL | remotereftests.py | Error starting server." 1.225 + return 2 1.226 + self.automation.log.info("INFO | remotereftests.py | Server pid: %d", pid) 1.227 + 1.228 + if (self.pidFile != ""): 1.229 + f = open(self.pidFile + ".xpcshell.pid", 'w') 1.230 + f.write("%s" % pid) 1.231 + f.close() 1.232 + 1.233 + def ensureReady(self, timeout): 1.234 + assert timeout >= 0 1.235 + 1.236 + aliveFile = os.path.join(self._profileDir, "server_alive.txt") 1.237 + i = 0 1.238 + while i < timeout: 1.239 + if os.path.exists(aliveFile): 1.240 + break 1.241 + time.sleep(1) 1.242 + i += 1 1.243 + else: 1.244 + print "TEST-UNEXPECTED-FAIL | remotereftests.py | Timed out while waiting for server startup." 1.245 + self.stop() 1.246 + return 1 1.247 + 1.248 + def stop(self): 1.249 + if hasattr(self, '_process'): 1.250 + try: 1.251 + c = urllib2.urlopen(self.shutdownURL) 1.252 + c.read() 1.253 + c.close() 1.254 + 1.255 + rtncode = self._process.poll() 1.256 + if (rtncode == None): 1.257 + self._process.terminate() 1.258 + except: 1.259 + self._process.kill() 1.260 + 1.261 +class RemoteReftest(RefTest): 1.262 + remoteApp = '' 1.263 + 1.264 + def __init__(self, automation, devicemanager, options, scriptDir): 1.265 + RefTest.__init__(self, automation) 1.266 + self._devicemanager = devicemanager 1.267 + self.scriptDir = scriptDir 1.268 + self.remoteApp = options.app 1.269 + self.remoteProfile = options.remoteProfile 1.270 + self.remoteTestRoot = options.remoteTestRoot 1.271 + self.remoteLogFile = options.remoteLogFile 1.272 + self.localLogName = options.localLogName 1.273 + self.pidFile = options.pidFile 1.274 + if self.automation.IS_DEBUG_BUILD: 1.275 + self.SERVER_STARTUP_TIMEOUT = 180 1.276 + else: 1.277 + self.SERVER_STARTUP_TIMEOUT = 90 1.278 + self.automation.deleteANRs() 1.279 + 1.280 + def findPath(self, paths, filename = None): 1.281 + for path in paths: 1.282 + p = path 1.283 + if filename: 1.284 + p = os.path.join(p, filename) 1.285 + if os.path.exists(self.getFullPath(p)): 1.286 + return path 1.287 + return None 1.288 + 1.289 + def startWebServer(self, options): 1.290 + """ Create the webserver on the host and start it up """ 1.291 + remoteXrePath = options.xrePath 1.292 + remoteUtilityPath = options.utilityPath 1.293 + localAutomation = Automation() 1.294 + localAutomation.IS_WIN32 = False 1.295 + localAutomation.IS_LINUX = False 1.296 + localAutomation.IS_MAC = False 1.297 + localAutomation.UNIXISH = False 1.298 + hostos = sys.platform 1.299 + if (hostos == 'mac' or hostos == 'darwin'): 1.300 + localAutomation.IS_MAC = True 1.301 + elif (hostos == 'linux' or hostos == 'linux2'): 1.302 + localAutomation.IS_LINUX = True 1.303 + localAutomation.UNIXISH = True 1.304 + elif (hostos == 'win32' or hostos == 'win64'): 1.305 + localAutomation.BIN_SUFFIX = ".exe" 1.306 + localAutomation.IS_WIN32 = True 1.307 + 1.308 + paths = [options.xrePath, localAutomation.DIST_BIN, self.automation._product, os.path.join('..', self.automation._product)] 1.309 + options.xrePath = self.findPath(paths) 1.310 + if options.xrePath == None: 1.311 + print "ERROR: unable to find xulrunner path for %s, please specify with --xre-path" % (os.name) 1.312 + return 1 1.313 + paths.append("bin") 1.314 + paths.append(os.path.join("..", "bin")) 1.315 + 1.316 + xpcshell = "xpcshell" 1.317 + if (os.name == "nt"): 1.318 + xpcshell += ".exe" 1.319 + 1.320 + if (options.utilityPath): 1.321 + paths.insert(0, options.utilityPath) 1.322 + options.utilityPath = self.findPath(paths, xpcshell) 1.323 + if options.utilityPath == None: 1.324 + print "ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name) 1.325 + return 1 1.326 + 1.327 + options.serverProfilePath = tempfile.mkdtemp() 1.328 + self.server = ReftestServer(localAutomation, options, self.scriptDir) 1.329 + retVal = self.server.start() 1.330 + if retVal: 1.331 + return retVal 1.332 + retVal = self.server.ensureReady(self.SERVER_STARTUP_TIMEOUT) 1.333 + if retVal: 1.334 + return retVal 1.335 + 1.336 + options.xrePath = remoteXrePath 1.337 + options.utilityPath = remoteUtilityPath 1.338 + return 0 1.339 + 1.340 + def stopWebServer(self, options): 1.341 + self.server.stop() 1.342 + 1.343 + def createReftestProfile(self, options, reftestlist): 1.344 + profile = RefTest.createReftestProfile(self, options, reftestlist, server=options.remoteWebServer) 1.345 + profileDir = profile.profile 1.346 + 1.347 + prefs = {} 1.348 + prefs["browser.firstrun.show.localepicker"] = False 1.349 + prefs["font.size.inflation.emPerLine"] = 0 1.350 + prefs["font.size.inflation.minTwips"] = 0 1.351 + prefs["reftest.remote"] = True 1.352 + # Set a future policy version to avoid the telemetry prompt. 1.353 + prefs["toolkit.telemetry.prompted"] = 999 1.354 + prefs["toolkit.telemetry.notifiedOptOut"] = 999 1.355 + prefs["reftest.uri"] = "%s" % reftestlist 1.356 + prefs["datareporting.policy.dataSubmissionPolicyBypassAcceptance"] = True 1.357 + 1.358 + # Point the url-classifier to the local testing server for fast failures 1.359 + prefs["browser.safebrowsing.gethashURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/gethash" 1.360 + prefs["browser.safebrowsing.updateURL"] = "http://127.0.0.1:8888/safebrowsing-dummy/update" 1.361 + # Point update checks to the local testing server for fast failures 1.362 + prefs["extensions.update.url"] = "http://127.0.0.1:8888/extensions-dummy/updateURL" 1.363 + prefs["extensions.update.background.url"] = "http://127.0.0.1:8888/extensions-dummy/updateBackgroundURL" 1.364 + prefs["extensions.blocklist.url"] = "http://127.0.0.1:8888/extensions-dummy/blocklistURL" 1.365 + prefs["extensions.hotfix.url"] = "http://127.0.0.1:8888/extensions-dummy/hotfixURL" 1.366 + # Turn off extension updates so they don't bother tests 1.367 + prefs["extensions.update.enabled"] = False 1.368 + # Make sure opening about:addons won't hit the network 1.369 + prefs["extensions.webservice.discoverURL"] = "http://127.0.0.1:8888/extensions-dummy/discoveryURL" 1.370 + # Make sure AddonRepository won't hit the network 1.371 + prefs["extensions.getAddons.maxResults"] = 0 1.372 + prefs["extensions.getAddons.get.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetURL" 1.373 + prefs["extensions.getAddons.getWithPerformance.url"] = "http://127.0.0.1:8888/extensions-dummy/repositoryGetWithPerformanceURL" 1.374 + prefs["extensions.getAddons.search.browseURL"] = "http://127.0.0.1:8888/extensions-dummy/repositoryBrowseURL" 1.375 + prefs["extensions.getAddons.search.url"] = "http://127.0.0.1:8888/extensions-dummy/repositorySearchURL" 1.376 + # Make sure that opening the plugins check page won't hit the network 1.377 + prefs["plugins.update.url"] = "http://127.0.0.1:8888/plugins-dummy/updateCheckURL" 1.378 + prefs["layout.css.devPixelsPerPx"] = "1.0" 1.379 + 1.380 + # Disable skia-gl: see bug 907351 1.381 + prefs["gfx.canvas.azure.accelerated"] = False 1.382 + 1.383 + # Set the extra prefs. 1.384 + profile.set_preferences(prefs) 1.385 + 1.386 + try: 1.387 + self._devicemanager.pushDir(profileDir, options.remoteProfile) 1.388 + except devicemanager.DMError: 1.389 + print "Automation Error: Failed to copy profiledir to device" 1.390 + raise 1.391 + 1.392 + return profile 1.393 + 1.394 + def copyExtraFilesToProfile(self, options, profile): 1.395 + profileDir = profile.profile 1.396 + RefTest.copyExtraFilesToProfile(self, options, profile) 1.397 + try: 1.398 + self._devicemanager.pushDir(profileDir, options.remoteProfile) 1.399 + except devicemanager.DMError: 1.400 + print "Automation Error: Failed to copy extra files to device" 1.401 + raise 1.402 + 1.403 + def getManifestPath(self, path): 1.404 + return path 1.405 + 1.406 + def printDeviceInfo(self, printLogcat=False): 1.407 + try: 1.408 + if printLogcat: 1.409 + logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters) 1.410 + print ''.join(logcat) 1.411 + print "Device info: %s" % self._devicemanager.getInfo() 1.412 + print "Test root: %s" % self._devicemanager.getDeviceRoot() 1.413 + except devicemanager.DMError: 1.414 + print "WARNING: Error getting device information" 1.415 + 1.416 + def cleanup(self, profileDir): 1.417 + # Pull results back from device 1.418 + if self.remoteLogFile and \ 1.419 + self._devicemanager.fileExists(self.remoteLogFile): 1.420 + self._devicemanager.getFile(self.remoteLogFile, self.localLogName) 1.421 + else: 1.422 + print "WARNING: Unable to retrieve log file (%s) from remote " \ 1.423 + "device" % self.remoteLogFile 1.424 + self._devicemanager.removeDir(self.remoteProfile) 1.425 + self._devicemanager.removeDir(self.remoteTestRoot) 1.426 + RefTest.cleanup(self, profileDir) 1.427 + if (self.pidFile != ""): 1.428 + try: 1.429 + os.remove(self.pidFile) 1.430 + os.remove(self.pidFile + ".xpcshell.pid") 1.431 + except: 1.432 + print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile 1.433 + 1.434 +def main(args): 1.435 + automation = RemoteAutomation(None) 1.436 + parser = RemoteOptions(automation) 1.437 + options, args = parser.parse_args() 1.438 + 1.439 + if (options.deviceIP == None): 1.440 + print "Error: you must provide a device IP to connect to via the --device option" 1.441 + return 1 1.442 + 1.443 + try: 1.444 + if (options.dm_trans == "adb"): 1.445 + if (options.deviceIP): 1.446 + dm = droid.DroidADB(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot) 1.447 + else: 1.448 + dm = droid.DroidADB(None, None, deviceRoot=options.remoteTestRoot) 1.449 + else: 1.450 + dm = droid.DroidSUT(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot) 1.451 + except devicemanager.DMError: 1.452 + print "Automation Error: exception while initializing devicemanager. Most likely the device is not in a testable state." 1.453 + return 1 1.454 + 1.455 + automation.setDeviceManager(dm) 1.456 + 1.457 + if (options.remoteProductName != None): 1.458 + automation.setProduct(options.remoteProductName) 1.459 + 1.460 + # Set up the defaults and ensure options are set 1.461 + options = parser.verifyRemoteOptions(options) 1.462 + if (options == None): 1.463 + print "ERROR: Invalid options specified, use --help for a list of valid options" 1.464 + return 1 1.465 + 1.466 + if not options.ignoreWindowSize: 1.467 + parts = dm.getInfo('screen')['screen'][0].split() 1.468 + width = int(parts[0].split(':')[1]) 1.469 + height = int(parts[1].split(':')[1]) 1.470 + if (width < 1050 or height < 1050): 1.471 + print "ERROR: Invalid screen resolution %sx%s, please adjust to 1366x1050 or higher" % (width, height) 1.472 + return 1 1.473 + 1.474 + automation.setAppName(options.app) 1.475 + automation.setRemoteProfile(options.remoteProfile) 1.476 + automation.setRemoteLog(options.remoteLogFile) 1.477 + reftest = RemoteReftest(automation, dm, options, SCRIPT_DIRECTORY) 1.478 + options = parser.verifyCommonOptions(options, reftest) 1.479 + 1.480 + # Hack in a symbolic link for jsreftest 1.481 + os.system("ln -s ../jsreftest " + str(os.path.join(SCRIPT_DIRECTORY, "jsreftest"))) 1.482 + 1.483 + # Dynamically build the reftest URL if possible, beware that args[0] should exist 'inside' the webroot 1.484 + manifest = args[0] 1.485 + if os.path.exists(os.path.join(SCRIPT_DIRECTORY, args[0])): 1.486 + manifest = "http://" + str(options.remoteWebServer) + ":" + str(options.httpPort) + "/" + args[0] 1.487 + elif os.path.exists(args[0]): 1.488 + manifestPath = os.path.abspath(args[0]).split(SCRIPT_DIRECTORY)[1].strip('/') 1.489 + manifest = "http://" + str(options.remoteWebServer) + ":" + str(options.httpPort) + "/" + manifestPath 1.490 + else: 1.491 + print "ERROR: Could not find test manifest '%s'" % manifest 1.492 + return 1 1.493 + 1.494 + # Start the webserver 1.495 + retVal = reftest.startWebServer(options) 1.496 + if retVal: 1.497 + return retVal 1.498 + 1.499 + procName = options.app.split('/')[-1] 1.500 + if (dm.processExist(procName)): 1.501 + dm.killProcess(procName) 1.502 + 1.503 + reftest.printDeviceInfo() 1.504 + 1.505 +#an example manifest name to use on the cli 1.506 +# manifest = "http://" + options.remoteWebServer + "/reftests/layout/reftests/reftest-sanity/reftest.list" 1.507 + retVal = 0 1.508 + try: 1.509 + cmdlineArgs = ["-reftest", manifest] 1.510 + if options.bootstrap: 1.511 + cmdlineArgs = [] 1.512 + dm.recordLogcat() 1.513 + retVal = reftest.runTests(manifest, options, cmdlineArgs) 1.514 + except: 1.515 + print "Automation Error: Exception caught while running tests" 1.516 + traceback.print_exc() 1.517 + retVal = 1 1.518 + 1.519 + reftest.stopWebServer(options) 1.520 + 1.521 + reftest.printDeviceInfo(printLogcat=True) 1.522 + 1.523 + return retVal 1.524 + 1.525 +if __name__ == "__main__": 1.526 + sys.exit(main(sys.argv[1:])) 1.527 +