Skip to content

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

Merged
merged 1 commit into from
Jan 24, 2020

Conversation

JanneKiiskila
Copy link
Contributor

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:


=================================== 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] aka @JammuKekkonen ) to figuring out how to actually run this test & the assertion.

Ref: Mbed OS issue #12219

Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[x] Tests / results supplied as part of this PR

Reviewers

@JammuKekkonen @ARMmbed/mbed-os-maintainers


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
@ciarmcom ciarmcom requested review from JammuKekkonen and a team January 9, 2020 16:00
@ciarmcom
Copy link
Member

ciarmcom commented Jan 9, 2020

@JanneKiiskila, thank you for your changes.
@JammuKekkonen @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 13, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 13, 2020

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 14, 2020

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

@adbridge
Copy link
Contributor

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!

Copy link
Contributor

@mark-edgeworth mark-edgeworth left a comment

Choose a reason for hiding this comment

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

Good change!

@adbridge
Copy link
Contributor

CI restarted

@mbed-ci
Copy link

mbed-ci commented Jan 22, 2020

Test run: FAILED

Summary: 1 of 4 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-IAR

@mergify mergify bot added needs: work and removed needs: CI labels Jan 22, 2020
@adbridge
Copy link
Contributor

Re-running CI as this looks a potential CI failure

@adbridge adbridge added needs: CI release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 and removed needs: work labels Jan 23, 2020
@JanneKiiskila
Copy link
Contributor Author

JanneKiiskila commented Jan 23, 2020

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.

Error
failed
Standard Output
hudson.AbortException: script returned exit code 1
Standard Error
Error: hudson.AbortException: script returned exit code 1
StackTrace:
org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.handleExit(DurableTaskStep.java:569)
org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.check(DurableTaskStep.java:515)
org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep.run(DurableTaskStep.java:461)
java.util.concurrent.Executors.call(Executors.java:511)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ScheduledThreadPoolExecutor.access(ScheduledThreadPoolExecutor.java:180)
java.util.concurrent.ScheduledThreadPoolExecutor.run(ScheduledThreadPoolExecutor.java:293)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

@mbed-ci
Copy link

mbed-ci commented Jan 23, 2020

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 3
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_dynamic-memory-usage

@mergify mergify bot removed the needs: CI label Jan 23, 2020
@adbridge
Copy link
Contributor

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 ?

@VeliMattiLahtela
Copy link

@adbridge one faulty device recognised on the system, re-executed failing tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants