github.com/rogpeppe/juju@v0.0.0-20140613142852-6337964b789e/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 "launchpad.net/gocheck" 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", "ppc64"}, 42 {"ppc64le", "ppc64"}, 43 } { 44 arch := arch.NormaliseArch(test.raw) 45 c.Check(arch, gc.Equals, test.arch) 46 } 47 } 48 49 func (s *archSuite) TestIsSupportedArch(c *gc.C) { 50 for _, a := range arch.AllSupportedArches { 51 c.Assert(arch.IsSupportedArch(a), jc.IsTrue) 52 } 53 c.Assert(arch.IsSupportedArch("invalid"), jc.IsFalse) 54 } 55 56 func (s *archSuite) TestArchInfo(c *gc.C) { 57 for _, a := range arch.AllSupportedArches { 58 _, ok := arch.Info[a] 59 c.Assert(ok, jc.IsTrue) 60 } 61 }