[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 140: remove the BaseAndroidAction class, moving its only method to LavaAndroidClient

Message ID 20111020064213.26677.39007.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Oct. 20, 2011, 6:42 a.m.
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-dispatcher/eliminate-BaseAndroidAction/+merge/79907
  proposed by: Michael Hudson-Doyle (mwhudson)
  review: Approve - Spring Zhang (qzhang)
------------------------------------------------------------
revno: 140 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Thu 2011-10-20 19:39:08 +1300
message:
  remove the BaseAndroidAction class, moving its only method to LavaAndroidClient
modified:
  lava_dispatcher/actions/__init__.py
  lava_dispatcher/actions/android_0xbench.py
  lava_dispatcher/actions/android_basic.py
  lava_dispatcher/actions/boot_control.py
  lava_dispatcher/android_client.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription

Patch

=== modified file 'lava_dispatcher/actions/__init__.py'
--- lava_dispatcher/actions/__init__.py	2011-10-13 01:41:00 +0000
+++ lava_dispatcher/actions/__init__.py	2011-10-20 04:36:56 +0000
@@ -57,20 +57,6 @@ 
         return self.command_name
 
 
-class BaseAndroidAction(BaseAction):
-    def __init__(self, context):
-        self.context = context
-
-    def check_sys_bootup(self):
-        result_pattern = "([0-1])"
-        cmd = "getprop sys.boot_completed"
-        self.client.proc.sendline(cmd)
-        id = self.client.proc.expect([result_pattern], timeout = 60)
-        if id == 0:
-            return True
-        else:
-            return False
-
 def _find_commands(module):
     cmds = {}
     for name, cls in module.__dict__.iteritems():

=== modified file 'lava_dispatcher/actions/android_0xbench.py'
--- lava_dispatcher/actions/android_0xbench.py	2011-09-12 22:31:47 +0000
+++ lava_dispatcher/actions/android_0xbench.py	2011-10-20 04:36:56 +0000
@@ -19,17 +19,17 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses>.
 
-from lava_dispatcher.actions import BaseAndroidAction
+from lava_dispatcher.actions import BaseAction
 import time
 import pexpect
 import logging
 
-class cmd_test_android_0xbench(BaseAndroidAction):
+class cmd_test_android_0xbench(BaseAction):
     def run(self):
         #Make sure in test image now
         self.client.in_test_shell()
         time.sleep(30)
-        if not self.check_sys_bootup():
+        if not self.client.check_sys_bootup():
             # TODO: Fetch the logcat message as attached
             logging.warning("0xbench Test: sys bootup fail, aborted")
             return

=== modified file 'lava_dispatcher/actions/android_basic.py'
--- lava_dispatcher/actions/android_basic.py	2011-10-18 02:38:34 +0000
+++ lava_dispatcher/actions/android_basic.py	2011-10-20 04:36:56 +0000
@@ -19,21 +19,19 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses>.
 
-from lava_dispatcher.actions import BaseAndroidAction
-from lava_dispatcher.client import OperationFailed
+from lava_dispatcher.actions import BaseAction
 import time
 import pexpect
-import sys
 import logging
 from datetime import datetime
 from lava_dispatcher.android_util import savebundlefile
 
-class cmd_test_android_monkey(BaseAndroidAction):
+class cmd_test_android_monkey(BaseAction):
     def run(self):
         #Make sure in test image now
         self.client.in_test_shell()
         time.sleep(30)
-        if not self.check_sys_bootup():
+        if not self.client.check_sys_bootup():
             # TODO: Fetch the logcat message as attachment
             logging.warning("monkey run test skipped: sys bootup fail")
             return
@@ -65,7 +63,7 @@ 
         self.client.proc.sendline("")
 
 
-class cmd_test_android_basic(BaseAndroidAction):
+class cmd_test_android_basic(BaseAction):
     def run(self):
         #Make sure in test image now
         self.client.in_test_shell()

=== modified file 'lava_dispatcher/actions/boot_control.py'
--- lava_dispatcher/actions/boot_control.py	2011-10-18 02:38:34 +0000
+++ lava_dispatcher/actions/boot_control.py	2011-10-20 04:36:56 +0000
@@ -22,10 +22,10 @@ 
 
 import logging
 
-from lava_dispatcher.actions import BaseAction, BaseAndroidAction
+from lava_dispatcher.actions import BaseAction
 from lava_dispatcher.client import CriticalError
 
-class cmd_boot_linaro_android_image(BaseAndroidAction):
+class cmd_boot_linaro_android_image(BaseAction):
     """ Call client code to boot to the master image
     """
     def run(self):

=== modified file 'lava_dispatcher/android_client.py'
--- lava_dispatcher/android_client.py	2011-10-20 04:09:15 +0000
+++ lava_dispatcher/android_client.py	2011-10-20 06:38:10 +0000
@@ -198,3 +198,9 @@ 
             time.sleep(1)
         raise GeneralError('The home screen does not displayed')
 
+    def check_sys_bootup(self):
+        result_pattern = "([0-1])"
+        cmd = "getprop sys.boot_completed"
+        self.proc.sendline(cmd)
+        match_id = self.proc.expect([result_pattern], timeout = 60)
+        return match_id == 0