code_size_compare.py: run make clean before build libraries

If we don't remove all executable files in current working
directory, we might measure code size between different architecture
and configuration. This generates a wrong code size comparison
report. This commit guarantees it runs `make clean` before build
libraries for code size comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
Yanray Wang 2023-07-04 16:49:04 +08:00
parent 443589ac53
commit 4c26db0845

View File

@ -273,6 +273,7 @@ class CodeSizeComparison(CodeSizeBase):
self.old_rev = old_revision
self.new_rev = new_revision
self.git_command = "git"
self.make_clean = 'make clean'
self.make_command = code_size_info.make_command
self.fname_suffix = "-" + code_size_info.arch + "-" +\
code_size_info.config
@ -306,6 +307,10 @@ class CodeSizeComparison(CodeSizeBase):
my_environment = os.environ.copy()
try:
subprocess.check_output(
self.make_clean, env=my_environment, shell=True,
cwd=git_worktree_path, stderr=subprocess.STDOUT,
)
subprocess.check_output(
self.make_command, env=my_environment, shell=True,
cwd=git_worktree_path, stderr=subprocess.STDOUT,