Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 3 | import os |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 4 | import sys |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 5 | import json |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 6 | import xmlrpclib |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 7 | import re |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 8 | |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 9 | tests_nano = [ |
| 10 | 'device-tree', |
| 11 | 'gatortests', |
| 12 | 'perf', |
| 13 | 'pwrmgmt', |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 14 | ] |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 15 | |
| 16 | tests_alip = [ |
| 17 | 'bootchart', |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 18 | ] |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 19 | |
| 20 | tests_desktop = [ |
| 21 | 'e2eaudiotest', |
| 22 | 'bluetooth-enablement', |
| 23 | 'wifi-enablement', |
| 24 | 'leb-basic-graphics', |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 25 | ] |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 26 | |
| 27 | tests_openembedded = [ |
Marcin Juszkiewicz | 1678f11 | 2013-04-09 09:55:46 +0200 | [diff] [blame] | 28 | 'device-tree', |
| 29 | 'perf', |
| 30 | 'pwrmgmt', |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 31 | ] |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 32 | |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 33 | # Mapping device type - bundle stream |
Andy Doan | 3462e4c | 2012-05-18 10:58:06 -0500 | [diff] [blame] | 34 | DEVICE_STREAM = { |
Fathi Boudra | 8b59a50 | 2013-01-18 10:20:04 +0200 | [diff] [blame] | 35 | 'arndale': 'arndale', |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 36 | 'beaglexm': 'beaglexm', |
Fathi Boudra | b97042a | 2013-04-04 17:49:22 +0300 | [diff] [blame] | 37 | 'highbank': 'highbank', |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 38 | 'origen': 'leb-origen', |
Andy Doan | 3462e4c | 2012-05-18 10:58:06 -0500 | [diff] [blame] | 39 | 'panda': 'leb-panda-4430', |
Paul Larson | 2730851 | 2012-08-17 14:09:05 -0500 | [diff] [blame] | 40 | 'panda-es': 'leb-panda-es', |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 41 | 'rtsm_foundation-armv8': 'vexpress64', |
| 42 | 'rtsm_ve-a15x1-a7x1': 'vexpress', |
| 43 | 'rtsm_ve-a15x4-a7x4': 'vexpress', |
| 44 | 'rtsm_ve-armv8': 'vexpress', |
Andy Doan | 3462e4c | 2012-05-18 10:58:06 -0500 | [diff] [blame] | 45 | 'snowball_sd': 'leb-snowball', |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 46 | 'vexpress-a5': 'vexpress', |
Fathi Boudra | 76551e5 | 2012-09-19 17:51:33 +0300 | [diff] [blame] | 47 | 'vexpress-a9': 'vexpress', |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 48 | 'vexpress-tc2': 'vexpress', |
Andy Doan | 3462e4c | 2012-05-18 10:58:06 -0500 | [diff] [blame] | 49 | } |
| 50 | |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 51 | |
| 52 | def obfuscate_credentials(s): |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 53 | return re.sub(r'([^ ]:).+?(@)', r'\1xxx\2', s) |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 54 | |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 55 | |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 56 | def main(): |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 57 | """Script entry point: return some JSON based on calling args. |
| 58 | We should be called from Jenkins and expect the following to be defined: |
| 59 | $HWPACK_BUILD_NUMBER $HWPACK_JOB_NAME HWPACK_FILE_NAME $DEVICE_TYPE |
| 60 | """ |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 61 | |
Fathi Boudra | d1f9a86 | 2012-12-28 14:46:04 +0200 | [diff] [blame] | 62 | # CI base URL |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 63 | ci_base_url = 'https://ci.linaro.org/jenkins/job/' |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 64 | # Snapshots base URL |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 65 | snapshots_url = 'http://snapshots.linaro.org' |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 66 | |
| 67 | # Name of the hardware pack project |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 68 | hwpack_job_name = os.environ.get('HWPACK_JOB_NAME') |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 69 | # The hardware pack build number |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 70 | hwpack_build_number = os.environ.get('HWPACK_BUILD_NUMBER') |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 71 | # Hardware pack file name |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 72 | hwpack_file_name = os.environ.get('HWPACK_FILE_NAME', 'Undefined') |
| 73 | if hwpack_file_name == 'Undefined': |
| 74 | sys.exit('Hardware pack is not defined.') |
| 75 | |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 76 | # Device type |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 77 | device_type = os.environ.get('DEVICE_TYPE', 'Undefined') |
| 78 | if device_type == 'Undefined': |
| 79 | sys.exit('Device type is not defined.') |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 80 | |
| 81 | # Distribution, architecture and hardware pack type |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 82 | ret_split = hwpack_job_name.split('-', 2) |
| 83 | (distribution, architecture, hwpack_type) = \ |
| 84 | ret_split[0], ret_split[1], ret_split[2] |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 85 | if hwpack_type.startswith('pre-built-images-'): |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 86 | hwpack_type = hwpack_type[(len('pre-built-images-')):] |
Fathi Boudra | 65aaf1a | 2013-01-10 10:35:57 +0200 | [diff] [blame] | 87 | if '=' in hwpack_type: |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 88 | hwpack_type = hwpack_type[(len('pre-built-images/hwpack=')):] |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 89 | # Rootfs type, default is developer |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 90 | rootfs_type = os.getenv('ROOTFS_TYPE', 'developer') |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 91 | |
| 92 | # Bundle stream name |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 93 | bundle_stream_name = os.environ.get( |
| 94 | 'BUNDLE_STREAM_NAME', |
| 95 | '/private/team/linaro/pre-built-%s/' % DEVICE_STREAM[device_type]) |
| 96 | |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 97 | # LAVA user |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 98 | lava_user = os.environ.get('LAVA_USER') |
| 99 | if lava_user is None: |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 100 | f = open('/var/run/lava/lava-user') |
| 101 | lava_user = f.read().strip() |
| 102 | f.close() |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 103 | |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 104 | # LAVA token |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 105 | lava_token = os.environ.get('LAVA_TOKEN') |
| 106 | if lava_token is None: |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 107 | f = open('/var/run/lava/lava-token') |
| 108 | lava_token = f.read().strip() |
| 109 | f.close() |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 110 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 111 | # LAVA server URL |
| 112 | lava_server = os.environ.get('LAVA_SERVER', |
| 113 | 'validation.linaro.org/lava-server/RPC2/') |
| 114 | # LAVA server base URL |
| 115 | lava_server_root = lava_server.rstrip('/') |
| 116 | if lava_server_root.endswith('/RPC2'): |
| 117 | lava_server_root = lava_server_root[:-len('/RPC2')] |
| 118 | |
| 119 | image_url = '%s/%s/pre-built/%s/%s/%s' % \ |
| 120 | (snapshots_url, |
| 121 | distribution, |
| 122 | hwpack_type, |
| 123 | hwpack_build_number, |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 124 | hwpack_file_name) |
| 125 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 126 | git_repo = 'git://git.linaro.org/qa/test-definitions.git' |
Senthil Kumaran | 672ac4d | 2012-12-19 15:10:59 +0530 | [diff] [blame] | 127 | |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 128 | # tests set specific to an image |
Fathi Boudra | c51e091 | 2012-06-15 18:18:41 +0300 | [diff] [blame] | 129 | tests = tests_nano |
| 130 | |
Ricardo Salveti de Araujo | acf2854 | 2012-06-27 18:56:00 -0300 | [diff] [blame] | 131 | # if ubuntu-desktop, cover more test cases (LEB) |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 132 | if rootfs_type == 'ubuntu-desktop': |
Fathi Boudra | c51e091 | 2012-06-15 18:18:41 +0300 | [diff] [blame] | 133 | tests += tests_desktop |
Andy Doan | bc19b7c | 2012-05-17 12:08:16 -0500 | [diff] [blame] | 134 | |
Ricardo Salveti de Araujo | 6ad9433 | 2012-06-29 02:48:18 -0300 | [diff] [blame] | 135 | # if alip, specific tests like bootchart (which should be first) |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 136 | if rootfs_type == 'alip': |
Ricardo Salveti de Araujo | 6ad9433 | 2012-06-29 02:48:18 -0300 | [diff] [blame] | 137 | tests = tests_alip + tests |
| 138 | |
Ricardo Salveti de Araujo | acf2854 | 2012-06-27 18:56:00 -0300 | [diff] [blame] | 139 | # removing bluetooth and wifi for devices that don't support it |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 140 | if device_type in ['beaglexm', 'vexpress-a9', 'mx53loco']: |
Ricardo Salveti de Araujo | dd78097 | 2012-06-29 11:48:47 -0300 | [diff] [blame] | 141 | try: |
| 142 | tests.remove('bluetooth-enablement') |
| 143 | tests.remove('wifi-enablement') |
| 144 | except ValueError: |
| 145 | pass |
Ricardo Salveti de Araujo | acf2854 | 2012-06-27 18:56:00 -0300 | [diff] [blame] | 146 | |
| 147 | # vexpress doesn't support PM, so disable pwrmgmt |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 148 | if device_type in ['vexpress-a9']: |
Ricardo Salveti de Araujo | dd78097 | 2012-06-29 11:48:47 -0300 | [diff] [blame] | 149 | try: |
| 150 | tests.remove('pwrmgmt') |
| 151 | except ValueError: |
| 152 | pass |
Andy Doan | e9bf215 | 2012-06-12 15:42:10 -0500 | [diff] [blame] | 153 | |
Fathi Boudra | 62eb6a9 | 2012-12-06 19:02:56 +0200 | [diff] [blame] | 154 | if distribution == 'openembedded': |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 155 | tests = tests_openembedded |
Fathi Boudra | 4079a58 | 2012-12-06 19:42:58 +0200 | [diff] [blame] | 156 | actions = [{ |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 157 | 'command': 'deploy_linaro_image', |
| 158 | 'parameters': { |
| 159 | 'image': '%s' % image_url, |
| 160 | }, |
| 161 | 'metadata': { |
| 162 | 'hwpack.type': '%s' % hwpack_type, |
| 163 | 'hwpack.build': '%s' % hwpack_build_number, |
| 164 | 'rootfs.type': '%s' % rootfs_type, |
| 165 | 'distribution': '%s' % distribution, |
| 166 | } |
| 167 | }, |
| 168 | { |
| 169 | 'command': 'boot_linaro_image', |
| 170 | 'parameters': { |
| 171 | 'options': ['boot_cmds=boot_cmds_oe'] |
| 172 | } |
| 173 | }] |
| 174 | else: # Distribution is Ubuntu |
Fathi Boudra | 4079a58 | 2012-12-06 19:42:58 +0200 | [diff] [blame] | 175 | actions = [{ |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 176 | 'command': 'deploy_linaro_image', |
| 177 | 'parameters': { |
| 178 | 'image': '%s' % image_url, |
| 179 | }, |
| 180 | 'metadata': { |
| 181 | 'ubuntu.name': '%s' % hwpack_type, |
| 182 | 'ubuntu.build': '%s' % hwpack_build_number, |
| 183 | 'rootfs.type': '%s' % rootfs_type, |
| 184 | 'ubuntu.distribution': '%s' % distribution, |
| 185 | } |
| 186 | }] |
Fathi Boudra | 4079a58 | 2012-12-06 19:42:58 +0200 | [diff] [blame] | 187 | |
Fathi Boudra | a9bbadb | 2012-12-07 16:10:29 +0200 | [diff] [blame] | 188 | if len(tests) > 0: |
Senthil Kumaran | b30d738 | 2012-12-19 15:11:47 +0530 | [diff] [blame] | 189 | test_list = [] |
| 190 | for test in tests: |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 191 | test_list.append( |
| 192 | {'git-repo': git_repo, |
| 193 | 'testdef': '{distribution:>s}/{test:>s}.yaml'.format( |
| 194 | distribution=distribution, test=test)}) |
| 195 | actions.append({ |
| 196 | 'command': 'lava_test_shell', |
| 197 | 'parameters': { |
| 198 | 'timeout': 18000, |
| 199 | 'testdef_repos': test_list |
| 200 | } |
| 201 | }) |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 202 | |
| 203 | actions.append({ |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 204 | 'command': 'submit_results', |
| 205 | 'parameters': { |
| 206 | 'stream': bundle_stream_name, |
| 207 | 'server': '%s%s' % ('http://', lava_server) |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 208 | } |
| 209 | }) |
| 210 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 211 | config = json.dumps({'timeout': 18000, |
| 212 | 'actions': actions, |
| 213 | 'job_name': '%s%s/%s/' % (ci_base_url, |
| 214 | hwpack_job_name, |
Fathi Boudra | d1f9a86 | 2012-12-28 14:46:04 +0200 | [diff] [blame] | 215 | hwpack_build_number), |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 216 | 'device_type': device_type, |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 217 | }, indent=2) |
Fathi Boudra | 79c1e8b | 2012-12-02 10:36:57 +0200 | [diff] [blame] | 218 | |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 219 | print config |
| 220 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 221 | skip_lava = os.environ.get('SKIP_LAVA') |
| 222 | if skip_lava is None: |
Fathi Boudra | 79c1e8b | 2012-12-02 10:36:57 +0200 | [diff] [blame] | 223 | try: |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 224 | server_url = \ |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 225 | 'https://{lava_user:>s}:{lava_token:>s}@{lava_server:>s}' |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 226 | server = \ |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 227 | xmlrpclib.ServerProxy(server_url.format( |
| 228 | lava_user=lava_user, |
| 229 | lava_token=lava_token, |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 230 | lava_server=lava_server)) |
| 231 | lava_job_id = server.scheduler.submit_job(config) |
Fathi Boudra | 79c1e8b | 2012-12-02 10:36:57 +0200 | [diff] [blame] | 232 | except xmlrpclib.ProtocolError, e: |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 233 | print 'Error making a LAVA request:', obfuscate_credentials(str(e)) |
Fathi Boudra | 79c1e8b | 2012-12-02 10:36:57 +0200 | [diff] [blame] | 234 | sys.exit(1) |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 235 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 236 | print 'LAVA Job Id: %s, URL: http://%s/scheduler/job/%s' % \ |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 237 | (lava_job_id, lava_server_root, lava_job_id) |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 238 | json.dump({'lava_url': 'http://' + lava_server_root, |
Fathi Boudra | c14068b | 2012-12-06 17:42:11 +0200 | [diff] [blame] | 239 | 'job_id': lava_job_id}, |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 240 | open('lava-job-info', 'w')) |
Fathi Boudra | 8e4ce56 | 2012-12-08 14:35:17 +0200 | [diff] [blame] | 241 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 242 | lava_job_info_orig = hwpack_file_name.replace('.img.gz', '.html') |
| 243 | top_dir = os.environ.get('WORKSPACE', '.') |
Fathi Boudra | de02059 | 2012-12-10 13:25:14 +0200 | [diff] [blame] | 244 | for root, dirs, files in os.walk(top_dir): |
| 245 | for file in files: |
| 246 | if file == lava_job_info_orig: |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 247 | lava_job_info_orig = os.path.join(root, file) |
Fathi Boudra | 5e48102 | 2012-12-08 19:21:16 +0200 | [diff] [blame] | 248 | |
Fathi Boudra | de02059 | 2012-12-10 13:25:14 +0200 | [diff] [blame] | 249 | with open(lava_job_info_orig) as f: |
| 250 | buffer = f.read() |
Fathi Boudra | 5e48102 | 2012-12-08 19:21:16 +0200 | [diff] [blame] | 251 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 252 | buffer = buffer.replace( |
| 253 | 'var lavaJobId = 0', |
| 254 | 'var lavaJobId = ' + str(lava_job_id), 1) |
Fathi Boudra | de02059 | 2012-12-10 13:25:14 +0200 | [diff] [blame] | 255 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 256 | lava_job_info = lava_job_info_orig.replace( |
| 257 | '.html', |
| 258 | '-' + device_type + '.html') |
Fathi Boudra | de02059 | 2012-12-10 13:25:14 +0200 | [diff] [blame] | 259 | with open(lava_job_info, 'w') as f: |
| 260 | f.write(buffer) |
| 261 | os.remove(lava_job_info_orig) |
Fathi Boudra | 79c1e8b | 2012-12-02 10:36:57 +0200 | [diff] [blame] | 262 | else: |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 263 | print 'LAVA job submission skipped.' |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 264 | |
Fathi Boudra | 3f7ace9 | 2013-04-11 13:06:11 +0300 | [diff] [blame^] | 265 | |
| 266 | if __name__ == '__main__': |
Andy Doan | 61b4d77 | 2012-04-24 10:03:28 -0500 | [diff] [blame] | 267 | main() |