mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
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
@ -276,12 +276,14 @@ class Mapping(Fragment):
|
||||
|
||||
MAPPING_ALL_OBJECTS = "*"
|
||||
|
||||
def __init__(self):
|
||||
Fragment.__init__(self)
|
||||
self.entries = set()
|
||||
|
||||
def set_key_value(self, key, parse_results):
|
||||
if key == "archive":
|
||||
self.archive = parse_results[0]["archive"]
|
||||
elif key == "entries":
|
||||
self.entries = set()
|
||||
|
||||
for result in parse_results:
|
||||
obj = None
|
||||
symbol = None
|
||||
@ -321,7 +323,7 @@ class Mapping(Fragment):
|
||||
|
||||
grammars = {
|
||||
"archive": KeyGrammar(Fragment.ENTITY.setResultsName("archive"), 1, 1, True),
|
||||
"entries": KeyGrammar(entry, 1, None, True)
|
||||
"entries": KeyGrammar(entry, 0, None, True)
|
||||
}
|
||||
|
||||
return grammars
|
||||
|
@ -617,8 +617,10 @@ entries:
|
||||
* (noflash) # if condition is false, then no 'entries' key value
|
||||
""")
|
||||
|
||||
with self.assertRaises(ParseFatalException):
|
||||
FragmentFile(test_fragment, self.sdkconfig)
|
||||
expected = set()
|
||||
|
||||
fragment_file = FragmentFile(test_fragment, self.sdkconfig)
|
||||
self.assertEqual(expected, fragment_file.fragments[0].entries)
|
||||
|
||||
test_fragment = self.create_fragment_file(u"""
|
||||
[mapping:test]
|
||||
|
@ -1108,6 +1108,20 @@ entries:
|
||||
|
||||
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):
|
||||
generation_with_condition = u"""
|
||||
[sections:cond_text_data]
|
||||
|
Loading…
Reference in New Issue
Block a user