joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers export_test.py Source File

export_test.py

00001 #!/usr/bin/env python
00002 """
00003 mbed SDK
00004 Copyright (c) 2011-2013 ARM Limited
00005 
00006 Licensed under the Apache License, Version 2.0 (the "License");
00007 you may not use this file except in compliance with the License.
00008 You may obtain a copy of the License at
00009 
00010     http://www.apache.org/licenses/LICENSE-2.0
00011 
00012 Unless required by applicable law or agreed to in writing, software
00013 distributed under the License is distributed on an "AS IS" BASIS,
00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 See the License for the specific language governing permissions and
00016 limitations under the License.
00017 """
00018 import sys
00019 from os.path import join, abspath, dirname, exists
00020 ROOT = abspath(join(dirname(__file__), ".."))
00021 sys.path.insert(0, ROOT)
00022 
00023 from shutil import move
00024 
00025 from tools.paths import *
00026 from tools.utils import mkdir, cmd
00027 from tools.export import export, setup_user_prj
00028 
00029 
00030 USR_PRJ_NAME = "usr_prj"
00031 USER_PRJ = join(EXPORT_WORKSPACE, USR_PRJ_NAME)
00032 USER_SRC = join(USER_PRJ, "src")
00033 
00034 
00035 def setup_test_user_prj():
00036     if exists(USER_PRJ):
00037         print 'Test user project already generated...'
00038         return
00039 
00040     setup_user_prj(USER_PRJ, join(TEST_DIR, "rtos", "mbed", "basic"), [join(ROOT, "rtos"), join(LIB_DIR, "tests", "mbed", "env")])
00041 
00042     # FAKE BUILD URL
00043     open(join(USER_SRC, "mbed.bld"), 'w').write("http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5\n")
00044 
00045 
00046 def fake_build_url_resolver(url):
00047     # FAKE BUILD URL: Ignore the URL, always return the path to the mbed library
00048     return {'path':MBED_LIBRARIES, 'name':'mbed'}
00049 
00050 
00051 def test_export(toolchain, target, expected_error=None):
00052     if toolchain is None and target is None:
00053         base_dir = join(EXPORT_TMP, "zip")
00054     else:
00055         base_dir = join(EXPORT_TMP, toolchain, target)
00056     temp_dir = join(base_dir, "temp")
00057     mkdir(temp_dir)
00058 
00059     zip_path, report = export(USER_PRJ, USR_PRJ_NAME, toolchain, target, base_dir, temp_dir, False, None, fake_build_url_resolver)
00060 
00061     if report['success']:
00062         move(zip_path, join(EXPORT_DIR, "export_%s_%s.zip" % (toolchain, target)))
00063         print "[OK]"
00064     else:
00065         if expected_error is None:
00066             print '[ERRROR] %s' % report['errormsg']
00067         else:
00068             if (zip_path is None) and (expected_error in report['errormsg']):
00069                 print '[OK]'
00070             else:
00071                 print '[ERROR]'
00072                 print '    zip:', zip_path
00073                 print '    msg:', report['errormsg']
00074 
00075 
00076 if __name__ == '__main__':
00077     setup_test_user_prj()
00078 
00079     for toolchain, target in [
00080             ('zip', 'LPC1768'),
00081 
00082             ('emblocks', 'LPC1768'),
00083             ('emblocks', 'LPC1549'),
00084             ('emblocks', 'LPC1114'),
00085             ('emblocks', 'LPC11U35_401'),
00086             ('emblocks', 'LPC11U35_501'),
00087             ('emblocks', 'LPCCAPPUCCINO'),
00088             ('emblocks', 'LPC2368'),
00089             ('emblocks', 'STM32F407'),
00090             ('emblocks', 'DISCO_F100RB'),
00091             ('emblocks', 'DISCO_F051R8'),
00092             ('emblocks', 'DISCO_F407VG'),
00093             ('emblocks', 'DISCO_F303VC'),
00094             ('emblocks', 'NRF51822'),
00095             ('emblocks', 'NUCLEO_F401RE'),
00096             ('emblocks', 'NUCLEO_F410RB'),
00097             ('emblocks', 'NUCLEO_F411RE'),
00098             ('emblocks', 'MTS_MDOT_F405RG'),
00099             ('emblocks', 'MTS_MDOT_F411RE'),
00100 
00101             ('coide', 'KL05Z'),
00102             ('coide', 'KL25Z'),
00103             ('coide', 'LPC1768'),
00104             ('coide', 'ARCH_PRO'),
00105             ('coide', 'DISCO_F407VG'),
00106             ('coide', 'NUCLEO_F401RE'),
00107             ('coide', 'NUCLEO_F410RB'),
00108             ('coide', 'NUCLEO_F411RE'),
00109             ('coide', 'DISCO_F429ZI'),
00110             ('coide', 'NUCLEO_F429ZI'),
00111             #('coide', 'DISCO_F469NI'), removed because template not available
00112             ('coide', 'NUCLEO_F334R8'),
00113             ('coide', 'NUCLEO_F303ZE'),
00114             ('coide', 'MTS_MDOT_F405RG'),
00115             ('coide', 'MTS_MDOT_F411RE'),
00116 
00117             ('uvision', 'LPC1768'),
00118             ('uvision', 'LPC11U24'),
00119             ('uvision', 'LPC11U35_401'),
00120             ('uvision', 'LPC11U35_501'),
00121             ('uvision', 'KL25Z'),
00122             ('uvision', 'LPC1347'),
00123             ('uvision', 'LPC1114'),
00124             ('uvision', 'LPC4088'),
00125             ('uvision', 'LPC4088_DM'),
00126             ('uvision', 'LPC4337'),
00127             ('uvision', 'LPC824'),
00128             ('uvision', 'SSCI824'),
00129             ('uvision', 'HRM1017'),
00130 
00131             ('uvision', 'B96B_F446VE'),
00132             ('uvision', 'NUCLEO_F030R8'),
00133             ('uvision', 'NUCLEO_F031K6'),
00134             ('uvision', 'NUCLEO_F042K6'),
00135             ('uvision', 'NUCLEO_F070RB'),
00136             ('uvision', 'NUCLEO_F072RB'),
00137             ('uvision', 'NUCLEO_F091RC'),
00138             ('uvision', 'NUCLEO_F103RB'),
00139             ('uvision', 'NUCLEO_F302R8'),
00140             ('uvision', 'NUCLEO_F303K8'),
00141             ('uvision', 'NUCLEO_F303RE'),
00142             ('uvision', 'NUCLEO_F334R8'),
00143             ('uvision', 'NUCLEO_F303ZE'),
00144             ('uvision', 'NUCLEO_F401RE'),
00145             ('uvision', 'NUCLEO_F410RB'),
00146             ('uvision', 'NUCLEO_F411RE'),
00147             ('uvision', 'NUCLEO_F429ZI'),
00148             ('uvision', 'NUCLEO_F446RE'),
00149             ('uvision', 'NUCLEO_F446ZE'),
00150             ('uvision', 'NUCLEO_L011K4'),
00151             ('uvision', 'NUCLEO_L031K6'),
00152             ('uvision', 'NUCLEO_L053R8'),
00153             ('uvision', 'NUCLEO_L073RZ'),
00154             ('uvision', 'NUCLEO_L152RE'),
00155             ('uvision', 'NUCLEO_L432KC'),
00156             ('uvision', 'NUCLEO_L476RG'),
00157             ('uvision', 'MTS_MDOT_F405RG'),
00158             ('uvision', 'MAXWSNENV'),
00159             ('uvision', 'MAX32600MBED'),
00160             ('uvision', 'MAX32620HSP'),
00161             ('uvision', 'DISCO_F051R8'),
00162             ('uvision', 'DISCO_F103RB'),
00163             ('uvision', 'DISCO_F303VC'),
00164             ('uvision', 'DISCO_L053C8'),
00165             ('uvision', 'DISCO_F334C8'),
00166             ('uvision', 'DISCO_F407VG'),
00167             ('uvision', 'DISCO_F429ZI'),
00168             ('uvision', 'DISCO_F746NG'),
00169             ('uvision', 'DISCO_F469NI'),
00170             ('uvision', 'DISCO_L476VG'),
00171             ('uvision', 'MOTE_L152RC'),
00172             ('uvision', 'ARM_BEETLE_SOC'),
00173 
00174             ('lpcxpresso', 'LPC1768'),
00175             ('lpcxpresso', 'LPC4088'),
00176             ('lpcxpresso', 'LPC4088_DM'),
00177             ('lpcxpresso', 'LPC1114'),
00178             ('lpcxpresso', 'LPC11U35_401'),
00179             ('lpcxpresso', 'LPC11U35_501'),
00180             ('lpcxpresso', 'LPCCAPPUCCINO'),
00181             ('lpcxpresso', 'LPC1549'),
00182             ('lpcxpresso', 'LPC11U68'),
00183 
00184             # Linux path: /home/emimon01/bin/gcc-arm/bin/
00185             # Windows path: C:/arm-none-eabi-gcc-4_7/bin/
00186             ('gcc_arm', 'LPC1768'),
00187             ('gcc_arm', 'LPC4088_DM'),
00188             ('gcc_arm', 'LPC1549'),
00189             ('gcc_arm', 'LPC1114'),
00190             ('gcc_arm', 'LPC11U35_401'),
00191             ('gcc_arm', 'LPC11U35_501'),
00192             ('gcc_arm', 'LPCCAPPUCCINO'),
00193             ('gcc_arm', 'LPC2368'),
00194             ('gcc_arm', 'LPC2460'),
00195             ('gcc_arm', 'LPC824'),
00196             ('gcc_arm', 'SSCI824'),
00197 
00198             ('gcc_arm', 'B96B_F446VE'),
00199             ('gcc_arm', 'STM32F407'),
00200             ('gcc_arm', 'DISCO_F100RB'),
00201             ('gcc_arm', 'DISCO_F051R8'),
00202             ('gcc_arm', 'DISCO_F407VG'),
00203             ('gcc_arm', 'DISCO_F303VC'),
00204             ('gcc_arm', 'DISCO_L053C8'),
00205             ('gcc_arm', 'DISCO_F334C8'),
00206             ('gcc_arm', 'DISCO_L053C8'),
00207             ('gcc_arm', 'DISCO_F429ZI'),
00208             ('gcc_arm', 'DISCO_F746NG'),
00209             ('gcc_arm', 'NUCLEO_F031K6'),
00210             ('gcc_arm', 'NUCLEO_F042K6'),
00211             ('gcc_arm', 'NRF51822'),
00212             ('gcc_arm', 'RBLAB_BLENANO'),
00213             ('gcc_arm', 'HRM1017'),
00214             ('gcc_arm', 'NUCLEO_F401RE'),
00215             ('gcc_arm', 'NUCLEO_F410RB'),
00216             ('gcc_arm', 'NUCLEO_F411RE'),
00217             ('gcc_arm', 'NUCLEO_F429ZI'),
00218             ('gcc_arm', 'NUCLEO_F446RE'),
00219             ('gcc_arm', 'NUCLEO_F446ZE'),
00220             ('gcc_arm', 'NUCLEO_F303ZE'),
00221             ('gcc_arm', 'ELMO_F411RE'),
00222             ('gcc_arm', 'DISCO_F469NI'),
00223             ('gcc_arm', 'NUCLEO_F334R8'),
00224             ('gcc_arm', 'NUCLEO_L011K4'),
00225             ('gcc_arm', 'NUCLEO_L031K6'),
00226             ('gcc_arm', 'NUCLEO_L432KC'),
00227             ('gcc_arm', 'MAX32600MBED'),
00228             ('gcc_arm', 'MTS_MDOT_F405RG'),
00229             ('gcc_arm', 'MTS_MDOT_F411RE'),
00230             ('gcc_arm', 'RZ_A1H'),
00231             ('gcc_arm', 'MAXWSNENV'),
00232             ('gcc_arm', 'MAX32600MBED'),
00233             ('gcc_arm', 'MAX32620HSP'),
00234             ('gcc_arm', 'ARCH_BLE'),
00235             ('gcc_arm', 'ARCH_MAX'),
00236             ('gcc_arm', 'ARCH_PRO'),
00237             ('gcc_arm', 'DELTA_DFCM_NNN40'),
00238             ('gcc_arm', 'K20D50M'),
00239             ('gcc_arm', 'K22F'),
00240             ('gcc_arm', 'K64F'),
00241             ('gcc_arm', 'KL05Z'),
00242             ('gcc_arm', 'KL25Z'),
00243             ('gcc_arm', 'KL43Z'),
00244             ('gcc_arm', 'KL46Z'),
00245             ('gcc_arm', 'EFM32GG_STK3700'),
00246             ('gcc_arm', 'EFM32LG_STK3600'),
00247             ('gcc_arm', 'EFM32WG_STK3800'),
00248             ('gcc_arm', 'EFM32ZG_STK3200'),
00249             ('gcc_arm', 'EFM32HG_STK3400'),
00250             ('gcc_arm', 'EFM32PG_STK3401'),
00251 
00252             ('ds5_5', 'LPC1768'),
00253             ('ds5_5', 'LPC11U24'),
00254             ('ds5_5', 'RZ_A1H'),
00255 
00256             ('iar', 'LPC1768'),
00257             ('iar', 'LPC4088_DM'),
00258             ('iar', 'LPC1347'),
00259 
00260             ('iar', 'B96B_F446VE'),
00261             ('iar', 'NUCLEO_F030R8'),
00262             ('iar', 'NUCLEO_F031K6'),
00263             ('iar', 'NUCLEO_F042K6'),
00264             ('iar', 'NUCLEO_F070RB'),
00265             ('iar', 'NUCLEO_F072RB'),
00266             ('iar', 'NUCLEO_F091RC'),
00267             ('iar', 'NUCLEO_F302R8'),
00268             ('iar', 'NUCLEO_F303K8'),
00269             ('iar', 'NUCLEO_F303RE'),
00270             ('iar', 'NUCLEO_F334R8'),
00271             ('iar', 'NUCLEO_F303ZE'),
00272             ('iar', 'NUCLEO_F401RE'),
00273             ('iar', 'NUCLEO_F410RB'),
00274             ('iar', 'NUCLEO_F411RE'),
00275             ('iar', 'NUCLEO_F429ZI'),
00276             ('iar', 'NUCLEO_F446RE'),
00277             ('iar', 'NUCLEO_F446ZE'),
00278             ('iar', 'NUCLEO_L011K4'),
00279             ('iar', 'NUCLEO_L031K6'),
00280             ('iar', 'NUCLEO_L053R8'),
00281             ('iar', 'NUCLEO_L073RZ'),
00282             ('iar', 'NUCLEO_L152RE'),
00283             ('iar', 'NUCLEO_L432KC'),
00284             ('iar', 'NUCLEO_L476RG'),
00285             ('iar', 'DISCO_L053C8'),
00286             ('iar', 'DISCO_F334C8'),
00287             ('iar', 'DISCO_F429ZI'),
00288             ('iar', 'DISCO_F469NI'),
00289             ('iar', 'DISCO_F746NG'),
00290             ('iar', 'DISCO_L476VG'),
00291             ('iar', 'STM32F407'),
00292             ('iar', 'MTS_MDOT_F405RG'),
00293             ('iar', 'MTS_MDOT_F411RE'),
00294             ('iar', 'MAXWSNENV'),
00295             ('iar', 'MAX32600MBED'),
00296             ('iar', 'MAX32620HSP'),
00297             ('iar', 'MOTE_L152RC'),
00298             ('iar', 'RZ_A1H'),
00299 
00300             # ('sw4stm32', 'DISCO_F051R8'),
00301             # ('sw4stm32', 'DISCO_F100RB'),
00302             ('sw4stm32', 'DISCO_F303VC'),
00303             ('sw4stm32', 'DISCO_F334C8'),
00304             # ('sw4stm32', 'DISCO_F401VC'),
00305             ('sw4stm32', 'DISCO_F407VG'),
00306             ('sw4stm32', 'DISCO_F429ZI'),
00307             ('sw4stm32', 'DISCO_F469NI'),
00308             ('sw4stm32', 'DISCO_F746NG'),
00309             ('sw4stm32', 'DISCO_L053C8'),
00310             ('sw4stm32', 'DISCO_L476VG'),
00311             ('sw4stm32', 'NUCLEO_F030R8'),
00312             ('sw4stm32', 'NUCLEO_F031K6'),
00313             ('sw4stm32', 'NUCLEO_F042K6'),
00314             ('sw4stm32', 'NUCLEO_F070RB'),
00315             ('sw4stm32', 'NUCLEO_F072RB'),
00316             ('sw4stm32', 'NUCLEO_F091RC'),
00317             ('sw4stm32', 'NUCLEO_F103RB'),
00318             ('sw4stm32', 'NUCLEO_F302R8'),
00319             ('sw4stm32', 'NUCLEO_F303K8'),
00320             ('sw4stm32', 'NUCLEO_F303RE'),
00321             ('sw4stm32', 'NUCLEO_F334R8'),
00322             ('sw4stm32', 'NUCLEO_F401RE'),
00323             ('sw4stm32', 'NUCLEO_F410RB'),
00324             ('sw4stm32', 'NUCLEO_F411RE'),
00325             ('sw4stm32', 'NUCLEO_F429ZI'),
00326             ('sw4stm32', 'NUCLEO_F446RE'),
00327             ('sw4stm32', 'NUCLEO_F446ZE'),
00328             ('sw4stm32', 'NUCLEO_L011K4'),
00329             ('sw4stm32', 'NUCLEO_L053R8'),
00330             ('sw4stm32', 'NUCLEO_L073RZ'),
00331             ('sw4stm32', 'NUCLEO_L152RE'),
00332             ('sw4stm32', 'NUCLEO_L432KC'),
00333             ('sw4stm32', 'NUCLEO_L476RG'),
00334             ('sw4stm32', 'NUCLEO_F031K6'),
00335             ('sw4stm32', 'NUCLEO_F042K6'),
00336             ('sw4stm32', 'NUCLEO_F303ZE'),
00337             ('sw4stm32', 'NUCLEO_F410RB'),
00338 
00339             ('e2studio', 'RZ_A1H'),
00340             # Removed following item to avoid script error
00341             #(None, None),
00342         ]:
00343         print '\n=== Exporting to "%s::%s" ===' % (toolchain, target)
00344         test_export(toolchain, target)
00345 
00346     print "\n=== Test error messages ==="
00347     test_export('lpcxpresso', 'LPC11U24', expected_error='lpcxpresso')