Skip to content

Commit

Permalink
Add amd64 as a condition for system/os.py to support freebsd x64 arch…
Browse files Browse the repository at this point in the history
…itecture (#3240)

* Add amd64 as a condition for system/os.py to support freebsd x64 architecture

Signed-off-by: Peter Zhu <[email protected]>

* Tweak test name from x86_64 to amd64

Signed-off-by: Peter Zhu <[email protected]>

---------

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Feb 28, 2023
1 parent c0449fe commit 76cc42d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/system/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def current_architecture() -> str:
architecture = subprocess.check_output(["uname", "-m"]).decode().strip()
if architecture == "x86_64":
if architecture == "x86_64" or architecture == "amd64":
return "x64"
elif architecture == "aarch64" or architecture == "arm64":
return "arm64"
Expand Down
4 changes: 4 additions & 0 deletions tests/tests_system/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def test_current_architecture(self) -> None:
def test_x86_64_return_x64_architecture(self, mock_subprocess: MagicMock) -> None:
self.assertTrue(current_architecture() == "x64")

@patch("subprocess.check_output", return_value="amd64".encode())
def test_amd64_return_x64_architecture(self, mock_subprocess: MagicMock) -> None:
self.assertTrue(current_architecture() == "x64")

@patch("subprocess.check_output", return_value="aarch64".encode())
def test_aarch64_return_arm64_architecture(self, mock_subprocess: MagicMock) -> None:
self.assertTrue(current_architecture() == "arm64")
Expand Down

0 comments on commit 76cc42d

Please sign in to comment.