Merge branch 'bugfix/ldgen_fails_when_wifi_ram_opt_off' into 'master'
ldgen: do not generate rules when no condition is true See merge request idf/esp-idf!4757
This commit is contained in:
commit
3694ed30eb
3 changed files with 23 additions and 5 deletions
|
@ -276,12 +276,14 @@ class Mapping(Fragment):
|
||||||
|
|
||||||
MAPPING_ALL_OBJECTS = "*"
|
MAPPING_ALL_OBJECTS = "*"
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Fragment.__init__(self)
|
||||||
|
self.entries = set()
|
||||||
|
|
||||||
def set_key_value(self, key, parse_results):
|
def set_key_value(self, key, parse_results):
|
||||||
if key == "archive":
|
if key == "archive":
|
||||||
self.archive = parse_results[0]["archive"]
|
self.archive = parse_results[0]["archive"]
|
||||||
elif key == "entries":
|
elif key == "entries":
|
||||||
self.entries = set()
|
|
||||||
|
|
||||||
for result in parse_results:
|
for result in parse_results:
|
||||||
obj = None
|
obj = None
|
||||||
symbol = None
|
symbol = None
|
||||||
|
@ -321,7 +323,7 @@ class Mapping(Fragment):
|
||||||
|
|
||||||
grammars = {
|
grammars = {
|
||||||
"archive": KeyGrammar(Fragment.ENTITY.setResultsName("archive"), 1, 1, True),
|
"archive": KeyGrammar(Fragment.ENTITY.setResultsName("archive"), 1, 1, True),
|
||||||
"entries": KeyGrammar(entry, 1, None, True)
|
"entries": KeyGrammar(entry, 0, None, True)
|
||||||
}
|
}
|
||||||
|
|
||||||
return grammars
|
return grammars
|
||||||
|
|
|
@ -617,8 +617,10 @@ entries:
|
||||||
* (noflash) # if condition is false, then no 'entries' key value
|
* (noflash) # if condition is false, then no 'entries' key value
|
||||||
""")
|
""")
|
||||||
|
|
||||||
with self.assertRaises(ParseFatalException):
|
expected = set()
|
||||||
FragmentFile(test_fragment, self.sdkconfig)
|
|
||||||
|
fragment_file = FragmentFile(test_fragment, self.sdkconfig)
|
||||||
|
self.assertEqual(expected, fragment_file.fragments[0].entries)
|
||||||
|
|
||||||
test_fragment = self.create_fragment_file(u"""
|
test_fragment = self.create_fragment_file(u"""
|
||||||
[mapping:test]
|
[mapping:test]
|
||||||
|
|
|
@ -1108,6 +1108,20 @@ entries:
|
||||||
|
|
||||||
self.compare_rules(expected, actual)
|
self.compare_rules(expected, actual)
|
||||||
|
|
||||||
|
def test_rule_generation_empty_entries(self):
|
||||||
|
normal = u"""
|
||||||
|
[mapping:test]
|
||||||
|
archive: lib.a
|
||||||
|
entries:
|
||||||
|
if PERFORMANCE_LEVEL >= 1: # is false, generate no special rules
|
||||||
|
obj.a (noflash)
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.add_fragments(normal)
|
||||||
|
actual = self.model.generate_rules(self.sections_info)
|
||||||
|
expected = self.generate_default_rules() # only default rules
|
||||||
|
self.compare_rules(expected, actual)
|
||||||
|
|
||||||
def test_conditional_sections_1(self):
|
def test_conditional_sections_1(self):
|
||||||
generation_with_condition = u"""
|
generation_with_condition = u"""
|
||||||
[sections:cond_text_data]
|
[sections:cond_text_data]
|
||||||
|
|
Loading…
Reference in a new issue