Merge lp:~liuyq0307/lava-android-test/cts-support-package into lp:lava-android-test

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 242
Proposed branch: lp:~liuyq0307/lava-android-test/cts-support-package
Merge into: lp:lava-android-test
Diff against target: 113 lines (+63/-11)
1 file modified
lava_android_test/test_definitions/cts/cts_wrapper.py (+63/-11)
To merge this branch: bzr merge lp:~liuyq0307/lava-android-test/cts-support-package
Reviewer Review Type Date Requested Status
Yongqin Liu self test Approve
vishal Pending
Review via email: mp+155663@code.launchpad.net

Description of the change

add support for specifying following features from android-build:
1. run with plan or package
2. the plan name or the package name
3. the the timeout value for the cts command
4. change the method for specifing the cts package name to --cts-pkg.

Like, we can specify cts(--cts-pkg android-cts-4.2_r3-linux_x86-arm_patched.zip --package android.accounts) in the LAVA_TEST_PLAN on android-build page for run the CTS android.accounts package test with android-cts-4.2_r3-linux_x86-arm_patched.zip file.

BTW, this branch is still on local testing.
When finished will report the result here.

To post a comment you must log in.
Revision history for this message
Yongqin Liu (liuyq0307) :
review: Approve (self test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_android_test/test_definitions/cts/cts_wrapper.py'
2--- lava_android_test/test_definitions/cts/cts_wrapper.py 2013-03-20 08:20:57 +0000
3+++ lava_android_test/test_definitions/cts/cts_wrapper.py 2013-03-27 06:13:21 +0000
4@@ -56,6 +56,7 @@
5
6 return result
7
8+
9 def get_not_executed():
10 list_result_path = os.path.join(curdir, 'cts_list_result_wrapper.sh')
11 list_result_cmd = "bash %s" % list_result_path
12@@ -83,20 +84,33 @@
13 cts_helper_jar_path = os.path.join(curdir, 'ctshelper.jar')
14 cts_prepare_cmd = "bash %s" % cts_prepare_path
15 if not stop_at_pattern(command="%s %s %s" % (cts_prepare_cmd,
16- adb.get_serial(),cts_helper_jar_path),
17+ adb.get_serial(), cts_helper_jar_path),
18 timeout=18000):
19 print "Preapration for CTS test times out"
20 return False
21 return True
22
23
24-def run_cts_with_plan(cts_cmd=None):
25- pattern = "Time:"
26- plan_command = '--plan CTS'
27- if cts_cmd:
28- plan_command = "%s %s --disable-reboot" % (cts_cmd, plan_command)
29- if not stop_at_cts_pattern(command=plan_command, pattern=pattern,
30- timeout=36000):
31+def run_cts_with_plan(cts_cmd=None, plan='CTS', timeout=36000):
32+ pattern = "Time:"
33+ plan_command = '--plan %s' % plan
34+ if cts_cmd:
35+ plan_command = "%s %s --disable-reboot" % (cts_cmd, plan_command)
36+ if not stop_at_cts_pattern(command=plan_command, pattern=pattern,
37+ timeout=timeout):
38+ print "CTS test times out"
39+ return False
40+
41+ return True
42+
43+
44+def run_cts_with_package(cts_cmd=None, package='CTS', timeout=36000):
45+ pattern = "Time:"
46+ plan_command = '--package %s' % package
47+ if cts_cmd:
48+ plan_command = "%s %s --disable-reboot" % (cts_cmd, plan_command)
49+ if not stop_at_cts_pattern(command=plan_command, pattern=pattern,
50+ timeout=timeout):
51 print "CTS test times out"
52 return False
53
54@@ -195,10 +209,42 @@
55 return package_list
56
57
58+def get_value_from_paras(paras=[], option=None, default=None):
59+ if not option:
60+ return default
61+
62+ if not option in paras:
63+ return default
64+
65+ index = paras.index(option)
66+ if len(paras) > index + 1:
67+ return paras[index + 1]
68+
69+ return default
70+
71+
72 def main():
73
74- if len(sys.argv) == 3:
75- os.environ["cts_pkg"] = sys.argv[2]
76+ package_name = None
77+ plan_name = 'CTS'
78+ timeout = 36000
79+ #--cts_pkg cts_package_file --package package_name --timeout 36000
80+ #--cts_pkg cts_package_file --plan plan_name --timeout 36000
81+ if len(sys.argv) > 2:
82+ paras = sys.argv[2:]
83+ cts_pkg = get_value_from_paras(paras=paras, option='--cts-pkg')
84+ if cts_pkg:
85+ os.environ["cts_pkg"] = cts_pkg
86+
87+ package_name = get_value_from_paras(paras=paras, option='--package')
88+ plan_name = get_value_from_paras(paras=paras,
89+ option='--plan',
90+ default='CTS')
91+ timeout = get_value_from_paras(paras=paras, option='--timeout',
92+ default=36000)
93+ if timeout:
94+ timeout = int(timeout)
95+
96 run_wrapper_path = os.path.join('./android-cts/tools/cts-tradefed ')
97 run_wrapper_cmd = "%s" % run_wrapper_path
98 run_wrapper_cmd = '%s run cts --serial %s' % (run_wrapper_cmd,
99@@ -209,7 +255,13 @@
100 sys.exit(1)
101
102 try:
103- run_cts_with_plan(cts_cmd=run_wrapper_cmd)
104+ if package_name:
105+ run_cts_with_package(cts_cmd=run_wrapper_cmd, package=package_name,
106+ timeout=timeout)
107+ else:
108+ run_cts_with_plan(cts_cmd=run_wrapper_cmd, plan=plan_name,
109+ timeout=timeout)
110+
111 finally:
112 for log in logs:
113 pid = log.get('pid')

Subscribers

People subscribed via source and target branches