Skip to content

Commit c52d1ed

Browse files
committed
Test for region list sanity (sizes all >= 0)
1 parent 964e6e7 commit c52d1ed

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tools/test/config/config_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,25 @@ def test_init_override_app_config(target):
174174

175175
mock_json_file_to_dict.assert_any_call(app_config)
176176
assert config.app_config_data == mock_return
177+
178+
@pytest.mark.parametrize("target", ["K64F", "UBLOX_EVK_ODIN_W2"])
179+
@pytest.mark.parametrize("overrides", [
180+
{},
181+
{"restrict_size": "0x200"},
182+
{"mbed_app_start": "0x200"}
183+
])
184+
def test_basic_regions(target, overrides):
185+
"""
186+
Test that the region lists are sane with various configurations
187+
"""
188+
set_targets_json_location()
189+
config = Config(target)
190+
for o, v in overrides.items():
191+
setattr(config.target, o, v)
192+
try:
193+
if config.has_regions:
194+
regions = list(config.regions)
195+
for r in regions:
196+
assert r.size >= 0
197+
except ConfigException:
198+
pass

0 commit comments

Comments
 (0)