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