fix n900 unit tests. bug 551310, r=jhford
authorAki Sasaki <asasaki@mozilla.com>
Tue, 30 Mar 2010 11:36:55 -0700
changeset 676 89c66c6acb07067ccd1ff0aaf58c462b7b87c4e3
parent 675 3c1c1003004b1b63d4226f3da6c6b6cc6c7d281f
child 677 da9e888f3189153e50ae8b0488f0f7ed2299556c
push id405
push userasasaki@mozilla.com
push dateTue, 30 Mar 2010 18:36:58 +0000
reviewersjhford
bugs551310
fix n900 unit tests. bug 551310, r=jhford
process/mobiletestfactoryrw.py
steps/mobile.py
--- a/process/mobiletestfactoryrw.py
+++ b/process/mobiletestfactoryrw.py
@@ -1,9 +1,8 @@
-
 import re
 
 from buildbot.process.factory import BuildFactory
 from buildbot.steps.shell import Compile, ShellCommand, WithProperties, \
   SetProperty
 from buildbot.changes import base, changes
 
 import buildbotcustom.steps.misc
@@ -344,17 +343,17 @@ class MobileTalosFactory(BuildFactory):
             description=['unpack', 'build'],
         ))
 
 #
 # Run unit tests through maemkit on Maemo Phones
 #
 class MobileUnittestFactory(MobileTalosFactory):
     def __init__(self, test_type, known_fail_count=0, clients=None,
-                 maemkit_repo_path='users/jford_mozilla.com/maemkit', **kwargs):
+                 maemkit_repo_path='qa/maemkit', **kwargs):
         ''' clients is a tuple of (clientnumber, totalclients), e.g. (1,4).
         being hopeful about default 0 for known fail count'''
         self.test_type = test_type
         self.known_fail_count = known_fail_count
         self.clients = clients
         self.maemkit_repo_path = maemkit_repo_path
         MobileTalosFactory.__init__(self, **kwargs)
 
@@ -406,19 +405,18 @@ class MobileUnittestFactory(MobileTalosF
         self.addStep(ShellCommand(
             command=test_command,
             workdir="%s/maemkit" % self.base_dir,
             description=['run', self.test],
             name="run_%s" % self.test,
             haltOnFailure=True,
             timeout=self.timeout,
         ))
-        #This is commented out while we figure out what is going on
-        # self.addStep(MobileParseTestLog(
-        #         log_name,
-        #         known_fail_count=self.known_fail_count,
-        #         workdir="%s/fennec" % self.base_dir,
-        #         description=['parse', self.test],
-        #         name='parse_%s' % self.test,
-        #         timeout=120,
-        #         flunkOnFailure=False,
-        #         haltOnFailure=False,
-        # ))
+        self.addStep(MobileParseTestLog,
+            name=self.test_type,
+            command=['cat', log_name],
+            knownFailCount=self.known_fail_count,
+            workdir="/builds/fennec",
+            description=['parse', self.test_type, 'log'],
+            timeout=120,
+            flunkOnFailure=False,
+            haltOnFailure=False,
+       )
--- a/steps/mobile.py
+++ b/steps/mobile.py
@@ -1,30 +1,39 @@
+import re
+
 from buildbot.steps.shell import ShellCommand
+  
 from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, SKIPPED, \
-    EXCEPTION
+  EXCEPTION
 
+import buildbotcustom.steps.unittest
+reload(buildbotcustom.steps.unittest)
+from buildbotcustom.steps.unittest import emphasizeFailureText, summaryText
 
 # Wasn't able to get ShellCommandReportTimeout working; may try again
 # later.
 class MobileParseTestLog(ShellCommand):
     warnOnFailure = True
     warnOnWarnings = True
 
-    def __init__(self, log, known_fail_count=0,
+    def __init__(self, name=None, command=None, knownFailCount=0,
                  timeout=60, **kwargs):
         self.super_class = ShellCommand
-        self.log = log
-        self.known_fail_count = known_fail_count
-        command = ['cat', self.log]
+        self.name = name
+        self.knownFailCount = knownFailCount
+
+        if not command:
+            command = ['python', 'maemkit-chunked.py',
+                          '--testtype=%s' % name],
 
         ShellCommand.__init__(self, timeout=timeout, command=command, **kwargs)
 
         self.addFactoryArguments(command=command, timeout=timeout,
-                                 known_fail_count=known_fail_count)
+                                 knownFailCount=knownFailCount)
 
     def createSummary(self, log):
         summary = ""
         crashed = leaked = False
         passCount = knownCount = failCount = 0
 
         skipIdent = "EXPECTED RANDOM"
         passIdent = "TEST-PASS"
@@ -52,46 +61,46 @@ class MobileParseTestLog(ShellCommand):
                 failCount = failCount + 1
                 continue
             if knownIdent in line:
                 knownCount = knownCount + 1
 
         if (failCount):
             summary = "Orig fail count: %d\nOrig known count: %d\n" % (
                     failCount, knownCount)
-            if failCount > self.known_fail_count:
-                failCount = failCount - self.known_fail_count
-                knownCount = knownCount + self.known_fail_count
+            if failCount > self.knownFailCount:
+                failCount = failCount - self.knownFailCount
+                knownCount = knownCount + self.knownFailCount
             else:
                 knownCount = knownCount + failCount
                 failCount = 0
 
         # Add the summary.
         if (passCount > 0):
             summary = "%sTinderboxPrint: %s<br/>%s [%d]\n" % (summary,
                     self.name, summaryText(passCount, failCount,
                                            knownCount, crashed=crashed,
                                            leaked=leaked),
-                    self.known_fail_count)
+                    self.knownFailCount)
         else:
             summary = emphasizeFailureText("T-FAIL")
 
         self.addCompleteLog('summary', summary)
 
     def evaluateCommand(self, cmd):
         superResult = self.super_class.evaluateCommand(self, cmd)
         if SUCCESS != superResult:
             return superResult
 
         cmdText = cmd.logs['stdio'].getText()
         if cmdText != str(cmdText):
             return WARNINGS
 
         m = re.findall('TEST-UNEXPECTED-', cmdText)
-        if len(m) > self.known_fail_count:
+        if len(m) > self.knownFailCount:
             return WARNINGS
         if re.search('FAIL Exited', cmdText):
             return WARNINGS
 
         if self.name.startswith('mochitest') or self.name.startswith('chrome'):
             # Support browser-chrome result summary format which differs
             # from MozillaMochitest's.
             if self.name != 'mochitest-browser-chrome':