Skip to content

Commit 0dc3132

Browse files
theotherjimmyadbridge
authored andcommitted
Test for region list sanity (sizes all >= 0)
1 parent 04dd95f commit 0dc3132

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
@@ -173,3 +173,25 @@ def test_init_override_app_config(target):
173173

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

0 commit comments

Comments
 (0)