blob: b05bbf7f1ecd6efba54bda6213813d03c42b5fa0 [file] [log] [blame]
Andy Doan61b4d772012-04-24 10:03:28 -05001#!/usr/bin/python
2
Andy Doan61b4d772012-04-24 10:03:28 -05003import os
Andy Doan61b4d772012-04-24 10:03:28 -05004import sys
Fathi Boudrac14068b2012-12-06 17:42:11 +02005import json
Andy Doan61b4d772012-04-24 10:03:28 -05006import xmlrpclib
Fathi Boudrac14068b2012-12-06 17:42:11 +02007import re
Andy Doan61b4d772012-04-24 10:03:28 -05008
Fathi Boudra2486ee12013-06-28 13:39:07 +03009tests_timeout = {
10 'bluetooth-enablement': 7200,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030011 'bootchart': 800,
12 'busybox': 800,
Fathi Boudra0ce7fd22013-10-16 19:51:24 +030013 'cyclictest': 90000,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030014 'device-tree': 800,
Fathi Boudra2486ee12013-06-28 13:39:07 +030015 'e2eaudiotest': 7200,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030016 'ethernet': 800,
Fathi Boudra2486ee12013-06-28 13:39:07 +030017 'gatortests': 1200,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030018 'kernel-version': 800,
Fathi Boudra2486ee12013-06-28 13:39:07 +030019 'leb-basic-graphics': 7200,
Fathi Boudracbabf942014-06-20 14:08:39 +030020 'ltp': 10800,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030021 'mysql': 800,
Fathi Boudrac13926a2013-07-03 11:36:37 +030022 'network-tests-basic': 1200,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030023 'perf': 800,
24 'phpinfo': 800,
25 'phpmysql': 800,
Fathi Boudrac8c4ac72014-05-29 14:19:55 +030026 'pwrmgmt': 1200,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030027 'sdkhelloc': 800,
28 'sdkhellocxx': 800,
Fathi Boudra2486ee12013-06-28 13:39:07 +030029 'smoke-tests-basic': 1200,
Fathi Boudra63d5cbb2013-08-02 08:55:36 +030030 'toolchain': 800,
Fathi Boudra2486ee12013-06-28 13:39:07 +030031 'wifi-enablement': 7200,
32}
33
Fathi Boudrac14068b2012-12-06 17:42:11 +020034tests_nano = [
35 'device-tree',
36 'gatortests',
Fathi Boudra45198242014-06-22 09:28:59 +030037 'ltp',
Fathi Boudrac14068b2012-12-06 17:42:11 +020038 'perf',
39 'pwrmgmt',
Fathi Boudra2486ee12013-06-28 13:39:07 +030040 'smoke-tests-basic',
Fathi Boudra1bd61312014-06-22 09:27:51 +030041 'network-tests-basic',
Fathi Boudra3f7ace92013-04-11 13:06:11 +030042]
Fathi Boudrac14068b2012-12-06 17:42:11 +020043
44tests_alip = [
45 'bootchart',
Fathi Boudra3f7ace92013-04-11 13:06:11 +030046]
Fathi Boudrac14068b2012-12-06 17:42:11 +020047
48tests_desktop = [
49 'e2eaudiotest',
50 'bluetooth-enablement',
51 'wifi-enablement',
52 'leb-basic-graphics',
Fathi Boudra3f7ace92013-04-11 13:06:11 +030053]
Fathi Boudrac14068b2012-12-06 17:42:11 +020054
Fathi Boudra60d0e972013-04-19 10:49:47 +030055tests_openembedded_minimal = [
Marcin Juszkiewicz59172832013-04-18 09:35:00 +020056 'busybox',
Marcin Juszkiewicz1678f112013-04-09 09:55:46 +020057 'device-tree',
Marcin Juszkiewicz59172832013-04-18 09:35:00 +020058 'ethernet',
59 'kernel-version',
Marcin Juszkiewicz1678f112013-04-09 09:55:46 +020060 'perf',
Marcin Juszkiewicz59172832013-04-18 09:35:00 +020061 'toolchain',
Fathi Boudra3f7ace92013-04-11 13:06:11 +030062]
Andy Doan61b4d772012-04-24 10:03:28 -050063
Fathi Boudra60d0e972013-04-19 10:49:47 +030064tests_openembedded_lamp = [
Fathi Boudra60d0e972013-04-19 10:49:47 +030065 'mysql',
66 'phpinfo',
67 'phpmysql',
68 'sdkhelloc',
69 'sdkhellocxx',
70]
71
Andrew McDermottb62dfaf2013-06-26 12:32:30 +010072tests_openembedded_leg_java = [
Andrew McDermottedd9b8d2013-08-24 00:07:53 +010073 'openjdk8-sanity',
Andrew McDermotta4723272013-12-18 09:41:14 +000074 'mauve-setup',
75 'mauve-BinaryCompatibility',
76 'mauve-BinaryCompatibility-altered',
77 'mauve-gnu-java',
78 'mauve-gnu-javax',
79 'mauve-java-awt',
80 'mauve-java-beans',
81 'mauve-java-io',
82 'mauve-java-lang',
83 'mauve-java-math',
84 'mauve-java-net',
85 'mauve-java-nio',
86 'mauve-java-rmi',
87 'mauve-java-security',
88 'mauve-java-sql',
89 'mauve-java-text',
90 'mauve-java-util',
91 'mauve-javax-accessibility',
92 'mauve-javax-crypto',
93 'mauve-javax-imageio',
94 'mauve-javax-management',
95 'mauve-javax-naming',
96 'mauve-javax-net',
97 'mauve-javax-print',
98 'mauve-javax-rmi',
99 'mauve-javax-security',
100 'mauve-javax-sound',
101 'mauve-javax-swing',
102 'mauve-javax-xml',
103 'mauve-locales',
104 'mauve-org-omg',
105 'mauve-org-w3c',
Andrew McDermottb62dfaf2013-06-26 12:32:30 +0100106]
107
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200108# Mapping device type - bundle stream
Andy Doan3462e4c2012-05-18 10:58:06 -0500109DEVICE_STREAM = {
Fathi Boudra8b59a502013-01-18 10:20:04 +0200110 'arndale': 'arndale',
Fathi Boudrabd5b2bd2014-05-20 08:23:55 +0300111 'arndale-octa': 'arndale-octa',
Koen Kooid401dbd2013-10-11 12:48:01 +0200112 'beaglebone-black': 'beaglebone',
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200113 'beaglexm': 'beaglexm',
Fathi Boudrab97042a2013-04-04 17:49:22 +0300114 'highbank': 'highbank',
Koen Kooi8ea753d2014-06-06 10:14:22 +0200115 'juno': 'vexpress64',
Fathi Boudra66a6e9d2013-12-15 10:14:50 +0200116 'midway': 'midway',
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200117 'origen': 'leb-origen',
Andy Doan3462e4c2012-05-18 10:58:06 -0500118 'panda': 'leb-panda-4430',
Paul Larson27308512012-08-17 14:09:05 -0500119 'panda-es': 'leb-panda-es',
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200120 'rtsm_foundation-armv8': 'vexpress64',
Fathi Boudra81c62312013-11-21 13:48:23 +0200121 'rtsm_fvp_base-aemv8a': 'vexpress64',
122 'rtsm_fvp_base_cortex-a57x1-a53x1': 'vexpress64',
123 'rtsm_fvp_base_cortex-a57x4-a53x4': 'vexpress64',
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200124 'rtsm_ve-a15x1-a7x1': 'vexpress',
125 'rtsm_ve-a15x4-a7x4': 'vexpress',
Fathi Boudra81c62312013-11-21 13:48:23 +0200126 'rtsm_ve-armv8': 'vexpress64',
Andy Doan3462e4c2012-05-18 10:58:06 -0500127 'snowball_sd': 'leb-snowball',
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200128 'vexpress-a5': 'vexpress',
Fathi Boudra76551e52012-09-19 17:51:33 +0300129 'vexpress-a9': 'vexpress',
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200130 'vexpress-tc2': 'vexpress',
Fathi Boudrad871dc82014-06-11 10:28:07 +0300131 'wg': 'vexpress64',
Andy Doan3462e4c2012-05-18 10:58:06 -0500132}
133
Andy Doan61b4d772012-04-24 10:03:28 -0500134
135def obfuscate_credentials(s):
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300136 return re.sub(r'([^ ]:).+?(@)', r'\1xxx\2', s)
Andy Doan61b4d772012-04-24 10:03:28 -0500137
Fathi Boudrac14068b2012-12-06 17:42:11 +0200138
Andy Doan61b4d772012-04-24 10:03:28 -0500139def main():
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200140 """Script entry point: return some JSON based on calling args.
141 We should be called from Jenkins and expect the following to be defined:
142 $HWPACK_BUILD_NUMBER $HWPACK_JOB_NAME HWPACK_FILE_NAME $DEVICE_TYPE
143 """
Andy Doan61b4d772012-04-24 10:03:28 -0500144
Fathi Boudrad1f9a862012-12-28 14:46:04 +0200145 # CI base URL
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300146 ci_base_url = 'https://ci.linaro.org/jenkins/job/'
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200147 # Snapshots base URL
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300148 snapshots_url = 'http://snapshots.linaro.org'
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200149
150 # Name of the hardware pack project
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300151 hwpack_job_name = os.environ.get('HWPACK_JOB_NAME')
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200152 # The hardware pack build number
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300153 hwpack_build_number = os.environ.get('HWPACK_BUILD_NUMBER')
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200154 # Hardware pack file name
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300155 hwpack_file_name = os.environ.get('HWPACK_FILE_NAME', 'Undefined')
156 if hwpack_file_name == 'Undefined':
157 sys.exit('Hardware pack is not defined.')
158
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200159 # Device type
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300160 device_type = os.environ.get('DEVICE_TYPE', 'Undefined')
161 if device_type == 'Undefined':
162 sys.exit('Device type is not defined.')
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200163
164 # Distribution, architecture and hardware pack type
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300165 ret_split = hwpack_job_name.split('-', 2)
166 (distribution, architecture, hwpack_type) = \
167 ret_split[0], ret_split[1], ret_split[2]
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200168 if hwpack_type.startswith('pre-built-images-'):
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300169 hwpack_type = hwpack_type[(len('pre-built-images-')):]
Fathi Boudra65aaf1a2013-01-10 10:35:57 +0200170 if '=' in hwpack_type:
Fathi Boudra5cae8992013-10-19 15:46:31 +0300171 hwpack_type = hwpack_type[(len('pre-built-images/')):]
172 ret_split = dict(
173 token.split('=') for token in hwpack_type.split(','))
174 hwpack_type = ret_split['hwpack']
175
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200176 # Rootfs type, default is developer
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300177 rootfs_type = os.getenv('ROOTFS_TYPE', 'developer')
Fathi Boudrac14068b2012-12-06 17:42:11 +0200178
179 # Bundle stream name
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300180 bundle_stream_name = os.environ.get(
181 'BUNDLE_STREAM_NAME',
182 '/private/team/linaro/pre-built-%s/' % DEVICE_STREAM[device_type])
183
Fathi Boudrac14068b2012-12-06 17:42:11 +0200184 # LAVA user
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300185 lava_user = os.environ.get('LAVA_USER')
186 if lava_user is None:
Fathi Boudrac14068b2012-12-06 17:42:11 +0200187 f = open('/var/run/lava/lava-user')
188 lava_user = f.read().strip()
189 f.close()
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300190
Fathi Boudrac14068b2012-12-06 17:42:11 +0200191 # LAVA token
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300192 lava_token = os.environ.get('LAVA_TOKEN')
193 if lava_token is None:
Fathi Boudrac14068b2012-12-06 17:42:11 +0200194 f = open('/var/run/lava/lava-token')
195 lava_token = f.read().strip()
196 f.close()
Fathi Boudrac14068b2012-12-06 17:42:11 +0200197
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300198 # LAVA server URL
199 lava_server = os.environ.get('LAVA_SERVER',
Fathi Boudra62997d92013-07-27 09:58:28 +0300200 'validation.linaro.org/RPC2/')
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300201 # LAVA server base URL
202 lava_server_root = lava_server.rstrip('/')
203 if lava_server_root.endswith('/RPC2'):
204 lava_server_root = lava_server_root[:-len('/RPC2')]
205
206 image_url = '%s/%s/pre-built/%s/%s/%s' % \
207 (snapshots_url,
208 distribution,
209 hwpack_type,
210 hwpack_build_number,
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200211 hwpack_file_name)
212
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300213 git_repo = 'git://git.linaro.org/qa/test-definitions.git'
Senthil Kumaran672ac4d2012-12-19 15:10:59 +0530214
Fathi Boudra0293e672013-12-03 20:14:54 +0200215 lava_test_plan = os.environ.get('LAVA_TEST_PLAN')
216 if lava_test_plan is None:
217 # tests set specific to an image
218 if distribution == 'openembedded':
219 tests = tests_openembedded_minimal
220 if 'lamp' in rootfs_type:
221 tests += tests_openembedded_lamp
222 if 'leg-java' in rootfs_type:
223 tests += tests_openembedded_leg_java
224 elif distribution == 'ubuntu' or distribution == 'quantal' or distribution == 'raring':
225 tests = tests_nano
226 # if ubuntu-desktop, cover more test cases (LEB)
227 if rootfs_type == 'ubuntu-desktop':
228 tests += tests_desktop
229 # if alip, specific tests like bootchart (which should be first)
230 if rootfs_type == 'alip':
231 tests = tests_alip + tests
232 else:
233 lava_test_plan = lava_test_plan.strip("'")
234 tests = lava_test_plan.split()
Andrew McDermottb62dfaf2013-06-26 12:32:30 +0100235
Ricardo Salveti de Araujoacf28542012-06-27 18:56:00 -0300236 # removing bluetooth and wifi for devices that don't support it
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200237 if device_type in ['beaglexm', 'vexpress-a9', 'mx53loco']:
Ricardo Salveti de Araujodd780972012-06-29 11:48:47 -0300238 try:
239 tests.remove('bluetooth-enablement')
240 tests.remove('wifi-enablement')
241 except ValueError:
242 pass
Ricardo Salveti de Araujoacf28542012-06-27 18:56:00 -0300243
244 # vexpress doesn't support PM, so disable pwrmgmt
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200245 if device_type in ['vexpress-a9']:
Ricardo Salveti de Araujodd780972012-06-29 11:48:47 -0300246 try:
247 tests.remove('pwrmgmt')
248 except ValueError:
249 pass
Andy Doane9bf2152012-06-12 15:42:10 -0500250
Fathi Boudra62eb6a92012-12-06 19:02:56 +0200251 if distribution == 'openembedded':
Fathi Boudra4079a582012-12-06 19:42:58 +0200252 actions = [{
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300253 'command': 'deploy_linaro_image',
254 'parameters': {
255 'image': '%s' % image_url,
256 },
257 'metadata': {
258 'hwpack.type': '%s' % hwpack_type,
259 'hwpack.build': '%s' % hwpack_build_number,
260 'rootfs.type': '%s' % rootfs_type,
261 'distribution': '%s' % distribution,
262 }
263 },
264 {
Fathi Boudra5f33aed2014-03-26 13:01:23 +0200265 'command': 'boot_linaro_image'
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300266 }]
Fathi Boudra26b4fb42014-05-20 08:24:56 +0300267
268 bootloader = os.environ.get('BOOTLOADER')
269 if bootloader is not None:
270 actions[0]['parameters'].update(json.loads('{"bootloadertype": "%s"}' % bootloader))
271
Fathi Boudrad2bd08b2013-05-06 15:00:00 +0300272 elif distribution == 'ubuntu' or distribution == 'quantal' or distribution == 'raring':
Fathi Boudra4079a582012-12-06 19:42:58 +0200273 actions = [{
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300274 'command': 'deploy_linaro_image',
275 'parameters': {
276 'image': '%s' % image_url,
277 },
278 'metadata': {
279 'ubuntu.name': '%s' % hwpack_type,
280 'ubuntu.build': '%s' % hwpack_build_number,
281 'rootfs.type': '%s' % rootfs_type,
282 'ubuntu.distribution': '%s' % distribution,
283 }
284 }]
Fathi Boudra4079a582012-12-06 19:42:58 +0200285
Fathi Boudraa9bbadb2012-12-07 16:10:29 +0200286 if len(tests) > 0:
Fathi Boudrad2bd08b2013-05-06 15:00:00 +0300287 if distribution == 'quantal' or distribution == 'raring':
Fathi Boudra60d0e972013-04-19 10:49:47 +0300288 distribution = 'ubuntu'
Senthil Kumaranb30d7382012-12-19 15:11:47 +0530289 for test in tests:
Fathi Boudraebb2f192013-06-17 10:01:09 +0300290 test_list = [(
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300291 {'git-repo': git_repo,
292 'testdef': '{distribution:>s}/{test:>s}.yaml'.format(
Fathi Boudraebb2f192013-06-17 10:01:09 +0300293 distribution=distribution, test=test)})]
Senthil Kumaran007181c2013-04-16 14:43:19 +0530294
Fathi Boudraebb2f192013-06-17 10:01:09 +0300295 actions.append({
296 'command': 'lava_test_shell',
297 'parameters': {
Fathi Boudrab088b142013-07-19 09:54:04 +0300298 'timeout': tests_timeout.get(test, 18000),
Fathi Boudraebb2f192013-06-17 10:01:09 +0300299 'testdef_repos': test_list
300 }
301 })
Fathi Boudrac14068b2012-12-06 17:42:11 +0200302
303 actions.append({
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300304 'command': 'submit_results',
305 'parameters': {
306 'stream': bundle_stream_name,
307 'server': '%s%s' % ('http://', lava_server)
Fathi Boudrac14068b2012-12-06 17:42:11 +0200308 }
309 })
310
Fathi Boudra4c0dd222013-11-21 13:34:35 +0200311 # XXX Global timeout in LAVA is hardcoded to 24h (24 * 60 60)
312 # https://bugs.launchpad.net/bugs/1226017
313 # Set to 172800s (48h) to workaround the limitation
314 # A sane default is 900s (15m)
315 config = json.dumps({'timeout': 172800,
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300316 'actions': actions,
317 'job_name': '%s%s/%s/' % (ci_base_url,
318 hwpack_job_name,
Fathi Boudrad1f9a862012-12-28 14:46:04 +0200319 hwpack_build_number),
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300320 'device_type': device_type,
Fathi Boudrac14068b2012-12-06 17:42:11 +0200321 }, indent=2)
Fathi Boudra79c1e8b2012-12-02 10:36:57 +0200322
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200323 print config
324
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300325 skip_lava = os.environ.get('SKIP_LAVA')
326 if skip_lava is None:
Fathi Boudra79c1e8b2012-12-02 10:36:57 +0200327 try:
Fathi Boudrac14068b2012-12-06 17:42:11 +0200328 server_url = \
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300329 'https://{lava_user:>s}:{lava_token:>s}@{lava_server:>s}'
Fathi Boudrac14068b2012-12-06 17:42:11 +0200330 server = \
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300331 xmlrpclib.ServerProxy(server_url.format(
332 lava_user=lava_user,
333 lava_token=lava_token,
Fathi Boudrac14068b2012-12-06 17:42:11 +0200334 lava_server=lava_server))
335 lava_job_id = server.scheduler.submit_job(config)
Fathi Boudra79c1e8b2012-12-02 10:36:57 +0200336 except xmlrpclib.ProtocolError, e:
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300337 print 'Error making a LAVA request:', obfuscate_credentials(str(e))
Fathi Boudra79c1e8b2012-12-02 10:36:57 +0200338 sys.exit(1)
Fathi Boudrac14068b2012-12-06 17:42:11 +0200339
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300340 print 'LAVA Job Id: %s, URL: http://%s/scheduler/job/%s' % \
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200341 (lava_job_id, lava_server_root, lava_job_id)
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300342 json.dump({'lava_url': 'http://' + lava_server_root,
Fathi Boudrac14068b2012-12-06 17:42:11 +0200343 'job_id': lava_job_id},
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300344 open('lava-job-info', 'w'))
Fathi Boudra8e4ce562012-12-08 14:35:17 +0200345
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300346 lava_job_info_orig = hwpack_file_name.replace('.img.gz', '.html')
347 top_dir = os.environ.get('WORKSPACE', '.')
Fathi Boudrade020592012-12-10 13:25:14 +0200348 for root, dirs, files in os.walk(top_dir):
349 for file in files:
350 if file == lava_job_info_orig:
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300351 lava_job_info_orig = os.path.join(root, file)
Fathi Boudra5e481022012-12-08 19:21:16 +0200352
Fathi Boudrade020592012-12-10 13:25:14 +0200353 with open(lava_job_info_orig) as f:
354 buffer = f.read()
Fathi Boudra5e481022012-12-08 19:21:16 +0200355
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300356 buffer = buffer.replace(
357 'var lavaJobId = 0',
358 'var lavaJobId = ' + str(lava_job_id), 1)
Fathi Boudrade020592012-12-10 13:25:14 +0200359
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300360 lava_job_info = lava_job_info_orig.replace(
361 '.html',
362 '-' + device_type + '.html')
Fathi Boudrade020592012-12-10 13:25:14 +0200363 with open(lava_job_info, 'w') as f:
364 f.write(buffer)
365 os.remove(lava_job_info_orig)
Fathi Boudra79c1e8b2012-12-02 10:36:57 +0200366 else:
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300367 print 'LAVA job submission skipped.'
Andy Doan61b4d772012-04-24 10:03:28 -0500368
Fathi Boudra3f7ace92013-04-11 13:06:11 +0300369
370if __name__ == '__main__':
Andy Doan61b4d772012-04-24 10:03:28 -0500371 main()