Merge lp:~liuyq0307/lava-android-test/cts-continue-session into lp:lava-android-test

Proposed by Yongqin Liu
Status: Needs review
Proposed branch: lp:~liuyq0307/lava-android-test/cts-continue-session
Merge into: lp:lava-android-test
Diff against target: 150 lines (+38/-34)
2 files modified
lava_android_test/adb.py (+5/-4)
lava_android_test/test_definitions/cts/cts_wrapper.py (+33/-30)
To merge this branch: bzr merge lp:~liuyq0307/lava-android-test/cts-continue-session
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+172299@code.launchpad.net

Description of the change

In the cts test, there are such case that the adb connection is lost during the execution, but we can connect again if try to connect after disconnect.

1. add support for continuing the uncompleted cts test
2. fix the problem of adb.reconnect method to not check the result of disconnect

To post a comment you must log in.
260. By Yongqin Liu

add some sleep time

Unmerged revisions

260. By Yongqin Liu

add some sleep time

259. By Yongqin Liu

1. add support for continuing the uncompleted cts test
2. fix the problem of adb.reconnect method to not check the result of disconnect

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_android_test/adb.py'
2--- lava_android_test/adb.py 2013-06-03 05:39:36 +0000
3+++ lava_android_test/adb.py 2013-07-03 03:44:24 +0000
4@@ -306,6 +306,7 @@
5 def connect(self):
6 if self.serial:
7 self.run_cmd_host('adb connect %s' % self.serial, quiet=False)
8+ time.sleep(3)
9 return self.isDeviceConnected()
10 return False
11
12@@ -319,10 +320,10 @@
13 for i in range(1, 5):
14 print "LAVA: try to reconnect the device(%s) %i/5 times" % (
15 self.serial, i)
16- if self.disconnect():
17- time.sleep(2)
18- if self.connect():
19- return True
20+ self.disconnect()
21+ time.sleep(3)
22+ if self.connect():
23+ return True
24 time.sleep(5)
25 return False
26
27
28=== modified file 'lava_android_test/test_definitions/cts/cts_wrapper.py'
29--- lava_android_test/test_definitions/cts/cts_wrapper.py 2013-06-09 07:15:03 +0000
30+++ lava_android_test/test_definitions/cts/cts_wrapper.py 2013-07-03 03:44:24 +0000
31@@ -53,27 +53,8 @@
32 result = False
33 finally:
34 proc_cts.sendcontrol('C')
35+ proc_cts.sendcontrol('C')
36 proc_cts.sendline('')
37- target_dir = os.path.join(os.getcwd(),
38- './android-cts/repository/results/')
39- for zip_f in find_files(target_dir, '.zip'):
40- ret_code = adb.push(zip_f, '/data/local/tmp/cts-results.zip')[0]
41- if ret_code != 0:
42- print "Failed to push file %s to device(%s)" % (zip_f,
43- adb.get_serial())
44- log_target_dir = os.path.join(os.getcwd(),
45- './android-cts/repository/logs/')
46- for zip_f in find_files(log_target_dir, '.zip'):
47- base_name = os.path.basename(zip_f)
48- if base_name.startswith('device_logcat_'):
49- base_name = 'device_logcat.zip'
50- if base_name.startswith('host_log_'):
51- base_name = 'host_log.zip'
52-
53- ret_code = adb.push(zip_f, '/data/local/tmp/%s' % base_name)[0]
54- if ret_code != 0:
55- print "Failed to push file %s to device(%s)" % (zip_f,
56- adb.get_serial())
57 return result
58
59
60@@ -81,21 +62,21 @@
61 list_result_path = os.path.join(curdir, 'cts_list_result_wrapper.sh')
62 list_result_cmd = "bash %s" % list_result_path
63
64- pattern = 'CTS unknown'
65+ pattern = 'I/CommandScheduler: All done'
66 if not stop_at_pattern(command=list_result_cmd,
67- pattern=pattern, timeout=5):
68+ pattern=pattern, timeout=30):
69 print "Failed to list the cts result for device(%s)" % adb.get_serial()
70
71 with open('cts_list_results.log') as fd:
72 #0 17237 126 0 2012.06.23_03.31.49 CTS unknown
73- pattern = ("\s*\d+\s+\d+\s+\d+\s+(?P<no_executed>\d+)"
74- "\s+.+CTS\s+unknown\s*$")
75+ pattern = ("^\s*0\s+\d+\s+\d+\s+(?P<not_executed>\d+)\s+[\d._]+"
76+ "\s+\S+\s+unknown\s*$")
77 pat = re.compile(pattern)
78 for line in fd.readlines():
79 match = pat.search(line)
80 if not match:
81 continue
82- return match.groupdict()['no_executed']
83+ return match.groupdict()['not_executed']
84 return 0
85
86
87@@ -157,9 +138,9 @@
88 return True
89
90
91-def run_cts_continue(cts_cmd=None):
92+def run_cts_continue(cts_cmd=None, timeout=36000):
93 pattern = "Time:"
94- continue_command = '--continue-session 0'
95+ continue_command = 'run cts --continue-session 0'
96 if cts_cmd:
97 continue_command = "%s %s" % (cts_cmd, continue_command)
98
99@@ -178,7 +159,7 @@
100
101 if not stop_at_cts_pattern(command=continue_command,
102 pattern=pattern,
103- timeout=36000):
104+ timeout=timeout):
105 print "CTS test times out"
106 else:
107 break
108@@ -229,10 +210,10 @@
109 adb.get_serial())
110 with open(log_file) as log_fd:
111 print '=========Log file [%s] starts=========>>>>>' % (
112- log_file)
113+ log_file)
114 for line in log_fd.readlines():
115 print line.rstrip()
116- print '<<<<<=========Log file [%s] ends=========' % log_file
117+ print '<<<<<=========Log file [%s] ends========' % log_file
118
119
120 def get_all_packages(plan_file=None):
121@@ -316,7 +297,29 @@
122 run_cts_with_plan(cts_cmd=run_wrapper_cmd, plan=plan_name,
123 timeout=timeout)
124
125+ time.sleep(3)
126+ run_cts_continue(cts_cmd=run_wrapper_path, timeout=timeout)
127 finally:
128+ target_dir = os.path.join(os.getcwd(),
129+ './android-cts/repository/results/')
130+ for zip_f in find_files(target_dir, '.zip'):
131+ ret_code = adb.push(zip_f, '/data/local/tmp/cts-results.zip')[0]
132+ if ret_code != 0:
133+ print "Failed to push file %s to device(%s)" % (zip_f,
134+ adb.get_serial())
135+ log_target_dir = os.path.join(os.getcwd(),
136+ './android-cts/repository/logs/')
137+ for zip_f in find_files(log_target_dir, '.zip'):
138+ base_name = os.path.basename(zip_f)
139+ if base_name.startswith('device_logcat_'):
140+ base_name = 'device_logcat.zip'
141+ if base_name.startswith('host_log_'):
142+ base_name = 'host_log.zip'
143+
144+ ret_code = adb.push(zip_f, '/data/local/tmp/%s' % base_name)[0]
145+ if ret_code != 0:
146+ print "Failed to push file %s to device(%s)" % (zip_f,
147+ adb.get_serial())
148 for log in logs:
149 pid = log.get('pid')
150 if pid:

Subscribers

People subscribed via source and target branches