github.com/mhilton/juju-juju@v0.0.0-20150901100907-a94dd2c73455/juju/arch/arch_test.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package arch_test 5 6 import ( 7 jc "github.com/juju/testing/checkers" 8 gc "gopkg.in/check.v1" 9 10 "github.com/juju/juju/juju/arch" 11 "github.com/juju/juju/testing" 12 ) 13 14 type archSuite struct { 15 testing.BaseSuite 16 } 17 18 var _ = gc.Suite(&archSuite{}) 19 20 func (s *archSuite) TestHostArch(c *gc.C) { 21 a := arch.HostArch() 22 c.Assert(arch.IsSupportedArch(a), jc.IsTrue) 23 } 24 25 func (s *archSuite) TestNormaliseArch(c *gc.C) { 26 for _, test := range []struct { 27 raw string 28 arch string 29 }{ 30 {"windows", "windows"}, 31 {"amd64", "amd64"}, 32 {"x86_64", "amd64"}, 33 {"386", "i386"}, 34 {"i386", "i386"}, 35 {"i486", "i386"}, 36 {"arm", "armhf"}, 37 {"armv", "armhf"}, 38 {"armv7", "armhf"}, 39 {"aarch64", "arm64"}, 40 {"arm64", "arm64"}, 41 {"ppc64el", "ppc64el"}, 42 {"ppc64le", "ppc64el"}, 43 {"ppc64", "ppc64el"}, 44 } { 45 arch := arch.NormaliseArch(test.raw) 46 c.Check(arch, gc.Equals, test.arch) 47 } 48 } 49 50 func (s *archSuite) TestIsSupportedArch(c *gc.C) { 51 for _, a := range arch.AllSupportedArches { 52 c.Assert(arch.IsSupportedArch(a), jc.IsTrue) 53 } 54 c.Assert(arch.IsSupportedArch("invalid"), jc.IsFalse) 55 } 56 57 func (s *archSuite) TestArchInfo(c *gc.C) { 58 for _, a := range arch.AllSupportedArches { 59 _, ok := arch.Info[a] 60 c.Assert(ok, jc.IsTrue) 61 } 62 }