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>
diff --git a/scripts/code_size_compare.py b/scripts/code_size_compare.py
index 3bd3e4c..094ccc4 100755
--- a/scripts/code_size_compare.py
+++ b/scripts/code_size_compare.py
@@ -273,6 +273,7 @@
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
@@ -307,6 +308,10 @@
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,
)