Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchun-li committed Jan 9, 2016
1 parent 0c4ada4 commit a23a1ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion droidbot/app_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,9 @@ def start(self):
elif self.policy == POLICY_NONE:
self.device.start_app(self.app)
while True:
print raw_input("press ENTER to save current device state...")
input = raw_input("press ENTER to save current state, type q to exit...")
if input.startswith('q'):
break
state = self.device.get_current_state()
if state is not None:
state.save2dir()
Expand Down
3 changes: 2 additions & 1 deletion droidbot/droidbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DroidBot(object):
# this is a single instance class
instance = None

def __init__(self, device_serial=None, app_path=None, output_dir=None,
def __init__(self, app_path, device_serial=None, output_dir=None,
env_policy=None, event_policy=None, with_droidbox=False,
event_count=None, event_interval=None, event_duration=None, quiet=False):
"""
Expand Down Expand Up @@ -92,3 +92,4 @@ def stop(self):
if self.droidbox is not None:
self.droidbox.stop()
self.device.uninstall_app(self.app)
self.device.disconnect()
12 changes: 8 additions & 4 deletions droidbot/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def parse_args():
formatter_class=RawTextHelpFormatter)
parser.add_argument("-d", action="store", dest="device_serial",
help="serial number of target device")
parser.add_argument("-a", action="store", dest="app_path", required=True,
help="file path of target app")
parser.add_argument("-a", action="store", dest="apk_path", required=True,
help="file path of target apk")
parser.add_argument("-count", action="store", dest="event_count",
type=int, help="number of events to generate during testing")
parser.add_argument("-interval", action="store", dest="event_interval",
Expand Down Expand Up @@ -59,9 +59,13 @@ def main():
it starts a droidbot according to the arguments given in cmd line
"""
opts = parse_args()
import os
if not os.path.exists(opts.apk_path):
print "apk not exist"
return

droidbot = DroidBot(device_serial=opts.device_serial,
app_path=opts.app_path,
droidbot = DroidBot(app_path=opts.apk_path,
device_serial=opts.device_serial,
output_dir=opts.output_dir,
env_policy=opts.env_policy,
event_policy=opts.event_policy,
Expand Down

0 comments on commit a23a1ef

Please sign in to comment.