Added Windows/ARM64 target host "flavor" for tools. (#3035) · arduino/arduino-cli@28dbc33 (original) (raw)

`@@ -29,6 +29,7 @@ func TestFlavorCompatibility(t *testing.T) {

`

29

29

` }

`

30

30

`windows32 := &os{"windows", "386"}

`

31

31

`windows64 := &os{"windows", "amd64"}

`

``

32

`+

windowsArm64 := &os{"windows", "arm64"}

`

32

33

`linux32 := &os{"linux", "386"}

`

33

34

`linux64 := &os{"linux", "amd64"}

`

34

35

`linuxArm := &os{"linux", "arm"}

`

`@@ -43,6 +44,7 @@ func TestFlavorCompatibility(t *testing.T) {

`

43

44

`oses := []*os{

`

44

45

`windows32,

`

45

46

`windows64,

`

``

47

`+

windowsArm64,

`

46

48

`linux32,

`

47

49

`linux64,

`

48

50

`linuxArm,

`

`@@ -62,8 +64,9 @@ func TestFlavorCompatibility(t *testing.T) {

`

62

64

`ExactMatch []*os

`

63

65

` }

`

64

66

`tests := []*test{

`

65

``

`-

{&Flavor{OS: "i686-mingw32"}, []*os{windows32, windows64}, []*os{windows32}},

`

66

``

`-

{&Flavor{OS: "x86_64-mingw32"}, []*os{windows64}, []*os{windows64}},

`

``

67

`+

{&Flavor{OS: "i686-mingw32"}, []*os{windows32, windows64, windowsArm64}, []*os{windows32}},

`

``

68

`+

{&Flavor{OS: "x86_64-mingw32"}, []*os{windows64, windowsArm64}, []*os{windows64}},

`

``

69

`+

{&Flavor{OS: "arm64-mingw32"}, []*os{windowsArm64}, []*os{windowsArm64}},

`

67

70

` {&Flavor{OS: "i386-apple-darwin11"}, []*os{darwin32, darwin64, darwinArm64}, []*os{darwin32}},

`

68

71

` {&Flavor{OS: "x86_64-apple-darwin"}, []*os{darwin64, darwinArm64}, []*os{darwin64}},

`

69

72

` {&Flavor{OS: "arm64-apple-darwin"}, []*os{darwinArm64}, []*os{darwinArm64}},

`

`@@ -160,17 +163,44 @@ func TestFlavorPrioritySelection(t *testing.T) {

`

160

163

`Flavors: []*Flavor{

`

161

164

` {OS: "i686-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "1"}},

`

162

165

` {OS: "x86_64-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "2"}},

`

``

166

`+

{OS: "arm64-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "3"}},

`

163

167

` },

`

164

168

` }).GetFlavourCompatibleWith("windows", "amd64")

`

165

169

`require.NotNil(t, res)

`

166

170

`require.Equal(t, "2", res.ArchiveFileName)

`

167

171

``

168

172

`res = (&ToolRelease{

`

169

173

`Flavors: []*Flavor{

`

``

174

`+

{OS: "i686-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "1"}},

`

170

175

` {OS: "x86_64-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "2"}},

`

``

176

`+

{OS: "arm64-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "3"}},

`

``

177

`+

},

`

``

178

`+

}).GetFlavourCompatibleWith("windows", "arm64")

`

``

179

`+

require.NotNil(t, res)

`

``

180

`+

require.Equal(t, "3", res.ArchiveFileName)

`

``

181

+

``

182

`+

res = (&ToolRelease{

`

``

183

`+

Flavors: []*Flavor{

`

171

184

` {OS: "i686-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "1"}},

`

172

185

` },

`

173

186

` }).GetFlavourCompatibleWith("windows", "amd64")

`

174

187

`require.NotNil(t, res)

`

``

188

`+

require.Equal(t, "1", res.ArchiveFileName)

`

``

189

+

``

190

`+

res = (&ToolRelease{

`

``

191

`+

Flavors: []*Flavor{

`

``

192

`+

{OS: "i686-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "1"}},

`

``

193

`+

{OS: "x86_64-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "2"}},

`

``

194

`+

},

`

``

195

`+

}).GetFlavourCompatibleWith("windows", "arm64")

`

``

196

`+

require.NotNil(t, res)

`

175

197

`require.Equal(t, "2", res.ArchiveFileName)

`

``

198

+

``

199

`+

res = (&ToolRelease{

`

``

200

`+

Flavors: []*Flavor{

`

``

201

`+

{OS: "i686-mingw32", Resource: &resources.DownloadResource{ArchiveFileName: "1"}},

`

``

202

`+

},

`

``

203

`+

}).GetFlavourCompatibleWith("windows", "arm64")

`

``

204

`+

require.NotNil(t, res)

`

``

205

`+

require.Equal(t, "1", res.ArchiveFileName)

`

176

206

`}

`