EL4121 Embedded System / mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers tests.py Source File

tests.py

00001 """
00002 mbed SDK
00003 Copyright (c) 2011-2013 ARM Limited
00004 
00005 Licensed under the Apache License, Version 2.0 (the "License");
00006 you may not use this file except in compliance with the License.
00007 You may obtain a copy of the License at
00008 
00009     http://www.apache.org/licenses/LICENSE-2.0
00010 
00011 Unless required by applicable law or agreed to in writing, software
00012 distributed under the License is distributed on an "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 See the License for the specific language governing permissions and
00015 limitations under the License.
00016 """
00017 from tools.paths import *
00018 from tools.data.support import *
00019 from argparse import ArgumentTypeError
00020 from utils import columnate
00021 
00022 try:
00023     import tools.private_settings as ps
00024 except:
00025     ps = object()
00026 
00027 TEST_CMSIS_LIB = join(TEST_DIR, "cmsis", "lib")
00028 TEST_MBED_LIB = join(TEST_DIR, "mbed", "env")
00029 
00030 PERIPHERALS = join(TEST_DIR, "peripherals")
00031 BENCHMARKS_DIR = join(TEST_DIR, "benchmarks")
00032 
00033 SD = join(TEST_DIR, "sd")
00034 TMP102 = join(PERIPHERALS, 'TMP102')
00035 AT30TSE75X = join(PERIPHERALS, 'AT30TSE75X')
00036 
00037 """
00038 Wiring:
00039   * Ground:
00040     * LPC1*: p1
00041     * KL25Z: GND
00042 
00043   * Vout
00044     * LPC1*: p40
00045     * KL25Z: P3V3
00046 
00047   * TMP102 (I2C):
00048       * LPC1*: (SDA=p28 , SCL=p27)
00049       * KL25Z: (SDA=PTC9, SCL=PTC8)
00050       * MAXWSNENV: (SDA=TP6, SCL=TP5)
00051 
00052   * digital_loop (Digital(In|Out|InOut), InterruptIn):
00053       * Arduino headers: (D0 <-> D7)
00054       * NUCLEO_*: (D2 <-> D9)
00055       * LPC1549: (D2 <-> D7)
00056       * LPC1*: (p5   <-> p25 )
00057       * KL25Z: (PTA5<-> PTC6)
00058       * MAXWSNENV: (TP3 <-> TP4)
00059       * MAX32600MBED: (P1_0 <-> P4_7)
00060       * VK_RZ_A1H: (P3_2 <-> P5_6)
00061 
00062   * port_loop (Port(In|Out|InOut)):
00063       * Arduino headers: (D0 <-> D7), (D1 <-> D6)
00064       * LPC1*: (p5   <-> p25), (p6   <-> p26)
00065       * KL25Z: (PTA5 <-> PTC6), (PTA4 <-> PTC5)
00066       * NUCLEO_F103RB: (PC_6 <-> PB_8), (PC_5 <-> PB_9)
00067       * MAXWSNENV: (TP1 <-> TP3), (TP2 <-> TP4)
00068       * MAX32600MBED: (P1_0 <-> P4_7), (P1_1 <-> P4_6)
00069       * VK_RZ_A1H: (P3_2 <-> P5_6), (P3_7 <-> P5_1)
00070 
00071   * analog_loop (AnalogIn, AnalogOut):
00072       * Arduino headers: (A0 <-> A5)
00073       * NUCLEO64: (A0 <-> A2)
00074       * NUCLEO144: (A0 <-> D13)
00075       * LPC1549: (A0 <-> D12)
00076       * LPC1*: (p17   <-> p18 )
00077       * KL25Z: (PTE30 <-> PTC2)
00078 
00079   * analog_pot (AnalogIn):
00080       * Arduino headers: (A0, A1)
00081       * VK_RZ_A1H: (AN0, AN1)
00082 
00083   * SD (SPI):
00084       * LPC1*: (mosi=p11 , miso=p12 , sclk=p13 , cs=p14 )
00085       * KL25Z: (mosi=PTD2, miso=PTD3, sclk=PTD1, cs=PTD0)
00086 
00087   * MMA7660 (I2C):
00088       * LPC1*: (SDA=p28 , SCL=p27)
00089 
00090   * i2c_loop:
00091       * LPC1768: (p28 <-> p9), (p27 <-> p10)
00092       * NUCLEO64: (D14 <-> D3), (D15 <-> D6)
00093       * NUCLEO144: (D14 <-> PB_11), (D15 <-> PB_10)
00094 
00095   * i2c_eeprom:
00096       * LPC1*: (SDA=p28 , SCL=p27)
00097       * KL25Z: (SDA=PTE0, SCL=PTE1)
00098       * VK_RZ_A1H:(SDA=P1_1, SCL=P1_0)
00099 
00100   * can_transceiver:
00101      * LPC1768: (RX=p9,   TX=p10)
00102      * LPC1549: (RX=D9,   TX=D8)
00103      * LPC4088: (RX=p9,   TX=p10)
00104      * VK_RZ_A1H:(RX=P5_9, TX=P5_10)
00105      * NUCLEO_F091RC: (RX=PA_11, TX=PA_12)
00106      * NUCLEO_F072RB: (RX=PA_11, TX=PA_12)
00107      * NUCLEO_F042K6: (RX=PA_11, TX=PA_12)
00108      * NUCLEO_F334R8: (RX=PA_11, TX=PA_12)
00109      * NUCLEO_F303RE: (RX=PA_11, TX=PA_12)
00110      * NUCLEO_F303K8: (RX=PA_11, TX=PA_12)
00111      * NUCLEO_F302R8: (RX=PA_11, TX=PA_12)
00112      * NUCLEO_F446RE: (RX=PA_11, TX=PA_12)
00113      * NUCLEO_F446ZE: (RX=PA_11, TX=PA_12)
00114      * DISCO_F469NI:  (RX=PB_8, TX=PB_9)
00115      * DISCO_F4269ZI: (RX=PA_11, TX=PA_12)
00116      * NUCLEO_F103RB: (RX=PA_11, TX=PA_12)
00117      * NUCLEO_F746ZG: (RX=PA_11, TX=PA_12)
00118      * DISCO_F746NG:  (RX=PB_8, TX=PB_9)
00119      * DISCO_L475VG_IOT01A:  (RX=PA_11, TX=PA_12)
00120      * DISCO_L476VG:  (RX=PA_11, TX=PA_12)
00121      * NUCLEO_L476RG: (RX=PA_11, TX=PA_12)
00122      * NUCLEO_L432KC: (RX=PA_11, TX=PA_12)
00123      * DISCO_F303VC:  (RX=PA_11, TX=PA_12)
00124      * NUCLEO_F412ZG: (RX=PA_11, TX=PA_12)
00125 
00126 """
00127 TESTS = [
00128     # Automated MBED tests
00129     {
00130         "id": "MBED_A1", "description": "Basic",
00131         "source_dir": join(TEST_DIR, "mbed", "basic"),
00132         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00133         "automated": True,
00134     },
00135     {
00136         "id": "MBED_A2", "description": "Semihost file system",
00137         "source_dir": join(TEST_DIR, "mbed", "file"),
00138         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00139         "automated": True,
00140         "mcu": ["LPC1768", "LPC11U24"]
00141     },
00142     {
00143         "id": "MBED_A3", "description": "C++ STL",
00144         "source_dir": join(TEST_DIR, "mbed", "stl"),
00145         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00146         "automated": False,
00147     },
00148     {
00149         "id": "MBED_A4", "description": "I2C TMP102",
00150         "source_dir": join(TEST_DIR, "mbed", "i2c_TMP102"),
00151         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, TMP102],
00152         "automated": True,
00153         "peripherals": ["TMP102"]
00154     },
00155     {
00156         "id": "MBED_AT30TSE75X", "description": "I2C Temperature Sensor / EEPROM",
00157         "source_dir": join(TEST_DIR, "mbed", "i2c_at30tse75x"),
00158         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, AT30TSE75X],
00159         "automated": False,
00160         "peripherals": ["AT30TSE75X"]
00161     },
00162     {
00163         "id": "MBED_A5", "description": "DigitalIn DigitalOut",
00164         "source_dir": join(TEST_DIR, "mbed", "digitalin_digitalout"),
00165         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00166         "automated": True,
00167         "peripherals": ["digital_loop"]
00168     },
00169     {
00170         "id": "MBED_A6", "description": "DigitalInOut",
00171         "source_dir": join(TEST_DIR, "mbed", "digitalinout"),
00172         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00173         "automated": True,
00174         "peripherals": ["digital_loop"]
00175     },
00176     {
00177         "id": "MBED_A7", "description": "InterruptIn",
00178         "source_dir": join(TEST_DIR, "mbed", "interruptin"),
00179         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00180         "automated": True,
00181         "peripherals": ["digital_loop"]
00182     },
00183     {
00184         "id": "MBED_A8", "description": "Analog",
00185         "source_dir": join(TEST_DIR, "mbed", "analog"),
00186         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00187         "automated": True,
00188         "peripherals": ["analog_loop"],
00189         "mcu": ["LPC1768", "KL25Z", "K64F", "K66F", "K22F", "LPC4088", "LPC1549",
00190                 "NUCLEO_F072RB", "NUCLEO_F091RC", "NUCLEO_F302R8", "NUCLEO_F303K8", "NUCLEO_F303RE", "NUCLEO_F207ZG",
00191                 "NUCLEO_F334R8", "NUCLEO_F303ZE", "NUCLEO_L053R8", "DISCO_L072CZ_LRWAN1", "NUCLEO_L073RZ", "NUCLEO_L152RE",
00192                 "NUCLEO_F410RB", "NUCLEO_F446RE", "NUCLEO_F446ZE", "NUCLEO_F429ZI",
00193                 "DISCO_F407VG", "NUCLEO_F746ZG", "NUCLEO_L476RG",
00194                 "DISCO_L053C8", "DISCO_F334C8", "DISCO_L475VG_IOT01A", "DISCO_L476VG", "DISCO_F469NI", "DISCO_F429ZI", "DISCO_F769NI",
00195                 "ARCH_MAX", "MAX32600MBED", "MOTE_L152RC", "B96B_F446VE"]
00196     },
00197     {
00198         "id": "MBED_A9", "description": "Serial Echo at 115200",
00199         "source_dir": join(TEST_DIR, "mbed", "echo"),
00200         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00201         "automated": True,
00202         #"host_test": "echo"
00203     },
00204     {
00205         "id": "MBED_A10", "description": "PortOut PortIn",
00206         "source_dir": join(TEST_DIR, "mbed", "portout_portin"),
00207         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00208         "peripherals": ["port_loop"],
00209         "supported": DEFAULT_SUPPORT,
00210         "automated": True,
00211     },
00212     {
00213         "id": "MBED_A11", "description": "PortInOut",
00214         "source_dir": join(TEST_DIR, "mbed", "portinout"),
00215         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00216         "peripherals": ["port_loop"],
00217         "supported": DEFAULT_SUPPORT,
00218         "automated": True,
00219     },
00220     {
00221         "id": "MBED_A13", "description": "I2C MMA7660 accelerometer",
00222         "source_dir": join(TEST_DIR, "mbed", "i2c_MMA7660"),
00223         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'MMA7660')],
00224         "automated": True,
00225         "peripherals": ["MMA7660"]
00226     },
00227     {
00228         "id": "MBED_A14", "description": "I2C Master",
00229         "source_dir": join(TEST_DIR, "mbed", "i2c_master"),
00230         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
00231     },
00232     {
00233         "id": "MBED_A15", "description": "I2C Slave",
00234         "source_dir": join(TEST_DIR, "mbed", "i2c_slave"),
00235         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
00236     },
00237     {
00238         "id": "MBED_A16", "description": "SPI Master",
00239         "source_dir": join(TEST_DIR, "mbed", "spi_master"),
00240         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
00241     },
00242     {
00243         "id": "MBED_A17", "description": "SPI Slave",
00244         "source_dir": join(TEST_DIR, "mbed", "spi_slave"),
00245         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
00246     },
00247     {
00248         "id": "MBED_A18", "description": "Interrupt vector relocation",
00249         "source_dir": join(TEST_DIR, "mbed", "vtor_reloc"),
00250         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
00251         "mcu": ["LPC1768"],
00252         "automated": True,
00253     },
00254     {
00255         "id": "MBED_A19", "description": "I2C EEPROM read/write test",
00256         "source_dir": join(TEST_DIR, "mbed", "i2c_eeprom"),
00257         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00258         "peripherals": ["24LC256"],
00259         "automated": True,
00260     },
00261     {
00262         "id": "MBED_A20", "description": "I2C master/slave test",
00263         "source_dir": join(TEST_DIR, "mbed", "i2c_master_slave"),
00264         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
00265         "automated": True,
00266         "peripherals": ["i2c_loop"]
00267     },
00268     {
00269         "id": "MBED_A21", "description": "Call function before main (mbed_main)",
00270         "source_dir": join(TEST_DIR, "mbed", "call_before_main"),
00271         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00272         "automated": True,
00273     },
00274     {
00275         "id": "MBED_A22", "description": "SPIFI for LPC4088 (test 1)",
00276         "source_dir": join(TEST_DIR, "mbed", "spifi1"),
00277         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00278         "automated": True,
00279         "mcu": ["LPC4088","LPC4088_DM"]
00280     },
00281     {
00282         "id": "MBED_A23", "description": "SPIFI for LPC4088 (test 2)",
00283         "source_dir": join(TEST_DIR, "mbed", "spifi2"),
00284         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00285         "automated": True,
00286         "mcu": ["LPC4088","LPC4088_DM"]
00287     },
00288     {
00289         "id": "MBED_A24", "description": "Serial echo with RTS/CTS flow control",
00290         "source_dir": join(TEST_DIR, "mbed", "echo_flow_control"),
00291         "dependencies": [MBED_LIBRARIES],
00292         "automated": "True",
00293         "host_test": "echo_flow_control",
00294         "mcu": ["LPC1768"],
00295         "peripherals": ["extra_serial"]
00296     },
00297     {
00298         "id": "MBED_A25", "description": "I2C EEPROM line read/write test",
00299         "source_dir": join(TEST_DIR, "mbed", "i2c_eeprom_line"),
00300         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00301         "peripherals": ["24LC256"],
00302         "automated": True,
00303     },
00304     {
00305         "id": "MBED_A26", "description": "AnalogIn potentiometer test",
00306         "source_dir": join(TEST_DIR, "mbed", "analog_pot"),
00307         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00308         "peripherals": ["analog_pot"],
00309         "automated": True,
00310     },
00311     {
00312         "id": "MBED_A27", "description": "CAN loopback test",
00313         "source_dir": join(TEST_DIR, "mbed", "can_loopback"),
00314         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00315         "automated": True,
00316         "peripherals": ["can_transceiver"],
00317         "mcu": ["LPC1549", "LPC1768","B96B_F446VE", "VK_RZ_A1H",
00318                 "NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F207ZG",
00319         "NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE","NUCLEO_F446ZE",
00320         "DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG",
00321         "DISCO_F746NG", "DISCO_L476VG", "NUCLEO_L476RG", "NUCLEO_L432KC",
00322         "DISCO_F769NI", "NUCLEO_F767ZI", "DISCO_F303VC", "NUCLEO_F412ZG",
00323         "DISCO_F413ZH"]
00324     },
00325     {
00326         "id": "MBED_A28", "description": "CAN loopback test",
00327         "source_dir": join(TEST_DIR, "mbed", "can_loopback"),
00328         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00329         "automated": True,
00330         "mcu": ["B96B_F446VE",
00331                 "NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F207ZG",
00332         "NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F446RE","NUCLEO_F446ZE",
00333         "DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG",
00334 
00335         "DISCO_F746NG", "DISCO_L476VG", "NUCLEO_L476RG", "NUCLEO_L432KC",
00336         "DISCO_F769NI", "NUCLEO_F767ZI", "DISCO_F303VC", "NUCLEO_F412ZG",
00337         "DISCO_F413ZH"]
00338     },
00339     {
00340         "id": "MBED_A29", "description": "i2c_master_slave_asynch",
00341         "source_dir": join(TEST_DIR, "mbed", "i2c_master_slave_asynch"),
00342         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00343         "automated": True,
00344         "peripherals": ["i2c_loop"]
00345     },
00346     {
00347         "id": "MBED_A30", "description": "CAN API",
00348         "source_dir": join(TEST_DIR, "mbed", "can_api"),
00349         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00350         "automated": True,
00351         "mcu": ["LPC1549", "LPC1768","B96B_F446VE", "VK_RZ_A1H",
00352                 "NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F207ZG",
00353                 "NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F303ZE", "NUCLEO_F302R8", "NUCLEO_F446RE","NUCLEO_F446ZE",
00354                 "DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG",
00355                 "NUCLEO_F429ZI", "NUCLEO_F439ZI", "NUCLEO_F756ZG", "NUCLEO_L486RG",
00356                 "DISCO_F746NG", "DISCO_L476VG", "NUCLEO_L476RG", "NUCLEO_L432KC",
00357                 "DISCO_F769NI", "NUCLEO_F767ZI", "DISCO_F303VC", "NUCLEO_F412ZG"]
00358     },
00359     {
00360         "id": "MBED_BLINKY", "description": "Blinky",
00361         "source_dir": join(TEST_DIR, "mbed", "blinky"),
00362         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00363         "automated": False,
00364     },
00365     {
00366         "id": "MBED_BUS", "description": "Blinky BUS",
00367         "source_dir": join(TEST_DIR, "mbed", "bus"),
00368         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00369         "automated": False,
00370     },
00371 
00372     {
00373         "id": "MBED_BUSOUT", "description": "BusOut",
00374         "source_dir": join(TEST_DIR, "mbed", "bus_out"),
00375         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00376         "exclude_mcu": ["NUCLEO_L011K4"],
00377         "automated": True,
00378     },
00379 
00380     # Size benchmarks
00381     {
00382         "id": "BENCHMARK_1", "description": "Size (c environment)",
00383         "source_dir": join(BENCHMARKS_DIR, "cenv"),
00384         "dependencies": [MBED_LIBRARIES]
00385     },
00386     {
00387         "id": "BENCHMARK_2", "description": "Size (float math)",
00388         "source_dir": join(BENCHMARKS_DIR, "float_math"),
00389         "dependencies": [MBED_LIBRARIES]
00390     },
00391     {
00392         "id": "BENCHMARK_3", "description": "Size (printf)",
00393         "source_dir": join(BENCHMARKS_DIR, "printf"),
00394         "dependencies": [MBED_LIBRARIES]
00395     },
00396     {
00397         "id": "BENCHMARK_4", "description": "Size (mbed libs)",
00398         "source_dir": join(BENCHMARKS_DIR, "mbed"),
00399         "dependencies": [MBED_LIBRARIES]
00400     },
00401     {
00402         "id": "BENCHMARK_5", "description": "Size (all)",
00403         "source_dir": join(BENCHMARKS_DIR, "all"),
00404         "dependencies": [MBED_LIBRARIES]
00405     },
00406 
00407 
00408     # Not automated MBED tests
00409     {
00410         "id": "MBED_1", "description": "I2C SRF08",
00411         "source_dir": join(TEST_DIR, "mbed", "i2c_SRF08"),
00412         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'SRF08')],
00413         "peripherals": ["SRF08"]
00414     },
00415     {
00416         "id": "MBED_2", "description": "stdio",
00417         "source_dir": join(TEST_DIR, "mbed", "stdio"),
00418         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00419         "automated": True,
00420         #"host_test": "stdio_auto"
00421     },
00422     {
00423         "id": "MBED_3", "description": "PortOut",
00424         "source_dir": join(TEST_DIR, "mbed", "portout"),
00425         "dependencies": [MBED_LIBRARIES],
00426     },
00427     {
00428         "id": "MBED_4", "description": "Sleep",
00429         "source_dir": join(TEST_DIR, "mbed", "sleep"),
00430         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00431         "mcu": ["LPC1768", "LPC11U24", "LPC4088","LPC4088_DM","NRF51822", "LPC11U68"]
00432     },
00433     {
00434         "id": "MBED_5", "description": "PWM",
00435         "source_dir": join(TEST_DIR, "mbed", "pwm"),
00436         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB]
00437     },
00438     {
00439         "id": "MBED_6", "description": "SW Reset",
00440         "source_dir": join(TEST_DIR, "mbed", "reset"),
00441         "dependencies": [MBED_LIBRARIES],
00442     },
00443     {
00444         "id": "MBED_7", "description": "stdio  benchmark",
00445         "source_dir": join(TEST_DIR, "mbed", "stdio_benchmark"),
00446         "dependencies": [MBED_LIBRARIES],
00447     },
00448     {
00449         "id": "MBED_8", "description": "SPI",
00450         "source_dir": join(TEST_DIR, "mbed", "spi"),
00451         "dependencies": [MBED_LIBRARIES],
00452     },
00453     {
00454         "id": "MBED_9", "description": "Sleep Timeout",
00455         "source_dir": join(TEST_DIR, "mbed", "sleep_timeout"),
00456         "dependencies": [MBED_LIBRARIES],
00457     },
00458     {
00459         "id": "MBED_10", "description": "Hello World",
00460         "source_dir": join(TEST_DIR, "mbed", "hello"),
00461         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00462         "automated": True,
00463         #"host_test": "hello_auto",
00464     },
00465     {
00466         "id": "MBED_11", "description": "Ticker Int",
00467         "source_dir": join(TEST_DIR, "mbed", "ticker"),
00468         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00469         "automated": True,
00470         #"host_test": "wait_us_auto",
00471     },
00472     {
00473         "id": "MBED_12", "description": "C++",
00474         "source_dir": join(TEST_DIR, "mbed", "cpp"),
00475         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00476         "automated": True
00477     },
00478     {
00479         "id": "MBED_13", "description": "Heap & Stack",
00480         "source_dir": join(TEST_DIR, "mbed", "heap_and_stack"),
00481         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00482     },
00483     {
00484         "id": "MBED_14", "description": "Serial Interrupt",
00485         "source_dir": join(TEST_DIR, "mbed", "serial_interrupt"),
00486         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00487     },
00488     {
00489         "id": "MBED_15", "description": "RPC",
00490         "source_dir": join(TEST_DIR, "mbed", "rpc"),
00491         "dependencies": [MBED_LIBRARIES, join(LIB_DIR, "rpc"), TEST_MBED_LIB],
00492         "automated": False,
00493         "mcu": ["LPC1768"]
00494     },
00495     {
00496         "id": "MBED_16", "description": "RTC",
00497         "source_dir": join(TEST_DIR, "mbed", "rtc"),
00498         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00499         "automated": True,
00500         "exclude_mcu": ["NRF51822", "NRF51822_BOOT", "NRF51822_OTA", "NRF51822_Y5_MBUG",
00501                         "NRF51_DK", "NRF51_DK_BOOT", "NRF51_DK_OTA",
00502                         "NRF51_MICROBIT", "NRF51_MICROBIT_B", "NRF51_MICROBIT_BOOT",
00503                         "NRF51_MICROBIT_B_BOOT", "NRF51_MICROBIT_B_OTA", "NRF51_MICROBIT_OTA",
00504                         "HRM1017", "HRM1017_BOOT", "HRM1701_OTA",
00505                         "NUCLEO_L011K4",
00506                         "TY51822R3", "TY51822R3_BOOT", "TY51822R3_OTA",
00507                         "NRF15_DONGLE", "NRF15_DONGLE_BOOT", "NRF15_DONGLE_OTA",
00508                         "ARCH_BLE", "ARCH_BLE_BOOT", "ARCH_BLE_OTA",
00509                         "ARCH_LINK", "ARCH_LINK_BOOT", "ARCH_LINK_OTA",
00510                         "RBLAB_BLENANO", "RBLAB_BLENANO_BOOT", "RBLAB_BLENANO_OTA",
00511                         "RBLAB_NRF51822", "RBLAB_NRF51822_BOOT", "RBLAB_NRF51822_OTA",
00512                         "SEEED_TINY_BLE", "SEEED_TINY_BLE_BOOT", "SEEED_TINY_BLE_OTA",
00513                         "WALLBOT_BLE", "WALLBOT_BLE_BOOT", "WALLBOT_BLE_OTA",
00514                         "DELTA_DFCM_NNN40", "DELTA_DFCM_NNN40_BOOT", "DELTA_DFCM_NNN40_OTA",
00515                         "LPC1114"],
00516         #"host_test": "rtc_auto",
00517     },
00518     {
00519         "id": "MBED_17", "description": "Serial Interrupt 2",
00520         "source_dir": join(TEST_DIR, "mbed", "serial_interrupt_2"),
00521         "dependencies": [MBED_LIBRARIES],
00522     },
00523     {
00524         "id": "MBED_18", "description": "Local FS Directory",
00525         "source_dir": join(TEST_DIR, "mbed", "dir"),
00526         "dependencies": [MBED_LIBRARIES],
00527     },
00528     {
00529         "id": "MBED_20", "description": "InterruptIn 2",
00530         "source_dir": join(TEST_DIR, "mbed", "interruptin_2"),
00531         "dependencies": [MBED_LIBRARIES],
00532     },
00533     {
00534         "id": "MBED_21", "description": "freopen Stream",
00535         "source_dir": join(TEST_DIR, "mbed", "freopen"),
00536         "dependencies": [MBED_LIBRARIES],
00537     },
00538     {
00539         "id": "MBED_22", "description": "Semihost",
00540         "source_dir": join(TEST_DIR, "mbed", "semihost"),
00541         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00542         "automated": True,
00543         "mcu": ["LPC1768", "LPC11U24"]
00544     },
00545     {
00546         "id": "MBED_23", "description": "Ticker Int us",
00547         "source_dir": join(TEST_DIR, "mbed", "ticker_2"),
00548         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00549         "automated": True,
00550         #"host_test": "wait_us_auto"
00551     },
00552     {
00553         "id": "MBED_24", "description": "Timeout Int us",
00554         "source_dir": join(TEST_DIR, "mbed", "timeout"),
00555         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00556         "automated": True,
00557         #"host_test": "wait_us_auto"
00558     },
00559     {
00560         "id": "MBED_25", "description": "Time us",
00561         "source_dir": join(TEST_DIR, "mbed", "time_us"),
00562         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00563         "automated": True,
00564         #"host_test": "wait_us_auto"
00565     },
00566     {
00567         "id": "MBED_26", "description": "Integer constant division",
00568         "source_dir": join(TEST_DIR, "mbed", "div"),
00569         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00570         "automated": True,
00571     },
00572     {
00573         "id": "MBED_27", "description": "SPI ADXL345",
00574         "source_dir": join(TEST_DIR, "mbed", "spi_ADXL345"),
00575         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'ADXL345')],
00576         "peripherals": ["ADXL345"]
00577     },
00578     {
00579         "id": "MBED_28", "description": "Interrupt chaining (InterruptManager)",
00580         "source_dir": join(TEST_DIR, "mbed", "interrupt_chaining"),
00581         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00582     },
00583     {
00584         "id": "MBED_29", "description": "CAN network test",
00585         "source_dir": join(TEST_DIR, "mbed", "can"),
00586         "dependencies": [MBED_LIBRARIES],
00587         "mcu": ["LPC1768", "LPC4088", "LPC1549", "RZ_A1H", "B96B_F446VE", "NUCLEO_F091RC",
00588                 "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F303RE",
00589                 "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE","NUCLEO_F446ZE", "DISCO_F469NI", "NUCLEO_F207ZG",
00590                 "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG", "DISCO_F746NG",
00591                 "NUCLEO_L476RG", "NUCLEO_L432KC", "DISCO_F303VC", "NUCLEO_F412ZG",
00592                 "DISCO_F413ZH"]
00593     },
00594     {
00595         "id": "MBED_30", "description": "CAN network test using interrupts",
00596         "source_dir": join(TEST_DIR, "mbed", "can_interrupt"),
00597         "dependencies": [MBED_LIBRARIES],
00598         "mcu": ["LPC1768", "LPC4088", "LPC1549", "RZ_A1H", "B96B_F446VE", "NUCLEO_F091RC", "NUCLEO_F207ZG",
00599                 "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F303RE",
00600                 "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE", "NUCLEO_F446ZE", "DISCO_F469NI",
00601                 "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG", "DISCO_F746NG",
00602                 "NUCLEO_L476RG", "NUCLEO_L432KC", "DISCO_F303VC", "NUCLEO_F412ZG",
00603                 "DISCO_F413ZH"]
00604     },
00605     {
00606         "id": "MBED_31", "description": "PWM LED test",
00607         "source_dir": join(TEST_DIR, "mbed", "pwm_led"),
00608         "dependencies": [MBED_LIBRARIES],
00609     },
00610     {
00611         "id": "MBED_32", "description": "Pin toggling",
00612         "source_dir": join(TEST_DIR, "mbed", "pin_toggling"),
00613         "dependencies": [MBED_LIBRARIES],
00614     },
00615     {
00616         "id": "MBED_33", "description": "C string operations",
00617         "source_dir": join(TEST_DIR, "mbed", "cstring"),
00618         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00619         "automated": False,
00620     },
00621     {
00622         "id": "MBED_34", "description": "Ticker Two callbacks",
00623         "source_dir": join(TEST_DIR, "mbed", "ticker_3"),
00624         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00625         "automated": True,
00626         #"host_test": "wait_us_auto"
00627     },
00628     {
00629         "id": "MBED_35", "description": "SPI C12832 display",
00630         "source_dir": join(TEST_DIR, "mbed", "spi_C12832"),
00631         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'C12832')],
00632         "peripherals": ["C12832"],
00633         "automated": True,
00634     },
00635     {
00636         "id": "MBED_36", "description": "WFI correct behavior",
00637         "source_dir": join(TEST_DIR, "mbed", "wfi"),
00638         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00639         "automated": False
00640     },
00641     {
00642         "id": "MBED_37", "description": "Serial NC RX",
00643         "source_dir": join(TEST_DIR, "mbed", "serial_nc_rx"),
00644         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00645         "exclude_mcu": ["NUCLEO_L011K4"],
00646         "automated": True
00647     },
00648     {
00649         "id": "MBED_38", "description": "Serial NC TX",
00650         "source_dir": join(TEST_DIR, "mbed", "serial_nc_tx"),
00651         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00652         "exclude_mcu": ["NUCLEO_L011K4"],
00653         "automated": True
00654     },
00655     {
00656         "id": "MBED_39", "description": "Serial Complete",
00657         "source_dir": join(TEST_DIR, "mbed", "serial_complete"),
00658         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00659         "automated": False
00660     },
00661 
00662     # USB Tests 
00663     # USB device test list
00664     {
00665         "id": "USB_1", "description": "Mouse",
00666         "source_dir": join(TEST_DIR, "usb", "device", "basic"),
00667         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00668     },
00669     {
00670         "id": "USB_2", "description": "Keyboard",
00671         "source_dir": join(TEST_DIR, "usb", "device", "keyboard"),
00672         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00673     },
00674     {
00675         "id": "USB_3", "description": "Mouse_Keyboard",
00676         "source_dir": join(TEST_DIR, "usb", "device", "keyboard"),
00677         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00678     },
00679     {
00680         "id": "USB_4", "description": "Serial Port",
00681         "source_dir": join(TEST_DIR, "usb", "device", "serial"),
00682         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00683     },
00684     {
00685         "id": "USB_5", "description": "Generic HID",
00686         "source_dir": join(TEST_DIR, "usb", "device", "raw_hid"),
00687         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00688     },
00689     {
00690         "id": "USB_6", "description": "MIDI",
00691         "source_dir": join(TEST_DIR, "usb", "device", "midi"),
00692         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00693     },
00694     {
00695         "id": "USB_7", "description": "AUDIO",
00696         "source_dir": join(TEST_DIR, "usb", "device", "audio"),
00697         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00698     },
00699     {
00700         "id": "USB_8", "description": "AUDIO_CB",
00701         "source_dir": join(TEST_DIR, "usb", "device", "audio_cb"),
00702         "dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
00703     },
00704 
00705     # CMSIS DSP
00706     {
00707         "id": "CMSIS_DSP_1", "description": "FIR",
00708         "source_dir": join(TEST_DIR, "dsp", "cmsis", "fir_f32"),
00709         "dependencies": [MBED_LIBRARIES, DSP_LIBRARIES],
00710     },
00711 
00712     # mbed DSP
00713     {
00714         "id": "DSP_1", "description": "FIR",
00715         "source_dir": join(TEST_DIR, "dsp", "mbed", "fir_f32"),
00716         "dependencies": [MBED_LIBRARIES, DSP_LIBRARIES],
00717     },
00718 
00719     # KL25Z
00720     {
00721         "id": "KL25Z_1", "description": "LPTMR",
00722         "source_dir": join(TEST_DIR, "KL25Z", "lptmr"),
00723         "dependencies": [MBED_LIBRARIES],
00724         "supported": CORTEX_ARM_SUPPORT,
00725         "mcu": ["KL25Z"],
00726     },
00727     {
00728         "id": "KL25Z_2", "description": "PIT",
00729         "source_dir": join(TEST_DIR, "KL25Z", "pit"),
00730         "dependencies": [MBED_LIBRARIES],
00731         "supported": CORTEX_ARM_SUPPORT,
00732         "mcu": ["KL25Z"],
00733     },
00734     {
00735         "id": "KL25Z_3", "description": "TSI Touch Sensor",
00736         "source_dir": join(TEST_DIR, "mbed", "tsi"),
00737         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'TSI')],
00738         "mcu": ["KL25Z"],
00739     },
00740     {
00741         "id": "KL25Z_4", "description": "RTC",
00742         "source_dir": join(TEST_DIR, "KL25Z", "rtc"),
00743         "dependencies": [MBED_LIBRARIES],
00744         "mcu": ["KL25Z"],
00745     },
00746     {
00747         "id": "KL25Z_5", "description": "MMA8451Q accelerometer",
00748         "source_dir": join(TEST_DIR, "mbed", "i2c_MMA8451Q"),
00749         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'MMA8451Q')],
00750         "mcu": ["KL25Z", "KL05Z", "KL46Z", "K20D50M"],
00751         "automated": True,
00752         },
00753 
00754     # Examples
00755     {
00756         "id": "EXAMPLE_1", "description": "/dev/null",
00757         "source_dir": join(TEST_DIR, "mbed", "dev_null"),
00758         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00759         "exclude_mcu": ["NUCLEO_L011K4"],
00760         "automated": True,
00761         #"host_test" : "dev_null_auto",
00762     },
00763 
00764     # CPPUTEST Library provides Unit testing Framework
00765     #
00766     # To write TESTs and TEST_GROUPs please add CPPUTEST_LIBRARY to 'dependencies'
00767     #
00768     # This will also include:
00769     # 1. test runner - main function with call to CommandLineTestRunner::RunAllTests(ac, av)
00770     # 2. Serial console object to print test result on serial port console
00771     #
00772 
00773     # Unit testing with cpputest library
00774     {
00775         "id": "UT_1", "description": "Basic",
00776         "source_dir": join(TEST_DIR, "utest", "basic"),
00777         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00778         "automated": False,
00779     },
00780     {
00781         "id": "UT_2", "description": "Semihost file system",
00782         "source_dir": join(TEST_DIR, "utest", "semihost_fs"),
00783         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00784         "automated": False,
00785         "mcu": ["LPC1768", "LPC11U24"]
00786     },
00787     {
00788         "id": "UT_3", "description": "General tests",
00789         "source_dir": join(TEST_DIR, "utest", "general"),
00790         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00791         "automated": False,
00792     },
00793     {
00794         "id": "UT_BUSIO", "description": "BusIn BusOut",
00795         "source_dir": join(TEST_DIR, "utest", "bus"),
00796         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00797         "automated": False,
00798     },
00799     {
00800         "id": "UT_I2C_EEPROM_ASYNCH", "description": "I2C Asynch eeprom",
00801         "source_dir": join(TEST_DIR, "utest", "i2c_eeprom_asynch"),
00802         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00803         "automated": False,
00804     },
00805     {
00806         "id": "UT_SERIAL_ASYNCH", "description": "Asynch serial test (req 2 serial peripherals)",
00807         "source_dir": join(TEST_DIR, "utest", "serial_asynch"),
00808         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00809         "automated": False,
00810     },
00811     {
00812         "id": "UT_SPI_ASYNCH", "description": "Asynch spi test",
00813         "source_dir": join(TEST_DIR, "utest", "spi_asynch"),
00814         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00815         "automated": False,
00816     },
00817     {
00818         "id": "UT_LP_TICKER", "description": "Low power ticker test",
00819         "source_dir": join(TEST_DIR, "utest", "lp_ticker"),
00820         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
00821         "automated": False,
00822     },
00823 
00824     # Tests used for target information purposes
00825     {
00826         "id": "DTCT_1", "description": "Simple detect test",
00827         "source_dir": join(TEST_DIR, "mbed", "detect"),
00828         "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
00829         "automated": True,
00830         #"host_test" : "detect_auto",
00831     },
00832 
00833 ]
00834 
00835 # Group tests with the same goals into categories
00836 GROUPS = {
00837     "core": ["MBED_A1", "MBED_A2", "MBED_A3", "MBED_A18"],
00838     "digital_io": ["MBED_A5", "MBED_A6", "MBED_A7", "MBED_A10", "MBED_A11"],
00839     "analog_io": ["MBED_A8"],
00840     "i2c": ["MBED_A19", "MBED_A20"],
00841     "spi": ["MBED_A12"],
00842 }
00843 
00844 GROUPS["automated"] = [test["id"] for test in TESTS if test.get("automated", False)]
00845 # Look for 'TEST_GROUPS' in mbed_settings.py and update the GROUPS dictionary
00846 # with the information in test_groups if found
00847 try:
00848     from mbed_settings import TEST_GROUPS
00849 except:
00850     TEST_GROUPS = {}
00851 GROUPS.update(TEST_GROUPS)
00852 
00853 class Test:
00854     DEFAULTS = {
00855         #'mcu': None,
00856         'description': None,
00857         'dependencies': None,
00858         'duration': 30,
00859         'host_test': 'host_test',
00860         'automated': False,
00861         'peripherals': None,
00862         #'supported': None,
00863         'source_dir': None,
00864         'extra_files': None
00865     }
00866     def __init__(self, n):
00867         self.n = n
00868         self.__dict__.update(Test.DEFAULTS)
00869         self.__dict__.update(TESTS[n])
00870 
00871     def is_supported(self, target, toolchain):
00872         if hasattr(self, 'mcu') and not target in self.mcu:
00873             return False
00874         if hasattr(self, 'exclude_mcu') and target in self.exclude_mcu:
00875             return False
00876         if not hasattr(self, 'supported'):
00877             return True
00878         return (target in self.supported) and (toolchain in self.supported[target])
00879 
00880     def get_description(self):
00881         if self.description:
00882             return self.description
00883         else:
00884             return self.id
00885 
00886     def __cmp__(self, other):
00887         return cmp(self.n, other.n)
00888 
00889     def __str__(self):
00890         return "[%3d] %s: %s" % (self.n, self.id, self.get_description())
00891 
00892     def __getitem__(self, key):
00893         if key == "id": return self.id
00894         elif key == "mcu": return self.mcu
00895         elif key == "exclude_mcu": return self.exclude_mcu
00896         elif key == "dependencies": return self.dependencies
00897         elif key == "description": return self.description
00898         elif key == "duration": return self.duration
00899         elif key == "host_test": return self.host_test
00900         elif key == "automated": return self.automated
00901         elif key == "peripherals": return self.peripherals
00902         elif key == "supported": return self.supported
00903         elif key == "source_dir": return self.source_dir
00904         elif key == "extra_files": return self.extra_files
00905         else:
00906             return None
00907 
00908 TEST_MAP = dict([(test['id'], Test(i)) for i, test in enumerate(TESTS)])
00909 
00910 # parser helpers
00911 def test_known(string):
00912     i = int(string)
00913     if i >= 0 and i < len(TESTS):
00914         return i
00915     else:
00916         raise ArgumentTypeError("{0} does not index a test. The accepted range is 0 to {1}\nThe test mapping is:\n{2}".format(i, len(TEST_MAP) - 1, columnate([str(i) + ":" + t['id'] for i,t in zip(range(len(TESTS)), TESTS)])))
00917 
00918 def test_name_known(string):
00919     if string not in TEST_MAP.keys() and \
00920        (getattr(ps, "test_alias", None) is None or \
00921         ps.test_alias.get(string, "") not in TEST_MAP.keys()):
00922         raise ArgumentTypeError("Program with name '{0}' not found. Supported tests are: \n{1}".format(string, columnate([t['id'] for t in TESTS])))
00923 
00924     return TEST_MAP[string].n