~fahad-k/linaro-android-build-tools/arndale

« back to all changes in this revision

Viewing changes to build-scripts/post-build-lava.py

[merge] Add support for lava_test_shell based tests for Android.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
REBOOT_TOKEN = '[system-reboot]'
45
45
 
46
46
 
 
47
def gen_lava_test_shell_action(test_name=None, test_para=None):
 
48
    if not test_para or not test_name:
 
49
        return None
 
50
    key_value_ary = test_para.split()
 
51
    key_value_hash = {}
 
52
    for pair_line in key_value_ary:
 
53
        pair = pair_line.split('=', 1)
 
54
        if len(pair) != 2:
 
55
            continue
 
56
        if pair[0]:
 
57
            key_value_hash[pair[0]] = pair[1]
 
58
    parameters = {}
 
59
    if key_value_hash.get('timeout'):
 
60
        parameters['timeout'] = int(key_value_hash.get('timeout'))
 
61
 
 
62
    if test_name == 'lava-test-shell-url':
 
63
        if key_value_hash.get('url'):
 
64
            parameters["testdef_urls"] = [key_value_hash['url']]
 
65
        else:
 
66
            return None
 
67
        action = {
 
68
                    "command": "lava_test_shell",
 
69
                    "parameters": parameters
 
70
                 }
 
71
        return action
 
72
    else:
 
73
        if not key_value_hash.get('repo'):
 
74
            return None
 
75
 
 
76
        repo = {}
 
77
        if test_name == 'lava-test-shell-git':
 
78
            repo = {"git-repo": key_value_hash.get('repo')}
 
79
        elif test_name == 'lava-test-shell-bzr':
 
80
            repo = {"bzr-repo": key_value_hash.get('repo')}
 
81
        else:
 
82
            return None
 
83
 
 
84
        if key_value_hash.get('revision'):
 
85
            repo["revision"] = key_value_hash.get('revision')
 
86
        if key_value_hash.get('testdef'):
 
87
            repo["testdef"] = key_value_hash.get('testdef')
 
88
 
 
89
        parameters["testdef_repos"] =  [repo]
 
90
        action = {
 
91
                    "command": "lava_test_shell",
 
92
                    "parameters": parameters
 
93
                 }
 
94
 
 
95
        return action
 
96
 
 
97
 
47
98
def gen_lava_android_test_actions(tests=[]):
48
99
    actions = []
49
100
    if len(tests) == 0:
55
106
        if test.startswith("android_"):
56
107
            continue
57
108
 
 
109
        #skip lava-test-shell test
 
110
        if test.startswith("lava-test-shell"):
 
111
            continue
 
112
 
58
113
        if test == REBOOT_TOKEN:
59
114
            continue
60
115
        ## support for test that specified with option like methanol,methanol(DEFAULT)
85
140
            test_option = test[test.find('(') + 1 : test.rfind(')')]
86
141
            test = test[:test.find('(')].strip()
87
142
 
 
143
        if test.startswith('lava-test-shell'):
 
144
            run_action = gen_lava_test_shell_action(test_name=test,
 
145
                                                    test_para=test_option)
 
146
            if run_action:
 
147
                actions.append(run_action)
 
148
            continue
88
149
 
89
150
        parameters = {}
90
151
        if not test_option:
106
167
            actions.append(run_action)
107
168
        elif test == 'hostshell-workload':
108
169
            config = "config.csv"
109
 
            workload_url = "ssh://linaro-lava@linaro-lava@mombin.canonical.com/srv/linaro-private.git.linaro.org/people/bhoj/workload-automation.git"
 
170
            workload_url = "ssh://linaro-lava@mombin.canonical.com/srv/linaro-private.git.linaro.org/people/bhoj/workload-automation.git"
110
171
            config_list = []
111
172
            config_prefix = "WORKLOAD_CONFIG_"
112
173
            url_prefix = "WORKLOAD_URL"