aboutsummaryrefslogtreecommitdiff
path: root/create-jobs.py
blob: 70da207306dbe55efbaf3918323c459b83294afb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import json
from copy import deepcopy
from pprint import pprint

SIGNAL_PREFIX = "SIGNAL_PREFIX"
MODE = "MODE"
JOB_NAME = "JOB_NAME"
AGENDA = "AGENDA"
PARAMETERS = "parameters"
TESTDEF_REPOS = "testdef_repos"
ACTIONS = "actions"

HOST_SHELL = {
            "command": "lava_test_shell",
            "parameters": {
                "testdef_repos": [
                    {
                        "git-repo": "git://git.linaro.org/qa/wa2-lava.git",
                        "testdef": "wa2host.yaml",
                        "parameters": {
                            "AGENDA": "$WA2_AGENDA",
                            "JOB_NAME": "$WA2_JOB_NAME",
                            "MODE": "$WA2_MODE",
                            "SIGNAL_PREFIX": "$WA2_PREFIX"
                        }
                    }
                ],
                "timeout": 4200,
                "role": "host"
            }
        }

TARGET_SHELL = {
            "command": "lava_test_shell",
            "parameters": {
                "testdef_repos": [
                    {
                        "git-repo": "git://git.linaro.org/qa/wa2-lava.git",
                        "testdef": "wa2target.yaml",
                        "parameters": {
                            "SIGNAL_PREFIX": "$WA2_PREFIX"
                        }

                    }
                ],
                "timeout": 2400,
                "role": "target"
            }
        }

JSON_TEMPLATE = {
    "logging_level": "INFO",
    "timeout": 1800,
    "job_name": "$JOB_NAME",
    "device_group": [
        {
            "role": "host",
            "count": 1,
            "device_type": "dummy-ssh"
        },
       {
            "role": "target",
            "count": 1,
            "device_type": "$DUT_TYPE"
        }
    ],
    "actions": [
        {
            "command": "dummy_deploy",
            "parameters": {
                "target_type": "ubuntu"
            }
        },
                {
            "command": "deploy_linaro_android_image",
            "metadata": {
                "android.build": "$ANDROID_META_BUILD",
                "android.name": "$ANDROID_META_NAME",
                "android.url": "$ANDROID_META_URL"
            },
            "parameters": {
                "boot": "$ANDROID_BOOT",
                "data": "$ANDROID_DATA",
                "system": "$ANDROID_SYSTEM",
                "role": "target"
            }
        }
    ]
}

SUBMIT_RESULTS = {
            "command": "submit_results_on_host",
            "parameters": {
                "stream": "$BUNDLE_STREAM",
                "server": "http://validation.linaro.org/RPC2/"
            }
        }

POSTPROCESSING = {
            "command": "lava_test_shell",
            "parameters": {
                "testdef_repos": [
                    {
                        "git-repo": "git://git.linaro.org/qa/wa2-lava.git",
                        "testdef": "wa2host_postprocessing.yaml",
                        "parameters": {
                            "JOB_NAME": "$JOB_NAME"
                        }
                    }
                ],
                "timeout": 4200,
                "role": "host"
            }
        }

modes = [
    "hmp",
    "a7only",
    "a15only",
]

agenda_hmp_workloads = [
    "hmp_audio.yaml",
    "hmp_bbench_audio.yaml",
]

agenda_hmp_benchmarks = [
    "hmp_andbench_t1.yaml",
    "hmp_andbench_t5.yaml",
    "hmp_antutu_4.0.3.yaml",
    "hmp_benchmarkpi.yaml",
    "hmp_caffeinemark.yaml",
    "hmp_cfbench.yaml",
    "hmp_geekbench3.yaml",
    "hmp_linpack.yaml",
    "hmp_quadrant.yaml",
    "hmp_smartbench.yaml",
    "hmp_sqlite.yaml",
    "hmp_vellamo.yaml",
]

agenda_a7only_workloads = [
    "a7only_audio.yaml",
    "a7only_bbench_audio.yaml",
]

agenda_a15only_workloads = [
    "a15only_audio.yaml",
    "a15only_bbench_audio.yaml",
]

agenda_a15only_benchmarks = [
    "a15only_andbench_t1.yaml",
    "a15only_andbench_t5.yaml",
    "a15only_antutu_4.0.3.yaml",
    "a15only_benchmarkpi.yaml",
    "a15only_caffeinemark.yaml",
    "a15only_cfbench.yaml",
    "a15only_geekbench3.yaml",
    "a15only_linpack.yaml",
    "a15only_quadrant.yaml",
    "a15only_smartbench.yaml",
    "a15only_sqlite.yaml",
    "a15only_vellamo.yaml",
]

for mode in modes:
    if mode.split("_")[1] == "workloads":
        for benchmark in globals()["agenda_" + mode]:
            test_case = deepcopy(JSON_TEMPLATE)
            for iteration in range(1,6):
                hostshell = deepcopy(HOST_SHELL)
                hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][AGENDA] = benchmark
                hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][MODE] = mode.split("_")[0]
                hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0] + "-iter" + str(iteration)
                targetshell = deepcopy(TARGET_SHELL)
                targetshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0] + "-iter" + str(iteration)
                test_case[ACTIONS].append(hostshell)
                test_case[ACTIONS].append(targetshell)
            #pprint(test_case)
            test_case[ACTIONS].append(deepcopy(SUBMIT_RESULTS))
            f = open("wa2_%s.json" % benchmark.split(".")[0], "w")
            f.write(json.dumps(test_case, sort_keys=True, indent=4))
            f.close()
    else:
        for benchmark in globals()["agenda_" + mode]:
            test_case = deepcopy(JSON_TEMPLATE)
            hostshell = deepcopy(HOST_SHELL)
            hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][AGENDA] = benchmark
            hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][MODE] = mode.split("_")[0]
            hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0]
            targetshell = deepcopy(TARGET_SHELL)
            targetshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0]
            test_case[ACTIONS].append(hostshell)
            test_case[ACTIONS].append(targetshell)
            test_case[ACTIONS].append(deepcopy(SUBMIT_RESULTS))
            #pprint(test_case)
            f = open("wa2_%s.json" % benchmark.split(".")[0], "w")
            f.write(json.dumps(test_case, sort_keys=True, indent=4))
            f.close()