Bug 1247054 - Fix |mach reftest| on Android, r?gbrown
There is an ImportError on Android, as well as a log related
regression from the structured log patch once that is fixed.
MozReview-Commit-ID: KxSEotr38qO
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -8,17 +8,17 @@ import time
import re
import os
import tempfile
import shutil
import subprocess
import sys
from automation import Automation
-from devicemanager import DMError, DeviceManager
+from mozdevice import DMError, DeviceManager
from mozlog import get_default_logger
import mozcrash
# signatures for logcat messages that we don't care about much
fennecLogcatFilters = [ "The character encoding of the HTML document was not declared",
"Use of Mutation Events is deprecated. Use MutationObserver instead.",
"Unexpected value from nativeGetEnabledTags: 0" ]
--- a/layout/tools/reftest/Makefile.in
+++ b/layout/tools/reftest/Makefile.in
@@ -9,23 +9,16 @@
$(srcdir)/runreftest.py \
$(srcdir)/reftestcommandline.py \
$(srcdir)/remotereftest.py \
$(srcdir)/runreftestb2g.py \
$(srcdir)/runreftestmulet.py \
$(srcdir)/gaia_lock_screen.js \
$(srcdir)/output.py \
automation.py \
- $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/devicemanager.py \
- $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py \
- $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/devicemanagerSUT.py \
- $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/droid.py \
- $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/version_codes.py \
- $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/Zeroconf.py \
- $(topsrcdir)/testing/mozbase/moznetwork/moznetwork/moznetwork.py \
$(topsrcdir)/build/mobile/b2gautomation.py \
$(topsrcdir)/build/mobile/remoteautomation.py \
$(topsrcdir)/testing/mochitest/server.js \
$(topsrcdir)/build/pgo/server-locations.txt \
$(NULL)
_HARNESS_PP_FILES = \
b2g_start_script.js \
--- a/layout/tools/reftest/mach_commands.py
+++ b/layout/tools/reftest/mach_commands.py
@@ -276,18 +276,16 @@ class ReftestRunner(MozbuildObject):
warnings.simplefilter('ignore')
import imp
path = os.path.join(self.reftest_dir, 'remotereftest.py')
with open(path, 'r') as fh:
imp.load_module('reftest', fh, path, ('.py', 'r', imp.PY_SOURCE))
import reftest
- # Remove the stdout handler from the internal logger and let mach deal with it
- runreftest.log.removeHandler(runreftest.log.handlers[0])
self.log_manager.enable_unstructured()
try:
rv = reftest.run(**kwargs)
finally:
self.log_manager.disable_unstructured()
return rv
--- a/layout/tools/reftest/remotereftest.py
+++ b/layout/tools/reftest/remotereftest.py
@@ -2,21 +2,20 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import os
import time
import tempfile
import traceback
+import urllib2
-import devicemanager
-import droid
+import mozdevice
import mozinfo
-import moznetwork
from automation import Automation
from remoteautomation import RemoteAutomation, fennecLogcatFilters
from output import OutputHandler
from runreftest import RefTest, ReftestResolver
import reftestcommandline
# We need to know our current directory so that we can serve our test files from it.
@@ -277,29 +276,29 @@ class RemoteReftest(RefTest):
prefs["layers.single-tile.enabled"] = False
# Set the extra prefs.
profile.set_preferences(prefs)
try:
self._devicemanager.pushDir(profileDir, options.remoteProfile)
self._devicemanager.chmodDir(options.remoteProfile)
- except devicemanager.DMError:
+ except mozdevice.DMError:
print "Automation Error: Failed to copy profiledir to device"
raise
return profile
def copyExtraFilesToProfile(self, options, profile):
profileDir = profile.profile
RefTest.copyExtraFilesToProfile(self, options, profile)
try:
self._devicemanager.pushDir(profileDir, options.remoteProfile)
self._devicemanager.chmodDir(options.remoteProfile)
- except devicemanager.DMError:
+ except mozdevice.DMError:
print "Automation Error: Failed to copy extra files to device"
raise
def printDeviceInfo(self, printLogcat=False):
try:
if printLogcat:
logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
print ''.join(logcat)
@@ -308,17 +307,17 @@ class RemoteReftest(RefTest):
for category in devinfo:
if type(devinfo[category]) is list:
print " %s:" % category
for item in devinfo[category]:
print " %s" % item
else:
print " %s: %s" % (category, devinfo[category])
print "Test root: %s" % self._devicemanager.deviceRoot
- except devicemanager.DMError:
+ except mozdevice.DMError:
print "WARNING: Error getting device information"
def environment(self, **kwargs):
return self.automation.environment(**kwargs)
def buildBrowserEnv(self, options, profileDir):
browserEnv = RefTest.buildBrowserEnv(self, options, profileDir)
# remove desktop environment not used on device
@@ -362,24 +361,24 @@ class RemoteReftest(RefTest):
def runTests(options, parser):
if (options.dm_trans == 'sut' and options.deviceIP == None):
print "Error: If --dm_trans = sut, you must provide a device IP to connect to via the --deviceIP option"
return 1
try:
if (options.dm_trans == "adb"):
if (options.deviceIP):
- dm = droid.DroidADB(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot)
+ dm = mozdevice.DroidADB(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot)
elif (options.deviceSerial):
- dm = droid.DroidADB(None, None, deviceSerial=options.deviceSerial, deviceRoot=options.remoteTestRoot)
+ dm = mozdevice.DroidADB(None, None, deviceSerial=options.deviceSerial, deviceRoot=options.remoteTestRoot)
else:
- dm = droid.DroidADB(None, None, deviceRoot=options.remoteTestRoot)
+ dm = mozdevice.DroidADB(None, None, deviceRoot=options.remoteTestRoot)
else:
- dm = droid.DroidSUT(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot)
- except devicemanager.DMError:
+ dm = mozdevice.DroidSUT(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot)
+ except mozdevice.DMError:
print "Automation Error: exception while initializing devicemanager. Most likely the device is not in a testable state."
return 1
automation = RemoteAutomation(None)
automation.setDeviceManager(dm)
if (options.remoteProductName != None):
automation.setProduct(options.remoteProductName)