sanitycheck: allow for extra binary sections in testcase.ini
Change-Id: I9e47a58f3f32ba093f7916af111a289b620c30d5 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
9d054653cf
commit
52fef67c13
1 changed files with 13 additions and 5 deletions
|
@ -54,6 +54,11 @@ Each testcase.ini block can define the following key/value pairs:
|
||||||
platform_exclude = <list of platforms>
|
platform_exclude = <list of platforms>
|
||||||
Set of platforms that this test case should not run on.
|
Set of platforms that this test case should not run on.
|
||||||
|
|
||||||
|
extra_sections = <list of extra binary sections>
|
||||||
|
When computing sizes, sanitycheck will report errors if it finds
|
||||||
|
extra, unexpected sections in the Zephyr binary unless they are named
|
||||||
|
here. They will not be included in the size calculation.
|
||||||
|
|
||||||
filter = <expression>
|
filter = <expression>
|
||||||
Filter whether the testcase should be run by evaluating an expression
|
Filter whether the testcase should be run by evaluating an expression
|
||||||
against an environment containing the following values:
|
against an environment containing the following values:
|
||||||
|
@ -463,7 +468,7 @@ class SizeCalculator:
|
||||||
ro_sections = ["text", "ctors", "init_array", "reset",
|
ro_sections = ["text", "ctors", "init_array", "reset",
|
||||||
"rodata", "devconfig"]
|
"rodata", "devconfig"]
|
||||||
|
|
||||||
def __init__(self, filename):
|
def __init__(self, filename, extra_sections):
|
||||||
"""Constructor
|
"""Constructor
|
||||||
|
|
||||||
@param filename Path to the output binary
|
@param filename Path to the output binary
|
||||||
|
@ -489,6 +494,7 @@ class SizeCalculator:
|
||||||
self.sections = []
|
self.sections = []
|
||||||
self.rom_size = 0
|
self.rom_size = 0
|
||||||
self.ram_size = 0
|
self.ram_size = 0
|
||||||
|
self.extra_sections = extra_sections
|
||||||
|
|
||||||
self._calculate_sizes()
|
self._calculate_sizes()
|
||||||
|
|
||||||
|
@ -564,6 +570,7 @@ class SizeCalculator:
|
||||||
stype = "ro"
|
stype = "ro"
|
||||||
else:
|
else:
|
||||||
stype = "unknown"
|
stype = "unknown"
|
||||||
|
if name not in self.extra_sections:
|
||||||
recognized = False
|
recognized = False
|
||||||
|
|
||||||
self.sections.append({"name" : name, "load_addr" : load_addr,
|
self.sections.append({"name" : name, "load_addr" : load_addr,
|
||||||
|
@ -889,6 +896,7 @@ testcase_valid_keys = {"tags" : {"type" : "set", "required" : True},
|
||||||
"kernel" : {"type": "str", "required" : False},
|
"kernel" : {"type": "str", "required" : False},
|
||||||
"arch_whitelist" : {"type" : "set"},
|
"arch_whitelist" : {"type" : "set"},
|
||||||
"arch_exclude" : {"type" : "set"},
|
"arch_exclude" : {"type" : "set"},
|
||||||
|
"extra_sections" : {"type" : "list", "default" : []},
|
||||||
"platform_exclude" : {"type" : "set"},
|
"platform_exclude" : {"type" : "set"},
|
||||||
"platform_whitelist" : {"type" : "set"},
|
"platform_whitelist" : {"type" : "set"},
|
||||||
"filter" : {"type" : "str"}}
|
"filter" : {"type" : "str"}}
|
||||||
|
@ -1110,6 +1118,7 @@ class TestCase:
|
||||||
self.timeout = tc_dict["timeout"]
|
self.timeout = tc_dict["timeout"]
|
||||||
self.build_only = tc_dict["build_only"]
|
self.build_only = tc_dict["build_only"]
|
||||||
self.slow = tc_dict["slow"]
|
self.slow = tc_dict["slow"]
|
||||||
|
self.extra_sections = tc_dict["extra_sections"]
|
||||||
self.path = os.path.join(os.path.basename(os.path.abspath(testcase_root)),
|
self.path = os.path.join(os.path.basename(os.path.abspath(testcase_root)),
|
||||||
workdir, name)
|
workdir, name)
|
||||||
self.name = self.path # for now
|
self.name = self.path # for now
|
||||||
|
@ -1149,8 +1158,7 @@ class TestInstance:
|
||||||
fns = [x for x in fns if not x.endswith('_prebuilt.elf')]
|
fns = [x for x in fns if not x.endswith('_prebuilt.elf')]
|
||||||
if (len(fns) != 1):
|
if (len(fns) != 1):
|
||||||
raise BuildError("Missing/multiple output ELF binary")
|
raise BuildError("Missing/multiple output ELF binary")
|
||||||
|
return SizeCalculator(fns[0], self.test.extra_sections)
|
||||||
return SizeCalculator(fns[0])
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<TestCase %s on %s>" % (self.test.name, self.platform.name)
|
return "<TestCase %s on %s>" % (self.test.name, self.platform.name)
|
||||||
|
@ -1778,7 +1786,7 @@ def main():
|
||||||
|
|
||||||
if args.size:
|
if args.size:
|
||||||
for fn in args.size:
|
for fn in args.size:
|
||||||
size_report(SizeCalculator(fn))
|
size_report(SizeCalculator(fn, []))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
VERBOSE += args.verbose
|
VERBOSE += args.verbose
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue