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