-
Notifications
You must be signed in to change notification settings - Fork 3k
target_test - assert if sectors keyword missing #12226
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
target_test - assert if sectors keyword missing #12226
Conversation
Assert it properly and thus give out the target name where the issue is, rather than just error out with KeyError and leave the poor sod wondering where exactly the issue is. Before: ``` =================================== FAILURES =================================== _____________________________ test_bl_has_sectors ______________________________ def test_bl_has_sectors(): """Assert a bootloader supporting pack has sector information""" cache = Cache(True, True) named_targets = ( target for target in TARGETS if (hasattr(target, "device_name") and getattr(target, "bootloader_supported", False)) ) for target in named_targets: assert target.device_name in cache.index,\ ("Target %s contains invalid device_name %s" % (target.name, target.device_name)) > assert cache.index[target.device_name]["sectors"],\ ("Device name %s is misssing sector information" % (target.device_name)) E KeyError: 'sectors' ``` After ``` ___________________________________________________ test_bl_has_sectors ___________________________________________________ def test_bl_has_sectors(): """Assert a bootloader supporting pack has sector information""" # ToDo: validity checks for the information IN the sectors! cache = Cache(True, True) named_targets = ( target for target in TARGETS if (hasattr(target, "device_name") and getattr(target, "bootloader_supported", False)) ) for target in named_targets: assert target.device_name in cache.index,\ ("Target %s contains invalid device_name %s" % (target.name, target.device_name)) > assert "sectors" in cache.index[target.device_name],\ ("Target %s does not have sectors" % (target.name)) E AssertionError: Target NUCLEO_L073RZ does not have sectors E assert 'sectors' in {'algorithms': [{'default': True, 'file_name': 'CMSIS/Flash/STM32L0xx_192.FLM', 'ram_size': None, 'ram_start': None, ....on_secure_callable': False, 'peripheral': False, ...}, 'default': True, 'size': 196608, 'start': 134217728, ...}}, ...} ``` This helps you finding the offending target a bit faster. Kudos to Jammu Kekkonen ([email protected]) to figuring out how to actually run this test & the assertion. Ref: Mbed OS issue ARMmbed#12219
@JanneKiiskila, thank you for your changes. |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
There is one ToDo in the code - I would rather keep this as an issue (internal ticket) than left this in the code itself. @ARMmbed/mbed-os-tools Please review |
NOTE the ci last ran several days ago and thus this will need to be run again before it can be merged, to ensure no conflicts etc due to other merges in the interim! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change!
CI restarted |
Test run: FAILEDSummary: 1 of 4 test jobs failed Failed test jobs:
|
Re-running CI as this looks a potential CI failure |
This can't make the IAR builds fail, it's technically impossible. This is a Python based test with no dependency on IAR or vice versa. But, it's Hudson or Jenkins that barfed out.
|
Test run: FAILEDSummary: 1 of 11 test jobs failed Failed test jobs:
|
Broke on dynamic-memory-usage this time, the third PR to do so and it looks like sync issues @VeliMattiLahtela has anything changed in the CI since yesterday? We are getting weird failures today ? |
@adbridge one faulty device recognised on the system, re-executed failing tests. |
Summary of changes
Assert it properly and thus give out the target name where the
issue is, rather than just error out with KeyError and leave the
poor sod wondering where exactly the issue is.
Before:
After
This helps you finding the offending target a bit faster.
Kudos to Jammu Kekkonen ([email protected] aka @JammuKekkonen ) to figuring out how to actually run this test & the assertion.
Ref: Mbed OS issue #12219
Pull request type
Test results
Reviewers
@JammuKekkonen @ARMmbed/mbed-os-maintainers