...

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

Documentation: cmd/go/testdata/script

     1# Regression test for https://go.dev/issue/48319:
     2# cgo builds should not include debug information from a stale GOROOT_FINAL.
     3
     4[short] skip
     5[!cgo] skip
     6
     7# This test has problems when run on the LUCI darwin longtest builder,
     8# which uses a more contemporary Xcode version that is unfriendly to
     9# reproducible builds (see issue #64947 for the gory details). Note
    10# that individual developers running "go test cmd/go" on Darwin may
    11# still run into failures depending on their Xcode version.
    12[GOOS:darwin] [go-builder] skip
    13
    14# This test is sensitive to cache invalidation,
    15# so use a separate build cache that we can control.
    16env GOCACHE=$WORK/gocache
    17mkdir $GOCACHE
    18
    19# Build a binary using a specific value of GOROOT_FINAL.
    20env GOROOT_FINAL=$WORK${/}goroot1
    21go build -o main.exe
    22mv main.exe main1.exe
    23
    24# Now clean the cache and build using a different GOROOT_FINAL.
    25# The resulting binaries should differ in their debug metadata.
    26go clean -cache
    27env GOROOT_FINAL=$WORK${/}goroot2
    28go build -o main.exe
    29mv main.exe main2.exe
    30! cmp -q main2.exe main1.exe
    31
    32# Set GOROOT_FINAL back to the first value.
    33# If the build is properly reproducible, the two binaries should match.
    34env GOROOT_FINAL=$WORK${/}goroot1
    35go build -o main.exe
    36cmp -q main.exe main1.exe
    37
    38-- go.mod --
    39module main
    40
    41go 1.18
    42-- main.go --
    43package main
    44
    45import "C"
    46
    47import "runtime"
    48
    49var _ C.int
    50
    51func main() {
    52	println(runtime.GOROOT())
    53}

View as plain text