From 4d5b8776d4d9461f7b6b44e21c11949d34b5e8b9 Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Thu, 19 Feb 2015 11:16:41 +0000 Subject: [PATCH] Bugfix for IOTSFW-345: Adde missing check for optional auto_detect parameter in CLI options. Test procedure: * Check with mbed-ls installed: $ singletest.py --auto -j 8 MBEDLS: Detecting connected mbed-enabled devices... MBEDLS: Detected K64F, port: COM61, mounted: E: Building library CMSIS (K64F, ARM) Copy: startup_MK64F12.o Copy: sys.o Copy: cmsis_nvic.o Copy: system_MK64F12.o * Uninstall mbed-ls iools: $ pip uninstall mbed-ls Uninstalling mbed-ls: c:\python27\lib\site-packages\mbed_ls-0.1.4-py2.7.egg c:\python27\scripts\mbedls-script.py c:\python27\scripts\mbedls.exe c:\python27\scripts\mbedls.exe.manifest Proceed (y/n)? y Successfully uninstalled mbed-ls $ mbedls 'mbedls' is not recognized as an internal or external command, operable program or batch file. $ python Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] win32 Type "help", "copyright", "credits" or "license" for more information. >>> import mbed_lstools Traceback (most recent call last): File "", line 1, in ImportError: No module named mbed_lstools * Check singletest.py work flow without mbed-ls: $ singletest.py -i test_spec.json -M muts_all.json Building library CMSIS (K64F, ARM) Building library MBED (K64F, ARM) Building project DETECT (K64F, ARM) TargetTest::K64F::ARM::DTCT_1::Simple detect test [OK] in 0.50 of 10 sec Building project DEV_NULL (K64F, ARM) TargetTest::K64F::ARM::EXAMPLE_1::/dev/null [OK] in 3.49 of 20 sec Building project HELLO (K64F, ARM) TargetTest::K64F::ARM::MBED_10::Hello World [OK] in 0.38 of 5 sec Building project TICKER (K64F, ARM) TargetTest::K64F::ARM::MBED_11::Ticker Int [OK] in 11.35 of 15 sec --- workspace_tools/singletest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/workspace_tools/singletest.py b/workspace_tools/singletest.py index 0f44337c89..5538291e9d 100644 --- a/workspace_tools/singletest.py +++ b/workspace_tools/singletest.py @@ -137,14 +137,16 @@ if __name__ == '__main__': test_spec = None MUTs = None - if opts.auto_detect: + if hasattr(opts, 'auto_detect') and opts.auto_detect: + # If auto_detect attribute is present, we assume other auto-detection + # parameters like 'toolchains_filter' are also set. print "MBEDLS: Detecting connected mbed-enabled devices... " if get_module_avail('mbed_lstools'): mbeds = mbed_lstools.create() muts_list = mbeds.list_mbeds() for mut in muts_list: - print "MBEDLS: Detected %s, port: %s, mounted: %s"% (mut['platform_name'], + print "MBEDLS: Detected %s, port: %s, mounted: %s"% (mut['platform_name'], mut['serial_port'], mut['mount_point'])