Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/go/testdata/script

     1  [short] skip
     2  [!cgo] skip
     3  
     4  [!exec:/usr/bin/env] skip
     5  [!exec:bash] skip
     6  [!exec:cat] skip
     7  
     8  mkdir $WORK/tmp/cache
     9  env GOCACHE=$WORK/tmp/cache
    10  
    11  # Before building our test main.go, ensure that an up-to-date copy of
    12  # runtime/cgo is present in the cache. If it isn't, the 'go build' step below
    13  # will fail with "can't open import". See golang.org/issue/29004.
    14  #
    15  # (The fix in golang.org/issue/29004 didn't completely fix the underlying issue:
    16  # cmd/go/internal/load adds a bunch of implicit dependencies
    17  # based on various heuristics, and, due to a bug described in
    18  # https://golang.org/issue/31544#issuecomment-490607180,
    19  # those implicit dependencies are not added early enough during
    20  # loading to properly affect the import graph.)
    21  go build runtime/cgo
    22  
    23  go build -x -o main main.go
    24  cp stderr commands.txt
    25  exec cat header.txt commands.txt
    26  cp stdout test.sh
    27  
    28  exec ./main
    29  cmp stderr hello.txt
    30  rm ./main
    31  
    32  exec /usr/bin/env bash -x test.sh
    33  exec ./main
    34  cmp stderr hello.txt
    35  
    36  grep '^WORK=(.*)\n' commands.txt
    37  
    38  -- main.go --
    39  package main
    40  
    41  import "C"
    42  
    43  func main() {
    44  	print("hello\n")
    45  }
    46  -- header.txt --
    47  set -e
    48  -- hello.txt --
    49  hello
    50  

View as plain text