~linaro-validation/lava-android-test/trunk

« back to all changes in this revision

Viewing changes to lava_android_test/test_definitions/cts/cts_wrapper.py

  • Committer: Yongqin Liu
  • Date: 2013-05-15 10:28:29 UTC
  • mfrom: (249.1.1 lava-android-test)
  • Revision ID: yongqin.liu@linaro.org-20130515102829-w1sb37ftopoon9eg
add suport for class for CTS test

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
    return True
105
105
 
106
106
 
107
 
def run_cts_with_package(cts_cmd=None, package='CTS', timeout=36000):
 
107
def run_cts_with_package(cts_cmd=None, package=None, timeout=36000):
 
108
    if not package:
 
109
        return True
108
110
    pattern = "Time:"
109
111
    plan_command = '--package %s' % package
110
112
    if cts_cmd:
117
119
    return True
118
120
 
119
121
 
 
122
def run_cts_with_class(cts_cmd=None, cls=None, method=None, timeout=36000):
 
123
    if not cls:
 
124
        return True
 
125
    pattern = "Time:"
 
126
    cmd = '--class %s' % cls
 
127
    if method:
 
128
        cmd = '%s --method %s' % (cmd, method)
 
129
 
 
130
    if cts_cmd:
 
131
        cmd = "%s %s --disable-reboot" % (cts_cmd, cmd)
 
132
    if not stop_at_cts_pattern(command=cmd, pattern=pattern,
 
133
                            timeout=timeout):
 
134
        print "CTS test times out"
 
135
        return False
 
136
 
 
137
    return True
 
138
 
 
139
 
120
140
def run_cts_continue(cts_cmd=None):
121
141
    pattern = "Time:"
122
142
    continue_command = '--continue-session 0'
227
247
 
228
248
    package_name = None
229
249
    plan_name = 'CTS'
 
250
    class_name= None
 
251
    method_name = None
230
252
    timeout = 36000
231
253
    #--cts_pkg cts_package_file --package package_name --timeout 36000
232
254
    #--cts_pkg cts_package_file --plan plan_name --timeout 36000
245
267
        if timeout:
246
268
            timeout = int(timeout)
247
269
 
 
270
        class_name = get_value_from_paras(paras=paras, option='--class')
 
271
        method_name = get_value_from_paras(paras=paras, option='--method')
 
272
 
248
273
    run_wrapper_path = os.path.join('./android-cts/tools/cts-tradefed ')
249
274
    run_wrapper_cmd = "%s" % run_wrapper_path
250
275
    run_wrapper_cmd = '%s run cts --serial %s' % (run_wrapper_cmd,
258
283
        if package_name:
259
284
            run_cts_with_package(cts_cmd=run_wrapper_cmd, package=package_name,
260
285
                                 timeout=timeout)
 
286
        elif class_name:
 
287
            run_cts_with_class(cts_cmd=run_wrapper_cmd, cls=class_name,
 
288
                               method=method_name, timeout=timeout)
261
289
        else:
262
290
            run_cts_with_plan(cts_cmd=run_wrapper_cmd, plan=plan_name,
263
291
                              timeout=timeout)