Skip to content

Commit b8cdfc5

Browse files
committed
Adding unit test for macro config
1 parent 5957ffd commit b8cdfc5

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

tools/test/config/config_test.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from os.path import join, isfile, dirname, abspath
2626
from tools.build_api import get_config
2727
from tools.targets import set_targets_json_location, Target, TARGET_NAMES
28-
from tools.config import ConfigException, Config
28+
from tools.config import ConfigException, Config, ConfigParameter, ConfigMacro
2929

3030
def compare_config(cfg, expected):
3131
"""Compare the output of config against a dictionary of known good results
@@ -196,3 +196,32 @@ def test_basic_regions(target, overrides):
196196
assert r.size >= 0
197197
except ConfigException:
198198
pass
199+
200+
def test_parameters_and_config_macros_to_macros():
201+
"""
202+
Test that checks that parameter-generated macros get overriden with
203+
explicitly set macros
204+
"""
205+
206+
params = {
207+
"test_lib.parameter_with_macro": ConfigParameter(
208+
"parameter_with_macro",
209+
{
210+
"macro_name": "CUSTOM_MACRO_NAME",
211+
"value": 1
212+
},
213+
"test_lib",
214+
"library"
215+
)
216+
}
217+
218+
macros = {
219+
"CUSTOM_MACRO_NAME": ConfigMacro(
220+
"CUSTOM_MACRO_NAME=2",
221+
"dummy",
222+
"application"
223+
)
224+
}
225+
226+
macro_list = Config._parameters_and_config_macros_to_macros(params, macros)
227+
assert macro_list == ["CUSTOM_MACRO_NAME=2"]

0 commit comments

Comments
 (0)