Commit Graph

10 Commits (c489c213a7ce0245f31ffd325883047853a46ae2)

Author SHA1 Message Date
Anna Bridge 8b25c51746
Merge pull request #12226 from JanneKiiskila/target_test_sector_missing
target_test - assert if sectors keyword missing
2020-01-24 11:23:51 +00:00
Rajkumar Kanagaraj 8a0fdd24d9 Rename "default_lib" to "c_lib". 2020-01-17 08:05:48 -08:00
Janne Kiiskila e20f2d30a2 target_test - assert if sectors keyword missing
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 (jammu.kekkonen@arm.com) to figuring out how to actually
run this test & the assertion.

Ref: Mbed OS issue #12219
2020-01-09 16:50:45 +02:00
Rajkumar Kanagaraj 6d081eeb70 Fixed the build tools test case failure,incorporated review comments 2019-12-23 03:54:18 -08:00
Jimmy Brisson 7a3ccf9518 Test for sector information 2019-03-07 09:05:59 -06:00
Jimmy Brisson 4a937fe15e Linting and correcting comments 2017-09-05 13:30:16 -05:00
Jimmy Brisson 817eb5ab05 Unify configuration testing and the travis command 2017-08-28 15:10:50 -05:00
Andrew Leech 4491d2e3f7 Prevent modifying existing targets.
A warning will be printed if it is attempted.
2017-06-21 22:17:58 +10:00
Andrew Leech 6bd55a16fe Add basic unit tests for custom_targets.json handling 2017-06-21 22:17:57 +10:00
Russ Butler 32b9ada3ec Enforce device_name is valid in targets.json
Add a CI test ensure that device_name exists inside the pack index.
2017-02-08 14:54:26 -06:00