Text file src/cmd/go/testdata/script/fipssnap.txt

     1  env snap=v1.0.0-c2097c7c
     2  env alias=inprocess
     3  
     4  env GOFIPS140=$snap
     5  
     6  # Go+BoringCrypto conflicts with GOFIPS140.
     7  [GOEXPERIMENT:boringcrypto] skip
     8  
     9  # default GODEBUG includes fips140=on
    10  go list -f '{{.DefaultGODEBUG}}'
    11  stdout fips140=on
    12  
    13  # std lists fips snapshot and not regular fips
    14  go list std
    15  stdout crypto/internal/fips140/$snap/sha256
    16  ! stdout crypto/internal/fips140/sha256
    17  ! stdout crypto/internal/fips140/check
    18  
    19  # build does not use regular fips
    20  go list -json -test
    21  stdout crypto/internal/fips140/$snap/sha256
    22  ! stdout crypto/internal/fips140/sha256
    23  ! stdout crypto/internal/fips140/check
    24  
    25  # again with GOFIPS140=$alias
    26  env GOFIPS140=$alias
    27  
    28  # default GODEBUG includes fips140=on
    29  go list -f '{{.DefaultGODEBUG}}'
    30  stdout fips140=on
    31  
    32  # std lists fips snapshot and not regular fips
    33  go list std
    34  stdout crypto/internal/fips140/$snap/sha256
    35  ! stdout crypto/internal/fips140/sha256
    36  ! stdout crypto/internal/fips140/check
    37  
    38  # build does not use regular fips
    39  go list -json -test
    40  stdout crypto/internal/fips140/$snap/sha256
    41  ! stdout crypto/internal/fips140/sha256
    42  ! stdout crypto/internal/fips140/check
    43  
    44  [short] skip
    45  
    46  # build with GOFIPS140=snap is cached
    47  go build -x -o x.exe
    48  stderr link.*-fipso
    49  go build -x -o x.exe
    50  ! stderr link.*-fipso
    51  
    52  # build test with GOFIPS140=snap is cached
    53  go test -x -c
    54  stderr link.*-fipso
    55  go test -x -c
    56  ! stderr link
    57  
    58  -- go.mod --
    59  module m
    60  -- x.go --
    61  package main
    62  import _ "crypto/sha256"
    63  func main() {
    64  }
    65  -- x_test.go --
    66  package main
    67  import "testing"
    68  func Test(t *testing.T) {}
    69  

View as plain text