From 4c26db0845562cbce8becb09961d6e1496d471b6 Mon Sep 17 00:00:00 2001 From: Yanray Wang Date: Tue, 4 Jul 2023 16:49:04 +0800 Subject: [PATCH 1/2] 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 --- scripts/code_size_compare.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/code_size_compare.py b/scripts/code_size_compare.py index 3bd3e4c327..094ccc48db 100755 --- a/scripts/code_size_compare.py +++ b/scripts/code_size_compare.py @@ -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, From 699a6c8a6db60ff20c101103edaeb9d59a1aa240 Mon Sep 17 00:00:00 2001 From: Yanray Wang Date: Tue, 4 Jul 2023 17:21:28 +0800 Subject: [PATCH 2/2] code_size_compare.py: add comment for sys_arch Signed-off-by: Yanray Wang --- scripts/code_size_compare.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/code_size_compare.py b/scripts/code_size_compare.py index 094ccc48db..0ed28999b3 100755 --- a/scripts/code_size_compare.py +++ b/scripts/code_size_compare.py @@ -91,6 +91,7 @@ class CodeSizeInfo: # pylint: disable=too-few-public-methods """ arch: architecture to measure code size on. config: configuration type to measure code size with. + sys_arch: host architecture. make_command: command to build library (Inferred from arch and config). """ self.arch = arch