...

Source file src/cmd/link/internal/ld/nooptcgolink_test.go

Documentation: cmd/link/internal/ld

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ld
     6  
     7  import (
     8  	"internal/testenv"
     9  	"path/filepath"
    10  	"testing"
    11  )
    12  
    13  func TestNooptCgoBuild(t *testing.T) {
    14  	if testing.Short() {
    15  		t.Skip("skipping test in short mode.")
    16  	}
    17  	t.Parallel()
    18  
    19  	testenv.MustHaveGoBuild(t)
    20  	testenv.MustHaveCGO(t)
    21  	dir := t.TempDir()
    22  	cmd := testenv.Command(t, testenv.GoToolPath(t), "build", "-gcflags=-N -l", "-o", filepath.Join(dir, "a.out"))
    23  	cmd.Dir = filepath.Join(testenv.GOROOT(t), "src", "runtime", "testdata", "testprogcgo")
    24  	out, err := cmd.CombinedOutput()
    25  	if err != nil {
    26  		t.Logf("go build output: %s", out)
    27  		t.Fatal(err)
    28  	}
    29  }
    30  

View as plain text