Bug 705175: update devicemanager, devicemanagerSUT versions of getAppRoot; r=jmaher
This commit is contained in:
@@ -346,24 +346,7 @@ class DeviceManager:
|
|||||||
# success: path for app root
|
# success: path for app root
|
||||||
# failure: None
|
# failure: None
|
||||||
def getAppRoot(self):
|
def getAppRoot(self):
|
||||||
devroot = self.getDeviceRoot()
|
assert 0 == 1
|
||||||
if (devroot == None):
|
|
||||||
return None
|
|
||||||
|
|
||||||
if (self.dirExists(devroot + '/fennec')):
|
|
||||||
return devroot + '/fennec'
|
|
||||||
elif (self.dirExists(devroot + '/firefox')):
|
|
||||||
return devroot + '/firefox'
|
|
||||||
elif (self.dirExsts('/data/data/org.mozilla.fennec')):
|
|
||||||
return 'org.mozilla.fennec'
|
|
||||||
elif (self.dirExists('/data/data/org.mozilla.firefox')):
|
|
||||||
return 'org.mozilla.firefox'
|
|
||||||
elif (self.dirExists('/data/data/org.mozilla.fennec_aurora')):
|
|
||||||
return 'org.mozilla.fennec_aurora'
|
|
||||||
elif (self.dirExists('/data/data/org.mozilla.firefox_beta')):
|
|
||||||
return 'org.mozilla.firefox_beta'
|
|
||||||
|
|
||||||
# Failure (either not installed or not a recognized platform)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Gets the directory location on the device for a specific test type
|
# Gets the directory location on the device for a specific test type
|
||||||
|
|||||||
@@ -426,15 +426,14 @@ class DeviceManagerADB(DeviceManager):
|
|||||||
# returns:
|
# returns:
|
||||||
# success: path for app root
|
# success: path for app root
|
||||||
# failure: None
|
# failure: None
|
||||||
def getAppRoot(self):
|
def getAppRoot(self, packageName):
|
||||||
devroot = self.getDeviceRoot()
|
devroot = self.getDeviceRoot()
|
||||||
if (devroot == None):
|
if (devroot == None):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if (self.dirExists(devroot + '/fennec')):
|
if (packageName and self.dirExists('/data/data/' + packageName)):
|
||||||
return devroot + '/fennec'
|
self.packageName = packageName
|
||||||
elif (self.dirExists(devroot + '/firefox')):
|
return '/data/data/' + packageName
|
||||||
return devroot + '/firefox'
|
|
||||||
elif (self.packageName and self.dirExists('/data/data/' + self.packageName)):
|
elif (self.packageName and self.dirExists('/data/data/' + self.packageName)):
|
||||||
return '/data/data/' + self.packageName
|
return '/data/data/' + self.packageName
|
||||||
|
|
||||||
|
|||||||
@@ -858,6 +858,15 @@ class DeviceManagerSUT(DeviceManager):
|
|||||||
|
|
||||||
return deviceRoot
|
return deviceRoot
|
||||||
|
|
||||||
|
def getAppRoot(self, packageName):
|
||||||
|
try:
|
||||||
|
data = self.verifySendCMD(['getapproot '+packageName])
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
appRoot = self.stripPrompt(data).strip('\n')
|
||||||
|
return appRoot
|
||||||
|
|
||||||
# external function
|
# external function
|
||||||
# returns:
|
# returns:
|
||||||
# success: output of unzip command
|
# success: output of unzip command
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public class DoCommand {
|
|||||||
String ffxProvider = "org.mozilla.ffxcp";
|
String ffxProvider = "org.mozilla.ffxcp";
|
||||||
String fenProvider = "org.mozilla.fencp";
|
String fenProvider = "org.mozilla.fencp";
|
||||||
|
|
||||||
private final String prgVersion = "SUTAgentAndroid Version 1.03";
|
private final String prgVersion = "SUTAgentAndroid Version 1.04";
|
||||||
|
|
||||||
public enum Command
|
public enum Command
|
||||||
{
|
{
|
||||||
@@ -1285,7 +1285,7 @@ private void CancelNotification()
|
|||||||
try {
|
try {
|
||||||
Context appCtx = ctx.createPackageContext(AppName, 0);
|
Context appCtx = ctx.createPackageContext(AppName, 0);
|
||||||
ContextWrapper appCtxW = new ContextWrapper(appCtx);
|
ContextWrapper appCtxW = new ContextWrapper(appCtx);
|
||||||
sRet = appCtxW.getPackageResourcePath();
|
sRet = appCtxW.getApplicationInfo().dataDir;
|
||||||
appCtxW = null;
|
appCtxW = null;
|
||||||
appCtx = null;
|
appCtx = null;
|
||||||
ctx = null;
|
ctx = null;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
# ***** END LICENSE BLOCK ***** */
|
# ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
import re, sys, os
|
import re, sys, os
|
||||||
|
import subprocess
|
||||||
import runxpcshelltests as xpcshell
|
import runxpcshelltests as xpcshell
|
||||||
from automationutils import *
|
from automationutils import *
|
||||||
import devicemanager, devicemanagerADB, devicemanagerSUT
|
import devicemanager, devicemanagerADB, devicemanagerSUT
|
||||||
@@ -66,6 +67,22 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
|||||||
self.remoteAPK = self.remoteJoin(self.remoteBinDir, os.path.basename(options.localAPK))
|
self.remoteAPK = self.remoteJoin(self.remoteBinDir, os.path.basename(options.localAPK))
|
||||||
self.remoteDebugger = options.debugger
|
self.remoteDebugger = options.debugger
|
||||||
self.remoteDebuggerArgs = options.debuggerArgs
|
self.remoteDebuggerArgs = options.debuggerArgs
|
||||||
|
self.setAppRoot()
|
||||||
|
|
||||||
|
def setAppRoot(self):
|
||||||
|
# Determine the application root directory associated with the package
|
||||||
|
# name used by the Fennec APK.
|
||||||
|
self.appRoot = None
|
||||||
|
packageName = None
|
||||||
|
if self.options.localAPK:
|
||||||
|
try:
|
||||||
|
packageName = subprocess.check_output(["unzip", "-p", self.options.localAPK, "package-name.txt"])
|
||||||
|
if packageName:
|
||||||
|
self.appRoot = self.device.getAppRoot(packageName.strip())
|
||||||
|
except Exception as detail:
|
||||||
|
print "unable to determine app root: " + detail
|
||||||
|
pass
|
||||||
|
return None
|
||||||
|
|
||||||
def remoteJoin(self, path1, path2):
|
def remoteJoin(self, path1, path2):
|
||||||
joined = os.path.join(path1, path2)
|
joined = os.path.join(path1, path2)
|
||||||
@@ -203,9 +220,9 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
|
|||||||
shellArgs = "cd "+self.remoteHere
|
shellArgs = "cd "+self.remoteHere
|
||||||
shellArgs += "; LD_LIBRARY_PATH="+self.remoteBinDir
|
shellArgs += "; LD_LIBRARY_PATH="+self.remoteBinDir
|
||||||
shellArgs += "; export CACHE_PATH="+self.remoteBinDir
|
shellArgs += "; export CACHE_PATH="+self.remoteBinDir
|
||||||
if (self.device.getAppRoot()):
|
if (self.appRoot):
|
||||||
# xpcshell still runs without GRE_HOME; it may not be necessary
|
# xpcshell still runs without GRE_HOME; it may not be necessary
|
||||||
shellArgs += "; export GRE_HOME="+self.device.getAppRoot()
|
shellArgs += "; export GRE_HOME="+self.appRoot
|
||||||
shellArgs += "; export XPCSHELL_TEST_PROFILE_DIR="+self.profileDir
|
shellArgs += "; export XPCSHELL_TEST_PROFILE_DIR="+self.profileDir
|
||||||
shellArgs += "; "+xpcshell+" "
|
shellArgs += "; "+xpcshell+" "
|
||||||
shellArgs += " ".join(cmd[1:])
|
shellArgs += " ".join(cmd[1:])
|
||||||
|
|||||||
Reference in New Issue
Block a user