-
Notifications
You must be signed in to change notification settings - Fork 3k
Add Mbed Configuration Option Range Limits #8673
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a834794
Add range specifers for config values
kegilbert b537387
Add guard against accepted and range definitions.
kegilbert 7a43666
Handle None and hex values in string format
kegilbert 9d9cd84
Refactor logic to improve readability
kegilbert 5ec1d7c
Update tools/config/__init__.py
bridadan 9116b99
Remove redundent line
kegilbert c26c258
Update expected error message
kegilbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "lib1", | ||
"config": { | ||
"config1": { | ||
"help": "The default value should pass as it is in the list of accepted values", | ||
"value": 5, | ||
"accepted_values": [0, 5, 10] | ||
}, | ||
"config2": { | ||
"help": "The default value should pass as it is in the range of accepted values", | ||
"value": 7, | ||
"value_min": 0, | ||
"value_max": 10 | ||
}, | ||
"config3": { | ||
"help": "The default value should pass as it is in the range of accepted values", | ||
"value": "foo", | ||
"accepted_values": ["foo", "bar"] | ||
}, | ||
"config4": { | ||
"help": "The default value should pass as it is in the range of accepted values", | ||
"value": "0x1000", | ||
"value_min": "0x10", | ||
"value_max": "0x8000" | ||
}, | ||
"config5": { | ||
"help": "The default value should pass as it is in the range of accepted values", | ||
"value": "0x2000", | ||
"value_min": 0, | ||
"value_max": "0x8000" | ||
}, | ||
"config6": { | ||
"help": "The default value should pass as it is in the list of accepted values", | ||
"value": "0x8000", | ||
"accepted_values": ["0x1000", "0x8000", "0x12000"] | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"test_target": { | ||
"core": "Cortex-M0", | ||
"extra_labels": [], | ||
"features": [], | ||
"default_lib": "std", | ||
"supported_toolchains": ["GCC_ARM"] | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"test_target": { | ||
"lib1.config1": 5, | ||
"lib1.config2": 7, | ||
"lib1.config3": "foo", | ||
"lib1.config4": "0x1000", | ||
"lib1.config5": "0x2000", | ||
"lib1.config6": "0x8000" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "lib1", | ||
"config": { | ||
"config1": { | ||
"help": "The default value should fail as it is not in the range of accepted values", | ||
"value": 99, | ||
"accepted_values": [0, 5, 10] | ||
}, | ||
"config2": { | ||
"help": "The default value should fail as it is not in the range of accepted values", | ||
"value": 100, | ||
"value_min": 0, | ||
"value_max": 10 | ||
}, | ||
"config3": { | ||
"help": "The default value should fail as it is not in the range of accepted values", | ||
"value": 101, | ||
"value_min": 102 | ||
}, | ||
"config4": { | ||
"help": "The default value should fail as it is not in the range of accepted values", | ||
"value": 102, | ||
"value_max": 101 | ||
}, | ||
"config5": { | ||
"help": "The default value should fail as it specified both a range and list of accepted values", | ||
"value": 103, | ||
"value_max": 104, | ||
"accepted_values": ["103"] | ||
}, | ||
"config6": { | ||
"help": "The default value should fail as it is not in the range of accepted values", | ||
"value": "0x1000", | ||
"value_max": "0x500" | ||
}, | ||
"config7": { | ||
"help": "The default value should fail as it is a non-decimal string with a max value", | ||
"value": "test", | ||
"value_max": "?" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"test_target": { | ||
"core": "Cortex-M0", | ||
"extra_labels": [], | ||
"features": [], | ||
"default_lib": "std", | ||
"supported_toolchains": ["GCC_ARM"] | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"test_target": { | ||
"exception_msg": "\nInvalid value for lib1.config1 = 99 (macro name: \"MBED_CONF_LIB1_CONFIG1\"), is not an accepted value: 0, 5, 10\nInvalid config range for lib1.config2 = 100 (macro name: \"MBED_CONF_LIB1_CONFIG2\"), is not in the required range: [0:10]\nInvalid config range for lib1.config3 = 101 (macro name: \"MBED_CONF_LIB1_CONFIG3\"), is not in the required range: [102:inf]\nInvalid config range for lib1.config4 = 102 (macro name: \"MBED_CONF_LIB1_CONFIG4\"), is not in the required range: [-inf:101]\nlib1.config5 = 103 (macro name: \"MBED_CONF_LIB1_CONFIG5\") has both a range and list of accepted values specified. Please only specify either value_min and/or value_max, or accepted_values\nInvalid config range for lib1.config6 = 0x1000 (macro name: \"MBED_CONF_LIB1_CONFIG6\"), is not in the required range: [-inf:1280]\nInvalid config range settings for lib1.config7 = test (macro name: \"MBED_CONF_LIB1_CONFIG7\"). Range specifiers are not applicable to non-decimal/hexadecimal string values" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
tools/test/config/range_limits_override_invalid/lib1/mbed_lib.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "lib1", | ||
"config": { | ||
"config1": { | ||
"help": "The default value should pass, but will be overridden out of bounds and should error", | ||
"value": 8, | ||
"value_min": 0, | ||
"value_max": 10 | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
tools/test/config/range_limits_override_invalid/mbed_app.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"target_overrides": { | ||
"test_target": { | ||
"lib1.config1": 12 | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
kegilbert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"test_target": { | ||
"core": "Cortex-M0", | ||
"extra_labels": [], | ||
"features": [], | ||
"default_lib": "std", | ||
"supported_toolchains": ["GCC_ARM"] | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
tools/test/config/range_limits_override_invalid/test_data.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"test_target": { | ||
"lib1.config1": 12, | ||
"exception_msg": "Invalid config range for lib1.config1 = 12 (macro name: \"MBED_CONF_LIB1_CONFIG1\"), is not in the required range: [0:10]" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.