Skip to content

Rename get_cpu_arch to get_target_cpu_arch - #5464

Draft
JuanMBriones wants to merge 1 commit into
masterfrom
rename_get_cpu_arch
Draft

JuanMBriones wants to merge 1 commit into
masterfrom
rename_get_cpu_arch

Conversation

@JuanMBriones

@JuanMBriones JuanMBriones commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

get_cpu_arch method might be a bit confusing, get_target_cpu_arch is a bit
more descriptive.

  • Ran python butler.py py_unittest -t core -p commands_test.py (passed).
  • Ran python butler.py py_unittest -t core -p settings_test.py (passed).
  • Ran python butler.py py_unittest -t core -p environment_test.py (passed).

Bug: 559993851
Signed-off-by: Manuel Briones manuelbriones@google.com

Comment thread src/clusterfuzz/_internal/system/environment.py
Comment thread src/clusterfuzz/_internal/system/environment.py
@JuanMBriones
JuanMBriones force-pushed the rename_get_cpu_arch branch 2 times, most recently from a9768d0 to c6aea43 Compare September 14, 2026 22:31
Comment thread src/clusterfuzz/_internal/system/environment.py
`get_cpu_arch` method might be a bit confusing, `get_target_cpu_arch` is a bit
more descriptive.

- Ran `python butler.py py_unittest -t core -p commands_test.py` (passed).
- Ran `python butler.py py_unittest -t core -p settings_test.py` (passed).
- Ran `python butler.py py_unittest -t core -p environment_test.py` (passed).

Bug: 559993851
Signed-off-by: Manuel Briones <manuelbriones@google.com>
def get_cpu_arch():
"""Return cpu architecture."""
def get_target_cpu_arch():
"""Return target cpu architecture."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Return target cpu architecture."""
"""Return target cpu architecture, i.e. the cpu architecture where the fuzzer will run.""

Comment thread src/clusterfuzz/_internal/system/environment.py


def get_host_cpu_arch():
"""Helper method. Returns cpu architecture by parsing platform name."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Helper method. Returns cpu architecture by parsing platform name."""
"""Returns cpu architecture of the current host."""

return get_host_cpu_arch()


def get_host_cpu_arch():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this method. Could we replace calls to platform_util.machine().lower() or similar with this method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion:D

Shall we create a new PR for fixing this Tech Debt?

I see several places where we use it, and worse when we are treating the platform on upper case (lol, we should create multiple conventions for CF repo)

Functions calling this function: machine

  File                     Function            Line
0 socks.py                 getpeername          369 machine (note: getproxypeername returns the proxy)
1 __init__.py              version             1140 list(platform.architecture()) + [platform.machine()])
2 test_contracts.py        test_cpu_count       240 @unittest.skipIf(MACOS and platform.machine() == 'arm64',
3 test_memleaks.py         fewtimes_if_linux    369 @unittest.skipIf(MACOS and platform.machine() == 'arm64',
4 test_osx.py              cpu_count            149 @unittest.skipIf(platform.machine() == 'arm64', "skipped due to #1892")
5 test_system.py           assertGreater        516 @unittest.skipIf(MACOS and platform.machine() == 'arm64',
6 markers.py               format_full_version  249 "platform_machine": platform.machine(),
7 markers.py               format_full_version  183 "platform_machine": platform.machine(),
8 test_windows_wrappers.py win_launcher_exe      58 if (platform.machine() == "ARM64":
9 environment.py           get_host_cpu_arch    236 machine = platform_util.machine().lower()
a common.py                get_platform         222 if (platform.machine() == 'arm64' or platform.processor() == 'arm':
b socks.py                 getpeername          369 machine (note: getproxypeername returns the proxy)
c __init__.py              version             1140 list(platform.architecture()) + [platform.machine()])
d test_contracts.py        test_cpu_count       240 @unittest.skipIf(MACOS and platform.machine() == 'arm64',
e test_memleaks.py         fewtimes_if_linux    369 @unittest.skipIf(MACOS and platform.machine() == 'arm64',
f test_osx.py              cpu_count            149 @unittest.skipIf(platform.machine() == 'arm64', "skipped due to #1892")
g test_system.py           assertGreater        516 @unittest.skipIf(MACOS and platform.machine() == 'arm64',
h markers.py               format_full_version  249 "platform_machine": platform.machine(),
i markers.py               format_full_version  183 "platform_machine": platform.machine(),
j test_windows_wrappers.py win_launcher_exe      58 if (platform.machine() == "ARM64":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, what do you think about only fixing the ones we added in the previous CL? I think that would be the one in src/clusterfuzz/_internal/bot/tasks/update_task.py?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants