-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/arch: move CurrentArch to pkg/arch
- Loading branch information
1 parent
5687595
commit 1bb3475
Showing
10 changed files
with
95 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package arch | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCurrentArchAMD64(t *testing.T) { | ||
origRuntimeGOARCH := runtimeGOARCH | ||
defer func() { runtimeGOARCH = origRuntimeGOARCH }() | ||
runtimeGOARCH = "amd64" | ||
assert.Equal(t, "x86_64", Current().String()) | ||
assert.True(t, IsX86_64()) | ||
} | ||
|
||
func TestCurrentArchARM64(t *testing.T) { | ||
origRuntimeGOARCH := runtimeGOARCH | ||
defer func() { runtimeGOARCH = origRuntimeGOARCH }() | ||
runtimeGOARCH = "arm64" | ||
assert.Equal(t, "aarch64", Current().String()) | ||
assert.True(t, IsAarch64()) | ||
} | ||
|
||
func TestCurrentArchPPC64LE(t *testing.T) { | ||
origRuntimeGOARCH := runtimeGOARCH | ||
defer func() { runtimeGOARCH = origRuntimeGOARCH }() | ||
runtimeGOARCH = "ppc64le" | ||
assert.Equal(t, "ppc64le", Current().String()) | ||
assert.True(t, IsPPC()) | ||
} | ||
|
||
func TestCurrentArchS390X(t *testing.T) { | ||
origRuntimeGOARCH := runtimeGOARCH | ||
defer func() { runtimeGOARCH = origRuntimeGOARCH }() | ||
runtimeGOARCH = "s390x" | ||
assert.Equal(t, "s390x", Current().String()) | ||
assert.True(t, IsS390x()) | ||
} | ||
|
||
func TestCurrentArchUnsupported(t *testing.T) { | ||
origRuntimeGOARCH := runtimeGOARCH | ||
defer func() { runtimeGOARCH = origRuntimeGOARCH }() | ||
runtimeGOARCH = "UKNOWN" | ||
assert.PanicsWithValue(t, "unsupported architecture", func() { Current() }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters