sanitycheck: fail on footprint analysis of stripped ELFs

These don't have necessary symbol information to determine if the
kernel is XIP or not. Fail instead of giving bogus data.

Change-Id: I87f6eeb5983f5275929e5b8d448a054b83e23d8f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-03-02 20:40:29 -08:00 committed by Gerrit Code Review
commit 8f0211dcf3

View file

@ -343,7 +343,10 @@ class SizeCalculator:
# Search for CONFIG_XIP in the ELF's list of symbols using NM and AWK.
# GREP can not be used as it returns an error if the symbol is not found.
is_xip_command = "nm " + filename + " | awk '/CONFIG_XIP/ { print $3 }'"
is_xip_output = subprocess.check_output(is_xip_command, shell=True).decode("utf-8")
is_xip_output = subprocess.check_output(is_xip_command, shell=True,
stderr=subprocess.STDOUT).decode("utf-8").strip()
if is_xip_output.endswith("no symbols"):
raise SanityRuntimeError("%s has no symbol information" % filename)
self.is_xip = (len(is_xip_output) != 0)
self.filename = filename