Source file
src/cmd/dist/supported_test.go
1
2
3
4
5 package main
6
7 import (
8 "internal/platform"
9 "testing"
10 )
11
12
13
14
15
16 func TestSupported(t *testing.T) {
17 defer func(a, o string) {
18 goarch = a
19 goos = o
20 }(goarch, goos)
21
22 var modes = []string{
23
24 "pie",
25 "c-archive",
26 "c-shared",
27 "shared",
28 "plugin",
29 }
30
31 for _, a := range okgoarch {
32 goarch = a
33 for _, o := range okgoos {
34 if _, ok := cgoEnabled[o+"/"+a]; !ok {
35 continue
36 }
37 goos = o
38 for _, mode := range modes {
39 var dt tester
40 dist := dt.supportedBuildmode(mode)
41 std := platform.BuildModeSupported("gc", mode, o, a)
42 if dist != std {
43 t.Errorf("discrepancy for %s-%s %s: dist says %t, standard library says %t", o, a, mode, dist, std)
44 }
45 }
46 }
47 }
48 }
49
50
51
52 func TestFIPS140Supported(t *testing.T) {
53 defer func(a, o string) {
54 goarch = a
55 goos = o
56 }(goarch, goos)
57
58 for _, a := range okgoarch {
59 goarch = a
60 for _, o := range okgoos {
61 goos = o
62 dist := fips140Supported(o, a)
63 std := platform.FIPS140Supported(o, a)
64 if dist != std {
65 t.Errorf("discrepancy for %s-%s: dist says %t, internal/platform says %t", o, a, dist, std)
66 }
67 }
68 }
69 }
70
View as plain text