Merge lp:~mwhudson/lava-dispatcher/eliminate-old-android-tests into lp:lava-dispatcher

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 151
Proposed branch: lp:~mwhudson/lava-dispatcher/eliminate-old-android-tests
Merge into: lp:lava-dispatcher
Diff against target: 598 lines (+64/-443)
9 files modified
doc/android-0xbench-job.json (+0/-37)
doc/android-basic-job.json (+0/-36)
doc/android-monkey-job.json (+0/-36)
doc/android-new-kernel.json (+12/-1)
doc/jobfile.rst (+52/-29)
lava_dispatcher/actions/android_0xbench.py (+0/-53)
lava_dispatcher/actions/android_basic.py (+0/-150)
lava_dispatcher/android_client.py (+0/-51)
lava_dispatcher/android_util.py (+0/-50)
To merge this branch: bzr merge lp:~mwhudson/lava-dispatcher/eliminate-old-android-tests
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+80522@code.launchpad.net

Description of the change

This branch removes the obsolete android_0xbench and android_test actions and some methods that only code in those actions used.

http://validation.linaro.org/lava-server/scheduler/job/2523 was the last job that used the 0xbench action (the basic action has never been used AFIACT) and was submitted over two weeks ago. I think we can kill them.

Cheers,
mwh

To post a comment you must log in.
154. By Michael Hudson-Doyle

turns out this file can go too

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'doc/android-0xbench-job.json'
2--- doc/android-0xbench-job.json 2011-09-13 09:15:07 +0000
3+++ doc/android-0xbench-job.json 1970-01-01 00:00:00 +0000
4@@ -1,37 +0,0 @@
5-{
6- "job_name": "android_0xbench_test",
7- "image_type": "android",
8- "target": "panda01",
9- "timeout": 18000,
10- "actions": [
11- {
12- "command": "deploy_linaro_android_image",
13- "parameters":
14- {
15- "boot": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/boot.tar.bz2",
16- "system": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/system.tar.bz2",
17- "data": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/userdata.tar.bz2"
18- },
19- "metadata":
20- {
21- "rootfs.type": "android",
22- "rootfs.build": "61"
23- }
24- },
25- {
26- "command": "boot_linaro_android_image"
27- },
28- {
29- "command": "test_android_0xbench"
30- },
31- {
32- "command": "submit_results",
33- "parameters":
34- {
35- "server": "http://validation.linaro.org/lava-server/RPC2/",
36- "stream": "/anonymous/android-panda01-0xbench/",
37- "result_disk": "sdcard"
38- }
39- }
40- ]
41-}
42
43=== removed file 'doc/android-basic-job.json'
44--- doc/android-basic-job.json 2011-09-13 09:15:07 +0000
45+++ doc/android-basic-job.json 1970-01-01 00:00:00 +0000
46@@ -1,36 +0,0 @@
47-{
48- "job_name": "android_basic_test",
49- "image_type": "android",
50- "target": "panda01",
51- "timeout": 18000,
52- "actions": [
53- {
54- "command": "deploy_linaro_android_image",
55- "parameters":
56- {
57- "boot": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/boot.tar.bz2",
58- "system": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/system.tar.bz2",
59- "data": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/userdata.tar.bz2"
60- },
61- "metadata":
62- {
63- "rootfs.type": "android",
64- "rootfs.build": "61"
65- }
66- },
67- {
68- "command": "boot_linaro_android_image"
69- },
70- {
71- "command": "test_android_basic"
72- },
73- {
74- "command": "submit_results_on_host",
75- "parameters":
76- {
77- "server": "http://validation.linaro.org/lava-server/RPC2/",
78- "stream": "/anonymous/android-panda01-basic/"
79- }
80- }
81- ]
82-}
83
84=== removed file 'doc/android-monkey-job.json'
85--- doc/android-monkey-job.json 2011-09-13 09:15:07 +0000
86+++ doc/android-monkey-job.json 1970-01-01 00:00:00 +0000
87@@ -1,36 +0,0 @@
88-{
89- "job_name": "android_monkey_test",
90- "image_type": "android",
91- "target": "panda01",
92- "timeout": 18000,
93- "actions": [
94- {
95- "command": "deploy_linaro_android_image",
96- "parameters":
97- {
98- "boot": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/boot.tar.bz2",
99- "system": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/system.tar.bz2",
100- "data": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/artifact/build/out/target/product/pandaboard/userdata.tar.bz2"
101- },
102- "metadata":
103- {
104- "rootfs.type": "android",
105- "rootfs.build": "61"
106- }
107- },
108- {
109- "command": "boot_linaro_android_image"
110- },
111- {
112- "command": "test_android_monkey"
113- },
114- {
115- "command": "submit_results_on_host",
116- "parameters":
117- {
118- "server": "http://validation.linaro.org/lava-server/RPC2/",
119- "stream": "/anonymous/android-panda01-monkey/"
120- }
121- }
122- ]
123-}
124
125=== modified file 'doc/android-new-kernel.json'
126--- doc/android-new-kernel.json 2011-10-09 03:11:54 +0000
127+++ doc/android-new-kernel.json 2011-10-27 02:31:23 +0000
128@@ -23,7 +23,18 @@
129 "command": "boot_linaro_android_image"
130 },
131 {
132- "command": "test_android_basic"
133+ "command": "lava_android_test_install",
134+ "parameters":
135+ {
136+ "tests": ["0xbench"]
137+ }
138+ },
139+ {
140+ "command": "lava_android_test_run",
141+ "parameters":
142+ {
143+ "test_name": "monkey"
144+ }
145 },
146 {
147 "command": "submit_results_on_host",
148
149=== modified file 'doc/jobfile.rst'
150--- doc/jobfile.rst 2011-10-09 07:17:05 +0000
151+++ doc/jobfile.rst 2011-10-27 02:31:23 +0000
152@@ -108,7 +108,18 @@
153 "command": "boot_linaro_android_image"
154 },
155 {
156- "command": "test_android_basic"
157+ "command": "lava_android_test_install",
158+ "parameters":
159+ {
160+ "tests": ["0xbench"]
161+ }
162+ },
163+ {
164+ "command": "lava_android_test_run",
165+ "parameters":
166+ {
167+ "test_name": "0xbench"
168+ }
169 },
170 {
171 "command": "submit_results_on_host",
172@@ -128,38 +139,50 @@
173 Here's an example showing how to run 0xbench on a Linaro Android image::
174
175 {
176- "image_type": "android",
177+ "job_name": "android_monkey_test2",
178+ "image_type": "android",
179+ "target": "panda01",
180+ "timeout": 18000,
181 "actions": [
182 {
183- "command": "deploy_linaro_android_image",
184- "parameters": {
185- "data": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/98/artifact/build/out/target/product/pandaboard/userdata.tar.bz2",
186- "boot": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/98/artifact/build/out/target/product/pandaboard/boot.tar.bz2",
187- "system": "https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/98/artifact/build/out/target/product/pandaboard/system.tar.bz2"
188- },
189- "metadata": {
190- "android.name": "linaro-android_leb-panda",
191- "android.build": "98",
192- "android.url": "https://android-build.linaro.org/builds/~linaro-android/leb-panda/#build=98"
193- }
194- },
195+ "command": "deploy_linaro_android_image",
196+ "parameters":
197+ {
198+ "boot": "https://android-build.linaro.org/jenkins/job/gerrit-bot_pandaboard/12/artifact/build/out/target/product/pandaboard/boot.tar.bz2",
199+ "system": "https://android-build.linaro.org/jenkins/job/gerrit-bot_pandaboard/12/artifact/build/out/target/product/pandaboard/system.tar.bz2",
200+ "data": "https://android-build.linaro.org/jenkins/job/gerrit-bot_pandaboard/12/artifact/build/out/target/product/pandaboard/userdata.tar.bz2"
201+ },
202+ "metadata":
203+ {
204+ "rootfs.type": "android",
205+ "rootfs.build": "12"
206+ }
207+ },
208 {
209 "command": "boot_linaro_android_image"
210- },
211- {
212- "command": "test_android_0xbench"
213- },
214- {
215- "command": "submit_results",
216- "parameters": {
217- "result_disk": "sdcard",
218- "stream": "/anonymous/android/",
219- "server": "http://localhost/lava-server/RPC2/"
220- }
221+ },
222+ {
223+ "command": "lava_android_test_install",
224+ "parameters":
225+ {
226+ "tests": ["0xbench"]
227+ }
228+ },
229+ {
230+ "command": "lava_android_test_run",
231+ "parameters":
232+ {
233+ "test_name": "0xbench"
234+ }
235+ },
236+ {
237+ "command": "submit_results_on_host",
238+ "parameters":
239+ {
240+ "server": "http://validation.linaro.org/lava-server/RPC2/",
241+ "stream": "/anonymous/lava-android-leb-panda/"
242+ }
243 }
244- ],
245- "target": "panda01",
246- "timeout": 18000,
247- "name": "test job"
248+ ]
249 }
250
251
252=== removed file 'lava_dispatcher/actions/android_0xbench.py'
253--- lava_dispatcher/actions/android_0xbench.py 2011-10-20 04:36:56 +0000
254+++ lava_dispatcher/actions/android_0xbench.py 1970-01-01 00:00:00 +0000
255@@ -1,53 +0,0 @@
256-#!/usr/bin/python
257-
258-# Copyright (C) 2011 Linaro Limited
259-#
260-# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
261-#
262-# This file is part of LAVA Dispatcher.
263-#
264-# LAVA Dispatcher is free software; you can redistribute it and/or modify
265-# it under the terms of the GNU General Public License as published by
266-# the Free Software Foundation; either version 2 of the License, or
267-# (at your option) any later version.
268-#
269-# LAVA Dispatcher is distributed in the hope that it will be useful,
270-# but WITHOUT ANY WARRANTY; without even the implied warranty of
271-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
272-# GNU General Public License for more details.
273-#
274-# You should have received a copy of the GNU General Public License
275-# along with this program; if not, see <http://www.gnu.org/licenses>.
276-
277-from lava_dispatcher.actions import BaseAction
278-import time
279-import pexpect
280-import logging
281-
282-class cmd_test_android_0xbench(BaseAction):
283- def run(self):
284- #Make sure in test image now
285- self.client.in_test_shell()
286- time.sleep(30)
287- if not self.client.check_sys_bootup():
288- # TODO: Fetch the logcat message as attached
289- logging.warning("0xbench Test: sys bootup fail, aborted")
290- return
291-
292- self.client.android_logcat_clear()
293-
294- package_name = 'org.zeroxlab.benchmark'
295- class_name = 'org.zeroxlab.benchmark.Benchmark'
296- cmd = 'am start -n %s/%s --ez math true --ez 2d true --ez 3d true \
297- --ez vm true --ez autorun true' % (package_name, class_name)
298- self.client.run_shell_command(cmd)
299-
300- # Do the logcat and monitor the log to know 0xbench done the test
301- pattern = "Displayed org.zeroxlab.benchmark/.Report"
302- try:
303- self.client.android_logcat_monitor(pattern, timeout = 1200)
304- except pexpect.TIMEOUT:
305- logging.warning("0xbench Test: TIMEOUT Fail")
306- raise
307- finally:
308- self.client.android_logcat_stop()
309
310=== removed file 'lava_dispatcher/actions/android_basic.py'
311--- lava_dispatcher/actions/android_basic.py 2011-10-26 02:59:28 +0000
312+++ lava_dispatcher/actions/android_basic.py 1970-01-01 00:00:00 +0000
313@@ -1,150 +0,0 @@
314-#!/usr/bin/python
315-
316-# Copyright (C) 2011 Linaro Limited
317-#
318-# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
319-#
320-# This file is part of LAVA Dispatcher.
321-#
322-# LAVA Dispatcher is free software; you can redistribute it and/or modify
323-# it under the terms of the GNU General Public License as published by
324-# the Free Software Foundation; either version 2 of the License, or
325-# (at your option) any later version.
326-#
327-# LAVA Dispatcher is distributed in the hope that it will be useful,
328-# but WITHOUT ANY WARRANTY; without even the implied warranty of
329-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
330-# GNU General Public License for more details.
331-#
332-# You should have received a copy of the GNU General Public License
333-# along with this program; if not, see <http://www.gnu.org/licenses>.
334-
335-from lava_dispatcher.actions import BaseAction
336-import time
337-import pexpect
338-import logging
339-from datetime import datetime
340-from lava_dispatcher.android_util import savebundlefile
341-
342-class cmd_test_android_monkey(BaseAction):
343- def run(self):
344- #Make sure in test image now
345- self.client.in_test_shell()
346- time.sleep(30)
347- if not self.client.check_sys_bootup():
348- # TODO: Fetch the logcat message as attachment
349- logging.warning("monkey run test skipped: sys bootup fail")
350- return
351-
352- TIMEFORMAT = '%Y-%m-%dT%H:%M:%SZ'
353- starttime = datetime.utcnow()
354- timestring = datetime.strftime(starttime, TIMEFORMAT)
355- results = {'test_results':[]}
356-
357- result_pattern = '## Network stats: elapsed time=(?P<measurement>\d+)ms'
358- test_case_result = {}
359- test_case_result['test_case_id'] = "monkey-1"
360- test_case_result['units'] = "mseconds"
361- cmd = 'monkey -s 1 --pct-touch 10 --pct-motion 20 --pct-nav 20 --pct-majornav 30 --pct-appswitch 20 --throttle 500 50'
362- self.client.proc.sendline(cmd)
363- try:
364- id = self.client.proc.expect([result_pattern, pexpect.EOF], timeout = 60)
365- if id == 0:
366- match_group = self.client.proc.match.groups()
367- test_case_result['measurement'] = int(match_group[0])
368- test_case_result['result'] = "pass"
369- else:
370- test_case_result['result'] = "fail"
371- except pexpect.TIMEOUT:
372- test_case_result['result'] = "fail"
373-
374- results['test_results'].append(test_case_result)
375- savebundlefile("monkey", results, timestring, self.context.lava_result_dir)
376- self.client.proc.sendline("")
377-
378-
379-class cmd_test_android_basic(BaseAction):
380- def run(self):
381- #Make sure in test image now
382- self.client.in_test_shell()
383-
384- #TODO: Checking if sdcard is mounted by vold to replace sleep idle, or check the Home app status
385- # Give time for Android system to boot up, then test
386- time.sleep(60)
387- TIMEFORMAT = '%Y-%m-%dT%H:%M:%SZ'
388- starttime = datetime.utcnow()
389- timestring = datetime.strftime(starttime, TIMEFORMAT)
390- results = {'test_results':[]}
391-
392- # Check booting completeness
393- # Transfer the result to launch-control json representation
394- result_pattern = "([0-1])"
395- test_case_result = {}
396- test_case_result['test_case_id'] = "dev.bootcomplete"
397- cmd = "getprop dev.bootcomplete"
398- self.client.proc.sendline(cmd)
399- id = self.client.proc.expect([result_pattern, pexpect.EOF], timeout = 5)
400- if id == 0:
401- match_group = self.client.proc.match.groups()
402- test_case_result['measurement'] = int(match_group[0])
403- if test_case_result['measurement'] == 1:
404- test_case_result['result'] = "pass"
405- else:
406- test_case_result['result'] = "fail"
407- else:
408- test_case_result['measurement'] = ""
409- test_case_result['result'] = "unknown"
410- results['test_results'].append(test_case_result)
411-
412- test_case_result = {}
413- test_case_result['test_case_id'] = "sys.boot_completed"
414- cmd = "getprop sys.boot_completed"
415- self.client.proc.sendline(cmd)
416- try:
417- id = self.client.proc.expect([result_pattern, pexpect.EOF], timeout = 5)
418- if id == 0:
419- match_group = self.client.proc.match.groups()
420- test_case_result['measurement'] = int(match_group[0])
421- if test_case_result['measurement'] == 1:
422- test_case_result['result'] = "pass"
423- else:
424- test_case_result['result'] = "fail"
425- else:
426- test_case_result['result'] = "unknown"
427- except:
428- logging.exception("getprop sys.boot_completed failed")
429- test_case_result['result'] = "fail"
430- pass
431-
432- results['test_results'].append(test_case_result)
433-
434- result_pattern = "(running)"
435- test_case_result = {}
436- test_case_result['test_case_id'] = "init.svc.adbd"
437- cmd = "getprop init.svc.adbd"
438- self.client.proc.sendline(cmd)
439- id = self.client.proc.expect([result_pattern, pexpect.EOF], timeout = 5)
440- if id == 0:
441- match_group = self.client.proc.match.groups()
442- test_case_result['message'] = match_group[0]
443- if test_case_result['message'] == "running":
444- test_case_result['result'] = "pass"
445- else:
446- test_case_result['result'] = "fail"
447- else:
448- test_case_result['result'] = "unknown"
449- results['test_results'].append(test_case_result)
450-
451- #TODO: Wait for boot completed, if timeout, do logcat and save as booting fail log
452-
453- adb_status = self.client.check_adb_status()
454- test_case_result = {}
455- test_case_result['test_case_id'] = "adb connection status"
456- if adb_status:
457- test_case_result['result'] = "pass"
458- else:
459- test_case_result['result'] = "fail"
460-
461- results['test_results'].append(test_case_result)
462- savebundlefile("basic", results, timestring, self.context.lava_result_dir)
463- self.client.proc.sendline("")
464
465=== modified file 'lava_dispatcher/android_client.py'
466--- lava_dispatcher/android_client.py 2011-10-26 02:59:28 +0000
467+++ lava_dispatcher/android_client.py 2011-10-27 02:31:23 +0000
468@@ -39,17 +39,6 @@
469 self.android_result_dir = mkdtemp()
470 os.chmod(self.android_result_dir, 0755)
471
472- def run_adb_shell_command(self, dev_id, cmd, response, timeout=-1):
473- adb_cmd = "adb -s %s shell %s" % (dev_id, cmd)
474- try:
475- adb_proc = pexpect.spawn(adb_cmd, logfile=sys.stdout)
476- match_id = adb_proc.expect([response, pexpect.EOF], timeout=timeout)
477- if match_id == 0:
478- return True
479- except pexpect.TIMEOUT:
480- pass
481- return False
482-
483 def boot_linaro_android_image(self):
484 """Reboot the system to the test android image."""
485 self._boot(string_to_list(self.config.get('boot_cmds_android')))
486@@ -59,28 +48,6 @@
487 self.enable_adb_over_tcpip()
488 self.android_adb_disconnect_over_default_nic_ip()
489
490- def android_logcat_clear(self):
491- cmd = "logcat -c"
492- self.proc.sendline(cmd)
493-
494- def _android_logcat_start(self):
495- cmd = "logcat"
496- self.proc.sendline(cmd)
497-
498- def android_logcat_monitor(self, pattern, timeout= -1):
499- self.android_logcat_stop()
500- cmd = 'logcat'
501- self.proc.sendline(cmd)
502- match_id = self.proc.expect(pattern, timeout=timeout)
503- if match_id == 0:
504- return True
505- else:
506- return False
507-
508- def android_logcat_stop(self):
509- self.proc.sendcontrol('C')
510- logging.info("logcat cancelled")
511-
512 # adb cound be connected through network
513 def android_adb_connect(self, dev_ip):
514 pattern1 = "connected to (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5})"
515@@ -100,17 +67,6 @@
516 cmd = "adb disconnect %s" % dev_ip
517 pexpect.run(cmd, timeout=300, logfile=sys.stdout)
518
519- def check_adb_status(self):
520- device_ip = self.get_default_nic_ip()
521- if device_ip is not None:
522- dev_name = self.android_adb_connect(device_ip)
523- if dev_name is not None:
524- logging.info("dev_name = " + dev_name)
525- result = self.run_adb_shell_command(dev_name, "echo 1", "1")
526- self.android_adb_disconnect(device_ip)
527- return result
528- return False
529-
530 def get_default_nic_ip(self):
531 # XXX: IP could be assigned in other way in the validation farm
532 network_interface = self.default_network_interface
533@@ -177,10 +133,3 @@
534 return True
535 time.sleep(1)
536 raise GeneralError('The home screen does not displayed')
537-
538- def check_sys_bootup(self):
539- result_pattern = "([0-1])"
540- cmd = "getprop sys.boot_completed"
541- self.proc.sendline(cmd)
542- match_id = self.proc.expect([result_pattern], timeout = 60)
543- return match_id == 0
544
545=== removed file 'lava_dispatcher/android_util.py'
546--- lava_dispatcher/android_util.py 2011-08-10 18:01:25 +0000
547+++ lava_dispatcher/android_util.py 1970-01-01 00:00:00 +0000
548@@ -1,50 +0,0 @@
549-# Copyright (C) 2011 Linaro Limited
550-#
551-# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
552-#
553-# This file is part of LAVA Dispatcher.
554-#
555-# LAVA Dispatcher is free software; you can redistribute it and/or modify
556-# it under the terms of the GNU General Public License as published by
557-# the Free Software Foundation; either version 2 of the License, or
558-# (at your option) any later version.
559-#
560-# LAVA Dispatcher is distributed in the hope that it will be useful,
561-# but WITHOUT ANY WARRANTY; without even the implied warranty of
562-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
563-# GNU General Public License for more details.
564-#
565-# You should have received a copy of the GNU General Public License
566-# along with this program; if not, see <http://www.gnu.org/licenses>.
567-
568-import os
569-from uuid import uuid1
570-from datetime import datetime
571-import json
572-import subprocess
573-import time
574-
575-# TODO: Result saving could be replaced by linaro_dashboard_bundle probably.
576-def savebundlefile(testname, results, starttime, lava_result_dir):
577- """
578- Save results as .bundle file under /tmp/LAVA_RESULT_DIR/
579- """
580- TIMEFORMAT = '%Y-%m-%dT%H:%M:%SZ'
581- testdata = {}
582- test_runs = [{}]
583- testdata['format'] = "Dashboard Bundle Format 1.2"
584- test_runs[0]['test_id'] = testname
585- test_runs[0]['analyzer_assigned_uuid'] = str(uuid1())
586- test_runs[0]['time_check_performed'] = False
587- test_runs[0]['analyzer_assigned_date'] = starttime
588- # TODO: hw_context sw_context for android
589- testdata['test_runs'] = test_runs
590- testdata['test_runs'][0].update(results)
591- bundle = testdata
592- subprocess.call(["mkdir", "-p", "/tmp/%s" % lava_result_dir])
593- # The file name should be unique to be distinguishable from others
594- filename = "/tmp/%s/" % lava_result_dir + testname + \
595- str(time.mktime(datetime.utcnow().timetuple())) + ".bundle"
596- with open(filename, "wt") as stream:
597- json.dump(bundle, stream)
598-

Subscribers

People subscribed via source and target branches