Skip to content
This repository

Fennec #40

Merged
merged 6 commits into from over 1 year ago

3 participants

staktrace Jeff Hammel William Lachance
staktrace

Make mozregression work with the new native fennec by installing/running over adb. Eventually mozrunner should be updated to do this and then we can continue to use mozrunner but for now this works.

William Lachance
Collaborator

It might be worth considering using mozdevice here, in particular the droid abstraction. This would allow you to work with devices running the SUTAgent protocol in addition to adb, in addition to being simpler.

Jeff Hammel
Collaborator
k0s commented October 02, 2012

I agree with wlach that mozdevice would be better.

Jeff Hammel
Collaborator
k0s commented October 02, 2012

I'm going to go ahead and merge and write a follow-up issue. If this helps testing now, that's a plus, and the mozregression code is not exactly wonderful as is

Jeff Hammel k0s merged commit a115a53 into from October 02, 2012
Jeff Hammel k0s closed this October 02, 2012
Jeff Hammel
Collaborator
k0s commented October 02, 2012

see also #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
4  README.md
Source Rendered
@@ -28,7 +28,7 @@ Find regression range on Thunderbird nightlies:
28 28
 
29 29
 Find regression range on Firefox mobile nightlies:
30 30
 
31  
-	mozregression --app=mobile
  31
+	mozregression --app=fennec
32 32
 
33 33
 Other branches/repos:
34 34
 
@@ -41,4 +41,4 @@ profile, addons, and browser arguments.
41 41
 
42 42
 mozregression uses mozcommitbuilder:
43 43
 
44  
-https://github.com/mozilla/mozcommitbuilder
  44
+https://github.com/mozilla/mozcommitbuilder
2  mozregression/mozInstall.py
@@ -292,7 +292,7 @@ def installExe(self):
292 292
                           1.9", metavar="BRANCH")
293 293
   parser.add_option("-p", "--Product", dest="product",
294 294
                     help="Product name - optional should be all lowercase if\
295  
-                         specified: firefox, mobile, thunderbird, etc",
  295
+                         specified: firefox, fennec, thunderbird, etc",
296 296
                     metavar="PRODUCT")
297 297
   parser.add_option("-o", "--Operation", dest="op",
298 298
                     help="The operation you would like the script to perform.\
4  mozregression/regression.py
@@ -168,8 +168,8 @@ def cli():
168 168
     parser.add_option("-p", "--profile", dest="profile", help="profile to use with nightlies", metavar="PATH")
169 169
     parser.add_option("-a", "--args", dest="cmdargs", help="command-line arguments to pass to the application",
170 170
                       metavar="ARG1,ARG2", default="")
171  
-    parser.add_option("-n", "--app", dest="app", help="application name (firefox, mobile or thunderbird)",
172  
-                      metavar="[firefox|mobile|thunderbird]", default="firefox")
  171
+    parser.add_option("-n", "--app", dest="app", help="application name (firefox, fennec or thunderbird)",
  172
+                      metavar="[firefox|fennec|thunderbird]", default="firefox")
173 173
     parser.add_option("-r", "--repo", dest="repo_name", help="repository name on ftp.mozilla.org",
174 174
                       metavar="[tracemonkey|mozilla-1.9.2]", default=None)
175 175
     (options, args) = parser.parse_args()
70  mozregression/runnightly.py
@@ -106,6 +106,7 @@ def install(self):
106 106
         rmdirRecursive("moznightlyapp")
107 107
         subprocess._cleanup = lambda : None # mikeal's fix for subprocess threading bug
108 108
         MozInstaller(src=self.dest, dest="moznightlyapp", dest_app="Mozilla.app")
  109
+        return True
109 110
 
110 111
     @staticmethod
111 112
     def urlLinks(url):
@@ -165,6 +166,22 @@ def getAppInfo(self):
165 166
         except:
166 167
             return ("", "")
167 168
 
  169
+    def start(self, profile, addons, cmdargs):
  170
+        if profile:
  171
+            profile = self.profileClass(profile=profile, addons=addons)
  172
+        elif len(addons):
  173
+            profile = self.profileClass(addons=addons)
  174
+        else:
  175
+            profile = self.profileClass()
  176
+
  177
+        self.runner = Runner(binary=self.binary, cmdargs=cmdargs, profile=profile)
  178
+        self.runner.names = [self.processName]
  179
+        self.runner.start()
  180
+        return True
  181
+
  182
+    def stop(self):
  183
+        self.runner.stop()
  184
+
168 185
 class ThunderbirdNightly(Nightly):
169 186
     appName = 'thunderbird'
170 187
     name = 'thunderbird'
@@ -203,15 +220,38 @@ class FennecNightly(Nightly):
203 220
     name = 'fennec'
204 221
     profileClass = FirefoxProfile
205 222
 
  223
+    def __init__(self, repo_name=None):
  224
+        Nightly.__init__(self, repo_name)
  225
+        self.buildRegex = 'fennec-.*\.apk'
  226
+        self.processName = 'org.mozilla.fennec'
  227
+        self.binary = 'org.mozilla.fennec/.App'
  228
+        if "y" != raw_input("WARNING: bisecting nightly fennec builds will clobber your existing nightly profile. Continue? (y or n)"):
  229
+            raise Exception("Aborting!")
  230
+
206 231
     def getRepoName(self, date):
207  
-      return "mozilla-central-linux"
  232
+        return "mozilla-central-android"
  233
+
  234
+    def install(self):
  235
+        subprocess.check_call(["adb", "uninstall", "org.mozilla.fennec"])
  236
+        subprocess.check_call(["adb", "install", self.dest])
  237
+        return True
  238
+
  239
+    def start(self, profile, addons, cmdargs):
  240
+        subprocess.check_call(["adb", "shell", "am start -n %s" % self.binary])
  241
+        return True
  242
+
  243
+    def stop(self):
  244
+        # TODO: kill fennec (don't really care though since uninstalling it kills it)
  245
+        # PID = $(adb shell ps | grep org.mozilla.fennec | awk '{ print $2 }')
  246
+        # adb shell run-as org.mozilla.fennec kill $PID
  247
+        return True
208 248
 
209 249
 class NightlyRunner(object):
210 250
     def __init__(self, addons=None, appname="firefox", repo_name=None,
211 251
                  profile=None, cmdargs=[]):
212 252
         if appname.lower() == 'thunderbird':
213 253
            self.app = ThunderbirdNightly(repo_name=repo_name)
214  
-        elif appname.lower() == 'mobile':
  254
+        elif appname.lower() == 'fennec':
215 255
            self.app = FennecNightly(repo_name=repo_name)
216 256
         else:
217 257
            self.app = FirefoxNightly(repo_name=repo_name)
@@ -223,25 +263,19 @@ def install(self, date=datetime.date.today()):
223 263
         if not self.app.download(date=date):
224 264
             print "could not find nightly from " + str(date)
225 265
             return False # download failed
226  
-        print "Starting nightly\n"
227  
-        self.app.install()
  266
+        print "Installing nightly\n"
  267
+        return self.app.install()
228 268
 
229 269
     def start(self, date=datetime.date.today()):
230  
-        self.install(date)
231  
-        if self.profile:
232  
-            profile = self.app.profileClass(profile=self.profile, addons=self.addons)
233  
-        elif len(self.addons):
234  
-            profile = self.app.profileClass(addons=self.addons)
235  
-        else:
236  
-            profile = self.app.profileClass()
237  
-
238  
-        self.runner = Runner(binary=self.app.binary, cmdargs=self.cmdargs, profile=profile)
239  
-        self.runner.names = [self.app.processName]
240  
-        self.runner.start()
  270
+        if not self.install(date):
  271
+            return False
  272
+        print "Starting nightly\n"
  273
+        if not self.app.start(self.profile, self.addons, self.cmdargs):
  274
+            return False
241 275
         return True
242 276
 
243 277
     def stop(self):
244  
-        self.runner.stop()
  278
+        self.app.stop()
245 279
 
246 280
     def getAppInfo(self):
247 281
         return self.app.getAppInfo()
@@ -253,8 +287,8 @@ def cli():
253 287
     parser.add_option("-a", "--addons", dest="addons", help="list of addons to install",
254 288
                       metavar="PATH1,PATH2", default="")
255 289
     parser.add_option("-p", "--profile", dest="profile", help="path to profile to user", metavar="PATH")
256  
-    parser.add_option("-n", "--app", dest="app", help="application name (firefox or thunderbird)",
257  
-                      metavar="[firefox|thunderbird]", default="firefox")
  290
+    parser.add_option("-n", "--app", dest="app", help="application name (firefox, thunderbird, or fennec)",
  291
+                      metavar="[firefox|thunderbird|fennec]", default="firefox")
258 292
     parser.add_option("-r", "--repo", dest="repo_name", help="repository name on ftp.mozilla.org",
259 293
                       metavar="[tracemonkey|mozilla-1.9.2]", default=None)
260 294
     (options, args) = parser.parse_args()
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.