Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tools] Prevent trace-backs from incomplete args #2393

Merged
merged 2 commits into from
Sep 5, 2016

Conversation

theotherjimmy
Copy link
Contributor

Also makes all argument errors (from our code and argpase) look the same

@bridadan
Copy link
Contributor

bridadan commented Aug 8, 2016

@theotherjimmy yes, this definitely need some TLC!

Any chance we could get a before and after log? (For the unified errors at least)

@theotherjimmy
Copy link
Contributor Author

example python tools/make.py -m K64F -t GCC_ARM --source .
before

[ERROR] coercing to Unicode: need string or buffer, list found

after

usage: make.py [-h] [-m MCU] [-t TOOLCHAIN] [--color] [-c] [-o OPTIONS]
               [-p PROGRAM] [-n PROGRAM] [-j JOBS] [-v] [--silent] [-D MACROS]
               [-S] [-f GENERAL_FILTER_REGEX] [--automated] [--host HOST_TEST]
               [--extra EXTRA] [--peripherals PERIPHERALS]
               [--dep DEPENDENCIES] [--source SOURCE_DIR]
               [--duration DURATION] [--build BUILD_DIR] [-N ARTIFACT_NAME]
               [-d DISK] [-s SERIAL] [-b BAUD] [-L] [--rtos] [--rpc] [--eth]
               [--usb_host] [--usb] [--dsp] [--fat] [--ublox] [--testlib]
               [-l LINKER_SCRIPT]
make.py: error: argument --build is required when argument --source is provided

@theotherjimmy
Copy link
Contributor Author

example python tools/get_config.py --source .
before



[ERROR] You should specify an MCU


usage: get_config.py [-h] [-m MCU] [-t TOOLCHAIN] [--color]
                     [--source SOURCE_DIR] [--prefix PREFIX] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -m MCU, --mcu MCU     build for the given MCU (ARCH_BLE, ARCH_BLE_BOOT,
                        ARCH_BLE_OTA, ARCH_GPRS, ARCH_LINK, ARCH_LINK_BOOT,
                        ARCH_LINK_OTA, ARCH_MAX, ARCH_PRO, ARM_BEETLE_SOC,
                        ARM_IOTSS_BEID, ARM_MPS2_M0, ARM_MPS2_M0P,
                        ARM_MPS2_M1, ARM_MPS2_M3, ARM_MPS2_M4, ARM_MPS2_M7,
                        B96B_F446VE, BLUEPILL_F103C8, DELTA_DFCM_NNN40,
                        DELTA_DFCM_NNN40_BOOT, DELTA_DFCM_NNN40_OTA,
                        DISCO_F051R8, DISCO_F100RB, DISCO_F303VC,
                        DISCO_F334C8, DISCO_F401VC, DISCO_F407VG,
                        DISCO_F429ZI, DISCO_F469NI, DISCO_F746NG,
                        DISCO_L053C8, DISCO_L476VG, EFM32GG_STK3700,
                        EFM32HG_STK3400, EFM32LG_STK3600, EFM32PG_STK3401,
                        EFM32WG_STK3800, EFM32ZG_STK3200, ELEKTOR_COCORICO,
                        ELMO_F411RE, HEXIWEAR, HRM1017, HRM1017_BOOT,
                        HRM1017_OTA, K20D50M, K22F, K64F, KL05Z, KL25Z, KL26Z,
                        KL27Z, KL43Z, KL46Z, LPC1114, LPC11C24, LPC11U24,
                        LPC11U24_301, LPC11U34_421, LPC11U35_401,
                        LPC11U35_501, LPC11U35_501_IBDAP, LPC11U35_Y5_MBUG,
                        LPC11U37H_401, LPC11U37_501, LPC11U68, LPC1347,
                        LPC1549, LPC1768, LPC2368, LPC2460, LPC4088,
                        LPC4088_DM, LPC4330_M0, LPC4330_M4, LPC4337, LPC810,
                        LPC812, LPC824, LPCCAPPUCCINO, MAX32600MBED,
                        MAXWSNENV, MICRONFCBOARD, MOTE_L152RC,
                        MTS_DRAGONFLY_F411RE, MTS_GAMBIT, MTS_MDOT_F405RG,
                        MTS_MDOT_F411RE, NRF51822, NRF51822_BOOT,
                        NRF51822_OTA, NRF51822_Y5_MBUG, NRF51_DK,
                        NRF51_DK_BOOT, NRF51_DK_LEGACY, NRF51_DK_OTA,
                        NRF51_DONGLE, NRF51_DONGLE_BOOT, NRF51_DONGLE_OTA,
                        NRF51_MICROBIT, NRF51_MICROBIT_B, NRF51_MICROBIT_BOOT,
                        NRF51_MICROBIT_B_BOOT, NRF51_MICROBIT_B_OTA,
                        NRF51_MICROBIT_OTA, NRF52_DK, NUCLEO_F030R8,
                        NUCLEO_F031K6, NUCLEO_F042K6, NUCLEO_F070RB,
                        NUCLEO_F072RB, NUCLEO_F091RC, NUCLEO_F103RB,
                        NUCLEO_F207ZG, NUCLEO_F302R8, NUCLEO_F303K8,
                        NUCLEO_F303RE, NUCLEO_F334R8, NUCLEO_F401RE,
                        NUCLEO_F410RB, NUCLEO_F411RE, NUCLEO_F429ZI,
                        NUCLEO_F446RE, NUCLEO_F446ZE, NUCLEO_F746ZG,
                        NUCLEO_F767ZI, NUCLEO_L011K4, NUCLEO_L031K6,
                        NUCLEO_L053R8, NUCLEO_L073RZ, NUCLEO_L152RE,
                        NUCLEO_L432KC, NUCLEO_L476RG, NUMAKER_PFM_NUC472,
                        NZ32_SC151, OC_MBUINO, RBLAB_BLENANO,
                        RBLAB_BLENANO_BOOT, RBLAB_BLENANO_OTA, RBLAB_NRF51822,
                        RBLAB_NRF51822_BOOT, RBLAB_NRF51822_OTA, RZ_A1H,
                        SAMD21G18A, SAMD21J18A, SAMG55J19, SAML21J18A,
                        SAMR21G18A, SEEED_TINY_BLE, SEEED_TINY_BLE_BOOT,
                        SEEED_TINY_BLE_OTA, SSCI824, STM32F3XX, STM32F407,
                        TEENSY3_1, TY51822R3, TY51822R3_BOOT, TY51822R3_OTA,
                        UBLOX_C027, UBLOX_C029, VK_RZ_A1H, WALLBOT_BLE,
                        WALLBOT_BLE_BOOT, WALLBOT_BLE_OTA, WIZWIKI_W7500,
                        WIZWIKI_W7500ECO, WIZWIKI_W7500P, XADOW_M0,
                        XBED_LPC1768)
  -t TOOLCHAIN, --tool TOOLCHAIN
                        build using the given TOOLCHAIN (ARM, GCC_ARM, GCC_CR,
                        IAR, uARM)
  --color               print Warnings, and Errors in color
  --source SOURCE_DIR   The source (input) directory
  --prefix PREFIX       Restrict listing to parameters that have this prefix
  -v, --verbose         Verbose diagnostic output

after

usage: get_config.py [-h] [-m MCU] [-t TOOLCHAIN] [--color] --source
                     SOURCE_DIR [--prefix PREFIX] [-v]
get_config.py: error: argument -m/--mcu is required

@@ -48,12 +48,12 @@

# Target
if options.mcu is None :
args_error(parser, "[ERROR] You should specify an MCU")
args_error(parser, "argument -m/--mcu is required")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove [ERROR] ? wasn't that an intention warning/error/etc ? Does this PR clean all [ERROR] messages ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args_error already prints an error message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args_error already prints an error message.

Yes, that's obvious from the outputs you shared but it changes from [ERROR] to command: error:. I am not aware though how was that used (if there any tool that was parsing this or was just an unification of messages we print to have a format. That was my concern, looks fine to me as it is now ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that makes sense. Thanks for the clarification. I only changed things that were "argument errors".

@bridadan
Copy link
Contributor

bridadan commented Aug 9, 2016

@theotherjimmy Thanks! I like the change :)

@bridadan
Copy link
Contributor

bridadan commented Aug 9, 2016

/morph test

@mbed-bot
Copy link

mbed-bot commented Aug 9, 2016

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 619

Test failed!

@theotherjimmy
Copy link
Contributor Author

/morph test

@mbed-bot
Copy link

mbed-bot commented Aug 9, 2016

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 620

Test failed!

@bridadan
Copy link
Contributor

bridadan commented Aug 9, 2016

The only failing test was the UDP nist test, which may have actually failed due to the UDP packets being lost. Any chance you can run that test locally just to double check? I'm about 98.9% sure that this tooling change didn't cause this test failure, so LGTM.

Side note, the nist test should probably retry multiple times if it doesn't hear back within a time frame, maybe I'll go look at that...

@theotherjimmy
Copy link
Contributor Author

Thanks for explaining the failure @bridadan ! LGTM?

@theotherjimmy
Copy link
Contributor Author

Resolves #1997

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 12, 2016

LGTM

cc @bogdanm @screamerbg

args_error(parser, "one of -p, -n, or --source is required")

if options.source_dir and not options.build_dir:
args_error(parser, "argument --build is required when argument --source is provided")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this corrrect? Do we really require the user to specify a build dir if he specifies one or more source dirs? Feels a bit weird.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, We do. I agree, it does feel a bit weird. If you don't specify a build directory, you get a traceback about None not having startswith, I think.

@sg-
Copy link
Contributor

sg- commented Aug 26, 2016

Any more feedback or is this ready for CI and merge?

@theotherjimmy
Copy link
Contributor Author

I guess it's ready for CI and merge.

@sg- sg- removed the needs: review label Aug 26, 2016
@theotherjimmy
Copy link
Contributor Author

So, I still think that this is good to go. Let's get this merged?

@bogdanm
Copy link
Contributor

bogdanm commented Sep 5, 2016

LGTM

@bogdanm bogdanm merged commit 5dcd546 into ARMmbed:master Sep 5, 2016
@bogdanm bogdanm deleted the argument-dependencies branch September 5, 2016 09:50
@sg- sg- removed the needs: CI label Sep 6, 2016
theotherjimmy added a commit that referenced this pull request Sep 19, 2016
Release mbed-os-5.1.4

Changes:

New Targets:
2504: [Disco_F769NI] adding new target [#2504]
2654: DELTA_DFBM_NQ620 platform porting [#2654]
2615: [MTM_MTCONNECT04S] Added support for MTM_MTCONNECT04S [#2615]
2548: Nucleof303ze [#2548]

Fixes:

2678: Fixing NCS36510 compile on Linux #2678
2657: [MAX326xx] Removed echoing of characters and carriage return. #2657
2651: Use lp_timer to count time in the deepsleep tests #2651
2645: NUCLEO_F446ZE - Enable mbed5 release version #2645
2643: Fix thread self termination #2643
2634: Updated USBHost for library changes #2634
2633: Updated USBDevice to use Callback #2633
2630: Test names not dependent on disk location of root #2630
2624: CFSTORE Bugfix for realloc() moving KV area and cfstore_file_t data structures not being updated correctly #2624
2623: DISCO_L476VG - Add Serial Flow Control pins + add SERIAL_FC macro #2623
2617: STM32F2xx - Enable Serial Flow Control #2617
2613: Correctly providing directories to build_apis #2613
2607: Fix uvisor memory tracing #2607
2604: Tools - Fix fill section size variation #2604
2601: Adding ON Semiconductor copyright notice to source and header files. #2601
2597: [HAL] Fixed "intrinsic is deprecated" warnings #2597
2596: [HAL] Improve memory tracer #2596
2594: Fix TCPServer constructor #2594
2593: Add app config command line switch for test and make #2593
2589: [NUC472] Fix heap configuration error with armcc #2589
2588: Timing tests drift refactor #2588
2587: add PTEx pins as option for SPI on Hexiwear - for SD Card Interface #2587
2584: Set size of callback irq array to IrqCnt #2584
2583: github issue and PR templates #2583
2582: [GCC_CR] fix runtime hang for baremetal build #2582
2580: lwip - Add check for previously-bound socket #2580
2579: lwip - Fix handling of max sockets in socket_accept #2579
2578: Fix double free in NanostackInterface #2578
2576: Add smoke test that builds example programs with mbed-cli #2576
2575: tools-config! -  Allow an empty or mal-formed config to be passed to the config system #2575
2562: Fix GCC lazy init race condition and add test #2562
2559: [utest]: Allow the linker to remove any part of utest if not used #2559
2545: Added define guards for SEQUENTIAL_FLASH_JOURNAL_MAX_LOGGED_BLOBS so  #2545
2538: STM32F4xx - Add support of ADC internal channels (Temp, VRef, VBat) #2538
2521: [NUCLEO_F207ZG] Add MBED5 capability #2521
2514: Updated FlexCan and SAI SDK drivers #2514
2487: Runtime dynamic memory tracing #2487
2442: Malloc heap info #2442
2419: [STM32F1] Add asynchronous serial #2419
2393: [tools] Prevent trace-backs from incomplete args #2393
2245: Refactor export subsystem #2245
2130: stm32 : reduce number of device.h files #2130
artokin pushed a commit to artokin/mbed-os that referenced this pull request Aug 17, 2020
…..48609ae

48609ae Merge branch 'release_internal' into release_external
62d8586 Ignore ns_monitor when receiving Ack (ARMmbed#2417)
3323f36 Add support for Ethernet RA dns configuration
d8e7d40 Iotthd 4239 (ARMmbed#2414)
b46f3c6 add empty function for ws_stack_info_get
fc97980 Changed RADIUS shared secret length to 16-bit value
f827ffc Added information API to Wi-SUN and border router
8f1f9d5 EDFE error handling update
51bf94e Fix adaptation interface unit tests (ARMmbed#2409)
0860b57 FHSS_WS: Fixed reading unicast remaining slots (ARMmbed#2408)
4d8c03b Border Router RADIUS client basic authentication functionality (ARMmbed#2406)
fbfada9 Adaptation IF: Allocate fragmentation buffer only if needed (ARMmbed#2407)
66f1bff Added storing of PAN version to NVM on BR
89826ce Iotthd 4224 (ARMmbed#2403)
3fc1ae2 BR EUI-64 is now selected for 4WH using PMKID on 4WH Message 1
af8438e Timing tool traces (ARMmbed#2401)
7938795 Fixed new PD data request for check if EDFE exchange is active.
85ab8fd Extented Frame exchange support
86b1f27 Merge pull request ARMmbed#2399 from ARMmbed/IOTTHD-4220
fed69e0 Add missing test method to ws_empty_functions
6b58e26 Add EDFE mode to Socket API setsockopt
1283077 Test API to adjust 6LoWPAN fragmentation MTU size (ARMmbed#2398)
e787874 Init MAC MTU size based on driver MTU size (ARMmbed#2397)
bf8e89e Ignore neighbors using unsupported channel function (ARMmbed#2395)
1c263fd FHSS exclude channel usage from mask and Brazilian Domain support
841dcbe MAC: Configurable data whitening (ARMmbed#2393)
9a10d66 Fix global address detection (ARMmbed#2392)
f27fe86 Corrected network name and PAN ID change on auth start
bcce0ed Clarified border router routing table API description
e4630a4 Wi-SUN interface now informs address changes as interface events
2174374 Fix error found by coverity (ARMmbed#2389)
843254a MPL: traces for transmit and receive message (ARMmbed#2387)

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: 48609ae
artokin pushed a commit to artokin/mbed-os that referenced this pull request Aug 18, 2020
…..48609ae

48609ae Merge branch 'release_internal' into release_external
62d8586 Ignore ns_monitor when receiving Ack (ARMmbed#2417)
3323f36 Add support for Ethernet RA dns configuration
d8e7d40 Iotthd 4239 (ARMmbed#2414)
b46f3c6 add empty function for ws_stack_info_get
fc97980 Changed RADIUS shared secret length to 16-bit value
f827ffc Added information API to Wi-SUN and border router
8f1f9d5 EDFE error handling update
51bf94e Fix adaptation interface unit tests (ARMmbed#2409)
0860b57 FHSS_WS: Fixed reading unicast remaining slots (ARMmbed#2408)
4d8c03b Border Router RADIUS client basic authentication functionality (ARMmbed#2406)
fbfada9 Adaptation IF: Allocate fragmentation buffer only if needed (ARMmbed#2407)
66f1bff Added storing of PAN version to NVM on BR
89826ce Iotthd 4224 (ARMmbed#2403)
3fc1ae2 BR EUI-64 is now selected for 4WH using PMKID on 4WH Message 1
af8438e Timing tool traces (ARMmbed#2401)
7938795 Fixed new PD data request for check if EDFE exchange is active.
85ab8fd Extented Frame exchange support
86b1f27 Merge pull request ARMmbed#2399 from ARMmbed/IOTTHD-4220
fed69e0 Add missing test method to ws_empty_functions
6b58e26 Add EDFE mode to Socket API setsockopt
1283077 Test API to adjust 6LoWPAN fragmentation MTU size (ARMmbed#2398)
e787874 Init MAC MTU size based on driver MTU size (ARMmbed#2397)
bf8e89e Ignore neighbors using unsupported channel function (ARMmbed#2395)
1c263fd FHSS exclude channel usage from mask and Brazilian Domain support
841dcbe MAC: Configurable data whitening (ARMmbed#2393)
9a10d66 Fix global address detection (ARMmbed#2392)
f27fe86 Corrected network name and PAN ID change on auth start
bcce0ed Clarified border router routing table API description
e4630a4 Wi-SUN interface now informs address changes as interface events
2174374 Fix error found by coverity (ARMmbed#2389)
843254a MPL: traces for transmit and receive message (ARMmbed#2387)

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: 48609ae
artokin pushed a commit to artokin/mbed-os that referenced this pull request Aug 21, 2020
…3fe574..48609ae

48609ae Merge branch 'release_internal' into release_external
62d8586 Ignore ns_monitor when receiving Ack (ARMmbed#2417)
3323f36 Add support for Ethernet RA dns configuration
d8e7d40 Iotthd 4239 (ARMmbed#2414)
b46f3c6 add empty function for ws_stack_info_get
fc97980 Changed RADIUS shared secret length to 16-bit value
f827ffc Added information API to Wi-SUN and border router
8f1f9d5 EDFE error handling update
51bf94e Fix adaptation interface unit tests (ARMmbed#2409)
0860b57 FHSS_WS: Fixed reading unicast remaining slots (ARMmbed#2408)
4d8c03b Border Router RADIUS client basic authentication functionality (ARMmbed#2406)
fbfada9 Adaptation IF: Allocate fragmentation buffer only if needed (ARMmbed#2407)
66f1bff Added storing of PAN version to NVM on BR
89826ce Iotthd 4224 (ARMmbed#2403)
3fc1ae2 BR EUI-64 is now selected for 4WH using PMKID on 4WH Message 1
af8438e Timing tool traces (ARMmbed#2401)
7938795 Fixed new PD data request for check if EDFE exchange is active.
85ab8fd Extented Frame exchange support
86b1f27 Merge pull request ARMmbed#2399 from ARMmbed/IOTTHD-4220
fed69e0 Add missing test method to ws_empty_functions
6b58e26 Add EDFE mode to Socket API setsockopt
1283077 Test API to adjust 6LoWPAN fragmentation MTU size (ARMmbed#2398)
e787874 Init MAC MTU size based on driver MTU size (ARMmbed#2397)
bf8e89e Ignore neighbors using unsupported channel function (ARMmbed#2395)
1c263fd FHSS exclude channel usage from mask and Brazilian Domain support
841dcbe MAC: Configurable data whitening (ARMmbed#2393)
9a10d66 Fix global address detection (ARMmbed#2392)
f27fe86 Corrected network name and PAN ID change on auth start
bcce0ed Clarified border router routing table API description
e4630a4 Wi-SUN interface now informs address changes as interface events
2174374 Fix error found by coverity (ARMmbed#2389)
843254a MPL: traces for transmit and receive message (ARMmbed#2387)

git-subtree-dir: connectivity/nanostack/sal-stack-nanostack
git-subtree-split: 48609ae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants